Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -878,12 +878,12 @@ suite('ExtHostLanguageFeatureCommands', function () {
let incoming = await commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.executeCallHierarchyProviderIncomingCalls', model.uri, new types.Position(0, 10));
assert.equal(incoming.length, 1);
assert.ok(incoming[0].source instanceof types.CallHierarchyItem);
assert.equal(incoming[0].source.name, 'IN');
assert.ok(incoming[0].from instanceof types.CallHierarchyItem);
assert.equal(incoming[0].from.name, 'IN');
let outgoing = await commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.executeCallHierarchyProviderOutgoingCalls', model.uri, new types.Position(0, 10));
assert.equal(outgoing.length, 1);
assert.ok(outgoing[0].target instanceof types.CallHierarchyItem);
assert.equal(outgoing[0].target.name, 'OUT');
assert.ok(outgoing[0].to instanceof types.CallHierarchyItem);
assert.equal(outgoing[0].to.name, 'OUT');
});
});

View File

@@ -20,7 +20,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
suite('ExtHostConfiguration', function () {
class RecordingShape extends mock<MainThreadConfigurationShape>() {
lastArgs: [ConfigurationTarget, string, any];
lastArgs!: [ConfigurationTarget, string, any];
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): Promise<void> {
this.lastArgs = [target, key, value];
return Promise.resolve(undefined);

View File

@@ -6,7 +6,7 @@
import * as assert from 'assert';
import { MainThreadMessageService } from 'vs/workbench/api/browser/mainThreadMessageService';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotification, NoOpNotification, INotificationHandle, Severity, IPromptChoice, IPromptOptions, IStatusMessageOptions } from 'vs/platform/notification/common/notification';
import { INotificationService, INotification, NoOpNotification, INotificationHandle, Severity, IPromptChoice, IPromptOptions, IStatusMessageOptions, NotificationsFilter } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
@@ -55,6 +55,9 @@ const emptyNotificationService = new class implements INotificationService {
status(message: string | Error, options?: IStatusMessageOptions): IDisposable {
return Disposable.None;
}
setFilter(filter: NotificationsFilter): void {
throw new Error('not implemented.');
}
};
class EmptyNotificationService implements INotificationService {
@@ -78,11 +81,14 @@ class EmptyNotificationService implements INotificationService {
throw new Error('Method not implemented.');
}
prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle {
throw new Error('not implemented');
throw new Error('Method not implemented');
}
status(message: string, options?: IStatusMessageOptions): IDisposable {
return Disposable.None;
}
setFilter(filter: NotificationsFilter): void {
throw new Error('Method not implemented.');
}
}
suite('ExtHostMessageService', function () {

View File

@@ -28,7 +28,7 @@ const disposables = new DisposableStore();
let mockMainThreadSearch: MockMainThreadSearch;
class MockMainThreadSearch implements MainThreadSearchShape {
lastHandle: number;
lastHandle!: number;
results: Array<UriComponents | IRawFileMatch2> = [];

View File

@@ -7,9 +7,10 @@
import * as assert from 'assert';
import { MarkdownString, LogLevel } from 'vs/workbench/api/common/extHostTypeConverters';
import { isEmptyObject } from 'vs/base/common/types';
import { size } from 'vs/base/common/collections';
import { size, forEach } from 'vs/base/common/collections';
import * as types from 'vs/workbench/api/common/extHostTypes';
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
import { URI } from 'vs/base/common/uri';
suite('ExtHostTypeConverter', function () {
@@ -21,11 +22,13 @@ suite('ExtHostTypeConverter', function () {
data = MarkdownString.from('Hello [link](foo)');
assert.equal(data.value, 'Hello [link](foo)');
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['foo']);
data = MarkdownString.from('Hello [link](www.noscheme.bad)');
assert.equal(data.value, 'Hello [link](www.noscheme.bad)');
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['www.noscheme.bad']);
data = MarkdownString.from('Hello [link](foo:path)');
assert.equal(data.value, 'Hello [link](foo:path)');
@@ -59,6 +62,20 @@ suite('ExtHostTypeConverter', function () {
assert.ok(!!data.uris!['file:///somepath/here2']);
});
test('NPM script explorer running a script from the hover does not work #65561', function () {
let data = MarkdownString.from('*hello* [click](command:npm.runScriptFromHover?%7B%22documentUri%22%3A%7B%22%24mid%22%3A1%2C%22external%22%3A%22file%3A%2F%2F%2Fc%253A%2Ffoo%2Fbaz.ex%22%2C%22path%22%3A%22%2Fc%3A%2Ffoo%2Fbaz.ex%22%2C%22scheme%22%3A%22file%22%7D%2C%22script%22%3A%22dev%22%7D)');
// assert that both uri get extracted but that the latter is only decoded once...
assert.equal(size(data.uris!), 2);
forEach(data.uris!, entry => {
if (entry.value.scheme === 'file') {
assert.ok(URI.revive(entry.value).toString().indexOf('file:///c%3A') === 0);
} else {
assert.equal(entry.value.scheme, 'command');
}
});
});
test('LogLevel', () => {
assert.equal(LogLevel.from(types.LogLevel.Error), _MainLogLevel.Error);
assert.equal(LogLevel.from(types.LogLevel.Info), _MainLogLevel.Info);

View File

@@ -11,6 +11,7 @@ import * as vscode from 'vscode';
import { SingleProxyRPCProtocol } from './testRPCProtocol';
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
import { URI } from 'vs/base/common/uri';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
suite('ExtHostWebview', () => {
@@ -22,7 +23,7 @@ suite('ExtHostWebview', () => {
webviewCspSource: '',
webviewResourceRoot: '',
isExtensionDevelopmentDebug: false,
});
}, undefined);
let lastInvokedDeserializer: vscode.WebviewPanelSerializer | undefined = undefined;
@@ -32,21 +33,23 @@ suite('ExtHostWebview', () => {
}
}
const extension = {} as IExtensionDescription;
const serializerA = new NoopSerializer();
const serializerB = new NoopSerializer();
const serializerARegistration = extHostWebviews.registerWebviewPanelSerializer(viewType, serializerA);
const serializerARegistration = extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializerA);
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, 0 as EditorViewColumn, {});
assert.strictEqual(lastInvokedDeserializer, serializerA);
assert.throws(
() => extHostWebviews.registerWebviewPanelSerializer(viewType, serializerB),
() => extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializerB),
'Should throw when registering two serializers for the same view');
serializerARegistration.dispose();
extHostWebviews.registerWebviewPanelSerializer(viewType, serializerB);
extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializerB);
await extHostWebviews.$deserializeWebviewPanel('x', viewType, 'title', {}, 0 as EditorViewColumn, {});
assert.strictEqual(lastInvokedDeserializer, serializerB);
@@ -58,7 +61,7 @@ suite('ExtHostWebview', () => {
webviewCspSource: '',
webviewResourceRoot: 'vscode-resource://{{resource}}',
isExtensionDevelopmentDebug: false,
});
}, undefined);
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
assert.strictEqual(
@@ -99,7 +102,7 @@ suite('ExtHostWebview', () => {
webviewCspSource: '',
webviewResourceRoot: `https://{{uuid}}.webview.contoso.com/commit/{{resource}}`,
isExtensionDevelopmentDebug: false,
});
}, undefined);
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
function stripEndpointUuid(input: string) {

View File

@@ -79,7 +79,7 @@ suite('MainThreadDocumentsAndEditors', () => {
onDidPanelOpen = Event.None;
onDidPanelClose = Event.None;
getActivePanel() {
return null;
return undefined;
}
},
TestEnvironmentService

View File

@@ -111,7 +111,7 @@ suite('MainThreadEditors', () => {
onDidPanelOpen = Event.None;
onDidPanelClose = Event.None;
getActivePanel() {
return null;
return undefined;
}
},
TestEnvironmentService