mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
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:
@@ -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 () {
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -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`,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -84,7 +84,6 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
$tryRevealRange: undefined!,
|
||||
$trySetSelections: undefined!,
|
||||
$tryApplyEdits: undefined!,
|
||||
$tryApplyWorkspaceEdit: undefined!,
|
||||
$tryInsertSnippet: undefined!,
|
||||
$getDiffInformation: undefined!
|
||||
};
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IQuickAccessRegistry, Extensions, IQuickAccessProvider, QuickAccessRegistry } from 'vs/platform/quickinput/common/quickAccess';
|
||||
import { IQuickPick, IQuickPickItem, IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TestServiceAccessor, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { DisposableStore, toDisposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { PickerQuickAccessProvider, FastAndSlowPicks } from 'vs/platform/quickinput/browser/pickerQuickAccess';
|
||||
|
||||
suite('QuickAccess', () => {
|
||||
|
||||
let instantiationService: IInstantiationService;
|
||||
let accessor: TestServiceAccessor;
|
||||
|
||||
let providerDefaultCalled = false;
|
||||
let providerDefaultCanceled = false;
|
||||
let providerDefaultDisposed = false;
|
||||
|
||||
let provider1Called = false;
|
||||
let provider1Canceled = false;
|
||||
let provider1Disposed = false;
|
||||
|
||||
let provider2Called = false;
|
||||
let provider2Canceled = false;
|
||||
let provider2Disposed = false;
|
||||
|
||||
let provider3Called = false;
|
||||
let provider3Canceled = false;
|
||||
let provider3Disposed = false;
|
||||
|
||||
class TestProviderDefault implements IQuickAccessProvider {
|
||||
|
||||
constructor(@IQuickInputService private readonly quickInputService: IQuickInputService, disposables: DisposableStore) { }
|
||||
|
||||
provide(picker: IQuickPick<IQuickPickItem>, token: CancellationToken): IDisposable {
|
||||
assert.ok(picker);
|
||||
providerDefaultCalled = true;
|
||||
token.onCancellationRequested(() => providerDefaultCanceled = true);
|
||||
|
||||
// bring up provider #3
|
||||
setTimeout(() => this.quickInputService.quickAccess.show(providerDescriptor3.prefix));
|
||||
|
||||
return toDisposable(() => providerDefaultDisposed = true);
|
||||
}
|
||||
}
|
||||
|
||||
class TestProvider1 implements IQuickAccessProvider {
|
||||
provide(picker: IQuickPick<IQuickPickItem>, token: CancellationToken): IDisposable {
|
||||
assert.ok(picker);
|
||||
provider1Called = true;
|
||||
token.onCancellationRequested(() => provider1Canceled = true);
|
||||
|
||||
return toDisposable(() => provider1Disposed = true);
|
||||
}
|
||||
}
|
||||
|
||||
class TestProvider2 implements IQuickAccessProvider {
|
||||
provide(picker: IQuickPick<IQuickPickItem>, token: CancellationToken): IDisposable {
|
||||
assert.ok(picker);
|
||||
provider2Called = true;
|
||||
token.onCancellationRequested(() => provider2Canceled = true);
|
||||
|
||||
return toDisposable(() => provider2Disposed = true);
|
||||
}
|
||||
}
|
||||
|
||||
class TestProvider3 implements IQuickAccessProvider {
|
||||
provide(picker: IQuickPick<IQuickPickItem>, token: CancellationToken): IDisposable {
|
||||
assert.ok(picker);
|
||||
provider3Called = true;
|
||||
token.onCancellationRequested(() => provider3Canceled = true);
|
||||
|
||||
// hide without picking
|
||||
setTimeout(() => picker.hide());
|
||||
|
||||
return toDisposable(() => provider3Disposed = true);
|
||||
}
|
||||
}
|
||||
|
||||
const providerDescriptorDefault = { ctor: TestProviderDefault, prefix: '', helpEntries: [] };
|
||||
const providerDescriptor1 = { ctor: TestProvider1, prefix: 'test', helpEntries: [] };
|
||||
const providerDescriptor2 = { ctor: TestProvider2, prefix: 'test something', helpEntries: [] };
|
||||
const providerDescriptor3 = { ctor: TestProvider3, prefix: 'changed', helpEntries: [] };
|
||||
|
||||
setup(() => {
|
||||
instantiationService = workbenchInstantiationService();
|
||||
accessor = instantiationService.createInstance(TestServiceAccessor);
|
||||
});
|
||||
|
||||
test('registry', () => {
|
||||
const registry = (Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess));
|
||||
const restore = (registry as QuickAccessRegistry).clear();
|
||||
|
||||
assert.ok(!registry.getQuickAccessProvider('test'));
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
disposables.add(registry.registerQuickAccessProvider(providerDescriptorDefault));
|
||||
assert(registry.getQuickAccessProvider('') === providerDescriptorDefault);
|
||||
assert(registry.getQuickAccessProvider('test') === providerDescriptorDefault);
|
||||
|
||||
const disposable = disposables.add(registry.registerQuickAccessProvider(providerDescriptor1));
|
||||
assert(registry.getQuickAccessProvider('test') === providerDescriptor1);
|
||||
|
||||
const providers = registry.getQuickAccessProviders();
|
||||
assert(providers.some(provider => provider.prefix === 'test'));
|
||||
|
||||
disposable.dispose();
|
||||
assert(registry.getQuickAccessProvider('test') === providerDescriptorDefault);
|
||||
|
||||
disposables.dispose();
|
||||
assert.ok(!registry.getQuickAccessProvider('test'));
|
||||
|
||||
restore();
|
||||
});
|
||||
|
||||
test('provider', async () => {
|
||||
const registry = (Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess));
|
||||
const restore = (registry as QuickAccessRegistry).clear();
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
disposables.add(registry.registerQuickAccessProvider(providerDescriptorDefault));
|
||||
disposables.add(registry.registerQuickAccessProvider(providerDescriptor1));
|
||||
disposables.add(registry.registerQuickAccessProvider(providerDescriptor2));
|
||||
disposables.add(registry.registerQuickAccessProvider(providerDescriptor3));
|
||||
|
||||
accessor.quickInputService.quickAccess.show('test');
|
||||
assert.equal(providerDefaultCalled, false);
|
||||
assert.equal(provider1Called, true);
|
||||
assert.equal(provider2Called, false);
|
||||
assert.equal(provider3Called, false);
|
||||
assert.equal(providerDefaultCanceled, false);
|
||||
assert.equal(provider1Canceled, false);
|
||||
assert.equal(provider2Canceled, false);
|
||||
assert.equal(provider3Canceled, false);
|
||||
assert.equal(providerDefaultDisposed, false);
|
||||
assert.equal(provider1Disposed, false);
|
||||
assert.equal(provider2Disposed, false);
|
||||
assert.equal(provider3Disposed, false);
|
||||
provider1Called = false;
|
||||
|
||||
accessor.quickInputService.quickAccess.show('test something');
|
||||
assert.equal(providerDefaultCalled, false);
|
||||
assert.equal(provider1Called, false);
|
||||
assert.equal(provider2Called, true);
|
||||
assert.equal(provider3Called, false);
|
||||
assert.equal(providerDefaultCanceled, false);
|
||||
assert.equal(provider1Canceled, true);
|
||||
assert.equal(provider2Canceled, false);
|
||||
assert.equal(provider3Canceled, false);
|
||||
assert.equal(providerDefaultDisposed, false);
|
||||
assert.equal(provider1Disposed, true);
|
||||
assert.equal(provider2Disposed, false);
|
||||
assert.equal(provider3Disposed, false);
|
||||
provider2Called = false;
|
||||
provider1Canceled = false;
|
||||
provider1Disposed = false;
|
||||
|
||||
accessor.quickInputService.quickAccess.show('usedefault');
|
||||
assert.equal(providerDefaultCalled, true);
|
||||
assert.equal(provider1Called, false);
|
||||
assert.equal(provider2Called, false);
|
||||
assert.equal(provider3Called, false);
|
||||
assert.equal(providerDefaultCanceled, false);
|
||||
assert.equal(provider1Canceled, false);
|
||||
assert.equal(provider2Canceled, true);
|
||||
assert.equal(provider3Canceled, false);
|
||||
assert.equal(providerDefaultDisposed, false);
|
||||
assert.equal(provider1Disposed, false);
|
||||
assert.equal(provider2Disposed, true);
|
||||
assert.equal(provider3Disposed, false);
|
||||
|
||||
await timeout(1);
|
||||
|
||||
assert.equal(providerDefaultCanceled, true);
|
||||
assert.equal(providerDefaultDisposed, true);
|
||||
assert.equal(provider3Called, true);
|
||||
|
||||
await timeout(1);
|
||||
|
||||
assert.equal(provider3Canceled, true);
|
||||
assert.equal(provider3Disposed, true);
|
||||
|
||||
disposables.dispose();
|
||||
|
||||
restore();
|
||||
});
|
||||
|
||||
let fastProviderCalled = false;
|
||||
let slowProviderCalled = false;
|
||||
let fastAndSlowProviderCalled = false;
|
||||
|
||||
let slowProviderCanceled = false;
|
||||
let fastAndSlowProviderCanceled = false;
|
||||
|
||||
class FastTestQuickPickProvider extends PickerQuickAccessProvider<IQuickPickItem> {
|
||||
|
||||
constructor() {
|
||||
super('fast');
|
||||
}
|
||||
|
||||
protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array<IQuickPickItem> {
|
||||
fastProviderCalled = true;
|
||||
|
||||
return [{ label: 'Fast Pick' }];
|
||||
}
|
||||
}
|
||||
|
||||
class SlowTestQuickPickProvider extends PickerQuickAccessProvider<IQuickPickItem> {
|
||||
|
||||
constructor() {
|
||||
super('slow');
|
||||
}
|
||||
|
||||
protected async getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise<Array<IQuickPickItem>> {
|
||||
slowProviderCalled = true;
|
||||
|
||||
await timeout(1);
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
slowProviderCanceled = true;
|
||||
}
|
||||
|
||||
return [{ label: 'Slow Pick' }];
|
||||
}
|
||||
}
|
||||
|
||||
class FastAndSlowTestQuickPickProvider extends PickerQuickAccessProvider<IQuickPickItem> {
|
||||
|
||||
constructor() {
|
||||
super('bothFastAndSlow');
|
||||
}
|
||||
|
||||
protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): FastAndSlowPicks<IQuickPickItem> {
|
||||
fastAndSlowProviderCalled = true;
|
||||
|
||||
return {
|
||||
picks: [{ label: 'Fast Pick' }],
|
||||
additionalPicks: (async () => {
|
||||
await timeout(1);
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
fastAndSlowProviderCanceled = true;
|
||||
}
|
||||
|
||||
return [{ label: 'Slow Pick' }];
|
||||
})()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const fastProviderDescriptor = { ctor: FastTestQuickPickProvider, prefix: 'fast', helpEntries: [] };
|
||||
const slowProviderDescriptor = { ctor: SlowTestQuickPickProvider, prefix: 'slow', helpEntries: [] };
|
||||
const fastAndSlowProviderDescriptor = { ctor: FastAndSlowTestQuickPickProvider, prefix: 'bothFastAndSlow', helpEntries: [] };
|
||||
|
||||
test('quick pick access', async () => {
|
||||
const registry = (Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess));
|
||||
const restore = (registry as QuickAccessRegistry).clear();
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
disposables.add(registry.registerQuickAccessProvider(fastProviderDescriptor));
|
||||
disposables.add(registry.registerQuickAccessProvider(slowProviderDescriptor));
|
||||
disposables.add(registry.registerQuickAccessProvider(fastAndSlowProviderDescriptor));
|
||||
|
||||
accessor.quickInputService.quickAccess.show('fast');
|
||||
assert.equal(fastProviderCalled, true);
|
||||
assert.equal(slowProviderCalled, false);
|
||||
assert.equal(fastAndSlowProviderCalled, false);
|
||||
fastProviderCalled = false;
|
||||
|
||||
accessor.quickInputService.quickAccess.show('slow');
|
||||
await timeout(2);
|
||||
|
||||
assert.equal(fastProviderCalled, false);
|
||||
assert.equal(slowProviderCalled, true);
|
||||
assert.equal(slowProviderCanceled, false);
|
||||
assert.equal(fastAndSlowProviderCalled, false);
|
||||
slowProviderCalled = false;
|
||||
|
||||
accessor.quickInputService.quickAccess.show('bothFastAndSlow');
|
||||
await timeout(2);
|
||||
|
||||
assert.equal(fastProviderCalled, false);
|
||||
assert.equal(slowProviderCalled, false);
|
||||
assert.equal(fastAndSlowProviderCalled, true);
|
||||
assert.equal(fastAndSlowProviderCanceled, false);
|
||||
fastAndSlowProviderCalled = false;
|
||||
|
||||
accessor.quickInputService.quickAccess.show('slow');
|
||||
accessor.quickInputService.quickAccess.show('bothFastAndSlow');
|
||||
accessor.quickInputService.quickAccess.show('fast');
|
||||
|
||||
assert.equal(fastProviderCalled, true);
|
||||
assert.equal(slowProviderCalled, true);
|
||||
assert.equal(fastAndSlowProviderCalled, true);
|
||||
|
||||
await timeout(2);
|
||||
assert.equal(slowProviderCanceled, true);
|
||||
assert.equal(fastAndSlowProviderCanceled, true);
|
||||
|
||||
disposables.dispose();
|
||||
|
||||
restore();
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,6 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IFilesConfigurationService, FilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
@@ -114,6 +113,7 @@ import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFil
|
||||
import { newWriteableStream, ReadableStreamEvents } from 'vs/base/common/stream';
|
||||
import { EncodingOracle, IEncodingOverride } from 'vs/workbench/services/textfile/browser/textFileService';
|
||||
import { UTF16le, UTF16be, UTF8_with_bom } from 'vs/workbench/services/textfile/common/encoding';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
|
||||
export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
|
||||
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined, undefined);
|
||||
@@ -555,7 +555,7 @@ export class TestEditorGroupsService implements IEditorGroupsService {
|
||||
get count(): number { return this.groups.length; }
|
||||
|
||||
getGroups(_order?: GroupsOrder): ReadonlyArray<IEditorGroup> { return this.groups; }
|
||||
getGroup(identifier: number): IEditorGroup | undefined { return find(this.groups, group => group.id === identifier); }
|
||||
getGroup(identifier: number): IEditorGroup | undefined { return this.groups.find(group => group.id === identifier); }
|
||||
getLabel(_identifier: number): string { return 'Group 1'; }
|
||||
findGroup(_scope: IFindGroupScope, _source?: number | IEditorGroup, _wrap?: boolean): IEditorGroup { throw new Error('not implemented'); }
|
||||
activateGroup(_group: number | IEditorGroup): IEditorGroup { throw new Error('not implemented'); }
|
||||
@@ -1037,6 +1037,9 @@ export class TestHostService implements IHostService {
|
||||
async openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise<void> { }
|
||||
|
||||
async toggleFullScreen(): Promise<void> { }
|
||||
|
||||
readonly colorScheme = ColorScheme.DARK;
|
||||
onDidChangeColorScheme = Event.None;
|
||||
}
|
||||
|
||||
export class TestFilesConfigurationService extends FilesConfigurationService {
|
||||
@@ -1227,6 +1230,8 @@ export class TestPathService implements IPathService {
|
||||
async fileURI(path: string): Promise<URI> {
|
||||
return URI.file(path);
|
||||
}
|
||||
|
||||
readonly defaultUriScheme = Schemas.vscodeRemote;
|
||||
}
|
||||
|
||||
export class TestTextFileEditorModelManager extends TextFileEditorModelManager {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbe
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as minimist from 'minimist';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { LocalSearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { LocalSearchService } from 'vs/workbench/services/search/electron-browser/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEditorService, TestEditorGroupsService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestEnvironmentService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService, TestLifecycleService, TestFilesConfigurationService, TestFileService, TestFileDialogService, TestPathService, TestEncodingOracle } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { NativeWorkbenchEnvironmentService, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { NativeTextFileService, } from 'vs/workbench/services/textfile/electron-browser/nativeTextFileService';
|
||||
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
import { FileOperationError, IFileService } from 'vs/platform/files/common/files';
|
||||
@@ -15,6 +15,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { IDialogService, IFileDialogService, INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
@@ -35,13 +36,14 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { NodeTestBackupFileService } from 'vs/workbench/services/backup/test/electron-browser/backupFileService.test';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { INativeWindowConfiguration } from 'vs/platform/windows/node/window';
|
||||
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IOSProperties } from 'vs/platform/electron/common/electron';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
|
||||
export const TestWindowConfiguration: INativeWindowConfiguration = {
|
||||
export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = {
|
||||
windowId: 0,
|
||||
machineId: 'testMachineId',
|
||||
sessionId: 'testSessionId',
|
||||
@@ -52,10 +54,11 @@ export const TestWindowConfiguration: INativeWindowConfiguration = {
|
||||
userEnv: {},
|
||||
execPath: process.execPath,
|
||||
perfEntries: [],
|
||||
colorScheme: ColorScheme.DARK,
|
||||
...parseArgs(process.argv, OPTIONS)
|
||||
};
|
||||
|
||||
export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(TestWindowConfiguration, process.execPath);
|
||||
export const TestEnvironmentService = new NativeWorkbenchEnvironmentService(TestWorkbenchConfiguration);
|
||||
|
||||
export class TestTextFileService extends NativeTextFileService {
|
||||
private resolveTextContentError!: FileOperationError | null;
|
||||
@@ -164,6 +167,7 @@ export class TestElectronService implements IElectronService {
|
||||
onWindowFocus: Event<number> = Event.None;
|
||||
onWindowBlur: Event<number> = Event.None;
|
||||
onOSResume: Event<unknown> = Event.None;
|
||||
onColorSchemeChange = Event.None;
|
||||
|
||||
windowCount = Promise.resolve(1);
|
||||
getWindowCount(): Promise<number> { return this.windowCount; }
|
||||
@@ -195,6 +199,7 @@ export class TestElectronService implements IElectronService {
|
||||
async setRepresentedFilename(path: string): Promise<void> { }
|
||||
async isAdmin(): Promise<boolean> { return false; }
|
||||
async getTotalMem(): Promise<number> { return 0; }
|
||||
async getOS(): Promise<IOSProperties> { return Object.create(null); }
|
||||
async killProcess(): Promise<void> { }
|
||||
async setDocumentEdited(edited: boolean): Promise<void> { }
|
||||
async openExternal(url: string): Promise<boolean> { return false; }
|
||||
|
||||
Reference in New Issue
Block a user