mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
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:
@@ -9,9 +9,8 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/editorCommon';
|
||||
import { Model } from 'vs/editor/common/model/model';
|
||||
import { TextSource } from 'vs/editor/common/model/textSource';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
@@ -44,9 +43,9 @@ suite('ModelService', () => {
|
||||
assert.equal(model3.getOptions().defaultEOL, DefaultEndOfLine.LF);
|
||||
});
|
||||
|
||||
test('_computeEdits first line changed', function () {
|
||||
test('_computeEdits no change', function () {
|
||||
|
||||
const model = Model.createFromString(
|
||||
const model = TextModel.createFromString(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
@@ -55,7 +54,33 @@ suite('ModelService', () => {
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const textSource = TextSource.fromString(
|
||||
const textBuffer = createTextBuffer(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
'it is followed by #3', //20
|
||||
'and finished with the fourth.', //29
|
||||
].join('\n'),
|
||||
DefaultEndOfLine.LF
|
||||
);
|
||||
|
||||
const actual = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
|
||||
assert.deepEqual(actual, []);
|
||||
});
|
||||
|
||||
test('_computeEdits first line changed', function () {
|
||||
|
||||
const model = TextModel.createFromString(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
'it is followed by #3', //20
|
||||
'and finished with the fourth.', //29
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const textBuffer = createTextBuffer(
|
||||
[
|
||||
'This is line One', //16
|
||||
'and this is line number two', //27
|
||||
@@ -65,16 +90,16 @@ suite('ModelService', () => {
|
||||
DefaultEndOfLine.LF
|
||||
);
|
||||
|
||||
const actual = ModelServiceImpl._computeEdits(model, textSource);
|
||||
const actual = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
|
||||
assert.deepEqual(actual, [
|
||||
EditOperation.replace(new Range(1, 1, 1, 17), 'This is line One')
|
||||
EditOperation.replace(new Range(1, 1, 2, 1), 'This is line One\n')
|
||||
]);
|
||||
});
|
||||
|
||||
test('_computeEdits EOL changed', function () {
|
||||
|
||||
const model = Model.createFromString(
|
||||
const model = TextModel.createFromString(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
@@ -83,7 +108,7 @@ suite('ModelService', () => {
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const textSource = TextSource.fromString(
|
||||
const textBuffer = createTextBuffer(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
@@ -93,14 +118,14 @@ suite('ModelService', () => {
|
||||
DefaultEndOfLine.LF
|
||||
);
|
||||
|
||||
const actual = ModelServiceImpl._computeEdits(model, textSource);
|
||||
const actual = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
|
||||
assert.deepEqual(actual, []);
|
||||
});
|
||||
|
||||
test('_computeEdits EOL and other change 1', function () {
|
||||
|
||||
const model = Model.createFromString(
|
||||
const model = TextModel.createFromString(
|
||||
[
|
||||
'This is line one', //16
|
||||
'and this is line number two', //27
|
||||
@@ -109,7 +134,7 @@ suite('ModelService', () => {
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const textSource = TextSource.fromString(
|
||||
const textBuffer = createTextBuffer(
|
||||
[
|
||||
'This is line One', //16
|
||||
'and this is line number two', //27
|
||||
@@ -119,17 +144,24 @@ suite('ModelService', () => {
|
||||
DefaultEndOfLine.LF
|
||||
);
|
||||
|
||||
const actual = ModelServiceImpl._computeEdits(model, textSource);
|
||||
const actual = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
|
||||
assert.deepEqual(actual, [
|
||||
EditOperation.replace(new Range(1, 1, 1, 17), 'This is line One'),
|
||||
EditOperation.replace(new Range(3, 1, 3, 21), 'It is followed by #3')
|
||||
EditOperation.replace(
|
||||
new Range(1, 1, 4, 1),
|
||||
[
|
||||
'This is line One',
|
||||
'and this is line number two',
|
||||
'It is followed by #3',
|
||||
''
|
||||
].join('\r\n')
|
||||
)
|
||||
]);
|
||||
});
|
||||
|
||||
test('_computeEdits EOL and other change 2', function () {
|
||||
|
||||
const model = Model.createFromString(
|
||||
const model = TextModel.createFromString(
|
||||
[
|
||||
'package main', // 1
|
||||
'func foo() {', // 2
|
||||
@@ -137,7 +169,7 @@ suite('ModelService', () => {
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const textSource = TextSource.fromString(
|
||||
const textBuffer = createTextBuffer(
|
||||
[
|
||||
'package main', // 1
|
||||
'func foo() {', // 2
|
||||
@@ -147,10 +179,10 @@ suite('ModelService', () => {
|
||||
DefaultEndOfLine.LF
|
||||
);
|
||||
|
||||
const actual = ModelServiceImpl._computeEdits(model, textSource);
|
||||
const actual = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
|
||||
assert.deepEqual(actual, [
|
||||
EditOperation.replace(new Range(3, 2, 3, 2), '\n')
|
||||
EditOperation.replace(new Range(3, 2, 3, 2), '\r\n')
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -271,12 +303,12 @@ suite('ModelService', () => {
|
||||
});
|
||||
|
||||
function assertComputeEdits(lines1: string[], lines2: string[]): void {
|
||||
const model = Model.createFromString(lines1.join('\n'));
|
||||
const textSource = TextSource.fromString(lines2.join('\n'), DefaultEndOfLine.LF);
|
||||
const model = TextModel.createFromString(lines1.join('\n'));
|
||||
const textBuffer = createTextBuffer(lines2.join('\n'), DefaultEndOfLine.LF);
|
||||
|
||||
// compute required edits
|
||||
// let start = Date.now();
|
||||
const edits = ModelServiceImpl._computeEdits(model, textSource);
|
||||
const edits = ModelServiceImpl._computeEdits(model, textBuffer);
|
||||
// console.log(`took ${Date.now() - start} ms.`);
|
||||
|
||||
// apply edits
|
||||
@@ -330,4 +362,4 @@ assertComputeEdits(file1, file2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user