Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -8,18 +8,19 @@ 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 { ScrollType, IEditorContribution, FindMatch, TrackedRangeStickiness, OverviewRulerLane, IModel } from 'vs/editor/common/editorCommon';
import { ScrollType, IEditorContribution } from 'vs/editor/common/editorCommon';
import { FindMatch, TrackedRangeStickiness, OverviewRulerLane, ITextModel } from 'vs/editor/common/model';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
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';
import { CursorMoveCommands } from 'vs/editor/common/controller/cursorMoveCommands';
import { CursorState, RevealTarget } from 'vs/editor/common/controller/cursorCommon';
import { 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/findController';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/common/colorRegistry';
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState';
@@ -55,10 +56,7 @@ export class InsertCursorAbove extends EditorAction {
cursors.setStates(
args.source,
CursorChangeReason.Explicit,
CursorState.ensureInEditableRange(
context,
CursorMoveCommands.addCursorUp(context, cursors.getAll())
)
CursorMoveCommands.addCursorUp(context, cursors.getAll())
);
cursors.reveal(true, RevealTarget.TopMost, ScrollType.Smooth);
}
@@ -94,10 +92,7 @@ export class InsertCursorBelow extends EditorAction {
cursors.setStates(
args.source,
CursorChangeReason.Explicit,
CursorState.ensureInEditableRange(
context,
CursorMoveCommands.addCursorDown(context, cursors.getAll())
)
CursorMoveCommands.addCursorDown(context, cursors.getAll())
);
cursors.reveal(true, RevealTarget.BottomMost, ScrollType.Smooth);
}
@@ -387,7 +382,7 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
this._ignoreSelectionChange = false;
}
private _expandEmptyToWord(model: IModel, selection: Selection): Selection {
private _expandEmptyToWord(model: ITextModel, selection: Selection): Selection {
if (!selection.isEmpty()) {
return selection;
}
@@ -815,6 +810,11 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
}
const model = this.editor.getModel();
if (model.isTooLargeForTokenization()) {
// the file is too large, so searching word under cursor in the whole document takes is blocking the UI.
return;
}
const hasFindOccurrences = DocumentHighlightProviderRegistry.has(model);
let allMatches = model.findMatches(this.state.searchText, true, false, this.state.matchCase, this.state.wordSeparators, false).map(m => m.range);
@@ -881,7 +881,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
}
}
function modelRangesContainSameText(model: IModel, ranges: Range[], matchCase: boolean): boolean {
function modelRangesContainSameText(model: ITextModel, ranges: Range[], matchCase: boolean): boolean {
const selectedText = getValueInRange(model, ranges[0], !matchCase);
for (let i = 1, len = ranges.length; i < len; i++) {
const range = ranges[i];
@@ -896,7 +896,7 @@ function modelRangesContainSameText(model: IModel, ranges: Range[], matchCase: b
return true;
}
function getValueInRange(model: IModel, range: Range, toLowerCase: boolean): string {
function getValueInRange(model: ITextModel, range: Range, toLowerCase: boolean): string {
const text = model.getValueInRange(range);
return (toLowerCase ? text.toLowerCase() : text);
}

View File

@@ -9,7 +9,8 @@ import { withTestCodeEditor, TestCodeEditor } from 'vs/editor/test/browser/testC
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/multicursor';
import { Handler, EndOfLineSequence } from 'vs/editor/common/editorCommon';
import { Handler } from 'vs/editor/common/editorCommon';
import { EndOfLineSequence } from 'vs/editor/common/model';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { CommonFindController } from 'vs/editor/contrib/find/findController';
@@ -27,7 +28,13 @@ suite('Multicursor', () => {
addCursorUpAction.run(null, editor, {});
assert.equal(cursor.getSelections().length, 2);
editor.trigger('test', Handler.Paste, { text: '1\n2' });
editor.trigger('test', Handler.Paste, {
text: '1\n2',
multicursorText: [
'1',
'2'
]
});
// cursorCommand(cursor, H.Paste, { text: '1\n2' });
assert.equal(editor.getModel().getLineContent(1), '1abc');
assert.equal(editor.getModel().getLineContent(2), '2def');