本文整理汇总了TypeScript中vs/editor/common/editorCommon.ICommonCodeEditor类的典型用法代码示例。如果您正苦于以下问题:TypeScript ICommonCodeEditor类的具体用法?TypeScript ICommonCodeEditor怎么用?TypeScript ICommonCodeEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ICommonCodeEditor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: assertFindState
function assertFindState(editor: ICommonCodeEditor, cursor: number[], highlighted: number[], findDecorations: number[][]): void {
assert.deepEqual(fromRange(editor.getSelection()), cursor, 'cursor');
let expectedState = {
highlighted: highlighted ? [highlighted] : [],
findDecorations: findDecorations
};
assert.deepEqual(_getFindState(editor), expectedState, 'state');
}
示例2: run
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
const debugService = accessor.get(IDebugService);
const panelService = accessor.get(IPanelService);
const text = editor.getModel().getValueInRange(editor.getSelection());
return debugService.addReplExpression(text)
.then(() => panelService.openPanel(REPL_ID, true))
.then(_ => void 0);
}
示例3: runEditorCommand
public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
const config = editor.getConfiguration();
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
const model = editor.getModel();
const selections = editor.getSelections();
const result = selections.map((sel) => {
const inPosition = new Position(sel.positionLineNumber, sel.positionColumn);
const outPosition = this._move(wordSeparators, model, inPosition, this._wordNavigationType);
return this._moveTo(sel, outPosition, this._inSelectionMode);
});
editor.setSelections(result);
if (result.length === 1) {
const pos = new Position(result[0].positionLineNumber, result[0].positionColumn);
editor.revealPosition(pos, false, true);
}
}
示例4: runEditorCommand
public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
const config = editor.getConfiguration();
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
const model = editor.getModel();
const selections = editor.getSelections();
const result = selections.map((sel) => {
const inPosition = new Position(sel.positionLineNumber, sel.positionColumn);
const outPosition = this._move(wordSeparators, model, inPosition, this._wordNavigationType);
return this._moveTo(sel, outPosition, this._inSelectionMode);
});
editor._getCursors().setStates('moveWordCommand', CursorChangeReason.NotSet, result.map(r => CursorState.fromModelSelection(r)));
if (result.length === 1) {
const pos = new Position(result[0].positionLineNumber, result[0].positionColumn);
editor.revealPosition(pos, ScrollType.Smooth);
}
}
示例5: 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);
});
}
示例6: function
test('text edit with reversed selection', function () {
const session = new SnippetSession(editor, '${1:bar}$0');
editor.setSelections([new Selection(2, 5, 2, 5), new Selection(1, 1, 1, 1)]);
session.insert();
assert.equal(model.getValue(), 'barfunction foo() {\n barconsole.log(a);\n}');
assertSelections(editor, new Selection(2, 5, 2, 8), new Selection(1, 1, 1, 4));
});
示例7: function
test('text edits & selection', function () {
const session = new SnippetSession(editor, 'foo${1:bar}foo$0');
session.insert();
assert.equal(editor.getModel().getValue(), 'foobarfoofunction foo() {\n foobarfooconsole.log(a);\n}');
assertSelections(editor, new Selection(1, 4, 1, 7), new Selection(2, 8, 2, 11));
session.next();
assertSelections(editor, new Selection(1, 10, 1, 10), new Selection(2, 14, 2, 14));
});
示例8: function
test('snippets, don\'t merge touching tabstops 2/2', function () {
const session = new SnippetSession(editor, '$1$2$3$0');
session.insert();
assertSelections(editor, new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5));
editor.trigger('test', 'type', { text: '111' });
session.next();
assertSelections(editor, new Selection(1, 4, 1, 4), new Selection(2, 8, 2, 8));
editor.trigger('test', 'type', { text: '222' });
session.next();
assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11));
editor.trigger('test', 'type', { text: '333' });
session.next();
assert.equal(session.isAtLastPlaceholder, true);
});
示例9: runPreview
private runPreview(): boolean {
// Select Outline Position
let range = this.toSelection();
this.editor.revealRangeInCenter(range);
// Decorate if possible
this.decorator.decorateLine(this.range, this.editor);
return false;
}