Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -51,8 +51,8 @@ export class TestFindController extends CommonFindController {
}
}
function fromRange(rng: Range): number[] {
return [rng.startLineNumber, rng.startColumn, rng.endLineNumber, rng.endColumn];
function fromSelection(slc: Selection): number[] {
return [slc.startLineNumber, slc.startColumn, slc.endLineNumber, slc.endColumn];
}
suite('FindController', () => {
@@ -67,8 +67,8 @@ suite('FindController', () => {
getBoolean: (key: string) => !!queryState[key],
getInteger: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => void 0
} as IStorageService);
remove: (key) => undefined
} as any);
if (platform.isMacintosh) {
serviceCollection.set(IClipboardService, <any>{
@@ -122,7 +122,7 @@ suite('FindController', () => {
nextMatchFindAction.run(null, editor);
assert.equal(findState.searchString, 'ABC');
assert.deepEqual(fromRange(editor.getSelection()), [1, 1, 1, 4]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 1, 1, 4]);
findController.dispose();
});
@@ -175,14 +175,14 @@ suite('FindController', () => {
findState.change({ searchString: 'ABC' }, true);
// The first ABC is highlighted.
assert.deepEqual(fromRange(editor.getSelection()), [1, 1, 1, 4]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 1, 1, 4]);
// I hit Esc to exit the Find dialog.
findController.closeFindWidget();
findController.hasFocus = false;
// The cursor is now at end of the first line, with ABC on that line highlighted.
assert.deepEqual(fromRange(editor.getSelection()), [1, 1, 1, 4]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 1, 1, 4]);
// I hit delete to remove it and change the text to XYZ.
editor.pushUndoStop();
@@ -195,10 +195,10 @@ suite('FindController', () => {
// ABC
// XYZ
// ABC
assert.equal(editor.getModel().getLineContent(1), 'XYZ');
assert.equal(editor.getModel()!.getLineContent(1), 'XYZ');
// The cursor is at end of the first line.
assert.deepEqual(fromRange(editor.getSelection()), [1, 4, 1, 4]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 4, 1, 4]);
// I hit F3 to "Find Next" to find the next occurrence of ABC, but instead it searches for XYZ.
nextMatchFindAction.run(null, editor);
@@ -224,10 +224,10 @@ suite('FindController', () => {
});
nextMatchFindAction.run(null, editor);
assert.deepEqual(fromRange(editor.getSelection()), [1, 26, 1, 29]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 26, 1, 29]);
nextMatchFindAction.run(null, editor);
assert.deepEqual(fromRange(editor.getSelection()), [1, 8, 1, 11]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 8, 1, 11]);
findController.dispose();
});
@@ -250,10 +250,10 @@ suite('FindController', () => {
startFindAction.run(null, editor);
nextMatchFindAction.run(null, editor);
assert.deepEqual(fromRange(editor.getSelection()), [2, 9, 2, 13]);
assert.deepEqual(fromSelection(editor.getSelection()!), [2, 9, 2, 13]);
nextMatchFindAction.run(null, editor);
assert.deepEqual(fromRange(editor.getSelection()), [1, 9, 1, 13]);
assert.deepEqual(fromSelection(editor.getSelection()!), [1, 9, 1, 13]);
findController.dispose();
});
@@ -330,7 +330,7 @@ suite('FindController', () => {
findController.getState().change({ searchString: '\\b\\s{3}\\b', replaceString: ' ', isRegex: true }, false);
findController.moveToNextMatch();
assert.deepEqual(editor.getSelections().map(fromRange), [
assert.deepEqual(editor.getSelections()!.map(fromSelection), [
[1, 39, 1, 42]
]);
@@ -357,7 +357,7 @@ suite('FindController', () => {
findController.getState().change({ searchString: '^', replaceString: 'x', isRegex: true }, false);
findController.moveToNextMatch();
assert.deepEqual(editor.getSelections().map(fromRange), [
assert.deepEqual(editor.getSelections()!.map(fromSelection), [
[2, 1, 2, 1]
]);
@@ -388,7 +388,7 @@ suite('FindController', () => {
// cmd+f3
nextSelectionMatchFindAction.run(null, editor);
assert.deepEqual(editor.getSelections().map(fromRange), [
assert.deepEqual(editor.getSelections()!.map(fromSelection), [
[3, 1, 3, 9]
]);
@@ -419,7 +419,7 @@ suite('FindController', () => {
// cmd+f3
nextSelectionMatchFindAction.run(null, editor);
assert.deepEqual(editor.getSelections().map(fromRange), [
assert.deepEqual(editor.getSelections()!.map(fromSelection), [
[3, 1, 3, 9]
]);
@@ -442,8 +442,8 @@ suite('FindController query options persistence', () => {
getBoolean: (key: string) => !!queryState[key],
getInteger: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => void 0
} as IStorageService);
remove: (key) => undefined
} as any);
test('matchCase', () => {
withTestCodeEditor([
@@ -464,7 +464,7 @@ suite('FindController query options persistence', () => {
// I type ABC.
findState.change({ searchString: 'ABC' }, true);
// The second ABC is highlighted as matchCase is true.
assert.deepEqual(fromRange(editor.getSelection()), [2, 1, 2, 4]);
assert.deepEqual(fromSelection(editor.getSelection()!), [2, 1, 2, 4]);
findController.dispose();
});
@@ -491,7 +491,7 @@ suite('FindController query options persistence', () => {
// I type AB.
findState.change({ searchString: 'AB' }, true);
// The second AB is highlighted as wholeWord is true.
assert.deepEqual(fromRange(editor.getSelection()), [2, 1, 2, 3]);
assert.deepEqual(fromSelection(editor.getSelection()!), [2, 1, 2, 3]);
findController.dispose();
});

View File

@@ -5,7 +5,7 @@
import * as assert from 'assert';
import { CoreNavigationCommands } from 'vs/editor/browser/controller/coreCommands';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ICodeEditor, IActiveCodeEditor } from 'vs/editor/browser/editorBrowser';
import { Cursor } from 'vs/editor/common/controller/cursor';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
@@ -18,7 +18,7 @@ import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
suite('FindModel', () => {
function findTest(testName: string, callback: (editor: ICodeEditor, cursor: Cursor) => void): void {
function findTest(testName: string, callback: (editor: IActiveCodeEditor, cursor: Cursor) => void): void {
test(testName, () => {
const textArr = [
'// my cool header',
@@ -34,7 +34,7 @@ suite('FindModel', () => {
'// blablablaciao',
''
];
withTestCodeEditor(textArr, {}, callback);
withTestCodeEditor(textArr, {}, (editor, cursor) => callback(editor as unknown as IActiveCodeEditor, cursor));
const text = textArr.join('\n');
const ptBuilder = new PieceTreeTextBufferBuilder();
@@ -45,7 +45,9 @@ suite('FindModel', () => {
withTestCodeEditor([],
{
model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null)
}, callback);
},
(editor, cursor) => callback(editor as unknown as IActiveCodeEditor, cursor)
);
});
}
@@ -54,7 +56,7 @@ suite('FindModel', () => {
}
function _getFindState(editor: ICodeEditor) {
let model = editor.getModel();
let model = editor.getModel()!;
let currentFindMatches: Range[] = [];
let allFindMatches: Range[] = [];
@@ -76,8 +78,8 @@ suite('FindModel', () => {
};
}
function assertFindState(editor: ICodeEditor, cursor: number[], highlighted: number[], findDecorations: number[][]): void {
assert.deepEqual(fromRange(editor.getSelection()), cursor, 'cursor');
function assertFindState(editor: ICodeEditor, cursor: number[], highlighted: number[] | null, findDecorations: number[][]): void {
assert.deepEqual(fromRange(editor.getSelection()!), cursor, 'cursor');
let expectedState = {
highlighted: highlighted ? [highlighted] : [],
@@ -1177,7 +1179,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1191,7 +1193,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1204,7 +1206,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, hi!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, hi!" << endl;');
findModel.replace();
assertFindState(
@@ -1216,7 +1218,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
findModel.replace();
assertFindState(
@@ -1227,7 +1229,7 @@ suite('FindModel', () => {
[6, 14, 6, 19]
]
);
assert.equal(editor.getModel().getLineContent(8), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hi world again" << endl;');
findModel.replace();
assertFindState(
@@ -1236,7 +1238,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, hi!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, hi!" << endl;');
findModel.dispose();
findState.dispose();
@@ -1269,7 +1271,7 @@ suite('FindModel', () => {
[11, 10, 11, 13]
]
);
assert.equal(editor.getModel().getLineContent(11), '// blablablaciao');
assert.equal(editor.getModel()!.getLineContent(11), '// blablablaciao');
findModel.replace();
assertFindState(
@@ -1281,7 +1283,7 @@ suite('FindModel', () => {
[11, 11, 11, 14]
]
);
assert.equal(editor.getModel().getLineContent(11), '// ciaoblablaciao');
assert.equal(editor.getModel()!.getLineContent(11), '// ciaoblablaciao');
findModel.replace();
assertFindState(
@@ -1292,7 +1294,7 @@ suite('FindModel', () => {
[11, 12, 11, 15]
]
);
assert.equal(editor.getModel().getLineContent(11), '// ciaociaoblaciao');
assert.equal(editor.getModel()!.getLineContent(11), '// ciaociaoblaciao');
findModel.replace();
assertFindState(
@@ -1301,7 +1303,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(11), '// ciaociaociaociao');
assert.equal(editor.getModel()!.getLineContent(11), '// ciaociaociaociao');
findModel.dispose();
findState.dispose();
@@ -1338,7 +1340,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
findModel.replaceAll();
assertFindState(
@@ -1347,9 +1349,9 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, hi!" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, hi!" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hi world again" << endl;');
findModel.dispose();
findState.dispose();
@@ -1388,10 +1390,10 @@ suite('FindModel', () => {
[9, 1, 9, 3]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << "hello world again" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << "Hello world again" << endl;');
assert.equal(editor.getModel().getLineContent(9), ' cout << "helloworld again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hello world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "Hello world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(9), ' cout << "helloworld again" << endl;');
findModel.dispose();
findState.dispose();
@@ -1420,7 +1422,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(11), '// ciaociaociaociao');
assert.equal(editor.getModel()!.getLineContent(11), '// ciaociaociaociao');
findModel.dispose();
findState.dispose();
@@ -1449,10 +1451,10 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(11), '// <');
assert.equal(editor.getModel().getLineContent(12), '\t><');
assert.equal(editor.getModel().getLineContent(13), '\t><');
assert.equal(editor.getModel().getLineContent(14), '\t>ciao');
assert.equal(editor.getModel()!.getLineContent(11), '// <');
assert.equal(editor.getModel()!.getLineContent(12), '\t><');
assert.equal(editor.getModel()!.getLineContent(13), '\t><');
assert.equal(editor.getModel()!.getLineContent(14), '\t>ciao');
findModel.dispose();
findState.dispose();
@@ -1481,8 +1483,8 @@ suite('FindModel', () => {
[]
);
assert.equal(editor.getModel().getLineContent(2), '#bar "cool.h"');
assert.equal(editor.getModel().getLineContent(3), '#bar <iostream>');
assert.equal(editor.getModel()!.getLineContent(2), '#bar "cool.h"');
assert.equal(editor.getModel()!.getLineContent(3), '#bar <iostream>');
findModel.dispose();
findState.dispose();
@@ -1671,7 +1673,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1683,7 +1685,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1694,7 +1696,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
findModel.replace();
assertFindState(
@@ -1703,7 +1705,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(8), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hi world again" << endl;');
findModel.dispose();
findState.dispose();
@@ -1742,7 +1744,7 @@ suite('FindModel', () => {
]
);
assert.equal(editor.getModel().getLineContent(8), ' cout << "Hello world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "Hello world again" << endl;');
findModel.replace();
assertFindState(
@@ -1754,7 +1756,7 @@ suite('FindModel', () => {
[7, 14, 7, 19],
]
);
assert.equal(editor.getModel().getLineContent(8), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hi world again" << endl;');
findModel.replace();
assertFindState(
@@ -1765,7 +1767,7 @@ suite('FindModel', () => {
[7, 14, 7, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1774,7 +1776,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
findModel.dispose();
findState.dispose();
@@ -1798,9 +1800,9 @@ suite('FindModel', () => {
findModel.replaceAll();
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hi world again" << endl;');
assertFindState(
editor,
@@ -1841,7 +1843,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1853,7 +1855,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hilo world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hilo world, Hello!" << endl;');
findModel.replace();
assertFindState(
@@ -1864,7 +1866,7 @@ suite('FindModel', () => {
[8, 14, 8, 19]
]
);
assert.equal(editor.getModel().getLineContent(7), ' cout << "hilo world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hilo world again" << endl;');
findModel.replace();
assertFindState(
@@ -1873,7 +1875,7 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(8), ' cout << "hilo world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "hilo world again" << endl;');
findModel.dispose();
findState.dispose();
@@ -1898,10 +1900,10 @@ suite('FindModel', () => {
findModel.replaceAll();
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello girl, Hello!" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << "hello girl again" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << "Hello girl again" << endl;');
assert.equal(editor.getModel().getLineContent(9), ' cout << "hellogirl again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello girl, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hello girl again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "Hello girl again" << endl;');
assert.equal(editor.getModel()!.getLineContent(9), ' cout << "hellogirl again" << endl;');
assertFindState(
editor,
@@ -1931,8 +1933,8 @@ suite('FindModel', () => {
findModel.replaceAll();
assert.equal(editor.getModel().getLineContent(6), ' cout << "hello girl, Hello!" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << "Hello girl again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hello girl, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << "Hello girl again" << endl;');
assertFindState(
editor,
@@ -1969,9 +1971,9 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << " world, !" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << " world again" << endl;');
assert.equal(editor.getModel().getLineContent(8), ' cout << " world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << " world, !" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << " world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(8), ' cout << " world again" << endl;');
findModel.dispose();
findState.dispose();
@@ -2023,9 +2025,9 @@ suite('FindModel', () => {
null,
[]
);
assert.equal(editor.getModel().getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel().getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel().getLineContent(9), ' cout << "hiworld again" << endl;');
assert.equal(editor.getModel()!.getLineContent(6), ' cout << "hi world, Hello!" << endl;');
assert.equal(editor.getModel()!.getLineContent(7), ' cout << "hi world again" << endl;');
assert.equal(editor.getModel()!.getLineContent(9), ' cout << "hiworld again" << endl;');
findModel.dispose();
findState.dispose();