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

@@ -5,20 +5,17 @@
'use strict';
import * as assert from 'assert';
import { Model } from 'vs/editor/common/model/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
import { ViewLineToken } from 'vs/editor/test/common/core/viewLineToken';
import { ITokenizationSupport, TokenizationRegistry, LanguageId, LanguageIdentifier, MetadataConsts } from 'vs/editor/common/modes';
import { CharacterPair } from 'vs/editor/common/modes/languageConfiguration';
import { Range } from 'vs/editor/common/core/range';
import { Position } from 'vs/editor/common/core/position';
import { IFoundBracket } from 'vs/editor/common/editorCommon';
import { TextModel } from 'vs/editor/common/model/textModel';
import { TextModelWithTokens } from 'vs/editor/common/model/textModelWithTokens';
import { IFoundBracket } from 'vs/editor/common/model';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { TokenizationResult2 } from 'vs/editor/common/core/token';
import { RawTextSource } from 'vs/editor/common/model/textSource';
suite('TextModelWithTokens', () => {
@@ -76,8 +73,8 @@ suite('TextModelWithTokens', () => {
brackets: brackets
});
let model = new TextModelWithTokens(
RawTextSource.fromString(contents.join('\n')),
let model = new TextModel(
contents.join('\n'),
TextModel.DEFAULT_CREATION_OPTIONS,
languageIdentifier
);
@@ -151,12 +148,12 @@ suite('TextModelWithTokens', () => {
suite('TextModelWithTokens - bracket matching', () => {
function isNotABracket(model: Model, lineNumber: number, column: number) {
function isNotABracket(model: TextModel, lineNumber: number, column: number) {
let match = model.matchBracket(new Position(lineNumber, column));
assert.equal(match, null, 'is not matching brackets at ' + lineNumber + ', ' + column);
}
function isBracket2(model: Model, testPosition: Position, expected: [Range, Range]): void {
function isBracket2(model: TextModel, testPosition: Position, expected: [Range, Range]): void {
let actual = model.matchBracket(testPosition);
assert.deepEqual(actual, expected, 'matches brackets at ' + testPosition);
}
@@ -183,7 +180,7 @@ suite('TextModelWithTokens - bracket matching', () => {
let text =
')]}{[(' + '\n' +
')]}{[(';
let model = Model.createFromString(text, undefined, languageIdentifier);
let model = TextModel.createFromString(text, undefined, languageIdentifier);
isNotABracket(model, 1, 1);
isNotABracket(model, 1, 2);
@@ -211,7 +208,7 @@ suite('TextModelWithTokens - bracket matching', () => {
'}, bar: {hallo: [{' + '\n' +
'}, {' + '\n' +
'}]}}';
let model = Model.createFromString(text, undefined, languageIdentifier);
let model = TextModel.createFromString(text, undefined, languageIdentifier);
let brackets: [Position, Range, Range][] = [
[new Position(1, 11), new Range(1, 11, 1, 12), new Range(5, 4, 5, 5)],
@@ -264,18 +261,29 @@ suite('TextModelWithTokens - bracket matching', () => {
suite('TextModelWithTokens regression tests', () => {
test('Microsoft/monaco-editor#122: Unhandled Exception: TypeError: Unable to get property \'replace\' of undefined or null reference', () => {
function assertViewLineTokens(model: Model, lineNumber: number, forceTokenization: boolean, expected: ViewLineToken[]): void {
function assertViewLineTokens(model: TextModel, lineNumber: number, forceTokenization: boolean, expected: ViewLineToken[]): void {
if (forceTokenization) {
model.forceTokenization(lineNumber);
}
let actual = model.getLineTokens(lineNumber).inflate();
let _actual = model.getLineTokens(lineNumber).inflate();
interface ISimpleViewToken {
endIndex: number;
foreground: number;
}
let actual: ISimpleViewToken[] = [];
for (let i = 0, len = _actual.getCount(); i < len; i++) {
actual[i] = {
endIndex: _actual.getEndOffset(i),
foreground: _actual.getForeground(i)
};
}
let decode = (token: ViewLineToken) => {
return {
endIndex: token.endIndex,
foreground: token.getForeground()
};
};
assert.deepEqual(actual.map(decode), expected.map(decode));
assert.deepEqual(actual, expected.map(decode));
}
let _tokenId = 10;
@@ -301,7 +309,7 @@ suite('TextModelWithTokens regression tests', () => {
let registration1 = TokenizationRegistry.register(LANG_ID1, tokenizationSupport);
let registration2 = TokenizationRegistry.register(LANG_ID2, tokenizationSupport);
let model = Model.createFromString('A model with\ntwo lines');
let model = TextModel.createFromString('A model with\ntwo lines');
assertViewLineTokens(model, 1, true, [createViewLineToken(12, 1)]);
assertViewLineTokens(model, 2, true, [createViewLineToken(9, 1)]);
@@ -340,7 +348,7 @@ suite('TextModelWithTokens regression tests', () => {
]
});
let model = Model.createFromString([
let model = TextModel.createFromString([
'Imports System',
'Imports System.Collections.Generic',
'',
@@ -363,7 +371,7 @@ suite('TextModelWithTokens regression tests', () => {
suite('TextModel.getLineIndentGuide', () => {
function assertIndentGuides(lines: [number, string][]): void {
let text = lines.map(l => l[1]).join('\n');
let model = Model.createFromString(text);
let model = TextModel.createFromString(text);
let actualIndents = model.getLinesIndentGuides(1, model.getLineCount());