本文整理匯總了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;
}