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

@@ -8,9 +8,9 @@ import * as nls from 'vs/nls';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { KeyCode, KeyMod, KeyChord } from 'vs/base/common/keyCodes';
import { RunOnceScheduler } from 'vs/base/common/async';
import { ICommonCodeEditor, ScrollType, IEditorContribution, FindMatch, TrackedRangeStickiness, OverviewRulerLane, IModel } from 'vs/editor/common/editorCommon';
import { ScrollType, IEditorContribution, FindMatch, TrackedRangeStickiness, OverviewRulerLane, IModel } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { editorAction, commonEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/common/editorCommonExtensions';
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { CursorChangeReason, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
@@ -18,13 +18,13 @@ import { CursorMoveCommands } from 'vs/editor/common/controller/cursorMoveComman
import { CursorState, RevealTarget } from 'vs/editor/common/controller/cursorCommon';
import { Constants } from 'vs/editor/common/core/uint';
import { DocumentHighlightProviderRegistry } from 'vs/editor/common/modes';
import { CommonFindController } from 'vs/editor/contrib/find/common/findController';
import { CommonFindController } from 'vs/editor/contrib/find/findController';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/common/colorRegistry';
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/common/findState';
import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
@editorAction
export class InsertCursorAbove extends EditorAction {
constructor() {
super({
@@ -43,7 +43,7 @@ export class InsertCursorAbove extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
const cursors = editor._getCursors();
const context = cursors.context;
@@ -64,7 +64,6 @@ export class InsertCursorAbove extends EditorAction {
}
}
@editorAction
export class InsertCursorBelow extends EditorAction {
constructor() {
super({
@@ -83,7 +82,7 @@ export class InsertCursorBelow extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
const cursors = editor._getCursors();
const context = cursors.context;
@@ -104,7 +103,6 @@ export class InsertCursorBelow extends EditorAction {
}
}
@editorAction
class InsertCursorAtEndOfEachLineSelected extends EditorAction {
constructor() {
@@ -120,7 +118,7 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
});
}
private getCursorsForSelection(selection: Selection, editor: ICommonCodeEditor): Selection[] {
private getCursorsForSelection(selection: Selection, editor: ICodeEditor): Selection[] {
if (selection.isEmpty()) {
return [];
}
@@ -138,7 +136,7 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction {
return newSelections;
}
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
let selections = editor.getSelections();
let newSelections = selections
.map((selection) => this.getCursorsForSelection(selection, editor))
@@ -160,7 +158,7 @@ export class MultiCursorSessionResult {
export class MultiCursorSession {
public static create(editor: ICommonCodeEditor, findController: CommonFindController): MultiCursorSession {
public static create(editor: ICodeEditor, findController: CommonFindController): MultiCursorSession {
const findState = findController.getState();
// Find widget owns entirely what we search for if:
@@ -209,7 +207,7 @@ export class MultiCursorSession {
}
constructor(
private readonly _editor: ICommonCodeEditor,
private readonly _editor: ICodeEditor,
public readonly findController: CommonFindController,
public readonly isDisconnectedFromFindController: boolean,
public readonly searchText: string,
@@ -303,21 +301,20 @@ export class MultiCursorSession {
}
}
@commonEditorContribution
export class MultiCursorSelectionController extends Disposable implements IEditorContribution {
private static ID = 'editor.contrib.multiCursorController';
private static readonly ID = 'editor.contrib.multiCursorController';
private readonly _editor: ICommonCodeEditor;
private readonly _editor: ICodeEditor;
private _ignoreSelectionChange: boolean;
private _session: MultiCursorSession;
private _sessionDispose: IDisposable[];
public static get(editor: ICommonCodeEditor): MultiCursorSelectionController {
public static get(editor: ICodeEditor): MultiCursorSelectionController {
return editor.getContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID);
}
constructor(editor: ICommonCodeEditor) {
constructor(editor: ICodeEditor) {
super();
this._editor = editor;
this._ignoreSelectionChange = false;
@@ -362,7 +359,7 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
this._editor.onDidBlurEditorText(() => {
this._endSession();
}),
findController.getState().addChangeListener((e) => {
findController.getState().onFindReplaceStateChange((e) => {
if (e.matchCase || e.wholeWord) {
this._endSession();
}
@@ -471,7 +468,7 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
// - and the search widget is visible
// - and the search string is non-empty
// - and we're searching for a regex
if (!this._editor.isFocused() && findState.isRevealed && findState.searchString.length > 0 && findState.isRegex) {
if (findState.isRevealed && findState.searchString.length > 0 && findState.isRegex) {
matches = this._editor.getModel().findMatches(findState.searchString, true, findState.isRegex, findState.matchCase, findState.wholeWord ? this._editor.getConfiguration().wordSeparators : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
@@ -506,7 +503,7 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
export abstract class MultiCursorSelectionControllerAction extends EditorAction {
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
const multiCursorController = MultiCursorSelectionController.get(editor);
if (!multiCursorController) {
return;
@@ -521,7 +518,6 @@ export abstract class MultiCursorSelectionControllerAction extends EditorAction
protected abstract _run(multiCursorController: MultiCursorSelectionController, findController: CommonFindController): void;
}
@editorAction
export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -540,7 +536,6 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr
}
}
@editorAction
export class AddSelectionToPreviousFindMatchAction extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -555,7 +550,6 @@ export class AddSelectionToPreviousFindMatchAction extends MultiCursorSelectionC
}
}
@editorAction
export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -574,7 +568,6 @@ export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionCont
}
}
@editorAction
export class MoveSelectionToPreviousFindMatchAction extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -589,7 +582,6 @@ export class MoveSelectionToPreviousFindMatchAction extends MultiCursorSelection
}
}
@editorAction
export class SelectHighlightsAction extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -608,7 +600,6 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction
}
}
@editorAction
export class CompatChangeAll extends MultiCursorSelectionControllerAction {
constructor() {
super({
@@ -662,17 +653,16 @@ class SelectionHighlighterState {
}
}
@commonEditorContribution
export class SelectionHighlighter extends Disposable implements IEditorContribution {
private static ID = 'editor.contrib.selectionHighlighter';
private static readonly ID = 'editor.contrib.selectionHighlighter';
private editor: ICommonCodeEditor;
private editor: ICodeEditor;
private _isEnabled: boolean;
private decorations: string[];
private updateSoon: RunOnceScheduler;
private state: SelectionHighlighterState;
constructor(editor: ICommonCodeEditor) {
constructor(editor: ICodeEditor) {
super();
this.editor = editor;
this._isEnabled = editor.getConfiguration().contribInfo.selectionHighlight;
@@ -709,7 +699,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
this._register(editor.onDidChangeModel((e) => {
this._setState(null);
}));
this._register(CommonFindController.get(editor).getState().addChangeListener((e) => {
this._register(CommonFindController.get(editor).getState().onFindReplaceStateChange((e) => {
this._update();
}));
}
@@ -722,7 +712,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
this._setState(SelectionHighlighter._createState(this._isEnabled, this.editor));
}
private static _createState(isEnabled: boolean, editor: ICommonCodeEditor): SelectionHighlighterState {
private static _createState(isEnabled: boolean, editor: ICodeEditor): SelectionHighlighterState {
if (!isEnabled) {
return null;
}
@@ -870,7 +860,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
this.decorations = this.editor.deltaDecorations(this.decorations, decorations);
}
private static _SELECTION_HIGHLIGHT_OVERVIEW = ModelDecorationOptions.register({
private static readonly _SELECTION_HIGHLIGHT_OVERVIEW = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'selectionHighlight',
overviewRuler: {
@@ -880,7 +870,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
}
});
private static _SELECTION_HIGHLIGHT = ModelDecorationOptions.register({
private static readonly _SELECTION_HIGHLIGHT = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'selectionHighlight',
});
@@ -910,3 +900,16 @@ function getValueInRange(model: IModel, range: Range, toLowerCase: boolean): str
const text = model.getValueInRange(range);
return (toLowerCase ? text.toLowerCase() : text);
}
registerEditorContribution(MultiCursorSelectionController);
registerEditorContribution(SelectionHighlighter);
registerEditorAction(InsertCursorAbove);
registerEditorAction(InsertCursorBelow);
registerEditorAction(InsertCursorAtEndOfEachLineSelected);
registerEditorAction(AddSelectionToNextFindMatchAction);
registerEditorAction(AddSelectionToPreviousFindMatchAction);
registerEditorAction(MoveSelectionToNextFindMatchAction);
registerEditorAction(MoveSelectionToPreviousFindMatchAction);
registerEditorAction(SelectHighlightsAction);
registerEditorAction(CompatChangeAll);

View File

@@ -5,19 +5,19 @@
'use strict';
import * as assert from 'assert';
import { withMockCodeEditor, MockCodeEditor } from 'vs/editor/test/common/mocks/mockCodeEditor';
import { withTestCodeEditor, TestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range';
import { InsertCursorAbove, InsertCursorBelow, MultiCursorSelectionController, SelectHighlightsAction, AddSelectionToNextFindMatchAction } from 'vs/editor/contrib/multicursor/common/multicursor';
import { InsertCursorAbove, InsertCursorBelow, MultiCursorSelectionController, SelectHighlightsAction, AddSelectionToNextFindMatchAction } from 'vs/editor/contrib/multicursor/multicursor';
import { Handler, EndOfLineSequence } from 'vs/editor/common/editorCommon';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { CommonFindController } from 'vs/editor/contrib/find/common/findController';
import { CommonFindController } from 'vs/editor/contrib/find/findController';
suite('Multicursor', () => {
test('issue #2205: Multi-cursor pastes in reverse order', () => {
withMockCodeEditor([
withTestCodeEditor([
'abc',
'def'
], {}, (editor, cursor) => {
@@ -35,7 +35,7 @@ suite('Multicursor', () => {
});
test('issue #1336: Insert cursor below on last line adds a cursor to the end of the current line', () => {
withMockCodeEditor([
withTestCodeEditor([
'abc'
], {}, (editor, cursor) => {
let addCursorDownAction = new InsertCursorBelow();
@@ -53,14 +53,14 @@ function fromRange(rng: Range): number[] {
suite('Multicursor selection', () => {
let queryState: { [key: string]: any; } = {};
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 #8817: Cursor position changes when you cancel multicursor', () => {
withMockCodeEditor([
withTestCodeEditor([
'var x = (3 * 5)',
'var y = (3 * 5)',
'var z = (3 * 5)',
@@ -89,7 +89,7 @@ suite('Multicursor selection', () => {
});
test('issue #5400: "Select All Occurrences of Find Match" does not select all if find uses regex', () => {
withMockCodeEditor([
withTestCodeEditor([
'something',
'someething',
'someeething',
@@ -120,7 +120,7 @@ suite('Multicursor selection', () => {
});
test('AddSelectionToNextFindMatchAction can work with multiline', () => {
withMockCodeEditor([
withTestCodeEditor([
'',
'qwe',
'rty',
@@ -154,7 +154,7 @@ suite('Multicursor selection', () => {
});
test('issue #6661: AddSelectionToNextFindMatchAction can work with touching ranges', () => {
withMockCodeEditor([
withTestCodeEditor([
'abcabc',
'abc',
'abcabc',
@@ -203,7 +203,7 @@ suite('Multicursor selection', () => {
});
test('issue #23541: Multiline Ctrl+D does not work in CRLF files', () => {
withMockCodeEditor([
withTestCodeEditor([
'',
'qwe',
'rty',
@@ -238,8 +238,8 @@ suite('Multicursor selection', () => {
});
});
function testMulticursor(text: string[], callback: (editor: MockCodeEditor, findController: CommonFindController) => void): void {
withMockCodeEditor(text, { serviceCollection: serviceCollection }, (editor, cursor) => {
function testMulticursor(text: string[], callback: (editor: TestCodeEditor, findController: CommonFindController) => void): void {
withTestCodeEditor(text, { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
@@ -250,7 +250,7 @@ suite('Multicursor selection', () => {
});
}
function testAddSelectionToNextFindMatchAction(text: string[], callback: (editor: MockCodeEditor, action: AddSelectionToNextFindMatchAction, findController: CommonFindController) => void): void {
function testAddSelectionToNextFindMatchAction(text: string[], callback: (editor: TestCodeEditor, action: AddSelectionToNextFindMatchAction, findController: CommonFindController) => void): void {
testMulticursor(text, (editor, findController) => {
let action = new AddSelectionToNextFindMatchAction();
callback(editor, action, findController);