本文整理汇总了TypeScript中vs/editor/common/editorCommonExtensions.ServicesAccessor.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ServicesAccessor.get方法的具体用法?TypeScript ServicesAccessor.get怎么用?TypeScript ServicesAccessor.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/editorCommonExtensions.ServicesAccessor
的用法示例。
在下文中一共展示了ServicesAccessor.get方法的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);
});
}