mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 20:10:11 -04:00
Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 (#9279)
* Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 * remove github
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { BracketMatchingController } from 'vs/editor/contrib/bracketMatching/bracketMatching';
|
||||
@@ -31,7 +31,7 @@ suite('bracket matching', () => {
|
||||
|
||||
test('issue #183: jump to matching bracket position', () => {
|
||||
let mode = new BracketMode();
|
||||
let model = TextModel.createFromString('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier());
|
||||
let model = createTextModel('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
@@ -63,7 +63,7 @@ suite('bracket matching', () => {
|
||||
|
||||
test('Jump to next bracket', () => {
|
||||
let mode = new BracketMode();
|
||||
let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
|
||||
let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
@@ -100,7 +100,7 @@ suite('bracket matching', () => {
|
||||
|
||||
test('Select to next bracket', () => {
|
||||
let mode = new BracketMode();
|
||||
let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
|
||||
let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
@@ -152,7 +152,7 @@ suite('bracket matching', () => {
|
||||
'};',
|
||||
].join('\n');
|
||||
const mode = new BracketMode();
|
||||
const model = TextModel.createFromString(text, undefined, mode.getLanguageIdentifier());
|
||||
const model = createTextModel(text, undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
const bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
@@ -177,7 +177,7 @@ suite('bracket matching', () => {
|
||||
'};',
|
||||
].join('\n');
|
||||
const mode = new BracketMode();
|
||||
const model = TextModel.createFromString(text, undefined, mode.getLanguageIdentifier());
|
||||
const model = createTextModel(text, undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
const bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
@@ -195,7 +195,7 @@ suite('bracket matching', () => {
|
||||
|
||||
test('issue #45369: Select to Bracket with multicursor', () => {
|
||||
let mode = new BracketMode();
|
||||
let model = TextModel.createFromString('{ } { } { }', undefined, mode.getLanguageIdentifier());
|
||||
let model = createTextModel('{ } { } { }', undefined, mode.getLanguageIdentifier());
|
||||
|
||||
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
|
||||
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
|
||||
|
||||
@@ -16,6 +16,7 @@ import { ITextModel } from 'vs/editor/common/model';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { CodeActionFilter, CodeActionKind, CodeActionTrigger, filtersAction, mayIncludeActionsOfKind } from './types';
|
||||
import { IProgress, Progress } from 'vs/platform/progress/common/progress';
|
||||
|
||||
export const codeActionCommandId = 'editor.action.codeAction';
|
||||
export const refactorCommandId = 'editor.action.refactor';
|
||||
@@ -70,7 +71,8 @@ export function getCodeActions(
|
||||
model: ITextModel,
|
||||
rangeOrSelection: Range | Selection,
|
||||
trigger: CodeActionTrigger,
|
||||
token: CancellationToken
|
||||
progress: IProgress<modes.CodeActionProvider>,
|
||||
token: CancellationToken,
|
||||
): Promise<CodeActionSet> {
|
||||
const filter = trigger.filter || {};
|
||||
|
||||
@@ -85,6 +87,7 @@ export function getCodeActions(
|
||||
const disposables = new DisposableStore();
|
||||
const promises = providers.map(async provider => {
|
||||
try {
|
||||
progress.report(provider);
|
||||
const providedCodeActions = await provider.provideCodeActions(model, rangeOrSelection, codeActionContext, cts.token);
|
||||
if (providedCodeActions) {
|
||||
disposables.add(providedCodeActions);
|
||||
@@ -210,6 +213,7 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor,
|
||||
model,
|
||||
validatedRangeOrSelection,
|
||||
{ type: modes.CodeActionTriggerType.Manual, filter: { includeSourceActions: true, include: kind && kind.value ? new CodeActionKind(kind.value) : undefined } },
|
||||
Progress.None,
|
||||
CancellationToken.None);
|
||||
|
||||
setTimeout(() => codeActionSet.dispose(), 100);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { CodeActionProviderRegistry, CodeActionTriggerType } from 'vs/editor/common/modes';
|
||||
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMarkerService } from 'vs/platform/markers/common/markers';
|
||||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IEditorProgressService, Progress } from 'vs/platform/progress/common/progress';
|
||||
import { getCodeActions, CodeActionSet } from './codeAction';
|
||||
import { CodeActionTrigger } from './types';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
@@ -213,7 +213,7 @@ export class CodeActionModel extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
const actions = createCancelablePromise(token => getCodeActions(model, trigger.selection, trigger.trigger, token));
|
||||
const actions = createCancelablePromise(token => getCodeActions(model, trigger.selection, trigger.trigger, Progress.None, token));
|
||||
if (this._progressService && trigger.trigger.type === CodeActionTriggerType.Manual) {
|
||||
this._progressService.showWhile(actions, 250);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import { getCodeActions } from 'vs/editor/contrib/codeAction/codeAction';
|
||||
import { CodeActionKind } from 'vs/editor/contrib/codeAction/types';
|
||||
import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Progress } from 'vs/platform/progress/common/progress';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
function staticCodeActionProvider(...actions: modes.CodeAction[]): modes.CodeActionProvider {
|
||||
return new class implements modes.CodeActionProvider {
|
||||
@@ -92,7 +94,7 @@ suite('CodeAction', () => {
|
||||
|
||||
setup(function () {
|
||||
disposables.clear();
|
||||
model = TextModel.createFromString('test1\ntest2\ntest3', undefined, langId, uri);
|
||||
model = createTextModel('test1\ntest2\ntest3', undefined, langId, uri);
|
||||
disposables.add(model);
|
||||
});
|
||||
|
||||
@@ -125,7 +127,7 @@ suite('CodeAction', () => {
|
||||
testData.tsLint.abc
|
||||
];
|
||||
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Manual }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 6);
|
||||
assert.deepEqual(actions, expected);
|
||||
});
|
||||
@@ -140,20 +142,20 @@ suite('CodeAction', () => {
|
||||
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
|
||||
|
||||
{
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 2);
|
||||
assert.strictEqual(actions[0].title, 'a');
|
||||
assert.strictEqual(actions[1].title, 'a.b');
|
||||
}
|
||||
|
||||
{
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b') } }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b') } }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'a.b');
|
||||
}
|
||||
|
||||
{
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b.c') } }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a.b.c') } }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 0);
|
||||
}
|
||||
});
|
||||
@@ -172,7 +174,7 @@ suite('CodeAction', () => {
|
||||
|
||||
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
|
||||
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: new CodeActionKind('a') } }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'a');
|
||||
});
|
||||
@@ -186,13 +188,13 @@ suite('CodeAction', () => {
|
||||
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
|
||||
|
||||
{
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'b');
|
||||
}
|
||||
|
||||
{
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.Source, includeSourceActions: true } }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: modes.CodeActionTriggerType.Auto, filter: { include: CodeActionKind.Source, includeSourceActions: true } }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'a');
|
||||
}
|
||||
@@ -214,7 +216,7 @@ suite('CodeAction', () => {
|
||||
excludes: [CodeActionKind.Source],
|
||||
includeSourceActions: true,
|
||||
}
|
||||
}, CancellationToken.None);
|
||||
}, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'b');
|
||||
}
|
||||
@@ -250,7 +252,7 @@ suite('CodeAction', () => {
|
||||
include: baseType,
|
||||
excludes: [subType],
|
||||
}
|
||||
}, CancellationToken.None);
|
||||
}, Progress.None, CancellationToken.None);
|
||||
assert.strictEqual(didInvoke, false);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions[0].title, 'a');
|
||||
@@ -275,7 +277,7 @@ suite('CodeAction', () => {
|
||||
filter: {
|
||||
include: CodeActionKind.QuickFix
|
||||
}
|
||||
}, CancellationToken.None);
|
||||
}, Progress.None, CancellationToken.None);
|
||||
assert.strictEqual(actions.length, 0);
|
||||
assert.strictEqual(wasInvoked, false);
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ import { CodeActionModel, CodeActionsState } from 'vs/editor/contrib/codeAction/
|
||||
import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { MarkerService } from 'vs/platform/markers/common/markerService';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
const testProvider = {
|
||||
provideCodeActions(): modes.CodeActionList {
|
||||
@@ -38,7 +39,7 @@ suite('CodeActionModel', () => {
|
||||
setup(() => {
|
||||
disposables.clear();
|
||||
markerService = new MarkerService();
|
||||
model = TextModel.createFromString('foobar foo bar\nfarboo far boo', undefined, languageIdentifier, uri);
|
||||
model = createTextModel('foobar foo bar\nfarboo far boo', undefined, languageIdentifier, uri);
|
||||
editor = createTestCodeEditor({ model: model });
|
||||
editor.setPosition({ lineNumber: 1, column: 1 });
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ export class DragAndDropController extends Disposable implements IEditorContribu
|
||||
}
|
||||
|
||||
private onEditorKeyDown(e: IKeyboardEvent): void {
|
||||
if (!this._editor.getOption(EditorOption.dragAndDrop)) {
|
||||
if (!this._editor.getOption(EditorOption.dragAndDrop) || this._editor.getOption(EditorOption.columnSelection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export class DragAndDropController extends Disposable implements IEditorContribu
|
||||
}
|
||||
|
||||
private onEditorKeyUp(e: IKeyboardEvent): void {
|
||||
if (!this._editor.getOption(EditorOption.dragAndDrop)) {
|
||||
if (!this._editor.getOption(EditorOption.dragAndDrop) || this._editor.getOption(EditorOption.columnSelection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { OutlineElement, OutlineGroup, OutlineModel } from '../outlineModel';
|
||||
import { SymbolKind, DocumentSymbol, DocumentSymbolProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IMarker, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
|
||||
@@ -16,7 +16,7 @@ suite('OutlineModel', function () {
|
||||
|
||||
test('OutlineModel#create, cached', async function () {
|
||||
|
||||
let model = TextModel.createFromString('foo', undefined, undefined, URI.file('/fome/path.foo'));
|
||||
let model = createTextModel('foo', undefined, undefined, URI.file('/fome/path.foo'));
|
||||
let count = 0;
|
||||
let reg = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, {
|
||||
provideDocumentSymbols() {
|
||||
@@ -42,7 +42,7 @@ suite('OutlineModel', function () {
|
||||
|
||||
test('OutlineModel#create, cached/cancel', async function () {
|
||||
|
||||
let model = TextModel.createFromString('foo', undefined, undefined, URI.file('/fome/path.foo'));
|
||||
let model = createTextModel('foo', undefined, undefined, URI.file('/fome/path.foo'));
|
||||
let isCancelled = false;
|
||||
|
||||
let reg = DocumentSymbolProviderRegistry.register({ pattern: '**/path.foo' }, {
|
||||
|
||||
@@ -16,6 +16,8 @@ import { FindModelBoundToEditorModel } from 'vs/editor/contrib/find/findModel';
|
||||
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
|
||||
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
|
||||
suite('FindModel', () => {
|
||||
|
||||
@@ -45,7 +47,7 @@ suite('FindModel', () => {
|
||||
const factory = ptBuilder.finish();
|
||||
withTestCodeEditor([],
|
||||
{
|
||||
model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null, new UndoRedoService())
|
||||
model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null, new UndoRedoService(new TestDialogService(), new TestNotificationService()))
|
||||
},
|
||||
(editor, cursor) => callback(editor as unknown as IActiveCodeEditor, cursor)
|
||||
);
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { FoldingModel, setCollapseStateAtLevel, setCollapseStateLevelsDown, setCollapseStateLevelsUp, setCollapseStateForMatchingLines, setCollapseStateUp } from 'vs/editor/contrib/folding/foldingModel';
|
||||
import { TextModel, ModelDecorationOptions } from 'vs/editor/common/model/textModel';
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider';
|
||||
import { TrackedRangeStickiness, IModelDeltaDecoration, ITextModel, IModelDecorationsChangeAccessor } from 'vs/editor/common/model';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
@@ -92,7 +93,7 @@ suite('Folding Model', () => {
|
||||
/* 7*/ ' }',
|
||||
/* 8*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -131,7 +132,7 @@ suite('Folding Model', () => {
|
||||
/* 7*/ ' }',
|
||||
/* 8*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -177,7 +178,7 @@ suite('Folding Model', () => {
|
||||
/* 7*/ ' }',
|
||||
/* 8*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -217,7 +218,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -254,7 +255,7 @@ suite('Folding Model', () => {
|
||||
/* 7*/ ' }',
|
||||
/* 8*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -295,7 +296,7 @@ suite('Folding Model', () => {
|
||||
/* 11*/ ' }',
|
||||
/* 12*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
@@ -346,7 +347,7 @@ suite('Folding Model', () => {
|
||||
/* 10*/ '//#endregion',
|
||||
/* 11*/ ''];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -392,7 +393,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -448,7 +449,7 @@ suite('Folding Model', () => {
|
||||
/* 15*/ ' //#endregion',
|
||||
/* 16*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -504,7 +505,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -556,7 +557,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -603,7 +604,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
@@ -648,7 +649,7 @@ suite('Folding Model', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider';
|
||||
import { FoldingMarkers } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { MAX_FOLDING_REGIONS } from 'vs/editor/contrib/folding/foldingRanges';
|
||||
@@ -26,7 +26,7 @@ suite('FoldingRanges', () => {
|
||||
for (let i = 0; i < nRegions; i++) {
|
||||
lines.push('#endregion');
|
||||
}
|
||||
let model = TextModel.createFromString(lines.join('\n'));
|
||||
let model = createTextModel(lines.join('\n'));
|
||||
let actual = computeRanges(model, false, markers, MAX_FOLDING_REGIONS);
|
||||
assert.equal(actual.length, nRegions, 'len');
|
||||
for (let i = 0; i < nRegions; i++) {
|
||||
@@ -53,7 +53,7 @@ suite('FoldingRanges', () => {
|
||||
/* 12*/ ' }',
|
||||
/* 13*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
try {
|
||||
let actual = computeRanges(textModel, false, markers);
|
||||
// let r0 = r(1, 2);
|
||||
@@ -91,7 +91,7 @@ suite('FoldingRanges', () => {
|
||||
for (let i = 0; i < nRegions; i++) {
|
||||
lines.push('#endregion');
|
||||
}
|
||||
let model = TextModel.createFromString(lines.join('\n'));
|
||||
let model = createTextModel(lines.join('\n'));
|
||||
let actual = computeRanges(model, false, markers, MAX_FOLDING_REGIONS);
|
||||
assert.equal(actual.length, nRegions, 'len');
|
||||
for (let i = 0; i < nRegions; i++) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { FoldingModel } from 'vs/editor/contrib/folding/foldingModel';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider';
|
||||
import { TestDecorationProvider } from './foldingModel.test';
|
||||
import { HiddenRangeModel } from 'vs/editor/contrib/folding/hiddenRangeModel';
|
||||
@@ -38,7 +38,7 @@ suite('Hidden Range Model', () => {
|
||||
/* 9*/ ' }',
|
||||
/* 10*/ '}'];
|
||||
|
||||
let textModel = TextModel.createFromString(lines.join('\n'));
|
||||
let textModel = createTextModel(lines.join('\n'));
|
||||
let foldingModel = new FoldingModel(textModel, new TestDecorationProvider(textModel));
|
||||
let hiddenRangeModel = new HiddenRangeModel(foldingModel);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
interface IndentRange {
|
||||
start: number;
|
||||
@@ -47,7 +47,7 @@ suite('Indentation Folding', () => {
|
||||
let r8 = r(13, 14);//4
|
||||
let r9 = r(15, 16);//0
|
||||
|
||||
let model = TextModel.createFromString(lines.join('\n'));
|
||||
let model = createTextModel(lines.join('\n'));
|
||||
|
||||
function assertLimit(maxEntries: number, expectedRanges: IndentRange[], message: string) {
|
||||
let indentRanges = computeRanges(model, true, undefined, maxEntries);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { computeRanges } from 'vs/editor/contrib/folding/indentRangeProvider';
|
||||
import { FoldingMarkers } from 'vs/editor/common/modes/languageConfiguration';
|
||||
|
||||
@@ -15,7 +15,7 @@ interface ExpectedIndentRange {
|
||||
}
|
||||
|
||||
function assertRanges(lines: string[], expected: ExpectedIndentRange[], offside: boolean, markers?: FoldingMarkers): void {
|
||||
let model = TextModel.createFromString(lines.join('\n'));
|
||||
let model = createTextModel(lines.join('\n'));
|
||||
let actual = computeRanges(model, offside, markers);
|
||||
|
||||
let actualRanges: ExpectedIndentRange[] = [];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { SyntaxRangeProvider } from 'vs/editor/contrib/folding/syntaxRangeProvider';
|
||||
import { FoldingRangeProvider, FoldingRange, FoldingContext, ProviderResult } from 'vs/editor/common/modes';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
@@ -69,7 +69,7 @@ suite('Syntax folding', () => {
|
||||
let r8 = r(14, 15); //6
|
||||
let r9 = r(22, 23); //0
|
||||
|
||||
let model = TextModel.createFromString(lines.join('\n'));
|
||||
let model = createTextModel(lines.join('\n'));
|
||||
let ranges = [r1, r2, r3, r4, r5, r6, r7, r8, r9];
|
||||
let providers = [new TestFoldingRangeProvider(model, ranges)];
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { LinkedList } from 'vs/base/common/linkedList';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { assertType } from 'vs/base/common/types';
|
||||
import { IProgress } from 'vs/platform/progress/common/progress';
|
||||
|
||||
export function alertFormattingEdits(edits: ISingleEditOperation[]): void {
|
||||
|
||||
@@ -209,6 +210,7 @@ export async function formatDocumentWithSelectedProvider(
|
||||
accessor: ServicesAccessor,
|
||||
editorOrModel: ITextModel | IActiveCodeEditor,
|
||||
mode: FormattingMode,
|
||||
progress: IProgress<DocumentFormattingEditProvider>,
|
||||
token: CancellationToken
|
||||
): Promise<void> {
|
||||
|
||||
@@ -217,6 +219,7 @@ export async function formatDocumentWithSelectedProvider(
|
||||
const provider = getRealAndSyntheticDocumentFormattersOrdered(model);
|
||||
const selected = await FormattingConflicts.select(provider, model, mode);
|
||||
if (selected) {
|
||||
progress.report(selected);
|
||||
await instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Progress } from 'vs/platform/progress/common/progress';
|
||||
|
||||
class FormatOnType implements IEditorContribution {
|
||||
|
||||
@@ -230,7 +231,7 @@ class FormatDocumentAction extends EditorAction {
|
||||
async run(accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> {
|
||||
if (editor.hasModel()) {
|
||||
const instaService = accessor.get(IInstantiationService);
|
||||
await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, FormattingMode.Explicit, CancellationToken.None);
|
||||
await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, FormattingMode.Explicit, Progress.None, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import * as peekView from 'vs/editor/contrib/peekView/peekView';
|
||||
import { FileReferences, OneReference, ReferencesModel } from '../referencesModel';
|
||||
import { FuzzyScore } from 'vs/base/common/filters';
|
||||
import { SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
|
||||
|
||||
class DecorationsManager implements IDisposable {
|
||||
@@ -215,7 +216,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
@ITextModelService private readonly _textModelResolverService: ITextModelService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@peekView.IPeekViewService private readonly _peekViewService: peekView.IPeekViewService,
|
||||
@ILabelService private readonly _uriLabel: ILabelService
|
||||
@ILabelService private readonly _uriLabel: ILabelService,
|
||||
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
|
||||
) {
|
||||
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true });
|
||||
|
||||
@@ -304,7 +306,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
};
|
||||
this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewContainer, options, this.editor);
|
||||
dom.hide(this._previewContainer);
|
||||
this._previewNotAvailableMessage = TextModel.createFromString(nls.localize('missingPreviewMessage', "no preview available"));
|
||||
this._previewNotAvailableMessage = new TextModel(nls.localize('missingPreviewMessage', "no preview available"), TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService);
|
||||
|
||||
// tree
|
||||
this._treeContainer = dom.append(containerElement, dom.$('div.ref-tree.inline'));
|
||||
|
||||
@@ -40,6 +40,7 @@ import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { Constants } from 'vs/base/common/uint';
|
||||
import { textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Progress } from 'vs/platform/progress/common/progress';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
@@ -626,6 +627,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
|
||||
this._editor.getModel()!,
|
||||
new Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn),
|
||||
markerCodeActionTrigger,
|
||||
Progress.None,
|
||||
cancellationToken);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Handler } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
@@ -49,7 +49,7 @@ suite('ParameterHintsModel', () => {
|
||||
});
|
||||
|
||||
function createMockEditor(fileContents: string) {
|
||||
const textModel = TextModel.createFromString(fileContents, undefined, undefined, mockFile);
|
||||
const textModel = createTextModel(fileContents, undefined, undefined, mockFile);
|
||||
const editor = createTestCodeEditor({
|
||||
model: textModel,
|
||||
serviceCollection: new ServiceCollection(
|
||||
|
||||
@@ -20,6 +20,8 @@ import { TestTextResourcePropertiesService } from 'vs/editor/test/common/service
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
|
||||
class MockJSMode extends MockMode {
|
||||
|
||||
@@ -48,7 +50,7 @@ suite('SmartSelect', () => {
|
||||
|
||||
setup(() => {
|
||||
const configurationService = new TestConfigurationService();
|
||||
modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService(), new NullLogService(), new UndoRedoService());
|
||||
modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService(), new NullLogService(), new UndoRedoService(new TestDialogService(), new TestNotificationService()));
|
||||
mode = new MockJSMode();
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { Handler } from 'vs/editor/common/editorCommon';
|
||||
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
suite('SnippetController2', function () {
|
||||
|
||||
@@ -36,7 +37,7 @@ suite('SnippetController2', function () {
|
||||
|
||||
setup(function () {
|
||||
contextKeys = new MockContextKeyService();
|
||||
model = TextModel.createFromString('if\n $state\nfi');
|
||||
model = createTextModel('if\n $state\nfi');
|
||||
editor = createTestCodeEditor({ model: model });
|
||||
editor.setSelections([new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5)]);
|
||||
assert.equal(model.getEOL(), '\n');
|
||||
|
||||
@@ -11,6 +11,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { SnippetParser } from 'vs/editor/contrib/snippet/snippetParser';
|
||||
import { SnippetSession } from 'vs/editor/contrib/snippet/snippetSession';
|
||||
import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
suite('SnippetSession', function () {
|
||||
|
||||
@@ -26,7 +27,7 @@ suite('SnippetSession', function () {
|
||||
}
|
||||
|
||||
setup(function () {
|
||||
model = TextModel.createFromString('function foo() {\n console.log(a);\n}');
|
||||
model = createTextModel('function foo() {\n console.log(a);\n}');
|
||||
editor = createTestCodeEditor({ model: model }) as IActiveCodeEditor;
|
||||
editor.setSelections([new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5)]);
|
||||
assert.equal(model.getEOL(), '\n');
|
||||
|
||||
@@ -12,6 +12,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { Workspace, toWorkspaceFolders, IWorkspace, IWorkspaceContextService, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { mock } from 'vs/editor/contrib/suggest/test/suggestModel.test';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
suite('Snippet Variables Resolver', function () {
|
||||
|
||||
@@ -25,7 +26,7 @@ suite('Snippet Variables Resolver', function () {
|
||||
let resolver: VariableResolver;
|
||||
|
||||
setup(function () {
|
||||
model = TextModel.createFromString([
|
||||
model = createTextModel([
|
||||
'this is line one',
|
||||
'this is line two',
|
||||
' this is line three'
|
||||
@@ -67,7 +68,7 @@ suite('Snippet Variables Resolver', function () {
|
||||
|
||||
resolver = new ModelBasedVariableResolver(
|
||||
labelService,
|
||||
TextModel.createFromString('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi'))
|
||||
createTextModel('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi'))
|
||||
);
|
||||
assertVariableResolve(resolver, 'TM_FILENAME', 'ghi');
|
||||
if (!isWindows) {
|
||||
@@ -77,7 +78,7 @@ suite('Snippet Variables Resolver', function () {
|
||||
|
||||
resolver = new ModelBasedVariableResolver(
|
||||
labelService,
|
||||
TextModel.createFromString('', undefined, undefined, URI.parse('mem:fff.ts'))
|
||||
createTextModel('', undefined, undefined, URI.parse('mem:fff.ts'))
|
||||
);
|
||||
assertVariableResolve(resolver, 'TM_DIRECTORY', '');
|
||||
assertVariableResolve(resolver, 'TM_FILEPATH', 'fff.ts');
|
||||
@@ -92,7 +93,7 @@ suite('Snippet Variables Resolver', function () {
|
||||
}
|
||||
};
|
||||
|
||||
const model = TextModel.createFromString([].join('\n'), undefined, undefined, URI.parse('foo:///foo/files/text.txt'));
|
||||
const model = createTextModel([].join('\n'), undefined, undefined, URI.parse('foo:///foo/files/text.txt'));
|
||||
|
||||
const resolver = new CompositeSnippetVariableResolver([new ModelBasedVariableResolver(labelService, model)]);
|
||||
|
||||
@@ -144,19 +145,19 @@ suite('Snippet Variables Resolver', function () {
|
||||
|
||||
resolver = new ModelBasedVariableResolver(
|
||||
labelService,
|
||||
TextModel.createFromString('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi'))
|
||||
createTextModel('', undefined, undefined, URI.parse('http://www.pb.o/abc/def/ghi'))
|
||||
);
|
||||
assertVariableResolve(resolver, 'TM_FILENAME_BASE', 'ghi');
|
||||
|
||||
resolver = new ModelBasedVariableResolver(
|
||||
labelService,
|
||||
TextModel.createFromString('', undefined, undefined, URI.parse('mem:.git'))
|
||||
createTextModel('', undefined, undefined, URI.parse('mem:.git'))
|
||||
);
|
||||
assertVariableResolve(resolver, 'TM_FILENAME_BASE', '.git');
|
||||
|
||||
resolver = new ModelBasedVariableResolver(
|
||||
labelService,
|
||||
TextModel.createFromString('', undefined, undefined, URI.parse('mem:foo.'))
|
||||
createTextModel('', undefined, undefined, URI.parse('mem:foo.'))
|
||||
);
|
||||
assertVariableResolve(resolver, 'TM_FILENAME_BASE', 'foo');
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import { provideSuggestionItems, SnippetSortOrder, CompletionOptions } from 'vs/
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
|
||||
suite('Suggest', function () {
|
||||
@@ -19,7 +20,7 @@ suite('Suggest', function () {
|
||||
|
||||
setup(function () {
|
||||
|
||||
model = TextModel.createFromString('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
|
||||
model = createTextModel('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
|
||||
registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, {
|
||||
provideCompletionItems(_doc, pos) {
|
||||
return {
|
||||
|
||||
@@ -23,6 +23,7 @@ import { CompletionProviderRegistry, CompletionItemKind, CompletionItemInsertTex
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2';
|
||||
import { IMenuService, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
suite('SuggestController', function () {
|
||||
|
||||
@@ -57,7 +58,7 @@ suite('SuggestController', function () {
|
||||
}]
|
||||
);
|
||||
|
||||
model = TextModel.createFromString('', undefined, undefined, URI.from({ scheme: 'test-ctrl', path: '/path.tst' }));
|
||||
model = createTextModel('', undefined, undefined, URI.from({ scheme: 'test-ctrl', path: '/path.tst' }));
|
||||
editor = createTestCodeEditor({
|
||||
model,
|
||||
serviceCollection,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { LRUMemory, NoMemory, PrefixMemory, Memory } from 'vs/editor/contrib/suggest/suggestMemory';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { createSuggestItem } from 'vs/editor/contrib/suggest/test/completionModel.test';
|
||||
import { IPosition } from 'vs/editor/common/core/position';
|
||||
import { CompletionItem } from 'vs/editor/contrib/suggest/suggest';
|
||||
@@ -19,7 +19,7 @@ suite('SuggestMemories', function () {
|
||||
|
||||
setup(function () {
|
||||
pos = { lineNumber: 1, column: 1 };
|
||||
buffer = TextModel.createFromString('This is some text.\nthis.\nfoo: ,');
|
||||
buffer = createTextModel('This is some text.\nthis.\nfoo: ,');
|
||||
items = [
|
||||
createSuggestItem('foo', 0),
|
||||
createSuggestItem('bar', 0)
|
||||
|
||||
@@ -32,6 +32,7 @@ import { ISuggestMemoryService } from 'vs/editor/contrib/suggest/suggestMemory';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { MockKeybindingService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
export interface Ctor<T> {
|
||||
new(): T;
|
||||
@@ -124,7 +125,7 @@ suite('SuggestModel - Context', function () {
|
||||
});
|
||||
|
||||
test('Context - shouldAutoTrigger', function () {
|
||||
const model = TextModel.createFromString('Das Pferd frisst keinen Gurkensalat - Philipp Reis 1861.\nWer hat\'s erfunden?');
|
||||
const model = createTextModel('Das Pferd frisst keinen Gurkensalat - Philipp Reis 1861.\nWer hat\'s erfunden?');
|
||||
disposables.push(model);
|
||||
|
||||
assertAutoTrigger(model, 3, true, 'end of word, Das|');
|
||||
@@ -138,7 +139,7 @@ suite('SuggestModel - Context', function () {
|
||||
const innerMode = new InnerMode();
|
||||
disposables.push(outerMode, innerMode);
|
||||
|
||||
const model = TextModel.createFromString('a<xx>a<x>', undefined, outerMode.getLanguageIdentifier());
|
||||
const model = createTextModel('a<xx>a<x>', undefined, outerMode.getLanguageIdentifier());
|
||||
disposables.push(model);
|
||||
|
||||
assertAutoTrigger(model, 1, true, 'a|<x — should trigger at end of word');
|
||||
@@ -187,7 +188,7 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
|
||||
|
||||
setup(function () {
|
||||
disposables = dispose(disposables);
|
||||
model = TextModel.createFromString('abc def', undefined, undefined, URI.parse('test:somefile.ttt'));
|
||||
model = createTextModel('abc def', undefined, undefined, URI.parse('test:somefile.ttt'));
|
||||
disposables.push(model);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { EditorSimpleWorker } from 'vs/editor/common/services/editorSimpleWorker
|
||||
import { mock } from 'vs/editor/contrib/suggest/test/suggestModel.test';
|
||||
import { EditorWorkerHost, EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
@@ -48,7 +48,7 @@ suite('suggest, word distance', function () {
|
||||
|
||||
disposables.clear();
|
||||
let mode = new BracketMode();
|
||||
let model = TextModel.createFromString('function abc(aa, ab){\na\n}', undefined, mode.getLanguageIdentifier(), URI.parse('test:///some.path'));
|
||||
let model = createTextModel('function abc(aa, ab){\na\n}', undefined, mode.getLanguageIdentifier(), URI.parse('test:///some.path'));
|
||||
let editor = createTestCodeEditor({ model: model });
|
||||
editor.updateOptions({ suggest: { localityBonus: true } });
|
||||
editor.setPosition({ lineNumber: 2, column: 2 });
|
||||
|
||||
Reference in New Issue
Block a user