Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -7,16 +7,14 @@
import * as assert from 'assert';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import {
getSelectionSearchString
} from 'vs/editor/contrib/find/common/find';
import { withMockCodeEditor } from 'vs/editor/test/common/mocks/mockCodeEditor';
import { getSelectionSearchString } from 'vs/editor/contrib/find/findController';
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
suite('Find', () => {
test('search string at position', () => {
withMockCodeEditor([
withTestCodeEditor([
'ABC DEF',
'0123 456'
], {}, (editor, cursor) => {
@@ -39,7 +37,7 @@ suite('Find', () => {
});
test('search string with selection', () => {
withMockCodeEditor([
withTestCodeEditor([
'ABC DEF',
'0123 456'
], {}, (editor, cursor) => {
@@ -63,7 +61,7 @@ suite('Find', () => {
});
test('search string with multiline selection', () => {
withMockCodeEditor([
withTestCodeEditor([
'ABC DEF',
'0123 456'
], {}, (editor, cursor) => {
@@ -86,4 +84,4 @@ suite('Find', () => {
});
});
});
});

View File

@@ -11,14 +11,16 @@ import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { CommonFindController, FindStartFocusAction, IFindStartOptions, NextMatchFindAction, StartFindAction } from 'vs/editor/contrib/find/common/findController';
import { withMockCodeEditor } from 'vs/editor/test/common/mocks/mockCodeEditor';
import * as platform from 'vs/base/common/platform';
import { CommonFindController, FindStartFocusAction, IFindStartOptions, NextMatchFindAction, StartFindAction } from 'vs/editor/contrib/find/findController';
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { HistoryNavigator } from 'vs/base/common/history';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { Delayer } from 'vs/base/common/async';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
export class TestFindController extends CommonFindController {
@@ -28,8 +30,13 @@ export class TestFindController extends CommonFindController {
private _delayedUpdateHistoryEvent: Emitter<void> = new Emitter<void>();
constructor(editor: ICommonCodeEditor, @IContextKeyService contextKeyService: IContextKeyService, @IStorageService storageService: IStorageService) {
super(editor, contextKeyService, storageService);
constructor(
editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@IStorageService storageService: IStorageService,
@IClipboardService clipboardService: IClipboardService
) {
super(editor, contextKeyService, storageService, clipboardService);
this._updateHistoryDelayer = new Delayer<void>(50);
}
@@ -70,21 +77,104 @@ function fromRange(rng: Range): number[] {
suite('FindController', () => {
let queryState: { [key: string]: any; } = {};
let clipboardState = '';
let serviceCollection = new ServiceCollection();
serviceCollection.set(IStorageService, <any>{
serviceCollection.set(IStorageService, {
get: (key: string) => queryState[key],
getBoolean: (key: string) => !!queryState[key],
store: (key: string, value: any) => { queryState[key] = value; }
});
} as IStorageService);
test('issue #1857: F3, Find Next, acts like "Find Under Cursor"', () => {
withMockCodeEditor([
if (platform.isMacintosh) {
serviceCollection.set(IClipboardService, <any>{
readFindText: _ => clipboardState,
writeFindText: (value: any) => { clipboardState = value; }
});
}
test('stores to the global clipboard buffer on start find action', () => {
withTestCodeEditor([
'ABC',
'ABC',
'XYZ',
'ABC'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
if (!platform.isMacintosh) {
assert.ok(true);
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let startFindAction = new StartFindAction();
// I select ABC on the first line
editor.setSelection(new Selection(1, 1, 1, 4));
// I hit Ctrl+F to show the Find dialog
startFindAction.run(null, editor);
assert.deepEqual(findController.getGlobalBufferTerm(), findController.getState().searchString);
findController.dispose();
});
});
test('reads from the global clipboard buffer on next find action if buffer exists', () => {
withTestCodeEditor([
'ABC',
'ABC',
'XYZ',
'ABC'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = 'ABC';
if (!platform.isMacintosh) {
assert.ok(true);
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findState = findController.getState();
let nextMatchFindAction = new NextMatchFindAction();
nextMatchFindAction.run(null, editor);
assert.equal(findState.searchString, 'ABC');
assert.deepEqual(fromRange(editor.getSelection()), [1, 1, 1, 4]);
findController.dispose();
});
});
test('writes to the global clipboard buffer when text changes', () => {
withTestCodeEditor([
'ABC',
'ABC',
'XYZ',
'ABC'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
if (!platform.isMacintosh) {
assert.ok(true);
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findState = findController.getState();
findState.change({ searchString: 'ABC' }, true);
assert.deepEqual(findController.getGlobalBufferTerm(), 'ABC');
findController.dispose();
});
});
test('issue #1857: F3, Find Next, acts like "Find Under Cursor"', () => {
withTestCodeEditor([
'ABC',
'ABC',
'XYZ',
'ABC'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
// The cursor is at the very top, of the file, at the first ABC
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findState = findController.getState();
@@ -136,10 +226,10 @@ suite('FindController', () => {
});
test('issue #3090: F3 does not loop with two matches on a single line', () => {
withMockCodeEditor([
withTestCodeEditor([
'import nls = require(\'vs/nls\');'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let nextMatchFindAction = new NextMatchFindAction();
@@ -159,12 +249,12 @@ suite('FindController', () => {
});
test('issue #6149: Auto-escape highlighted text for search and replace regex mode', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let startFindAction = new StartFindAction();
let nextMatchFindAction = new NextMatchFindAction();
@@ -185,16 +275,17 @@ suite('FindController', () => {
});
test('issue #9043: Clear search scope when find widget is hidden', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.start({
forceRevealReplace: false,
seedSearchStringFromSelection: false,
seedSearchStringFromGlobalClipboard: false,
shouldFocus: FindStartFocusAction.NoFocusChange,
shouldAnimate: false
});
@@ -213,12 +304,12 @@ suite('FindController', () => {
});
test('find term is added to history on state change', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.getState().change({ searchString: '1' }, false);
findController.getState().change({ searchString: '2' }, false);
@@ -229,12 +320,12 @@ suite('FindController', () => {
});
test('find term is added with delay', (done) => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.delayUpdateHistory = true;
findController.getState().change({ searchString: '1' }, false);
@@ -249,12 +340,12 @@ suite('FindController', () => {
});
test('show previous find term', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.getState().change({ searchString: '1' }, false);
findController.getState().change({ searchString: '2' }, false);
@@ -266,12 +357,12 @@ suite('FindController', () => {
});
test('show previous find term do not update history', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.getState().change({ searchString: '1' }, false);
findController.getState().change({ searchString: '2' }, false);
@@ -283,12 +374,12 @@ suite('FindController', () => {
});
test('show next find term', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.getState().change({ searchString: '1' }, false);
findController.getState().change({ searchString: '2' }, false);
@@ -303,12 +394,12 @@ suite('FindController', () => {
});
test('show next find term do not update history', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
findController.getState().change({ searchString: '1' }, false);
findController.getState().change({ searchString: '2' }, false);
@@ -323,10 +414,10 @@ suite('FindController', () => {
});
test('issue #18111: Regex replace with single space replaces with no space', () => {
withMockCodeEditor([
withTestCodeEditor([
'HRESULT OnAmbientPropertyChange(DISPID dispid);'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let startFindAction = new StartFindAction();
@@ -348,12 +439,12 @@ suite('FindController', () => {
});
test('issue #24714: Regular expression with ^ in search & replace', () => {
withMockCodeEditor([
withTestCodeEditor([
'',
'line2',
'line3'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let startFindAction = new StartFindAction();
@@ -392,14 +483,14 @@ suite('FindController query options persistence', () => {
queryState['editor.matchCase'] = false;
queryState['editor.wholeWord'] = false;
let serviceCollection = new ServiceCollection();
serviceCollection.set(IStorageService, <any>{
serviceCollection.set(IStorageService, {
get: (key: string) => queryState[key],
getBoolean: (key: string) => !!queryState[key],
store: (key: string, value: any) => { queryState[key] = value; }
});
} as IStorageService);
test('matchCase', () => {
withMockCodeEditor([
withTestCodeEditor([
'abc',
'ABC',
'XYZ',
@@ -426,7 +517,7 @@ suite('FindController query options persistence', () => {
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
test('wholeWord', () => {
withMockCodeEditor([
withTestCodeEditor([
'ABC',
'AB',
'XYZ',
@@ -451,7 +542,7 @@ suite('FindController query options persistence', () => {
});
test('toggling options is saved', () => {
withMockCodeEditor([
withTestCodeEditor([
'ABC',
'AB',
'XYZ',
@@ -466,4 +557,4 @@ suite('FindController query options persistence', () => {
findController.dispose();
});
});
});
});

View File

@@ -9,17 +9,17 @@ import { Cursor } from 'vs/editor/common/controller/cursor';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { FindModelBoundToEditorModel } from 'vs/editor/contrib/find/common/findModel';
import { FindReplaceState } from 'vs/editor/contrib/find/common/findState';
import { withMockCodeEditor } from 'vs/editor/test/common/mocks/mockCodeEditor';
import { CoreNavigationCommands } from 'vs/editor/common/controller/coreCommands';
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 { CoreNavigationCommands } from 'vs/editor/browser/controller/coreCommands';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
suite('FindModel', () => {
function findTest(testName: string, callback: (editor: ICommonCodeEditor, cursor: Cursor) => void): void {
function findTest(testName: string, callback: (editor: ICodeEditor, cursor: Cursor) => void): void {
test(testName, () => {
withMockCodeEditor([
withTestCodeEditor([
'// my cool header',
'#include "cool.h"',
'#include <iostream>',
@@ -40,7 +40,7 @@ suite('FindModel', () => {
return [rng.startLineNumber, rng.startColumn, rng.endLineNumber, rng.endColumn];
}
function _getFindState(editor: ICommonCodeEditor) {
function _getFindState(editor: ICodeEditor) {
let model = editor.getModel();
let currentFindMatches: Range[] = [];
let allFindMatches: Range[] = [];
@@ -63,7 +63,7 @@ suite('FindModel', () => {
};
}
function assertFindState(editor: ICommonCodeEditor, cursor: number[], highlighted: number[], findDecorations: number[][]): void {
function assertFindState(editor: ICodeEditor, cursor: number[], highlighted: number[], findDecorations: number[][]): void {
assert.deepEqual(fromRange(editor.getSelection()), cursor, 'cursor');
let expectedState = {

View File

@@ -5,7 +5,7 @@
'use strict';
import * as assert from 'assert';
import { parseReplaceString, ReplacePattern, ReplacePiece } from 'vs/editor/contrib/find/common/replacePattern';
import { parseReplaceString, ReplacePattern, ReplacePiece } from 'vs/editor/contrib/find/replacePattern';
suite('Replace Pattern test', () => {