mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 17:23:56 -05:00
Merge VS Code 1.26.1 (#2394)
* Squash merge commits for 1.26 (#1) (#2323) * Polish tag search as per feedback (#55269) * Polish tag search as per feedback * Updated regex * Allow users to opt-out of features that send online requests in the background (#55097) * settings sweep #54690 * Minor css tweaks to enable eoverflow elipsis in more places (#55277) * fix an issue with titlebarheight when not scaling with zoom * Settings descriptions update #54690 * fixes #55209 * Settings editor - many padding fixes * More space above level 2 label * Fixing Cannot debug npm script using Yarn #55103 * Settings editor - show ellipsis when description overflows * Settings editor - ... fix measuring around links, relayout * Setting descriptions * Settings editor - fix ... for some short lines, fix select container width * Settings editor - overlay trees so scrollable shadow is full width * Fix #54133 - missing extension settings after reload * Settings color token description tweak * Settings editor - disable overflow indicator temporarily, needs to be faster * Added command to Run the selected npm script * fixes #54452 * fixes #54929 * fixes #55248 * prefix command with extension name * Contribute run selected to the context menu * node-debug@1.26.6 * Allow terminal rendererType to be swapped out at runtime Part of #53274 Fixes #55344 * Settings editor - fix not focusing search when restoring editor setInput must be actually async. Will be fixed naturally when we aren't using winJS promises... * Settings editor - TOC should only expand the section with a selected item * Bump node-debug2 * Settings editor - Tree focus outlines * Settings editor - don't blink the scrollbar when toc selection changes And hide TOC correctly when the editor is narrow * Settings editor - header rows should not be selectable * fixes #54877 * change debug assignee to isi * Settings sweep (#54690) * workaround for #55051 * Settings sweep (#54690) * settings sweep #54690 * Don't try closing tags when you type > after another > * Describe what implementation code lens does Fixes #55370 * fix javadoc formatter setting description * fixes #55325 * update to officical TS version * Settings editor - Even more padding, use semibold instead of bold * Fix #55357 - fix TOC twistie * fixes #55288 * explorer: refresh on di change file system provider registration fixes #53256 * Disable push to Linux repo to test standalone publisher * New env var to notify log level to extensions #54001 * Disable snippets in extension search (when not in suggest dropdown) (#55281) * Disable snippits in extension search (when not in suggest dropdown) * Add monaco input contributions * Fix bug preventing snippetSuggestions from taking effect in sub-editors * Latest emmet helper to fix #52366 * Fix comment updates for threads within same file * Allow extensions to log telemetry to log files #54001 * Pull latest css grammar * files.exclude control - use same style for "add" vs "edit" * files.exclude control - focus/keyboard behavior * don't show menubar too early * files.exclude - better styling * Place cursor at end of extensions search box on autofill (#55254) * Place cursor at end of extensions search box on autofill * Use position instead of selection * fix linux build issue (empty if block) * Settings editor - fix extension category prefixes * Settings editor - add simple ellipsis for first line that overflows, doesn't cover case when first line does not overflow but there is more text, TODO * File/Text search provider docs * Fixes #52655 * Include epoch (#55008) * Fixes #53385 * Fixes #49480 * VS Code Insiders (Users) not opening Fixes #55353 * Better handling of the case when the extension host fails to start * Fixes #53966 * Remove confusing Start from wordPartLeft commands ID * vscode-xterm@3.6.0-beta12 Fixes #55488 * Initial size is set to infinity!! Fixes #55461 * Polish embeddedEditorBackground * configuration service misses event * Fix #55224 - fix duplicate results in multiroot workspace from splitting the diskseach query * Select all not working in issue reporter on mac, fixes #55424 * Disable fuzzy matching for extensions autosuggest (#55498) * Fix clipping of extensions search border in some third party themes (#55504) * fixes #55538 * Fix bug causing an aria alert to not be shown the third time (and odd numbers thereafter) * Settings editor - work around rendering glitch with webkit-line-clamp * Settings editor - revert earlier '...' changes * Settings editor - move enumDescription to its own div, because it disturbs -webkit-line-clamp for some reason * Settings editor - better overflow indicator * Don't show existing filters in autocomplete (#55495) * Dont show existing filters in autocomplete * Simplify * Settings Editor: Add aria labels for input elements Fixes: #54836 (#55543) * fixes #55223 * Update vscode-css-languageservice to 3.0.10-next.1 * Fix #55509 - settings navigation * Fix #55519 * Fix #55520 * FIx #55524 * Fix #55556 - include wordSeparators in all search queries, so findTextInFiles can respect isWordMatch correctly * oss updates for endgame * Fix unit tests * fixes #55522 * Avoid missing manifest error from bubbling up #54757 * Settings format crawl * Search provider - Fix FileSearchProvider to return array, not progress * Fix #55598 * Settings editor - fix NPE rendering settings with no description * dont render inden guides in search box (#55600) * fixes #55454 * More settings crawl * Another change for #55598 - maxResults applies to FileSearch and TextSearch but not FileIndex * Fix FileSearchProvider unit tests for progress change * fixes #55561 * Settings description update for #54690 * Update setting descriptions for online services * Minor edits * fixes #55513 * fixes #55451 * Fix #55612 - fix findTextInFiles cancellation * fixes #55539 * More setting description tweaks * Setting to disable online experiments #54354 * fixes #55507 * fixes #55515 * Show online services action only in Insiders for now * Settings editor - change toc behavior default to 'filter' * Settings editor - nicer filter count style during search * Fix #55617 - search viewlet icons * Settings editor - better styling for element count indicator * SearchProvider - fix NPE when searching extraFileResources * Allow extends to work without json suffix Fixes #16905 * Remove accessability options logic entirely Follow up on #55451 * use latest version of DAP * fixes #55490 * fixes #55122 * fixes #52332 * Avoid assumptions about git: URIs (fixes #36236) * relative path for descriptions * resourece: get rid of isFile context key fixes #48275 * Register previous ids for compatibility (#53497) * more tuning for #48275 * no need to always re-read "files explorer" fixes #52003 * read out active composites properly fixes #51967 * Update link colors for hc theme to meet color contrast ratio, fixes #55651 Also updated link color for `textLinkActiveForeground` to be the same as `textLinkForeground` as it wasn't properly updated * detect 'winpty-agent.exe'; fixes #55672 * node-debug@1.26.7 * reset counter on new label * Settings editor - fix multiple setting links in one description * Settings editor - color code blocks in setting descriptions, fix #55532 * Settings editor - hover color in TOC * Settings editor - fix navigation NPE * Settings editor - fix text control width * Settings editor - maybe fix #55684 * Fix bug causing cursor to not move on paste * fixes #53582 * Use ctrlCmd instead of ctrl for go down from search box * fixes #55264 * fixes #55456 * filter for spcaes before triggering search (#55611) * Fix #55698 - don't lose filtered TOC counts when refreshing TOC * fixes #55421 * fixes #28979 * fixes #55576 * only add check for updates to windows/linux help * readonly files: append decoration to label fixes #53022 * debug: do not show toolbar while initialising fixes #55026 * Opening launch.json should not activate debug extensions fixes #55029 * fixes #55435 * fixes #55434 * fixes #55439 * trigger menu only on altkey up * Fix #50555 - fix settings editor memory leak * Fix #55712 - no need to focus 'a' anymore when restoring control focus after tree render * fixes #55335 * proper fix for readonly model fixes #53022 * improve FoldingRangeKind spec (for #55686) * Use class with static fields (fixes #55494) * Fixes #53671 * fixes #54630 * [html] should disable ionic suggestions by default. Currently forces deprecated Ionic v1 suggestions in .html files while typing. Fixes #53324 * cleanup deps * debug issues back to andre * update electron for smoketest * Fix #55757 - prevent settings tabs from overflowing * Fix #53897 - revert setting menu defaults to old editor * Add enum descriptions to `typescript.preferences.importModuleSpecifier` * Fix #55767 - leaking style elements from settings editor * Fix #55521 - prevent flashing when clicking in exclude control * Update Git modified color for contrast ratio, fixes #53140 * Revert "Merge branch 'master' of github.com:Microsoft/vscode" This reverts commit bf46b6bfbae0cab99c2863e1244a916181fa9fbc, reversing changes made to e275a424483dfb4ed33b428c97d5e2c441d6b917. * Revert "Revert "Merge branch 'master' of github.com:Microsoft/vscode"" This reverts commit 53949d963f39e40757557c6526332354a31d9154. * don't ask to install an incomplete menu * Fix NPE in terminal AccessibilityManager Fixes #55744 * don't display fallback menu unless we've closed the last window * fixes #55547 * Fix smoke tests for extension search box * Update OSSREADME.json for Electron 2.0.5 * Update distro Includes Chromium license changes * fix #55455 * fix #55865 * fixes #55893 * Fix bug causing workspace recommendations to go away upon ignoring a recommendation (#55805) * Fix bug causing workspace recommendations to go away upon ignoring a recommendation * ONly show on @recommended or @recommended:workspace * Make more consistant * Fix #55911 * Understand json activity (#55926) * Understand json file activity * Refactoring * adding composer.json * Distro update for experiments * use terminal.processId for auto-attach; fixes #55918 * Reject invalid URI with vscode.openFolder (for #55891) * improve win32 setup system vs user detection fixes #55840 fixes #55840 delay winreg import related to #55840 show notification earlier related to #55840 fix #55840 update inno setup message related to #55840 * Fix #55593 - this code only operates on local paths, so use fsPath and Uri.file instead * Bring back the old menu due to electron 2.0 issues (#55913) * add the old menu back for native menus * make menu labels match * `vscode.openFolder`: treat missing URI schema gracefully (for #55891) * delay EH reattach; fixes #55955 * Mark all json files under appSettingsHome as settings * Use localized strings for telemetry opt-out * Exception when saving file editor opened from remote file provider (fixes #55051) * Remove terminal menu from stable Fixes 56003 * VSCode Insiders crashes on open with TypeError: Cannot read property 'lastIndexOf' of undefined. Fixes #54933 * improve fix for #55891 * fix #55916 * Improve #55891 * increase EH debugging restart delay; fixes #55955 * Revert "Don't include non-resource entries in history quick pick" This reverts commit 37209a838e9f7e9abe6dc53ed73cdf1e03b72060. * Diff editor: horizontal scrollbar height is smaller (fixes #56062) * improve openFolder uri fix (correctly treat backslashes) * fixes #56116 repair ipc for native menubar keybindings * Fix #56240 - Open the JSON settings editor instead of the UI editor * Fix #55536 * uriDisplay: if no formatter is registered fall back to getPathlabel fixes #56104 * VSCode hangs when opening python file. Fixes #56377 * VS Code Hangs When Opening Specific PowerShell File. Fixes #56430 * Fix #56433 - search extraFileResources even when no folders open * Workaround #55649 * Fix in master #56371 * Fix tests #56371 * Fix in master #56317 * increase version to 1.26.1 * Fixes #56387: Handle SIGPIPE in extension host * fixes #56185 * Fix merge issues (part 1) * Fix build breaks (part 1) * Build breaks (part 2) * Build breaks (part 3) * More build breaks (part 4) * Fix build breaks (part 5) * WIP * Fix menus * Render query result and message panels (#2363) * Put back query editor hot exit changes * Fix grid changes that broke profiler (#2365) * Update APIs for saving query editor state * Fix restore view state for profiler and edit data * Updating custom default themes to support 4.5:1 contrast ratio * Test updates * Fix Extension Manager and Windows Setup * Update license headers * Add appveyor and travis files back * Fix hidden modal dropdown issue
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { originalFSPath } from 'vs/workbench/api/node/extHost.api.impl';
|
||||
|
||||
suite('ExtHost API', function () {
|
||||
test('issue #51387: originalFSPath', function () {
|
||||
assert.equal(originalFSPath(URI.file('C:\\test')).charAt(0), 'C');
|
||||
assert.equal(originalFSPath(URI.file('c:\\test')).charAt(0), 'c');
|
||||
|
||||
assert.equal(originalFSPath(URI.revive(JSON.parse(JSON.stringify(URI.file('C:\\test'))))).charAt(0), 'C');
|
||||
assert.equal(originalFSPath(URI.revive(JSON.parse(JSON.stringify(URI.file('c:\\test'))))).charAt(0), 'c');
|
||||
});
|
||||
});
|
||||
@@ -33,9 +33,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import 'vs/workbench/parts/search/electron-browser/search.contribution';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ExtHostTask } from 'vs/workbench/api/node/extHostTask';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = EditorModel.createFromString(
|
||||
@@ -52,8 +49,6 @@ let rpcProtocol: TestRPCProtocol;
|
||||
let extHost: ExtHostLanguageFeatures;
|
||||
let mainThread: MainThreadLanguageFeatures;
|
||||
let commands: ExtHostCommands;
|
||||
let task: ExtHostTask;
|
||||
let workspace: ExtHostWorkspace;
|
||||
let disposables: vscode.Disposable[] = [];
|
||||
let originalErrorHandler: (e: any) => any;
|
||||
|
||||
@@ -71,14 +66,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
rpcProtocol = new TestRPCProtocol();
|
||||
instantiationService.stub(IHeapService, {
|
||||
_serviceBrand: undefined,
|
||||
trackRecursive(args) {
|
||||
trackRecursive(args: any) {
|
||||
// nothing
|
||||
return args;
|
||||
}
|
||||
});
|
||||
instantiationService.stub(ICommandService, {
|
||||
_serviceBrand: undefined,
|
||||
executeCommand(id, args): any {
|
||||
executeCommand(id: string, args: any): any {
|
||||
if (!CommandsRegistry.getCommands()[id]) {
|
||||
return TPromise.wrapError(new Error(id + ' NOT known'));
|
||||
}
|
||||
@@ -120,16 +115,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
const heapService = new ExtHostHeapService();
|
||||
|
||||
commands = new ExtHostCommands(rpcProtocol, heapService, new NullLogService());
|
||||
workspace = new ExtHostWorkspace(rpcProtocol, { id: generateUuid(), name: 'Test', folders: [] }, new NullLogService());
|
||||
task = new ExtHostTask(rpcProtocol, workspace);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostCommands, commands);
|
||||
rpcProtocol.set(MainContext.MainThreadCommands, inst.createInstance(MainThreadCommands, rpcProtocol));
|
||||
ExtHostApiCommands.register(commands, task);
|
||||
ExtHostApiCommands.register(commands);
|
||||
|
||||
const diagnostics = new ExtHostDiagnostics(rpcProtocol);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, diagnostics);
|
||||
|
||||
extHost = new ExtHostLanguageFeatures(rpcProtocol, null, extHostDocuments, commands, heapService, diagnostics);
|
||||
extHost = new ExtHostLanguageFeatures(rpcProtocol, null, extHostDocuments, commands, heapService, diagnostics, new NullLogService());
|
||||
rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, extHost);
|
||||
|
||||
mainThread = rpcProtocol.set(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures, rpcProtocol));
|
||||
@@ -339,6 +332,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeDocumentSymbolProvider', model.uri).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
let [first, second] = values;
|
||||
assert.ok(first instanceof types.SymbolInformation);
|
||||
assert.ok(second instanceof types.SymbolInformation);
|
||||
assert.equal(first.name, 'testing2');
|
||||
assert.equal(second.name, 'testing1');
|
||||
});
|
||||
@@ -455,6 +450,38 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
});
|
||||
|
||||
test('"vscode.executeCompletionItemProvider" doesnot return a preselect field #53749', async function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
a.preselect = true;
|
||||
let b = new types.CompletionItem('item2');
|
||||
let c = new types.CompletionItem('item3');
|
||||
c.preselect = true;
|
||||
let d = new types.CompletionItem('item4');
|
||||
return new types.CompletionList([a, b, c, d], false);
|
||||
}
|
||||
}, []));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
let list = await commands.executeCommand<vscode.CompletionList>(
|
||||
'vscode.executeCompletionItemProvider',
|
||||
model.uri,
|
||||
new types.Position(0, 4),
|
||||
undefined
|
||||
);
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(list.items.length, 4);
|
||||
|
||||
let [a, b, c, d] = list.items;
|
||||
assert.equal(a.preselect, true);
|
||||
assert.equal(b.preselect, undefined);
|
||||
assert.equal(c.preselect, true);
|
||||
assert.equal(d.preselect, undefined);
|
||||
});
|
||||
|
||||
// --- quickfix
|
||||
|
||||
test('QuickFix, back and forth', function () {
|
||||
@@ -640,4 +667,20 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('"TypeError: e.onCancellationRequested is not a function" calling hover provider in Insiders #54174', function () {
|
||||
|
||||
disposables.push(extHost.registerHoverProvider(defaultSelector, <vscode.HoverProvider>{
|
||||
provideHover(): any {
|
||||
return new types.Hover('fofofofo');
|
||||
}
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Hover[]>('vscode.executeHoverProvider', model.uri, new types.Position(1, 1)).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.equal(value[0].contents.length, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import URI, { UriComponents } from 'vs/base/common/uri';
|
||||
import { DiagnosticCollection } from 'vs/workbench/api/node/extHostDiagnostics';
|
||||
import { DiagnosticCollection, ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
|
||||
import { Diagnostic, DiagnosticSeverity, Range, DiagnosticRelatedInformation, Location } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { MainThreadDiagnosticsShape } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { MainThreadDiagnosticsShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { Emitter, toPromise } from 'vs/base/common/event';
|
||||
@@ -27,7 +27,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('disposeCheck', function () {
|
||||
|
||||
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
|
||||
collection.dispose();
|
||||
collection.dispose(); // that's OK
|
||||
@@ -44,13 +44,13 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
|
||||
test('diagnostic collection, forEach, clear, has', function () {
|
||||
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
assert.equal(collection.name, 'test');
|
||||
collection.dispose();
|
||||
assert.throws(() => collection.name);
|
||||
|
||||
let c = 0;
|
||||
collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
collection.forEach(() => c++);
|
||||
assert.equal(c, 0);
|
||||
|
||||
@@ -87,7 +87,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
});
|
||||
|
||||
test('diagnostic collection, immutable read', function () {
|
||||
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
collection.set(URI.parse('foo:bar'), [
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-1'),
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-2')
|
||||
@@ -112,7 +112,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
|
||||
test('diagnostics collection, set with dupliclated tuples', function () {
|
||||
let collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
let uri = URI.parse('sc:hightower');
|
||||
collection.set([
|
||||
[uri, [new Diagnostic(new Range(0, 0, 0, 1), 'message-1')]],
|
||||
@@ -163,7 +163,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
test('diagnostics collection, set tuple overrides, #11547', function () {
|
||||
|
||||
let lastEntries: [UriComponents, IMarkerData[]][];
|
||||
let collection = new DiagnosticCollection('test', new class extends DiagnosticsShape {
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, new class extends DiagnosticsShape {
|
||||
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): void {
|
||||
lastEntries = entries;
|
||||
return super.$changeMany(owner, entries);
|
||||
@@ -192,7 +192,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('diagnostics collection, tuples and undefined (small array), #15585', function () {
|
||||
|
||||
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
let uri = URI.parse('sc:hightower');
|
||||
let uri2 = URI.parse('sc:nomad');
|
||||
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
@@ -213,7 +213,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('diagnostics collection, tuples and undefined (large array), #15585', function () {
|
||||
|
||||
const collection = new DiagnosticCollection('test', new DiagnosticsShape(), new Emitter());
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
const tuples: [URI, Diagnostic[]][] = [];
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
@@ -237,7 +237,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
test('diagnostic capping', function () {
|
||||
|
||||
let lastEntries: [UriComponents, IMarkerData[]][];
|
||||
let collection = new DiagnosticCollection('test', new class extends DiagnosticsShape {
|
||||
let collection = new DiagnosticCollection('test', 'test', 250, new class extends DiagnosticsShape {
|
||||
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): void {
|
||||
lastEntries = entries;
|
||||
return super.$changeMany(owner, entries);
|
||||
@@ -258,12 +258,12 @@ suite('ExtHostDiagnostics', () => {
|
||||
assert.equal(lastEntries[0][1].length, 251);
|
||||
assert.equal(lastEntries[0][1][0].severity, MarkerSeverity.Error);
|
||||
assert.equal(lastEntries[0][1][200].severity, MarkerSeverity.Warning);
|
||||
assert.equal(lastEntries[0][1][250].severity, MarkerSeverity.Error);
|
||||
assert.equal(lastEntries[0][1][250].severity, MarkerSeverity.Info);
|
||||
});
|
||||
|
||||
test('diagnostic eventing', async function () {
|
||||
let emitter = new Emitter<(string | URI)[]>();
|
||||
let collection = new DiagnosticCollection('ddd', new DiagnosticsShape(), emitter);
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, new DiagnosticsShape(), emitter);
|
||||
|
||||
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
let diag2 = new Diagnostic(new Range(1, 1, 2, 3), 'diag2');
|
||||
@@ -299,9 +299,32 @@ suite('ExtHostDiagnostics', () => {
|
||||
await p;
|
||||
});
|
||||
|
||||
test('vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582', async function () {
|
||||
let emitter = new Emitter<(string | URI)[]>();
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, new DiagnosticsShape(), emitter);
|
||||
|
||||
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
|
||||
// delete
|
||||
collection.set(URI.parse('aa:bb'), [diag1]);
|
||||
let p = toPromise(emitter.event).then(e => {
|
||||
assert.equal(e[0].toString(), 'aa:bb');
|
||||
});
|
||||
collection.delete(URI.parse('aa:bb'));
|
||||
await p;
|
||||
|
||||
// set->undefined (as delete)
|
||||
collection.set(URI.parse('aa:bb'), [diag1]);
|
||||
p = toPromise(emitter.event).then(e => {
|
||||
assert.equal(e[0].toString(), 'aa:bb');
|
||||
});
|
||||
collection.set(URI.parse('aa:bb'), undefined);
|
||||
await p;
|
||||
});
|
||||
|
||||
test('diagnostics with related information', function (done) {
|
||||
|
||||
let collection = new DiagnosticCollection('ddd', new class extends DiagnosticsShape {
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, new class extends DiagnosticsShape {
|
||||
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
|
||||
|
||||
let [[, data]] = entries;
|
||||
@@ -324,4 +347,33 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
collection.set(URI.parse('aa:bb'), [diag]);
|
||||
});
|
||||
|
||||
test('vscode.languages.getDiagnostics appears to return old diagnostics in some circumstances #54359', function () {
|
||||
const ownerHistory: string[] = [];
|
||||
const diags = new ExtHostDiagnostics(new class implements IMainContext {
|
||||
getProxy(id: any): any {
|
||||
return new class DiagnosticsShape {
|
||||
$clear(owner: string): void {
|
||||
ownerHistory.push(owner);
|
||||
}
|
||||
};
|
||||
}
|
||||
set(): any {
|
||||
return null;
|
||||
}
|
||||
assertRegistered(): void {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
let collection1 = diags.createDiagnosticCollection('foo');
|
||||
let collection2 = diags.createDiagnosticCollection('foo'); // warns, uses a different owner
|
||||
|
||||
collection1.clear();
|
||||
collection2.clear();
|
||||
|
||||
assert.equal(ownerHistory.length, 2);
|
||||
assert.equal(ownerHistory[0], 'foo');
|
||||
assert.equal(ownerHistory[1], 'foo0');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,8 +33,9 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
publisher: 'vscode',
|
||||
enableProposedApi: false,
|
||||
engines: undefined,
|
||||
extensionFolderPath: undefined,
|
||||
extensionLocation: undefined,
|
||||
isBuiltin: false,
|
||||
isUnderDevelopment: false,
|
||||
version: undefined
|
||||
};
|
||||
|
||||
@@ -87,7 +88,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
sub.dispose();
|
||||
|
||||
assert.ok(event);
|
||||
assert.throws(() => event.document = null);
|
||||
assert.throws(() => { event.document = null; });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -167,12 +168,12 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
let callCount = 0;
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
callCount += 1;
|
||||
event.waitUntil(timeout(17));
|
||||
event.waitUntil(timeout(1));
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
callCount += 1;
|
||||
event.waitUntil(timeout(17));
|
||||
event.waitUntil(timeout(170));
|
||||
});
|
||||
|
||||
let sub3 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
|
||||
@@ -6,18 +6,25 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ExtHostFileSystemEventService } from 'vs/workbench/api/node/extHostFileSystemEventService';
|
||||
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
suite('ExtHostFileSystemEventService', () => {
|
||||
|
||||
|
||||
test('FileSystemWatcher ignore events properties are reversed #26851', function () {
|
||||
|
||||
const watcher1 = new ExtHostFileSystemEventService().createFileSystemWatcher('**/somethingInteresting', false, false, false);
|
||||
const protocol: IMainContext = {
|
||||
getProxy: () => { return undefined; },
|
||||
set: undefined,
|
||||
assertRegistered: undefined
|
||||
};
|
||||
|
||||
const watcher1 = new ExtHostFileSystemEventService(protocol, undefined).createFileSystemWatcher('**/somethingInteresting', false, false, false);
|
||||
assert.equal(watcher1.ignoreChangeEvents, false);
|
||||
assert.equal(watcher1.ignoreCreateEvents, false);
|
||||
assert.equal(watcher1.ignoreDeleteEvents, false);
|
||||
|
||||
const watcher2 = new ExtHostFileSystemEventService().createFileSystemWatcher('**/somethingBoring', true, true, true);
|
||||
const watcher2 = new ExtHostFileSystemEventService(protocol, undefined).createFileSystemWatcher('**/somethingBoring', true, true, true);
|
||||
assert.equal(watcher2.ignoreChangeEvents, true);
|
||||
assert.equal(watcher2.ignoreCreateEvents, true);
|
||||
assert.equal(watcher2.ignoreDeleteEvents, true);
|
||||
|
||||
@@ -26,7 +26,7 @@ import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/node/extHostDocumen
|
||||
import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen';
|
||||
import { DocumentSymbolProviderRegistry, DocumentHighlightKind, Hover, ResourceTextEdit } from 'vs/editor/common/modes';
|
||||
import { getCodeLensData } from 'vs/editor/contrib/codelens/codelens';
|
||||
import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition } from 'vs/editor/contrib/goToDeclaration/goToDeclaration';
|
||||
import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition } from 'vs/editor/contrib/goToDefinition/goToDefinition';
|
||||
import { getHover } from 'vs/editor/contrib/hover/getHover';
|
||||
import { getOccurrencesAtPosition } from 'vs/editor/contrib/wordHighlighter/wordHighlighter';
|
||||
import { provideReferences } from 'vs/editor/contrib/referenceSearch/referenceSearch';
|
||||
@@ -46,6 +46,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { ITextModel, EndOfLineSequence } from 'vs/editor/common/model';
|
||||
import { getColors } from 'vs/editor/contrib/colorPicker/color';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = EditorModel.createFromString(
|
||||
@@ -77,7 +78,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
instantiationService.stub(IMarkerService, MarkerService);
|
||||
instantiationService.stub(IHeapService, {
|
||||
_serviceBrand: undefined,
|
||||
trackRecursive(args) {
|
||||
trackRecursive(args: any) {
|
||||
// nothing
|
||||
return args;
|
||||
}
|
||||
@@ -111,7 +112,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
const diagnostics = new ExtHostDiagnostics(rpcProtocol);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostDiagnostics, diagnostics);
|
||||
|
||||
extHost = new ExtHostLanguageFeatures(rpcProtocol, null, extHostDocuments, commands, heapService, diagnostics);
|
||||
extHost = new ExtHostLanguageFeatures(rpcProtocol, null, extHostDocuments, commands, heapService, diagnostics, new NullLogService());
|
||||
rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, extHost);
|
||||
|
||||
mainThread = rpcProtocol.set(MainContext.MainThreadLanguageFeatures, inst.createInstance(MainThreadLanguageFeatures, rpcProtocol));
|
||||
@@ -136,7 +137,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
assert.equal(DocumentSymbolProviderRegistry.all(model).length, 0);
|
||||
let d1 = extHost.registerDocumentSymbolProvider(defaultSelector, <vscode.DocumentSymbolProvider>{
|
||||
provideDocumentSymbols() {
|
||||
return [];
|
||||
return <vscode.SymbolInformation[]>[];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -163,7 +164,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getDocumentSymbols(model).then(value => {
|
||||
assert.equal(value.entries.length, 1);
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -178,11 +179,11 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getDocumentSymbols(model).then(value => {
|
||||
assert.equal(value.entries.length, 1);
|
||||
assert.equal(value.length, 1);
|
||||
|
||||
let entry = value.entries[0];
|
||||
let entry = value[0];
|
||||
assert.equal(entry.name, 'test');
|
||||
assert.deepEqual(entry.location.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -203,7 +204,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getCodeLensData(model).then(value => {
|
||||
return getCodeLensData(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
});
|
||||
@@ -224,7 +225,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getCodeLensData(model).then(value => {
|
||||
return getCodeLensData(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let data = value[0];
|
||||
|
||||
@@ -248,7 +249,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getCodeLensData(model).then(value => {
|
||||
return getCodeLensData(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
|
||||
let data = value[0];
|
||||
@@ -403,7 +404,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
getHover(model, new EditorPosition(1, 1)).then(value => {
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
@@ -422,7 +423,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
getHover(model, new EditorPosition(1, 1)).then(value => {
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 4, startColumn: 1, endLineNumber: 9, endColumn: 8 });
|
||||
@@ -446,7 +447,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getHover(model, new EditorPosition(1, 1)).then(value => {
|
||||
return getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 2);
|
||||
let [first, second] = value as Hover[];
|
||||
assert.equal(first.contents[0].value, 'registered second');
|
||||
@@ -471,7 +472,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
getHover(model, new EditorPosition(1, 1)).then(value => {
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
@@ -490,7 +491,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2)).then(value => {
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
@@ -514,7 +515,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2)).then(value => {
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
@@ -538,7 +539,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2)).then(value => {
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 3 });
|
||||
@@ -563,7 +564,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2)).then(value => {
|
||||
return getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
});
|
||||
@@ -587,7 +588,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return provideReferences(model, new EditorPosition(1, 2)).then(value => {
|
||||
return provideReferences(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 2);
|
||||
|
||||
let [first, second] = value;
|
||||
@@ -607,7 +608,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return provideReferences(model, new EditorPosition(1, 2)).then(value => {
|
||||
return provideReferences(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
|
||||
let [item] = value;
|
||||
@@ -633,7 +634,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return provideReferences(model, new EditorPosition(1, 2)).then(value => {
|
||||
return provideReferences(model, new EditorPosition(1, 2), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
|
||||
@@ -654,7 +655,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getCodeActions(model, model.getFullModelRange()).then(value => {
|
||||
return getCodeActions(model, model.getFullModelRange(), undefined).then(value => {
|
||||
assert.equal(value.length, 2);
|
||||
|
||||
const [first, second] = value;
|
||||
@@ -681,7 +682,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getCodeActions(model, model.getFullModelRange()).then(value => {
|
||||
return getCodeActions(model, model.getFullModelRange(), undefined).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
|
||||
const [first] = value;
|
||||
@@ -707,7 +708,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getCodeActions(model, model.getFullModelRange()).then(value => {
|
||||
return getCodeActions(model, model.getFullModelRange(), undefined).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
});
|
||||
@@ -727,7 +728,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getCodeActions(model, model.getFullModelRange()).then(value => {
|
||||
return getCodeActions(model, model.getFullModelRange(), undefined).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
});
|
||||
});
|
||||
@@ -841,8 +842,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return rename(model, new EditorPosition(1, 1), 'newName').then(value => {
|
||||
assert.equal(value.edits.length, 1); // least relevant renamer
|
||||
assert.equal((<ResourceTextEdit[]>value.edits)[0].edits.length, 2); // least relevant renamer
|
||||
// least relevant rename provider
|
||||
assert.equal(value.edits.length, 2);
|
||||
assert.equal((<ResourceTextEdit>value.edits[0]).edits.length, 1);
|
||||
assert.equal((<ResourceTextEdit>value.edits[1]).edits.length, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -869,7 +872,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return provideSignatureHelp(model, new EditorPosition(1, 1)).then(value => {
|
||||
return provideSignatureHelp(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.ok(value);
|
||||
});
|
||||
});
|
||||
@@ -884,7 +887,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
|
||||
return provideSignatureHelp(model, new EditorPosition(1, 1)).then(value => {
|
||||
return provideSignatureHelp(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value, undefined);
|
||||
});
|
||||
});
|
||||
@@ -1149,7 +1152,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getLinks(model).then(value => {
|
||||
return getLinks(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
@@ -1174,7 +1177,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getLinks(model).then(value => {
|
||||
return getLinks(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
@@ -1196,7 +1199,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return getColors(model).then(value => {
|
||||
return getColors(model, CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
|
||||
const emptyDialogService = new class implements IDialogService {
|
||||
_serviceBrand: 'dialogService';
|
||||
show(severity, message, buttons): never {
|
||||
show(): never {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
|
||||
confirm(...opts): never {
|
||||
confirm(): never {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
};
|
||||
@@ -83,7 +83,7 @@ suite('ExtHostMessageService', function () {
|
||||
let service = new MainThreadMessageService(null, new EmptyNotificationService(notification => {
|
||||
assert.equal(notification.actions.primary.length, 1);
|
||||
setImmediate(() => notification.actions.primary[0].run());
|
||||
}), emptyCommandService, emptyDialogService, null);
|
||||
}), emptyCommandService, emptyDialogService);
|
||||
|
||||
return service.$showMessage(1, 'h', {}, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]).then(handle => {
|
||||
assert.equal(handle, 42);
|
||||
@@ -100,7 +100,7 @@ suite('ExtHostMessageService', function () {
|
||||
assert.equal(buttons[1], 'Cancel');
|
||||
return Promise.as(0);
|
||||
}
|
||||
} as IDialogService, null);
|
||||
} as IDialogService);
|
||||
|
||||
return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]).then(handle => {
|
||||
assert.equal(handle, 42);
|
||||
@@ -112,7 +112,7 @@ suite('ExtHostMessageService', function () {
|
||||
show(severity, message, buttons) {
|
||||
return Promise.as(1);
|
||||
}
|
||||
} as IDialogService, null);
|
||||
} as IDialogService);
|
||||
|
||||
return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]).then(handle => {
|
||||
assert.equal(handle, undefined);
|
||||
@@ -125,7 +125,7 @@ suite('ExtHostMessageService', function () {
|
||||
assert.equal(buttons.length, 1);
|
||||
return Promise.as(0);
|
||||
}
|
||||
} as IDialogService, null);
|
||||
} as IDialogService);
|
||||
|
||||
return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]).then(handle => {
|
||||
assert.equal(handle, 42);
|
||||
|
||||
1137
src/vs/workbench/test/electron-browser/api/extHostSearch.test.ts
Normal file
1137
src/vs/workbench/test/electron-browser/api/extHostSearch.test.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6,21 +6,22 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { TextEditorLineNumbersStyle, Range } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
|
||||
import { MainThreadTextEditorsShape, IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { ExtHostTextEditorOptions, ExtHostTextEditor } from 'vs/workbench/api/node/extHostTextEditor';
|
||||
import { ExtHostDocumentData } from 'vs/workbench/api/node/extHostDocumentData';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
|
||||
suite('ExtHostTextEditor', () => {
|
||||
|
||||
let editor: ExtHostTextEditor;
|
||||
let doc = new ExtHostDocumentData(undefined, URI.file(''), [
|
||||
'aaaa bbbb+cccc abc'
|
||||
], '\n', 'text', 1, false);
|
||||
|
||||
setup(() => {
|
||||
let doc = new ExtHostDocumentData(undefined, URI.file(''), [
|
||||
'aaaa bbbb+cccc abc'
|
||||
], '\n', 'text', 1, false);
|
||||
editor = new ExtHostTextEditor(null, 'fake', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4 }, [], 1);
|
||||
});
|
||||
|
||||
@@ -39,6 +40,25 @@ suite('ExtHostTextEditor', () => {
|
||||
assert.throws(() => editor._acceptOptions(null));
|
||||
assert.throws(() => editor._acceptSelections([]));
|
||||
});
|
||||
|
||||
test('API [bug]: registerTextEditorCommand clears redo stack even if no edits are made #55163', async function () {
|
||||
let applyCount = 0;
|
||||
let editor = new ExtHostTextEditor(new class extends mock<MainThreadTextEditorsShape>() {
|
||||
$tryApplyEdits(): TPromise<boolean> {
|
||||
applyCount += 1;
|
||||
return TPromise.wrap(true);
|
||||
}
|
||||
}, 'edt1', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4 }, [], 1);
|
||||
|
||||
await editor.edit(edit => { });
|
||||
assert.equal(applyCount, 0);
|
||||
|
||||
await editor.edit(edit => { edit.setEndOfLine(1); });
|
||||
assert.equal(applyCount, 1);
|
||||
|
||||
await editor.edit(edit => { edit.delete(new Range(0, 0, 1, 1)); });
|
||||
assert.equal(applyCount, 2);
|
||||
});
|
||||
});
|
||||
|
||||
suite('ExtHostTextEditorOptions', () => {
|
||||
|
||||
@@ -31,8 +31,8 @@ suite('ExtHostTreeView', function () {
|
||||
$registerTreeViewDataProvider(treeViewId: string): void {
|
||||
}
|
||||
|
||||
$refresh(viewId: string, itemsToRefresh?: { [treeItemHandle: string]: ITreeItem }): void {
|
||||
this.onRefresh.fire(itemsToRefresh);
|
||||
$refresh(viewId: string, itemsToRefresh?: { [treeItemHandle: string]: ITreeItem }): TPromise<void> {
|
||||
return TPromise.as(null).then(() => this.onRefresh.fire(itemsToRefresh));
|
||||
}
|
||||
|
||||
$reveal(): TPromise<void> {
|
||||
@@ -72,17 +72,13 @@ suite('ExtHostTreeView', function () {
|
||||
|
||||
rpcProtocol.set(MainContext.MainThreadCommands, inst.createInstance(MainThreadCommands, rpcProtocol));
|
||||
target = new RecordingShape();
|
||||
testObject = new ExtHostTreeViews(target, new ExtHostCommands(rpcProtocol, new ExtHostHeapService(), new NullLogService()));
|
||||
testObject = new ExtHostTreeViews(target, new ExtHostCommands(rpcProtocol, new ExtHostHeapService(), new NullLogService()), new NullLogService());
|
||||
onDidChangeTreeNode = new Emitter<{ key: string }>();
|
||||
onDidChangeTreeNodeWithId = new Emitter<{ key: string }>();
|
||||
testObject.createTreeView('testNodeTreeProvider', { treeDataProvider: aNodeTreeDataProvider() });
|
||||
testObject.createTreeView('testNodeWithIdTreeProvider', { treeDataProvider: aNodeWithIdTreeDataProvider() });
|
||||
|
||||
testObject.$getChildren('testNodeTreeProvider').then(elements => {
|
||||
for (const element of elements) {
|
||||
testObject.$getChildren('testNodeTreeProvider', element.handle);
|
||||
}
|
||||
});
|
||||
return loadCompleteTree('testNodeTreeProvider');
|
||||
});
|
||||
|
||||
test('construct node tree', () => {
|
||||
@@ -319,7 +315,6 @@ suite('ExtHostTreeView', function () {
|
||||
'a/0:b': {}
|
||||
};
|
||||
|
||||
onDidChangeTreeNode.fire();
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
@@ -327,6 +322,7 @@ suite('ExtHostTreeView', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
onDidChangeTreeNode.fire();
|
||||
});
|
||||
|
||||
test('tree with duplicate labels', (done) => {
|
||||
@@ -361,8 +357,6 @@ suite('ExtHostTreeView', function () {
|
||||
tree['f'] = {};
|
||||
tree[dupItems['adup2']] = {};
|
||||
|
||||
onDidChangeTreeNode.fire();
|
||||
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
@@ -376,6 +370,8 @@ suite('ExtHostTreeView', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
onDidChangeTreeNode.fire();
|
||||
});
|
||||
|
||||
test('getChildren is not returned from cache if refreshed', (done) => {
|
||||
@@ -383,7 +379,6 @@ suite('ExtHostTreeView', function () {
|
||||
'c': {}
|
||||
};
|
||||
|
||||
onDidChangeTreeNode.fire();
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
@@ -391,6 +386,8 @@ suite('ExtHostTreeView', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
onDidChangeTreeNode.fire();
|
||||
});
|
||||
|
||||
test('getChildren is returned from cache if not refreshed', () => {
|
||||
@@ -419,7 +416,7 @@ suite('ExtHostTreeView', function () {
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual({ handle: '0/0:a', label: 'a', collapsibleState: TreeItemCollapsibleState.Collapsed }, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepEqual([], revealTarget.args[0][2]);
|
||||
assert.equal(void 0, revealTarget.args[0][3]);
|
||||
assert.deepEqual({ select: true, focus: false }, revealTarget.args[0][3]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -432,7 +429,7 @@ suite('ExtHostTreeView', function () {
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual({ handle: '0/0:a/0:aa', label: 'aa', collapsibleState: TreeItemCollapsibleState.None, parentHandle: '0/0:a' }, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepEqual([{ handle: '0/0:a', label: 'a', collapsibleState: TreeItemCollapsibleState.Collapsed }], (<Array<any>>revealTarget.args[0][2]).map(arg => removeUnsetKeys(arg)));
|
||||
assert.equal(void 0, revealTarget.args[0][3]);
|
||||
assert.deepEqual({ select: true, focus: false }, revealTarget.args[0][3]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -447,7 +444,7 @@ suite('ExtHostTreeView', function () {
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual({ handle: '0/0:a/0:aa', label: 'aa', collapsibleState: TreeItemCollapsibleState.None, parentHandle: '0/0:a' }, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepEqual([{ handle: '0/0:a', label: 'a', collapsibleState: TreeItemCollapsibleState.Collapsed }], (<Array<any>>revealTarget.args[0][2]).map(arg => removeUnsetKeys(arg)));
|
||||
assert.equal(void 0, revealTarget.args[0][3]);
|
||||
assert.deepEqual({ select: true, focus: false }, revealTarget.args[0][3]);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -461,7 +458,7 @@ suite('ExtHostTreeView', function () {
|
||||
};
|
||||
const revealTarget = sinon.spy(target, '$reveal');
|
||||
const treeView = testObject.createTreeView('treeDataProvider', { treeDataProvider: aCompleteNodeTreeDataProvider() });
|
||||
return treeView.reveal({ key: 'bac' }, { select: false })
|
||||
return treeView.reveal({ key: 'bac' }, { select: false, focus: false })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
@@ -470,10 +467,16 @@ suite('ExtHostTreeView', function () {
|
||||
{ handle: '0/0:b', label: 'b', collapsibleState: TreeItemCollapsibleState.Collapsed },
|
||||
{ handle: '0/0:b/0:ba', label: 'ba', collapsibleState: TreeItemCollapsibleState.Collapsed, parentHandle: '0/0:b' }
|
||||
], (<Array<any>>revealTarget.args[0][2]).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: false }, revealTarget.args[0][3]);
|
||||
assert.deepEqual({ select: false, focus: false }, revealTarget.args[0][3]);
|
||||
});
|
||||
});
|
||||
|
||||
function loadCompleteTree(treeId, element?: string): TPromise<void> {
|
||||
return testObject.$getChildren(treeId, element)
|
||||
.then(elements => elements.map(e => loadCompleteTree(treeId, e.handle)))
|
||||
.then(() => null);
|
||||
}
|
||||
|
||||
function removeUnsetKeys(obj: any): any {
|
||||
const result = {};
|
||||
for (const key of Object.keys(obj)) {
|
||||
|
||||
@@ -21,8 +21,22 @@ suite('ExtHostTypes', function () {
|
||||
test('URI, toJSON', function () {
|
||||
|
||||
let uri = URI.parse('file:///path/test.file');
|
||||
let data = uri.toJSON();
|
||||
assert.deepEqual(data, {
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file'
|
||||
});
|
||||
|
||||
assert.ok(uri.fsPath);
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file',
|
||||
fsPath: '/path/test.file'.replace(/\//g, isWindows ? '\\' : '/'),
|
||||
});
|
||||
|
||||
assert.ok(uri.toString());
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file',
|
||||
@@ -182,8 +196,8 @@ suite('ExtHostTypes', function () {
|
||||
assert.throws(() => new types.Range(null, new types.Position(0, 0)));
|
||||
|
||||
let range = new types.Range(1, 0, 0, 0);
|
||||
assert.throws(() => (range as any).start = null);
|
||||
assert.throws(() => (range as any).start = new types.Position(0, 3));
|
||||
assert.throws(() => { (range as any).start = null; });
|
||||
assert.throws(() => { (range as any).start = new types.Position(0, 3); });
|
||||
});
|
||||
|
||||
test('Range, toJSON', function () {
|
||||
@@ -342,72 +356,73 @@ suite('ExtHostTypes', function () {
|
||||
edit.set(a, [types.TextEdit.insert(new types.Position(0, 0), 'fff')]);
|
||||
assert.ok(edit.has(a));
|
||||
assert.equal(edit.size, 1);
|
||||
assertToJSON(edit, [[URI.parse('file:///a.ts').toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]]]);
|
||||
assertToJSON(edit, [[a.toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]]]);
|
||||
|
||||
edit.insert(b, new types.Position(1, 1), 'fff');
|
||||
edit.delete(b, new types.Range(0, 0, 0, 0));
|
||||
assert.ok(edit.has(b));
|
||||
assert.equal(edit.size, 2);
|
||||
assertToJSON(edit, [
|
||||
[URI.parse('file:///a.ts').toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]],
|
||||
[URI.parse('file:///b.ts').toJSON(), [{ range: [{ line: 1, character: 1 }, { line: 1, character: 1 }], newText: 'fff' }, { range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: '' }]]
|
||||
[a.toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]],
|
||||
[b.toJSON(), [{ range: [{ line: 1, character: 1 }, { line: 1, character: 1 }], newText: 'fff' }, { range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: '' }]]
|
||||
]);
|
||||
|
||||
edit.set(b, undefined);
|
||||
assert.ok(edit.has(b));
|
||||
assert.equal(edit.size, 2);
|
||||
assert.ok(!edit.has(b));
|
||||
assert.equal(edit.size, 1);
|
||||
|
||||
edit.set(b, [types.TextEdit.insert(new types.Position(0, 0), 'ffff')]);
|
||||
assert.equal(edit.get(b).length, 1);
|
||||
|
||||
});
|
||||
|
||||
// test('WorkspaceEdit should fail when editing deleted resource', () => {
|
||||
// const resource = URI.parse('file:///a.ts');
|
||||
test('WorkspaceEdit - keep order of text and file changes', function () {
|
||||
|
||||
// const edit = new types.WorkspaceEdit();
|
||||
// edit.deleteResource(resource);
|
||||
// try {
|
||||
// edit.insert(resource, new types.Position(0, 0), '');
|
||||
// assert.fail(false, 'Should disallow edit of deleted resource');
|
||||
// } catch {
|
||||
// // expected
|
||||
// }
|
||||
// });
|
||||
const edit = new types.WorkspaceEdit();
|
||||
edit.replace(URI.parse('foo:a'), new types.Range(1, 1, 1, 1), 'foo');
|
||||
edit.renameFile(URI.parse('foo:a'), URI.parse('foo:b'));
|
||||
edit.replace(URI.parse('foo:a'), new types.Range(2, 1, 2, 1), 'bar');
|
||||
edit.replace(URI.parse('foo:b'), new types.Range(3, 1, 3, 1), 'bazz');
|
||||
|
||||
// test('WorkspaceEdit - keep order of text and file changes', function () {
|
||||
const all = edit._allEntries();
|
||||
assert.equal(all.length, 4);
|
||||
|
||||
// const edit = new types.WorkspaceEdit();
|
||||
// edit.replace(URI.parse('foo:a'), new types.Range(1, 1, 1, 1), 'foo');
|
||||
// edit.renameResource(URI.parse('foo:a'), URI.parse('foo:b'));
|
||||
// edit.replace(URI.parse('foo:a'), new types.Range(2, 1, 2, 1), 'bar');
|
||||
// edit.replace(URI.parse('foo:b'), new types.Range(3, 1, 3, 1), 'bazz');
|
||||
function isFileChange(thing: [URI, types.TextEdit[]] | [URI, URI, { overwrite?: boolean }]): thing is [URI, URI, { overwrite?: boolean }] {
|
||||
const [f, s] = thing;
|
||||
return URI.isUri(f) && URI.isUri(s);
|
||||
}
|
||||
|
||||
// const all = edit.allEntries();
|
||||
// assert.equal(all.length, 3);
|
||||
function isTextChange(thing: [URI, types.TextEdit[]] | [URI, URI, { overwrite?: boolean }]): thing is [URI, types.TextEdit[]] {
|
||||
const [f, s] = thing;
|
||||
return URI.isUri(f) && Array.isArray(s);
|
||||
}
|
||||
|
||||
// function isFileChange(thing: [URI, types.TextEdit[]] | [URI, URI]): thing is [URI, URI] {
|
||||
// const [f, s] = thing;
|
||||
// return URI.isUri(f) && URI.isUri(s);
|
||||
// }
|
||||
const [first, second, third, fourth] = all;
|
||||
assert.equal(first[0].toString(), 'foo:a');
|
||||
assert.ok(!isFileChange(first));
|
||||
assert.ok(isTextChange(first) && first[1].length === 1);
|
||||
|
||||
// function isTextChange(thing: [URI, types.TextEdit[]] | [URI, URI]): thing is [URI, types.TextEdit[]] {
|
||||
// const [f, s] = thing;
|
||||
// return URI.isUri(f) && Array.isArray(s);
|
||||
// }
|
||||
assert.equal(second[0].toString(), 'foo:a');
|
||||
assert.ok(isFileChange(second));
|
||||
|
||||
// const [first, second, third] = all;
|
||||
// assert.equal(first[0].toString(), 'foo:a');
|
||||
// assert.ok(!isFileChange(first));
|
||||
// assert.ok(isTextChange(first) && first[1].length === 2);
|
||||
assert.equal(third[0].toString(), 'foo:a');
|
||||
assert.ok(isTextChange(third) && third[1].length === 1);
|
||||
|
||||
// assert.equal(second[0].toString(), 'foo:a');
|
||||
// assert.ok(isFileChange(second));
|
||||
assert.equal(fourth[0].toString(), 'foo:b');
|
||||
assert.ok(!isFileChange(fourth));
|
||||
assert.ok(isTextChange(fourth) && fourth[1].length === 1);
|
||||
});
|
||||
|
||||
// assert.equal(third[0].toString(), 'foo:b');
|
||||
// assert.ok(!isFileChange(third));
|
||||
// assert.ok(isTextChange(third) && third[1].length === 1);
|
||||
// });
|
||||
test('WorkspaceEdit - two edits for one resource', function () {
|
||||
let edit = new types.WorkspaceEdit();
|
||||
let uri = URI.parse('foo:bar');
|
||||
edit.insert(uri, new types.Position(0, 0), 'Hello');
|
||||
edit.insert(uri, new types.Position(0, 0), 'Foo');
|
||||
|
||||
assert.equal(edit._allEntries().length, 2);
|
||||
let [first, second] = edit._allEntries();
|
||||
assert.equal((first as [URI, types.TextEdit[]])[1][0].newText, 'Hello');
|
||||
assert.equal((second as [URI, types.TextEdit[]])[1][0].newText, 'Foo');
|
||||
});
|
||||
|
||||
test('DocumentLink', function () {
|
||||
assert.throws(() => new types.DocumentLink(null, null));
|
||||
|
||||
@@ -11,11 +11,11 @@ import { ExtHostWebviews } from 'vs/workbench/api/node/extHostWebview';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import * as vscode from 'vscode';
|
||||
import { SingleProxyRPCProtocol } from './testRPCProtocol';
|
||||
import { Position as EditorPosition } from 'vs/platform/editor/common/editor';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
|
||||
|
||||
suite('ExtHostWebview', function () {
|
||||
|
||||
test('Cannot register multiple serializer for the same view type', async () => {
|
||||
test('Cannot register multiple serializers for the same view type', async () => {
|
||||
const viewType = 'view.type';
|
||||
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
@@ -24,9 +24,7 @@ suite('ExtHostWebview', function () {
|
||||
let lastInvokedDeserializer: vscode.WebviewPanelSerializer | undefined = undefined;
|
||||
|
||||
class NoopSerializer implements vscode.WebviewPanelSerializer {
|
||||
async serializeWebviewPanel(webview: vscode.WebviewPanel): Promise<any> { /* noop */ }
|
||||
|
||||
async deserializeWebviewPanel(webview: vscode.WebviewPanel, state: any): Promise<void> {
|
||||
async deserializeWebviewPanel(_webview: vscode.WebviewPanel, _state: any): Promise<void> {
|
||||
lastInvokedDeserializer = this;
|
||||
}
|
||||
}
|
||||
@@ -36,7 +34,7 @@ suite('ExtHostWebview', function () {
|
||||
|
||||
const serializerARegistration = extHostWebviews.registerWebviewPanelSerializer(viewType, serializerA);
|
||||
|
||||
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, EditorPosition.ONE, {});
|
||||
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, 0 as EditorViewColumn, {});
|
||||
assert.strictEqual(lastInvokedDeserializer, serializerA);
|
||||
|
||||
assert.throws(
|
||||
@@ -47,7 +45,7 @@ suite('ExtHostWebview', function () {
|
||||
|
||||
extHostWebviews.registerWebviewPanelSerializer(viewType, serializerB);
|
||||
|
||||
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, EditorPosition.ONE, {});
|
||||
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, 0 as EditorViewColumn, {});
|
||||
assert.strictEqual(lastInvokedDeserializer, serializerB);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import { normalize } from 'vs/base/common/paths';
|
||||
import { IWorkspaceFolderData } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
suite('ExtHostWorkspace', function () {
|
||||
|
||||
@@ -23,8 +24,9 @@ suite('ExtHostWorkspace', function () {
|
||||
publisher: 'vscode',
|
||||
enableProposedApi: false,
|
||||
engines: undefined,
|
||||
extensionFolderPath: undefined,
|
||||
extensionLocation: undefined,
|
||||
isBuiltin: false,
|
||||
isUnderDevelopment: false,
|
||||
version: undefined
|
||||
};
|
||||
|
||||
@@ -176,7 +178,7 @@ suite('ExtHostWorkspace', function () {
|
||||
let ws = new ExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
|
||||
let finished = false;
|
||||
const finish = (error?) => {
|
||||
const finish = (error?: any) => {
|
||||
if (!finished) {
|
||||
finished = true;
|
||||
done(error);
|
||||
@@ -510,6 +512,8 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
finish();
|
||||
});
|
||||
|
||||
// {{SQL CARBON EDIT}} remove broken test
|
||||
|
||||
test('`vscode.workspace.getWorkspaceFolder(file)` don\'t return workspace folder when file open from command line. #36221', function () {
|
||||
let ws = new ExtHostWorkspace(new TestRPCProtocol(), {
|
||||
|
||||
@@ -10,24 +10,35 @@ import { MainThreadDocumentsAndEditors } from 'vs/workbench/api/electron-browser
|
||||
import { SingleProxyRPCProtocol } from './testRPCProtocol';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { TestCodeEditorService } from 'vs/editor/test/browser/testCodeEditorService';
|
||||
import { TestCodeEditorService } from 'vs/editor/test/browser/editorTestServices';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ExtHostDocumentsAndEditorsShape, IDocumentsAndEditorsDelta } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { createTestCodeEditor, TestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { TestEditorService, TestEditorGroupsService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
|
||||
suite('MainThreadDocumentsAndEditors', () => {
|
||||
|
||||
let modelService: ModelServiceImpl;
|
||||
let codeEditorService: TestCodeEditorService;
|
||||
let textFileService: ITextFileService;
|
||||
let workbenchEditorService: IWorkbenchEditorService;
|
||||
let deltas: IDocumentsAndEditorsDelta[] = [];
|
||||
const hugeModelString = new Array(2 + (50 * 1024 * 1024)).join('-');
|
||||
|
||||
function myCreateTestCodeEditor(model: ITextModel): TestCodeEditor {
|
||||
return createTestCodeEditor({
|
||||
model: model,
|
||||
serviceCollection: new ServiceCollection(
|
||||
[ICodeEditorService, codeEditorService]
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
setup(() => {
|
||||
deltas.length = 0;
|
||||
const configService = new TestConfigurationService();
|
||||
@@ -42,29 +53,28 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
onModelDirty: Event.None,
|
||||
};
|
||||
};
|
||||
workbenchEditorService = <IWorkbenchEditorService>{
|
||||
getVisibleEditors() { return []; },
|
||||
getActiveEditor() { return undefined; }
|
||||
};
|
||||
const editorGroupService = new class extends mock<IEditorGroupService>() {
|
||||
onEditorsChanged = Event.None;
|
||||
onEditorGroupMoved = Event.None;
|
||||
const workbenchEditorService = new TestEditorService();
|
||||
const editorGroupService = new TestEditorGroupsService();
|
||||
|
||||
const fileService = new class extends mock<IFileService>() {
|
||||
onAfterOperation = Event.None;
|
||||
};
|
||||
|
||||
/* tslint:disable */
|
||||
new MainThreadDocumentsAndEditors(
|
||||
SingleProxyRPCProtocol(new class extends mock<ExtHostDocumentsAndEditorsShape>() {
|
||||
$acceptDocumentsAndEditorsDelta(delta) { deltas.push(delta); }
|
||||
$acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta) { deltas.push(delta); }
|
||||
}),
|
||||
modelService,
|
||||
textFileService,
|
||||
workbenchEditorService,
|
||||
codeEditorService,
|
||||
null,
|
||||
null,
|
||||
fileService,
|
||||
null,
|
||||
null,
|
||||
editorGroupService,
|
||||
null
|
||||
);
|
||||
/* tslint:enable */
|
||||
});
|
||||
@@ -119,18 +129,17 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
this.timeout(1000 * 60); // increase timeout for this one test
|
||||
|
||||
const model = modelService.createModel(hugeModelString, null, null);
|
||||
const editor = createTestCodeEditor(model);
|
||||
const editor = myCreateTestCodeEditor(model);
|
||||
|
||||
assert.equal(deltas.length, 1);
|
||||
deltas.length = 0;
|
||||
codeEditorService.addCodeEditor(editor);
|
||||
assert.equal(deltas.length, 0);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
|
||||
test('ignore editor w/o model', () => {
|
||||
const editor = createTestCodeEditor(null);
|
||||
editor.setModel(null);
|
||||
codeEditorService.addCodeEditor(editor);
|
||||
const editor = myCreateTestCodeEditor(null);
|
||||
assert.equal(deltas.length, 1);
|
||||
const [delta] = deltas;
|
||||
assert.equal(delta.newActiveEditor, null);
|
||||
@@ -138,13 +147,15 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
assert.equal(delta.removedDocuments, undefined);
|
||||
assert.equal(delta.addedEditors, undefined);
|
||||
assert.equal(delta.removedEditors, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
|
||||
test('editor with model', () => {
|
||||
deltas.length = 0;
|
||||
|
||||
const model = modelService.createModel('farboo', null, null);
|
||||
codeEditorService.addCodeEditor(createTestCodeEditor(model));
|
||||
const editor = myCreateTestCodeEditor(model);
|
||||
|
||||
assert.equal(deltas.length, 2);
|
||||
const [first, second] = deltas;
|
||||
@@ -158,14 +169,15 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
assert.equal(second.addedDocuments, undefined);
|
||||
assert.equal(second.removedDocuments, undefined);
|
||||
assert.equal(second.removedEditors, undefined);
|
||||
assert.equal(typeof second.newActiveEditor, 'string');
|
||||
assert.equal(second.newActiveEditor, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
|
||||
test('editor with dispos-ed/-ing model', () => {
|
||||
modelService.createModel('foobar', null, null);
|
||||
const model = modelService.createModel('farboo', null, null);
|
||||
const editor = createTestCodeEditor(model);
|
||||
codeEditorService.addCodeEditor(editor);
|
||||
const editor = myCreateTestCodeEditor(model);
|
||||
|
||||
// ignore things until now
|
||||
deltas.length = 0;
|
||||
@@ -179,5 +191,7 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
assert.equal(first.removedDocuments.length, 1);
|
||||
assert.equal(first.addedDocuments, undefined);
|
||||
assert.equal(first.addedEditors, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,12 +10,10 @@ import { MainThreadDocumentsAndEditors } from 'vs/workbench/api/electron-browser
|
||||
import { SingleProxyRPCProtocol, TestRPCProtocol } from './testRPCProtocol';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { TestCodeEditorService } from 'vs/editor/test/browser/testCodeEditorService';
|
||||
import { TestCodeEditorService } from 'vs/editor/test/browser/editorTestServices';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ExtHostDocumentsAndEditorsShape, ExtHostContext, ExtHostDocumentsShape } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { MainThreadTextEditors } from 'vs/workbench/api/electron-browser/mainThreadEditors';
|
||||
import URI from 'vs/base/common/uri';
|
||||
@@ -23,10 +21,14 @@ import { Range } from 'vs/editor/common/core/range';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { TestFileService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestFileService, TestEditorService, TestEditorGroupsService, TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IFileStat } from 'vs/platform/files/common/files';
|
||||
import { ResourceTextEdit } from 'vs/editor/common/modes';
|
||||
import { BulkEditService } from 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
import { IReference, ImmortalReference } from 'vs/base/common/lifecycle';
|
||||
import { UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
|
||||
|
||||
suite('MainThreadEditors', () => {
|
||||
|
||||
@@ -48,38 +50,41 @@ suite('MainThreadEditors', () => {
|
||||
createdResources.clear();
|
||||
deletedResources.clear();
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
async moveFile(from, target): TPromise<IFileStat> {
|
||||
movedResources.set(from, target);
|
||||
return createMockFileStat(target);
|
||||
}
|
||||
async createFile(uri): TPromise<IFileStat> {
|
||||
createdResources.add(uri);
|
||||
return createMockFileStat(uri);
|
||||
}
|
||||
async del(uri): TPromise<any> {
|
||||
deletedResources.add(uri);
|
||||
}
|
||||
};
|
||||
|
||||
const fileService = new TestFileService();
|
||||
|
||||
const textFileService = new class extends mock<ITextFileService>() {
|
||||
isDirty() { return false; }
|
||||
create(uri: URI, contents?: string, options?: any) {
|
||||
createdResources.add(uri);
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
delete(resource: URI) {
|
||||
deletedResources.add(resource);
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
move(source: URI, target: URI) {
|
||||
movedResources.set(source, target);
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
models = <any>{
|
||||
onModelSaved: Event.None,
|
||||
onModelReverted: Event.None,
|
||||
onModelDirty: Event.None,
|
||||
};
|
||||
};
|
||||
const workbenchEditorService = <IWorkbenchEditorService>{
|
||||
getVisibleEditors() { return []; },
|
||||
getActiveEditor() { return undefined; }
|
||||
};
|
||||
const editorGroupService = new class extends mock<IEditorGroupService>() {
|
||||
onEditorsChanged = Event.None;
|
||||
onEditorGroupMoved = Event.None;
|
||||
const workbenchEditorService = new TestEditorService();
|
||||
const editorGroupService = new TestEditorGroupsService();
|
||||
const textModelService = new class extends mock<ITextModelService>() {
|
||||
createModelReference(resource: URI): TPromise<IReference<ITextEditorModel>> {
|
||||
const textEditorModel: ITextEditorModel = new class extends mock<ITextEditorModel>() {
|
||||
textEditorModel = modelService.getModel(resource);
|
||||
};
|
||||
return TPromise.as(new ImmortalReference(textEditorModel));
|
||||
}
|
||||
};
|
||||
|
||||
const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new UriDisplayService(TestEnvironmentService, new TestContextService()));
|
||||
|
||||
const rpcProtocol = new TestRPCProtocol();
|
||||
rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock<ExtHostDocumentsShape>() {
|
||||
$acceptModelChanged(): void {
|
||||
@@ -101,17 +106,16 @@ suite('MainThreadEditors', () => {
|
||||
null,
|
||||
null,
|
||||
editorGroupService,
|
||||
bulkEditService,
|
||||
);
|
||||
|
||||
editors = new MainThreadTextEditors(
|
||||
documentAndEditor,
|
||||
SingleProxyRPCProtocol(null),
|
||||
codeEditorService,
|
||||
bulkEditService,
|
||||
workbenchEditorService,
|
||||
editorGroupService,
|
||||
null,
|
||||
fileService,
|
||||
modelService
|
||||
);
|
||||
});
|
||||
|
||||
@@ -136,12 +140,44 @@ suite('MainThreadEditors', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test(`issue #54773: applyWorkspaceEdit checks model version in race situation`, () => {
|
||||
|
||||
let model = modelService.createModel('something', null, resource);
|
||||
|
||||
let workspaceResourceEdit1: ResourceTextEdit = {
|
||||
resource: resource,
|
||||
modelVersionId: model.getVersionId(),
|
||||
edits: [{
|
||||
text: 'asdfg',
|
||||
range: new Range(1, 1, 1, 1)
|
||||
}]
|
||||
};
|
||||
let workspaceResourceEdit2: ResourceTextEdit = {
|
||||
resource: resource,
|
||||
modelVersionId: model.getVersionId(),
|
||||
edits: [{
|
||||
text: 'asdfg',
|
||||
range: new Range(1, 1, 1, 1)
|
||||
}]
|
||||
};
|
||||
|
||||
let p1 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit1] }).then((result) => {
|
||||
// first edit request succeeds
|
||||
assert.equal(result, true);
|
||||
});
|
||||
let p2 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit2] }).then((result) => {
|
||||
// second edit request fails
|
||||
assert.equal(result, false);
|
||||
});
|
||||
return TPromise.join([p1, p2]);
|
||||
});
|
||||
|
||||
test(`applyWorkspaceEdit with only resource edit`, () => {
|
||||
return editors.$tryApplyWorkspaceEdit({
|
||||
edits: [
|
||||
{ oldUri: resource, newUri: resource },
|
||||
{ oldUri: undefined, newUri: resource },
|
||||
{ oldUri: resource, newUri: undefined }
|
||||
{ oldUri: resource, newUri: resource, options: undefined },
|
||||
{ oldUri: undefined, newUri: resource, options: undefined },
|
||||
{ oldUri: resource, newUri: undefined, options: undefined }
|
||||
]
|
||||
}).then((result) => {
|
||||
assert.equal(result, true);
|
||||
@@ -151,15 +187,3 @@ suite('MainThreadEditors', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function createMockFileStat(target: URI): IFileStat {
|
||||
return {
|
||||
etag: '',
|
||||
isDirectory: false,
|
||||
name: target.path,
|
||||
mtime: 0,
|
||||
resource: target
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ suite('MainThreadSaveParticipant', function () {
|
||||
let lineContent = `${textContent}`;
|
||||
model.textEditorModel.setValue(lineContent);
|
||||
// apply edits and push to undo stack.
|
||||
let textEdits = [{ identifier: null, range: new Range(1, 14, 1, 14), text: '.', forceMoveMarkers: false }];
|
||||
let textEdits = [{ range: new Range(1, 14, 1, 14), text: '.', forceMoveMarkers: false }];
|
||||
model.textEditorModel.pushEditOperations([new Selection(1, 14, 1, 14)], textEdits, () => { return [new Selection(1, 15, 1, 15)]; });
|
||||
// undo
|
||||
model.textEditorModel.undo();
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ProxyIdentifier, IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
|
||||
import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
export function SingleProxyRPCProtocol(thing: any): IRPCProtocol {
|
||||
export function SingleProxyRPCProtocol(thing: any): IExtHostContext {
|
||||
return {
|
||||
getProxy<T>(): T {
|
||||
return thing;
|
||||
@@ -21,9 +22,9 @@ export function SingleProxyRPCProtocol(thing: any): IRPCProtocol {
|
||||
};
|
||||
}
|
||||
|
||||
declare var Proxy; // TODO@TypeScript
|
||||
declare var Proxy: any; // TODO@TypeScript
|
||||
|
||||
export class TestRPCProtocol implements IRPCProtocol {
|
||||
export class TestRPCProtocol implements IExtHostContext {
|
||||
|
||||
private _callCountValue: number = 0;
|
||||
private _idle: Promise<any>;
|
||||
@@ -76,7 +77,7 @@ export class TestRPCProtocol implements IRPCProtocol {
|
||||
|
||||
private _createProxy<T>(proxyId: string): T {
|
||||
let handler = {
|
||||
get: (target, name: string) => {
|
||||
get: (target: any, name: string) => {
|
||||
if (!target[name] && name.charCodeAt(0) === CharCode.DollarSign) {
|
||||
target[name] = (...myArgs: any[]) => {
|
||||
return this._remoteCall(proxyId, name, myArgs);
|
||||
|
||||
@@ -9,24 +9,23 @@ import 'vs/workbench/parts/search/electron-browser/search.contribution'; // load
|
||||
import * as assert from 'assert';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { ISearchService } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExperimentService, IExperiments } from 'vs/platform/telemetry/common/experiments';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as minimist from 'minimist';
|
||||
import * as path from 'path';
|
||||
import { IQuickOpenRegistry, Extensions } from 'vs/workbench/browser/quickopen';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestEnvironmentService, TestContextService, TestEditorService, TestEditorGroupsService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -68,16 +67,14 @@ suite.skip('QuickOpen performance (integration)', () => {
|
||||
const testWorkspacePath = testWorkspaceArg ? path.resolve(testWorkspaceArg) : __dirname;
|
||||
|
||||
const telemetryService = new TestTelemetryService();
|
||||
const experimentService = new TestExperimentService();
|
||||
const configurationService = new SimpleConfigurationService();
|
||||
const configurationService = new TestConfigurationService();
|
||||
const instantiationService = new InstantiationService(new ServiceCollection(
|
||||
[ITelemetryService, telemetryService],
|
||||
[IExperimentService, experimentService],
|
||||
[IConfigurationService, configurationService],
|
||||
[IModelService, new ModelServiceImpl(null, configurationService)],
|
||||
[IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))],
|
||||
[IWorkbenchEditorService, new TestEditorService()],
|
||||
[IEditorGroupService, new TestEditorGroupService()],
|
||||
[IEditorService, new TestEditorService()],
|
||||
[IEditorGroupsService, new TestEditorGroupsService()],
|
||||
[IEnvironmentService, TestEnvironmentService],
|
||||
[IUntitledEditorService, createSyncDescriptor(UntitledEditorService)],
|
||||
[ISearchService, createSyncDescriptor(SearchService)]
|
||||
@@ -179,12 +176,3 @@ class TestTelemetryService implements ITelemetryService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class TestExperimentService implements IExperimentService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
getExperiments(): IExperiments {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,21 +10,21 @@ import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { ISearchService, IQueryOptions } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as minimist from 'minimist';
|
||||
import * as path from 'path';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestEnvironmentService, TestContextService, TestEditorService, TestEditorGroupsService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -42,7 +42,7 @@ declare var __dirname: string;
|
||||
// git clone --separate-git-dir=testGit --no-checkout --single-branch https://chromium.googlesource.com/chromium/src testWorkspace
|
||||
// cd testWorkspace; git checkout 39a7f93d67f7
|
||||
// Run from repository root folder with (test.bat on Windows): ./scripts/test-int-mocha.sh --grep TextSearch.performance --timeout 500000 --testWorkspace <path>
|
||||
suite('TextSearch performance (integration)', () => {
|
||||
suite.skip('TextSearch performance (integration)', () => {
|
||||
|
||||
test('Measure', () => {
|
||||
if (process.env['VSCODE_PID']) {
|
||||
@@ -58,14 +58,14 @@ suite('TextSearch performance (integration)', () => {
|
||||
}
|
||||
|
||||
const telemetryService = new TestTelemetryService();
|
||||
const configurationService = new SimpleConfigurationService();
|
||||
const configurationService = new TestConfigurationService();
|
||||
const instantiationService = new InstantiationService(new ServiceCollection(
|
||||
[ITelemetryService, telemetryService],
|
||||
[IConfigurationService, configurationService],
|
||||
[IModelService, new ModelServiceImpl(null, configurationService)],
|
||||
[IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))],
|
||||
[IWorkbenchEditorService, new TestEditorService()],
|
||||
[IEditorGroupService, new TestEditorGroupService()],
|
||||
[IEditorService, new TestEditorService()],
|
||||
[IEditorGroupsService, new TestEditorGroupsService()],
|
||||
[IEnvironmentService, TestEnvironmentService],
|
||||
[IUntitledEditorService, createSyncDescriptor(UntitledEditorService)],
|
||||
[ISearchService, createSyncDescriptor(SearchService)],
|
||||
|
||||
Reference in New Issue
Block a user