Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)

* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3

* Fix test build break

* Update distro

* Fix build errors

* Update distro

* Update REH build file

* Update build task names for REL

* Fix product build yaml

* Fix product REH task name

* Fix type in task name

* Update linux build step

* Update windows build tasks

* Turn off server publish

* Disable REH

* Fix typo

* Bump distro

* Update vscode tests

* Bump distro

* Fix type in disto

* Bump distro

* Turn off docker build

* Remove docker step from release

Co-authored-by: ADS Merger <andresse@microsoft.com>
Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
Christopher Suh
2020-10-03 14:42:05 -04:00
committed by GitHub
parent 58d02b76db
commit 6ff1e3866b
687 changed files with 10507 additions and 9104 deletions

View File

@@ -1011,6 +1011,29 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
});
test('What\'s the condition for DocumentLink target to be undefined? #106308', async function () {
disposables.push(extHost.registerDocumentLinkProvider(nullExtensionDescription, defaultSelector, <vscode.DocumentLinkProvider>{
provideDocumentLinks(): any {
return [new types.DocumentLink(new types.Range(0, 0, 0, 20), undefined)];
},
resolveDocumentLink(link) {
link.target = URI.parse('foo:bar');
return link;
}
}));
await rpcProtocol.sync();
const links1 = await commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri);
assert.equal(links1.length, 1);
assert.equal(links1[0].target, undefined);
const links2 = await commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri, 1000);
assert.equal(links2.length, 1);
assert.equal(links2[0].target!.toString(), URI.parse('foo:bar').toString());
});
test('Color provider', function () {

View File

@@ -4,26 +4,26 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
import { MainContext, MainThreadTextEditorsShape, IWorkspaceEditDto, WorkspaceEditType } from 'vs/workbench/api/common/extHost.protocol';
import { MainContext, IWorkspaceEditDto, WorkspaceEditType, MainThreadBulkEditsShape } from 'vs/workbench/api/common/extHost.protocol';
import { URI } from 'vs/base/common/uri';
import { mock } from 'vs/base/test/common/mock';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { SingleProxyRPCProtocol, TestRPCProtocol } from 'vs/workbench/test/browser/api/testRPCProtocol';
import { ExtHostEditors } from 'vs/workbench/api/common/extHostTextEditors';
import { NullLogService } from 'vs/platform/log/common/log';
import { assertType } from 'vs/base/common/types';
import { ExtHostBulkEdits } from 'vs/workbench/api/common/extHostBulkEdits';
suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
suite('ExtHostBulkEdits.applyWorkspaceEdit', () => {
const resource = URI.parse('foo:bar');
let editors: ExtHostEditors;
let bulkEdits: ExtHostBulkEdits;
let workspaceResourceEdits: IWorkspaceEditDto;
setup(() => {
workspaceResourceEdits = null!;
let rpcProtocol = new TestRPCProtocol();
rpcProtocol.set(MainContext.MainThreadTextEditors, new class extends mock<MainThreadTextEditorsShape>() {
rpcProtocol.set(MainContext.MainThreadBulkEdits, new class extends mock<MainThreadBulkEditsShape>() {
$tryApplyWorkspaceEdit(_workspaceResourceEdits: IWorkspaceEditDto): Promise<boolean> {
workspaceResourceEdits = _workspaceResourceEdits;
return Promise.resolve(true);
@@ -40,23 +40,13 @@ suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
EOL: '\n',
}]
});
editors = new ExtHostEditors(rpcProtocol, documentsAndEditors, null!);
});
test('uses version id if document available', async () => {
let edit = new extHostTypes.WorkspaceEdit();
edit.replace(resource, new extHostTypes.Range(0, 0, 0, 0), 'hello');
await editors.applyWorkspaceEdit(edit);
assert.equal(workspaceResourceEdits.edits.length, 1);
const [first] = workspaceResourceEdits.edits;
assertType(first._type === WorkspaceEditType.Text);
assert.equal(first.modelVersionId, 1337);
bulkEdits = new ExtHostBulkEdits(rpcProtocol, documentsAndEditors, null!);
});
test('does not use version id if document is not available', async () => {
let edit = new extHostTypes.WorkspaceEdit();
edit.replace(URI.parse('foo:bar2'), new extHostTypes.Range(0, 0, 0, 0), 'hello');
await editors.applyWorkspaceEdit(edit);
await bulkEdits.applyWorkspaceEdit(edit);
assert.equal(workspaceResourceEdits.edits.length, 1);
const [first] = workspaceResourceEdits.edits;
assertType(first._type === WorkspaceEditType.Text);

View File

@@ -14,7 +14,6 @@ import { mock } from 'vs/base/test/common/mock';
import { IWorkspaceFolder, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { ConfigurationTarget, IConfigurationModel, IConfigurationChange } from 'vs/platform/configuration/common/configuration';
import { NullLogService } from 'vs/platform/log/common/log';
import { assign } from 'vs/base/common/objects';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
suite('ExtHostConfiguration', function () {
@@ -211,20 +210,22 @@ suite('ExtHostConfiguration', function () {
}), JSON.stringify(actual));
actual = all.getConfiguration('workbench').get('emptyobjectkey');
actual = assign(actual || {}, {
actual = {
...(actual || {}),
'statusBar.background': `#0ff`,
'statusBar.foreground': `#ff0`,
});
};
assert.deepEqual(JSON.stringify({
'statusBar.background': `#0ff`,
'statusBar.foreground': `#ff0`,
}), JSON.stringify(actual));
actual = all.getConfiguration('workbench').get('unknownkey');
actual = assign(actual || {}, {
actual = {
...(actual || {}),
'statusBar.background': `#0ff`,
'statusBar.foreground': `#ff0`,
});
};
assert.deepEqual(JSON.stringify({
'statusBar.background': `#0ff`,
'statusBar.foreground': `#ff0`,

View File

@@ -7,7 +7,7 @@ import { URI } from 'vs/base/common/uri';
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { TextDocumentSaveReason, TextEdit, Position, EndOfLine } from 'vs/workbench/api/common/extHostTypes';
import { MainThreadTextEditorsShape, IWorkspaceEditDto, IWorkspaceTextEditDto } from 'vs/workbench/api/common/extHost.protocol';
import { MainThreadTextEditorsShape, IWorkspaceEditDto, IWorkspaceTextEditDto, MainThreadBulkEditsShape } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostDocumentSaveParticipant } from 'vs/workbench/api/common/extHostDocumentSaveParticipant';
import { SingleProxyRPCProtocol } from './testRPCProtocol';
import { SaveReason } from 'vs/workbench/common/editor';
@@ -20,7 +20,7 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
suite('ExtHostDocumentSaveParticipant', () => {
let resource = URI.parse('foo:bar');
let mainThreadEditors = new class extends mock<MainThreadTextEditorsShape>() { };
let mainThreadBulkEdits = new class extends mock<MainThreadBulkEditsShape>() { };
let documents: ExtHostDocuments;
let nullLogService = new NullLogService();
let nullExtensionDescription: IExtensionDescription = {
@@ -51,12 +51,12 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('no listeners, no problem', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(() => assert.ok(true));
});
test('event delivery', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let event: vscode.TextDocumentWillSaveEvent;
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
@@ -73,7 +73,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, immutable', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let event: vscode.TextDocumentWillSaveEvent;
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
@@ -89,7 +89,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, bad listener', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
throw new Error('💀');
@@ -104,7 +104,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, bad listener doesn\'t prevent more events', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
throw new Error('💀');
@@ -123,7 +123,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, in subscriber order', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let counter = 0;
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
@@ -141,7 +141,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, ignore bad listeners', async () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors, { timeout: 5, errors: 1 });
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 5, errors: 1 });
let callCount = 0;
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
@@ -159,7 +159,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, overall timeout', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors, { timeout: 20, errors: 5 });
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 20, errors: 5 });
let callCount = 0;
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
@@ -187,7 +187,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, waitUntil', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
@@ -203,11 +203,11 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, waitUntil must be called sync', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
event.waitUntil(new Promise((resolve, reject) => {
event.waitUntil(new Promise<undefined>((resolve, reject) => {
setTimeout(() => {
try {
assert.throws(() => event.waitUntil(timeout(10)));
@@ -226,7 +226,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, waitUntil will timeout', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors, { timeout: 5, errors: 3 });
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 5, errors: 3 });
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
event.waitUntil(timeout(15));
@@ -241,7 +241,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
});
test('event delivery, waitUntil failure handling', () => {
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadEditors);
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
e.waitUntil(Promise.reject(new Error('dddd')));
@@ -380,7 +380,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
error(message: string | Error, ...args: any[]): void {
didLogSomething = true;
}
}, documents, mainThreadEditors);
}, documents, mainThreadBulkEdits);
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {

View File

@@ -22,7 +22,7 @@ import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { getDocumentSymbols } from 'vs/editor/contrib/gotoSymbol/documentSymbols';
import * as modes from 'vs/editor/common/modes';
import { getCodeLensData } from 'vs/editor/contrib/codelens/codelens';
import { getCodeLensModel } from 'vs/editor/contrib/codelens/codelens';
import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition, getDeclarationsAtPosition, getReferencesAtPosition } from 'vs/editor/contrib/gotoSymbol/goToSymbol';
import { getHover } from 'vs/editor/contrib/hover/getHover';
import { getOccurrencesAtPosition } from 'vs/editor/contrib/wordHighlighter/wordHighlighter';
@@ -189,7 +189,7 @@ suite('ExtHostLanguageFeatures', function () {
}));
await rpcProtocol.sync();
const value = await getCodeLensData(model, CancellationToken.None);
const value = await getCodeLensModel(model, CancellationToken.None);
assert.equal(value.lenses.length, 1);
});
@@ -207,7 +207,7 @@ suite('ExtHostLanguageFeatures', function () {
}));
await rpcProtocol.sync();
const value = await getCodeLensData(model, CancellationToken.None);
const value = await getCodeLensModel(model, CancellationToken.None);
assert.equal(value.lenses.length, 1);
const [data] = value.lenses;
const symbol = await Promise.resolve(data.provider.resolveCodeLens!(model, data.symbol, CancellationToken.None));
@@ -224,7 +224,7 @@ suite('ExtHostLanguageFeatures', function () {
}));
await rpcProtocol.sync();
const value = await getCodeLensData(model, CancellationToken.None);
const value = await getCodeLensModel(model, CancellationToken.None);
assert.equal(value.lenses.length, 1);
let [data] = value.lenses;
const symbol = await Promise.resolve(data.provider.resolveCodeLens!(model, data.symbol, CancellationToken.None));

View File

@@ -11,7 +11,8 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
import { NullLogService } from 'vs/platform/log/common/log';
import { mock } from 'vs/base/test/common/mock';
import { IModelAddedData, MainContext, MainThreadCommandsShape, MainThreadNotebookShape } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostNotebookDocument, ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { ExtHostNotebookDocument } from 'vs/workbench/api/common/extHostNotebookDocument';
import { CellKind, CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { URI } from 'vs/base/common/uri';
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
@@ -56,7 +57,6 @@ suite('NotebookCell#Document', function () {
});
extHostNotebooks.$acceptDocumentAndEditorsDelta({
addedDocuments: [{
handle: 0,
uri: notebookUri,
viewType: 'test',
versionId: 0,
@@ -135,7 +135,7 @@ suite('NotebookCell#Document', function () {
test('cell document is vscode.TextDocument after changing it', async function () {
const p = new Promise((resolve, reject) => {
const p = new Promise<void>((resolve, reject) => {
extHostNotebooks.onDidChangeNotebookCells(e => {
try {
assert.strictEqual(e.changes.length, 1);
@@ -160,25 +160,29 @@ suite('NotebookCell#Document', function () {
});
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 2,
uri: CellUri.generate(notebookUri, 2),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 3,
uri: CellUri.generate(notebookUri, 3),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 2,
uri: CellUri.generate(notebookUri, 2),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 3,
uri: CellUri.generate(notebookUri, 3),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
await p;
@@ -232,9 +236,13 @@ suite('NotebookCell#Document', function () {
const [cell1, cell2] = notebook.notebookDocument.cells;
extHostNotebooks.$acceptModelChanged(notebook.uri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: 2,
changes: [[0, 1, []]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 1, []]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1);
@@ -249,4 +257,51 @@ suite('NotebookCell#Document', function () {
assert.equal(cells.document.notebook === notebook.notebookDocument, true);
}
});
test('cell#index', function () {
assert.equal(notebook.notebookDocument.cells.length, 2);
const [first, second] = notebook.notebookDocument.cells;
assert.equal(first.index, 0);
assert.equal(second.index, 1);
// remove first cell
extHostNotebooks.$acceptModelChanged(notebook.uri, {
versionId: notebook.notebookDocument.version + 1,
rawEvents: [{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 1, []]]
}]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1);
assert.equal(second.index, 0);
extHostNotebooks.$acceptModelChanged(notebookUri, {
versionId: notebook.notebookDocument.version + 1,
rawEvents: [{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 2,
uri: CellUri.generate(notebookUri, 2),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 3,
uri: CellUri.generate(notebookUri, 3),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 3);
assert.equal(second.index, 2);
});
});

View File

@@ -9,7 +9,8 @@ import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { NullLogService } from 'vs/platform/log/common/log';
import { ExtHostNotebookConcatDocument } from 'vs/workbench/api/common/extHostNotebookConcatDocument';
import { ExtHostNotebookDocument, ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { ExtHostNotebookDocument } from 'vs/workbench/api/common/extHostNotebookDocument';
import { URI } from 'vs/base/common/uri';
import { CellKind, CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { Position, Location, Range } from 'vs/workbench/api/common/extHostTypes';
@@ -56,7 +57,6 @@ suite('NotebookConcatDocument', function () {
});
extHostNotebooks.$acceptDocumentAndEditorsDelta({
addedDocuments: [{
handle: 0,
uri: notebookUri,
viewType: 'test',
cells: [{
@@ -125,25 +125,28 @@ suite('NotebookConcatDocument', function () {
const cellUri2 = CellUri.generate(notebook.uri, 2);
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: cellUri1,
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: cellUri2,
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: cellUri1,
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: cellUri2,
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]
]
}]
}, false);
@@ -159,25 +162,29 @@ suite('NotebookConcatDocument', function () {
test('location, position mapping', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
@@ -200,17 +207,21 @@ suite('NotebookConcatDocument', function () {
// UPDATE 1
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 1);
assert.equal(doc.version, 1);
@@ -223,17 +234,21 @@ suite('NotebookConcatDocument', function () {
// UPDATE 2
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[1, 0, [{
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[1, 0, [{
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2);
@@ -247,9 +262,13 @@ suite('NotebookConcatDocument', function () {
// UPDATE 3 (remove cell #2 again)
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[1, 1, []]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[1, 1, []]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 1);
assert.equal(doc.version, 3);
@@ -265,25 +284,30 @@ suite('NotebookConcatDocument', function () {
// UPDATE 1
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2);
assert.equal(doc.version, 1);
@@ -319,25 +343,29 @@ suite('NotebookConcatDocument', function () {
test('selector', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['fooLang-document'],
eol: '\n',
language: 'fooLang',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['barLang-document'],
eol: '\n',
language: 'barLang',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['fooLang-document'],
eol: '\n',
language: 'fooLang',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['barLang-document'],
eol: '\n',
language: 'barLang',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
const mixedDoc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
@@ -349,17 +377,21 @@ suite('NotebookConcatDocument', function () {
assertLines(barLangDoc, 'barLang-document');
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[2, 0, [{
handle: 3,
uri: CellUri.generate(notebook.uri, 3),
source: ['barLang-document2'],
eol: '\n',
language: 'barLang',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[2, 0, [{
handle: 3,
uri: CellUri.generate(notebook.uri, 3),
source: ['barLang-document2'],
eol: '\n',
language: 'barLang',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assertLines(mixedDoc, 'fooLang-document', 'barLang-document', 'barLang-document2');
@@ -383,25 +415,29 @@ suite('NotebookConcatDocument', function () {
test('offsetAt(position) <-> positionAt(offset)', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
@@ -436,25 +472,29 @@ suite('NotebookConcatDocument', function () {
test('locationAt(position) <-> positionAt(location)', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
@@ -473,25 +513,29 @@ suite('NotebookConcatDocument', function () {
test('getText(range)', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
@@ -507,25 +551,29 @@ suite('NotebookConcatDocument', function () {
test('validateRange/Position', function () {
extHostNotebooks.$acceptModelChanged(notebookUri, {
kind: NotebookCellsChangeType.ModelChange,
versionId: notebook.notebookDocument.version + 1,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
rawEvents: [
{
kind: NotebookCellsChangeType.ModelChange,
changes: [[0, 0, [{
handle: 1,
uri: CellUri.generate(notebook.uri, 1),
source: ['Hello', 'World', 'Hello World!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}, {
handle: 2,
uri: CellUri.generate(notebook.uri, 2),
source: ['Hallo', 'Welt', 'Hallo Welt!'],
eol: '\n',
language: 'test',
cellKind: CellKind.Code,
outputs: [],
}]]]
}
]
}, false);
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code

View File

@@ -84,7 +84,6 @@ suite('ExtHostTextEditorOptions', () => {
$tryRevealRange: undefined!,
$trySetSelections: undefined!,
$tryApplyEdits: undefined!,
$tryApplyWorkspaceEdit: undefined!,
$tryInsertSnippet: undefined!,
$getDiffInformation: undefined!
};

View File

@@ -248,7 +248,7 @@ suite.skip('ExtHostTreeView', function () {
});
async function runWithEventMerging(action: (resolve: () => void) => void) {
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
let subscription: IDisposable | undefined = undefined;
subscription = target.onRefresh.event(() => {
subscription!.dispose();
@@ -256,7 +256,7 @@ suite.skip('ExtHostTreeView', function () {
});
onDidChangeTreeNode.fire(getNode('b'));
});
await new Promise(action);
await new Promise<void>(action);
}
test('refresh parent and child node trigger refresh only on parent - scenario 1', async () => {

View File

@@ -35,7 +35,7 @@ suite('MainThreadDocumentContentProviders', function () {
},
);
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
let expectedEvents = 1;
model.onDidChangeContent(e => {
expectedEvents -= 1;

View File

@@ -13,7 +13,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import { ExtHostDocumentsAndEditorsShape, IDocumentsAndEditorsDelta } from 'vs/workbench/api/common/extHost.protocol';
import { createTestCodeEditor, ITestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { mock } from 'vs/base/test/common/mock';
import { TestEditorService, TestEditorGroupsService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestEditorService, TestEditorGroupsService, TestEnvironmentService, TestPathService } from 'vs/workbench/test/browser/workbenchTestServices';
import { Event } from 'vs/base/common/event';
import { ITextModel } from 'vs/editor/common/model';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
@@ -99,7 +99,8 @@ suite('MainThreadDocumentsAndEditors', () => {
readText() {
return Promise.resolve('clipboard_contents');
}
}
},
new TestPathService()
);
});