本文整理匯總了TypeScript中vs/editor/common/editorCommonExtensions.ServicesAccessor類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ServicesAccessor類的具體用法?TypeScript ServicesAccessor怎麽用?TypeScript ServicesAccessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ServicesAccessor類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
const debugService = accessor.get(IDebugService);
const viewletService = accessor.get(IViewletService);
const text = editor.getModel().getValueInRange(editor.getSelection());
return viewletService.openViewlet(VIEWLET_ID).then(() => debugService.addWatchExpression(text));
}
示例2: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const keybindingService = accessor.get(IKeybindingService);
const editorService = accessor.get(IWorkbenchEditorService);
if (keybindingService instanceof WorkbenchKeybindingService) {
editorService.openEditor({ contents: keybindingService.dumpDebugInfo(), options: { pinned: true } } as IUntitledResourceInput);
}
}
示例3: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const keybindingService = accessor.get(IKeybindingService);
const editorService = accessor.get(IWorkbenchEditorService);
const untitledEditorService = accessor.get(IUntitledEditorService);
if (keybindingService instanceof WorkbenchKeybindingService) {
const input = untitledEditorService.createOrGet(undefined, null, keybindingService.dumpDebugInfo());
editorService.openEditor(input, { pinned: true });
}
}
示例4: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const configurationEditingService = accessor.get(IConfigurationEditingService);
const messageService = accessor.get(IMessageService);
let newRenderControlCharacters = !editor.getConfiguration().viewInfo.renderControlCharacters;
configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: 'editor.renderControlCharacters', value: newRenderControlCharacters }).then(null, error => {
messageService.show(Severity.Error, error);
});
}
示例5: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const configurationEditingService = accessor.get(IConfigurationEditingService);
const messageService = accessor.get(IMessageService);
let renderWhitespace = editor.getConfiguration().viewInfo.renderWhitespace;
let newRenderWhitespace: string;
if (renderWhitespace === 'none') {
newRenderWhitespace = 'all';
} else {
newRenderWhitespace = 'none';
}
configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: 'editor.renderWhitespace', value: newRenderWhitespace }).then(null, error => {
messageService.show(Severity.Error, error);
});
}
示例6: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const configurationService = accessor.get(IConfigurationService);
let newRenderControlCharacters = !editor.getConfiguration().viewInfo.renderControlCharacters;
configurationService.updateValue('editor.renderControlCharacters', newRenderControlCharacters, ConfigurationTarget.USER);
}
示例7: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
const quickOpenService = accessor.get(IQuickOpenService);
if (!editor.getModel()) {
return;
}
const {lineNumber, column} = editor.getPosition();
const modeId = editor.getModel().getModeIdAtPosition(lineNumber, column);
const picks: ISnippetPick[] = [];
Registry.as<ISnippetsRegistry>(Extensions.Snippets).visitSnippets(modeId, snippet => {
picks.push({
label: snippet.prefix,
detail: snippet.description,
snippet
});
return true;
});
return quickOpenService.pick(picks).then(pick => {
if (pick) {
SnippetController.get(editor).insertSnippet(pick.snippet.codeSnippet, 0, 0);
}
});
}
示例8: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const configurationEditingService = accessor.get(IConfigurationEditingService);
const newValue = !editor.getConfiguration().viewInfo.minimap.enabled;
configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: 'editor.minimap.enabled', value: newValue });
}
示例9: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
const configurationEditingService = accessor.get(IConfigurationEditingService);
const messageService = accessor.get(IMessageService);
let wrappingInfo = editor.getConfiguration().wrappingInfo;
let newWordWrap: boolean;
if (!wrappingInfo.isViewportWrapping) {
newWordWrap = true;
} else {
newWordWrap = false;
}
configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: 'editor.wordWrap', value: newWordWrap }).then(null, error => {
messageService.show(Severity.Error, error);
});
}