本文整理匯總了TypeScript中vs/editor/common/core/selection.Selection.toString方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Selection.toString方法的具體用法?TypeScript Selection.toString怎麽用?TypeScript Selection.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/core/selection.Selection
的用法示例。
在下文中一共展示了Selection.toString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: testCommand
export function testCommand(
lines: string[],
languageIdentifier: LanguageIdentifier,
selection: Selection,
commandFactory: (selection: Selection) => editorCommon.ICommand,
expectedLines: string[],
expectedSelection: Selection
): void {
let model = Model.createFromString(lines.join('\n'), undefined, languageIdentifier);
let config = new MockConfiguration(null);
let cursor = new Cursor(config, model, viewModelHelper(model), false);
cursor.setSelections('tests', [selection]);
cursor.trigger('tests', editorCommon.Handler.ExecuteCommand, commandFactory(cursor.getSelection()));
let actualValue = model.toRawText().lines;
assert.deepEqual(actualValue, expectedLines);
let actualSelection = cursor.getSelection();
assert.deepEqual(actualSelection.toString(), expectedSelection.toString());
cursor.dispose();
config.dispose();
model.dispose();
}
示例2: testCommand
export function testCommand(
lines: string[],
mode: IMode,
selection: Selection,
commandFactory: (selection:Selection) => editorCommon.ICommand,
expectedLines: string[],
expectedSelection: Selection
): void {
let model = new Model(lines.join('\n'), Model.DEFAULT_CREATION_OPTIONS, mode);
let config = new MockConfiguration(null);
let cursor = new Cursor(0, config, model, null, false);
cursor.setSelections('tests', [selection]);
cursor.trigger('tests', editorCommon.Handler.ExecuteCommand, commandFactory(cursor.getSelection()));
let actualValue = model.toRawText().lines;
assert.deepEqual(actualValue, expectedLines);
let actualSelection = cursor.getSelection();
assert.deepEqual(actualSelection.toString(), expectedSelection.toString());
cursor.dispose();
config.dispose();
model.dispose();
}
示例3: withTestCodeEditor
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
cursor.setSelections('tests', [selection]);
cursor.trigger('tests', editorCommon.Handler.ExecuteCommand, commandFactory(cursor.getSelection()));
assert.deepEqual(model.getLinesContent(), expectedLines);
let actualSelection = cursor.getSelection();
assert.deepEqual(actualSelection.toString(), expectedSelection.toString());
});
示例4: _runTest
function _runTest(selection: Selection, editRange: Range, editText: string, editForceMoveMarkers: boolean, expected: Selection, msg: string): void {
const model = Model.createFromString(LINES.join('\n'));
const config = new TestConfiguration(null);
const viewModel = new ViewModel(0, config, model, null);
const cursor = new Cursor(config, model, viewModel);
cursor.setSelections('tests', [selection]);
model.applyEdits([{ range: editRange, text: editText, forceMoveMarkers: editForceMoveMarkers, identifier: null }]);
const actual = cursor.getSelection();
assert.deepEqual(actual.toString(), expected.toString(), msg);
cursor.dispose();
viewModel.dispose();
config.dispose();
model.dispose();
}
示例5: testCommand
function testCommand(lines:string[], selection:Selection, edits:IIdentifiedSingleEditOperation[], expectedLines:string[], expectedSelection:Selection): void {
let model = new Model(lines.join('\n'), Model.DEFAULT_CREATION_OPTIONS, null);
let config = new MockConfiguration(null);
let cursor = new Cursor(0, config, model, null, false);
cursor.setSelections('tests', [selection]);
model.applyEdits(edits);
let actualValue = model.toRawText().lines;
assert.deepEqual(actualValue, expectedLines);
let actualSelection = cursor.getSelection();
assert.deepEqual(actualSelection.toString(), expectedSelection.toString());
cursor.dispose();
config.dispose();
model.dispose();
}