Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2 (#9253)

* Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2

* skip failing tests

* remove github-authentication extensions

* ignore github compile steps

* ignore github compile steps

* check in compiled files
This commit is contained in:
Anthony Dresser
2020-02-21 12:11:51 -08:00
committed by GitHub
parent c74bac3746
commit 1b78a9b1e0
179 changed files with 3200 additions and 1830 deletions

View File

@@ -1240,22 +1240,22 @@ suite('Editor Controller - Regression tests', () => {
CoreEditingCommands.DeleteLeft.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), 'x', 'assert9');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\nx', 'assert10');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\t\nx', 'assert11');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\t\n\tx', 'assert12');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\t\nx', 'assert13');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\nx', 'assert14');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), 'x', 'assert15');
});
@@ -1263,12 +1263,12 @@ suite('Editor Controller - Regression tests', () => {
});
test('issue #23539: Setting model EOL isn\'t undoable', () => {
usingCursor({
text: [
'Hello',
'world'
]
}, (model, cursor) => {
withTestCodeEditor([
'Hello',
'world'
], {}, (editor, cursor) => {
const model = editor.getModel()!;
assertCursor(cursor, new Position(1, 1));
model.setEOL(EndOfLineSequence.LF);
assert.equal(model.getValue(), 'Hello\nworld');
@@ -1276,7 +1276,7 @@ suite('Editor Controller - Regression tests', () => {
model.pushEOL(EndOfLineSequence.CRLF);
assert.equal(model.getValue(), 'Hello\r\nworld');
cursorCommand(cursor, H.Undo);
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(), 'Hello\nworld');
});
});
@@ -1301,7 +1301,7 @@ suite('Editor Controller - Regression tests', () => {
cursorCommand(cursor, H.Type, { text: '%' }, 'keyboard');
assert.equal(model.getValue(EndOfLinePreference.LF), '%\'%👁\'', 'assert1');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\'👁\'', 'assert2');
});
@@ -1327,39 +1327,39 @@ suite('Editor Controller - Regression tests', () => {
assert.equal(model.getLineContent(1), 'Hello world');
assertCursor(cursor, new Position(1, 12));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world ');
assertCursor(cursor, new Position(1, 13));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world');
assertCursor(cursor, new Position(1, 12));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello');
assertCursor(cursor, new Position(1, 6));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), '');
assertCursor(cursor, new Position(1, 1));
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello');
assertCursor(cursor, new Position(1, 6));
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world');
assertCursor(cursor, new Position(1, 12));
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world ');
assertCursor(cursor, new Position(1, 13));
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world');
assertCursor(cursor, new Position(1, 12));
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'Hello world');
assertCursor(cursor, new Position(1, 12));
});
@@ -1735,21 +1735,21 @@ suite('Editor Controller - Regression tests', () => {
'\t just some text'
].join('\n'), '001');
cursorCommand(cursor, H.Undo);
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(), [
' some lines',
' and more lines',
' just some text',
].join('\n'), '002');
cursorCommand(cursor, H.Undo);
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(), [
'some lines',
'and more lines',
'just some text',
].join('\n'), '003');
cursorCommand(cursor, H.Undo);
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(), [
'some lines',
'and more lines',
@@ -1935,10 +1935,8 @@ suite('Editor Controller - Regression tests', () => {
});
test('issue #9675: Undo/Redo adds a stop in between CHN Characters', () => {
usingCursor({
text: [
]
}, (model, cursor) => {
withTestCodeEditor([], {}, (editor, cursor) => {
const model = editor.getModel()!;
assertCursor(cursor, new Position(1, 1));
// Typing sennsei in Japanese - Hiragana
@@ -1957,7 +1955,7 @@ suite('Editor Controller - Regression tests', () => {
assert.equal(model.getLineContent(1), 'せんせい');
assertCursor(cursor, new Position(1, 5));
cursorCommand(cursor, H.Undo);
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), '');
assertCursor(cursor, new Position(1, 1));
});
@@ -2138,7 +2136,7 @@ suite('Editor Controller - Regression tests', () => {
}], () => [new Selection(1, 1, 1, 1)]);
assert.equal(model.getValue(EndOfLinePreference.LF), 'Hello world!');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), 'Hello world!');
});
@@ -2229,12 +2227,12 @@ suite('Editor Controller - Regression tests', () => {
new Selection(1, 5, 1, 5),
]);
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assertCursor(cursor, [
new Selection(1, 4, 1, 4),
]);
cursorCommand(cursor, H.Redo, null, 'keyboard');
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assertCursor(cursor, [
new Selection(1, 5, 1, 5),
]);
@@ -2263,7 +2261,7 @@ suite('Editor Controller - Regression tests', () => {
new Selection(1, 1, 1, 1),
]);
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assertCursor(cursor, [
new Selection(1, 1, 1, 1),
]);
@@ -2378,49 +2376,49 @@ suite('Editor Controller - Cursor Configuration', () => {
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 1) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), ' My Second Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 2
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 2) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'M y Second Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 3
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 3) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'My Second Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 4
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 4) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'My Second Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 5
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 5) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'My S econd Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 5
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 5) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'My S econd Line123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 13
assert.equal(model.getLineContent(2), 'My Second Line123');
CoreNavigationCommands.MoveTo.runCoreEditorCommand(cursor, { position: new Position(2, 13) });
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'My Second Li ne123');
cursorCommand(cursor, H.Undo, null, 'keyboard');
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
// Tab on column 14
assert.equal(model.getLineContent(2), 'My Second Line123');
@@ -2774,7 +2772,7 @@ suite('Editor Controller - Cursor Configuration', () => {
assert.equal(model.getLineContent(2), 'a ');
// Undo DeleteLeft - get us back to original indentation
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), ' a ');
// Nothing is broken when cursor is in (1,1)
@@ -2859,22 +2857,22 @@ suite('Editor Controller - Cursor Configuration', () => {
CoreEditingCommands.DeleteLeft.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), 'x', 'assert10');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\nx', 'assert11');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\ty\nx', 'assert12');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\ty\n\tx', 'assert13');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\n\ty\nx', 'assert14');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), '\nx', 'assert15');
cursorCommand(cursor, H.Redo, {});
CoreEditingCommands.Redo.runEditorCommand(null, editor, null);
assert.equal(model.getValue(EndOfLinePreference.LF), 'x', 'assert16');
});
@@ -2895,7 +2893,7 @@ suite('Editor Controller - Cursor Configuration', () => {
const beforeVersion = model.getVersionId();
const beforeAltVersion = model.getAlternativeVersionId();
cursorCommand(cursor, H.Type, { text: 'Hello' }, 'keyboard');
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
const afterVersion = model.getVersionId();
const afterAltVersion = model.getAlternativeVersionId();
@@ -4263,7 +4261,7 @@ suite('autoClosingPairs', () => {
moveTo(cursor, lineNumber, column);
cursorCommand(cursor, H.Type, { text: chr }, 'keyboard');
assert.deepEqual(model.getLineContent(lineNumber), expected, message);
cursorCommand(cursor, H.Undo);
model.undo();
}
test('open parens: default', () => {
@@ -5347,11 +5345,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(1), 'A fir line');
assertCursor(cursor, new Selection(1, 6, 1, 6));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A first line');
assertCursor(cursor, new Selection(1, 8, 1, 8));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A line');
assertCursor(cursor, new Selection(1, 3, 1, 3));
});
@@ -5376,11 +5374,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(1), 'A firstine');
assertCursor(cursor, new Selection(1, 8, 1, 8));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A first line');
assertCursor(cursor, new Selection(1, 8, 1, 8));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A line');
assertCursor(cursor, new Selection(1, 3, 1, 3));
});
@@ -5410,11 +5408,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(2), 'Second line');
assertCursor(cursor, new Selection(2, 7, 2, 7));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), ' line');
assertCursor(cursor, new Selection(2, 1, 2, 1));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another line');
assertCursor(cursor, new Selection(2, 8, 2, 8));
});
@@ -5448,11 +5446,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(2), '');
assertCursor(cursor, new Selection(2, 1, 2, 1));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), ' line');
assertCursor(cursor, new Selection(2, 1, 2, 1));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another line');
assertCursor(cursor, new Selection(2, 8, 2, 8));
});
@@ -5479,11 +5477,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(2), 'Another text');
assertCursor(cursor, new Selection(2, 13, 2, 13));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another ');
assertCursor(cursor, new Selection(2, 9, 2, 9));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another line');
assertCursor(cursor, new Selection(2, 9, 2, 9));
});
@@ -5515,11 +5513,11 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(2), 'An');
assertCursor(cursor, new Selection(2, 3, 2, 3));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another ');
assertCursor(cursor, new Selection(2, 9, 2, 9));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(2), 'Another line');
assertCursor(cursor, new Selection(2, 9, 2, 9));
});
@@ -5539,15 +5537,15 @@ suite('Undo stops', () => {
assert.equal(model.getLineContent(1), 'A first and interesting line');
assertCursor(cursor, new Selection(1, 24, 1, 24));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A first and line');
assertCursor(cursor, new Selection(1, 12, 1, 12));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A first line');
assertCursor(cursor, new Selection(1, 8, 1, 8));
cursorCommand(cursor, H.Undo, {});
CoreEditingCommands.Undo.runEditorCommand(null, editor, null);
assert.equal(model.getLineContent(1), 'A line');
assertCursor(cursor, new Selection(1, 3, 1, 3));
});

View File

@@ -84,6 +84,7 @@ export function withTestCodeEditor(text: string | string[] | null, options: Test
}
let editor = <TestCodeEditor>createTestCodeEditor(options);
editor.getCursor()!.setHasFocus(true);
callback(editor, editor.getCursor()!);
editor.dispose();

View File

@@ -12,7 +12,7 @@ import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvent
import { assertSyncedModels, testApplyEditsWithSyncedModels } from 'vs/editor/test/common/model/editableTextModelTestUtils';
function createEditableTextModelFromString(text: string): TextModel {
return new TextModel(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
return TextModel.createFromString(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
}
suite('EditorModel - EditableTextModel.applyEdits updates mightContainRTL', () => {

View File

@@ -88,7 +88,7 @@ function assertLineMapping(model: TextModel, msg: string): void {
export function assertSyncedModels(text: string, callback: (model: TextModel, assertMirrorModels: () => void) => void, setup: ((model: TextModel) => void) | null = null): void {
let model = new TextModel(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
let model = TextModel.createFromString(text, TextModel.DEFAULT_CREATION_OPTIONS, null);
model.setEOL(EndOfLineSequence.LF);
assertLineMapping(model, 'model');

View File

@@ -106,7 +106,7 @@ suite('ModelLinesTokens', () => {
function testApplyEdits(initial: IBufferLineState[], edits: IEdit[], expected: IBufferLineState[]): void {
const initialText = initial.map(el => el.text).join('\n');
const model = new TextModel(initialText, TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
const model = TextModel.createFromString(initialText, TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
for (let lineIndex = 0; lineIndex < initial.length; lineIndex++) {
const lineTokens = initial[lineIndex].tokens;
const lineTextLength = model.getLineMaxColumn(lineIndex + 1) - 1;
@@ -442,7 +442,7 @@ suite('ModelLinesTokens', () => {
}
test('insertion on empty line', () => {
const model = new TextModel('some text', TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
const model = TextModel.createFromString('some text', TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
const tokens = TestToken.toTokens([new TestToken(0, 1)]);
LineTokens.convertToEndOffset(tokens, model.getLineMaxColumn(1) - 1);
model.setLineTokens(1, tokens);

View File

@@ -72,7 +72,7 @@ suite('TextModelWithTokens', () => {
brackets: brackets
});
let model = new TextModel(
let model = TextModel.createFromString(
contents.join('\n'),
TextModel.DEFAULT_CREATION_OPTIONS,
languageIdentifier

View File

@@ -18,6 +18,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
import { NullLogService } from 'vs/platform/log/common/log';
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
const GENERATE_TESTS = false;
@@ -29,7 +30,7 @@ suite('ModelService', () => {
configService.setUserConfiguration('files', { 'eol': '\n' });
configService.setUserConfiguration('files', { 'eol': '\r\n' }, URI.file(platform.isWindows ? 'c:\\myroot' : '/myroot'));
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService());
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService(), new UndoRedoService());
});
teardown(() => {

View File

@@ -80,7 +80,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
outerWidth: input.outerWidth,
outerHeight: input.outerHeight,
lineHeight: input.lineHeight,
maxLineNumber: input.maxLineNumber || Math.pow(10, input.lineNumbersDigitCount) - 1,
viewLineCount: input.maxLineNumber || Math.pow(10, input.lineNumbersDigitCount) - 1,
lineNumbersDigitCount: input.lineNumbersDigitCount,
typicalHalfwidthCharacterWidth: input.typicalHalfwidthCharacterWidth,
maxDigitWidth: input.maxDigitWidth,