mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 17:24:01 -05:00
Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)
* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 * fix pipelines * fix strict-null-checks * add missing files
This commit is contained in:
@@ -39,7 +39,7 @@ interface IOpenFolderAPICommandOptions {
|
||||
}
|
||||
|
||||
export class OpenFolderAPICommand {
|
||||
public static ID = 'vscode.openFolder';
|
||||
public static readonly ID = 'vscode.openFolder';
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, forceNewWindow?: boolean): Promise<any>;
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, options?: IOpenFolderAPICommandOptions): Promise<any>;
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, arg: boolean | IOpenFolderAPICommandOptions = {}): Promise<any> {
|
||||
@@ -73,7 +73,7 @@ interface INewWindowAPICommandOptions {
|
||||
}
|
||||
|
||||
export class NewWindowAPICommand {
|
||||
public static ID = 'vscode.newWindow';
|
||||
public static readonly ID = 'vscode.newWindow';
|
||||
public static execute(executor: ICommandsExecutor, options?: INewWindowAPICommandOptions): Promise<any> {
|
||||
const commandOptions: IOpenEmptyWindowOptions = {
|
||||
forceReuseWindow: options && options.reuseWindow,
|
||||
@@ -94,7 +94,7 @@ CommandsRegistry.registerCommand({
|
||||
});
|
||||
|
||||
export class DiffAPICommand {
|
||||
public static ID = 'vscode.diff';
|
||||
public static readonly ID = 'vscode.diff';
|
||||
public static execute(executor: ICommandsExecutor, left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions): Promise<any> {
|
||||
return executor.executeCommand('_workbench.diff', [
|
||||
left, right,
|
||||
@@ -108,7 +108,7 @@ export class DiffAPICommand {
|
||||
CommandsRegistry.registerCommand(DiffAPICommand.ID, adjustHandler(DiffAPICommand.execute));
|
||||
|
||||
export class OpenAPICommand {
|
||||
public static ID = 'vscode.open';
|
||||
public static readonly ID = 'vscode.open';
|
||||
public static execute(executor: ICommandsExecutor, resource: URI, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions, label?: string): Promise<any> {
|
||||
let options: ITextEditorOptions | undefined;
|
||||
let position: EditorViewColumn | undefined;
|
||||
@@ -138,7 +138,7 @@ CommandsRegistry.registerCommand('_workbench.removeFromRecentlyOpened', function
|
||||
});
|
||||
|
||||
export class RemoveFromRecentlyOpenedAPICommand {
|
||||
public static ID = 'vscode.removeFromRecentlyOpened';
|
||||
public static readonly ID = 'vscode.removeFromRecentlyOpened';
|
||||
public static execute(executor: ICommandsExecutor, path: string | URI): Promise<any> {
|
||||
if (typeof path === 'string') {
|
||||
path = path.match(/^[^:/?#]+:\/\//) ? URI.parse(path) : URI.file(path);
|
||||
@@ -151,7 +151,7 @@ export class RemoveFromRecentlyOpenedAPICommand {
|
||||
CommandsRegistry.registerCommand(RemoveFromRecentlyOpenedAPICommand.ID, adjustHandler(RemoveFromRecentlyOpenedAPICommand.execute));
|
||||
|
||||
export class OpenIssueReporter {
|
||||
public static ID = 'vscode.openIssueReporter';
|
||||
public static readonly ID = 'vscode.openIssueReporter';
|
||||
public static execute(executor: ICommandsExecutor, extensionId: string): Promise<void> {
|
||||
return executor.executeCommand('workbench.action.openIssueReporter', [extensionId]);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ CommandsRegistry.registerCommand('_workbench.getRecentlyOpened', async function
|
||||
});
|
||||
|
||||
export class SetEditorLayoutAPICommand {
|
||||
public static ID = 'vscode.setEditorLayout';
|
||||
public static readonly ID = 'vscode.setEditorLayout';
|
||||
public static execute(executor: ICommandsExecutor, layout: EditorGroupLayout): Promise<any> {
|
||||
return executor.executeCommand('layoutEditorGroups', layout);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { ExtensionsRegistry, IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IConfigurationNode, IConfigurationRegistry, Extensions, editorConfigurationSchemaId, IDefaultConfigurationExtension, validateProperty, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { workspaceSettingsSchemaId, launchSchemaId } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { workspaceSettingsSchemaId, launchSchemaId, tasksSchemaId } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
@@ -296,6 +296,12 @@ jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
|
||||
description: nls.localize('workspaceConfig.launch.description', "Workspace launch configurations"),
|
||||
$ref: launchSchemaId
|
||||
},
|
||||
'tasks': {
|
||||
type: 'object',
|
||||
default: { version: '2.0.0', tasks: [] },
|
||||
description: nls.localize('workspaceConfig.tasks.description', "Workspace task configurations"),
|
||||
$ref: tasksSchemaId
|
||||
},
|
||||
'extensions': {
|
||||
type: 'object',
|
||||
default: {},
|
||||
|
||||
@@ -105,7 +105,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostOutputService = rpcProtocol.set(ExtHostContext.ExtHostOutputService, accessor.get(IExtHostOutputService));
|
||||
|
||||
// manually create and register addressable instances
|
||||
const extHostWebviews = rpcProtocol.set(ExtHostContext.ExtHostWebviews, new ExtHostWebviews(rpcProtocol, initData.environment));
|
||||
const extHostWebviews = rpcProtocol.set(ExtHostContext.ExtHostWebviews, new ExtHostWebviews(rpcProtocol, initData.environment, extHostWorkspace));
|
||||
const extHostUrls = rpcProtocol.set(ExtHostContext.ExtHostUrls, new ExtHostUrls(rpcProtocol));
|
||||
const extHostDocuments = rpcProtocol.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors));
|
||||
const extHostDocumentContentProviders = rpcProtocol.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(rpcProtocol, extHostDocumentsAndEditors, extHostLogService));
|
||||
@@ -250,14 +250,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
return extHostWindow.openUri(uri, { allowTunneling: !!initData.remote.isRemote });
|
||||
},
|
||||
asExternalUri(uri: URI) {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWindow.asExternalUri(uri, { allowTunneling: !!initData.remote.isRemote });
|
||||
},
|
||||
get remoteName() {
|
||||
return getRemoteName(initData.remote.authority);
|
||||
},
|
||||
get uiKind() {
|
||||
checkProposedApiEnabled(extension);
|
||||
return initData.uiKind;
|
||||
}
|
||||
};
|
||||
@@ -533,11 +531,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
return extHostTreeViews.createTreeView(viewId, options, extension);
|
||||
},
|
||||
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
||||
return extHostWebviews.registerWebviewPanelSerializer(viewType, serializer);
|
||||
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
||||
},
|
||||
registerWebviewEditorProvider: (viewType: string, provider: vscode.WebviewEditorProvider) => {
|
||||
registerWebviewEditorProvider: (viewType: string, provider: vscode.WebviewEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWebviews.registerWebviewEditorProvider(extension, viewType, provider);
|
||||
return extHostWebviews.registerWebviewEditorProvider(extension, viewType, provider, options);
|
||||
},
|
||||
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
||||
checkProposedApiEnabled(extension);
|
||||
@@ -635,7 +633,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const options = uriOrFileNameOrOptions as { language?: string; content?: string; };
|
||||
if (typeof uriOrFileNameOrOptions === 'string') {
|
||||
uriPromise = Promise.resolve(URI.file(uriOrFileNameOrOptions));
|
||||
} else if (uriOrFileNameOrOptions instanceof URI) {
|
||||
} else if (URI.isUri(uriOrFileNameOrOptions)) {
|
||||
uriPromise = Promise.resolve(uriOrFileNameOrOptions);
|
||||
} else if (!options || typeof options === 'object') {
|
||||
uriPromise = extHostDocuments.createDocumentData(options);
|
||||
@@ -850,7 +848,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
EndOfLine: extHostTypes.EndOfLine,
|
||||
EventEmitter: Emitter,
|
||||
ExtensionKind: extHostTypes.ExtensionKind,
|
||||
CustomExecution2: extHostTypes.CustomExecution2,
|
||||
CustomExecution: extHostTypes.CustomExecution,
|
||||
FileChangeType: extHostTypes.FileChangeType,
|
||||
FileSystemError: extHostTypes.FileSystemError,
|
||||
FileType: files.FileType,
|
||||
|
||||
@@ -509,7 +509,7 @@ export interface MainThreadQuickOpenShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadStatusBarShape extends IDisposable {
|
||||
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string, command: string, color: string | ThemeColor, alignment: statusbar.StatusbarAlignment, priority: number | undefined): void;
|
||||
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: string | undefined, color: string | ThemeColor | undefined, alignment: statusbar.StatusbarAlignment, priority: number | undefined): void;
|
||||
$dispose(id: number): void;
|
||||
}
|
||||
|
||||
@@ -544,8 +544,13 @@ export interface WebviewPanelShowOptions {
|
||||
readonly preserveFocus?: boolean;
|
||||
}
|
||||
|
||||
export interface WebviewExtensionDescription {
|
||||
readonly id: ExtensionIdentifier;
|
||||
readonly location: UriComponents;
|
||||
}
|
||||
|
||||
export interface MainThreadWebviewsShape extends IDisposable {
|
||||
$createWebviewPanel(handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: modes.IWebviewPanelOptions & modes.IWebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void;
|
||||
$createWebviewPanel(extension: WebviewExtensionDescription, handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: modes.IWebviewPanelOptions & modes.IWebviewOptions): void;
|
||||
$disposeWebview(handle: WebviewPanelHandle): void;
|
||||
$reveal(handle: WebviewPanelHandle, showOptions: WebviewPanelShowOptions): void;
|
||||
$setTitle(handle: WebviewPanelHandle, value: string): void;
|
||||
@@ -554,14 +559,13 @@ export interface MainThreadWebviewsShape extends IDisposable {
|
||||
|
||||
$setHtml(handle: WebviewPanelHandle, value: string): void;
|
||||
$setOptions(handle: WebviewPanelHandle, options: modes.IWebviewOptions): void;
|
||||
$setExtension(handle: WebviewPanelHandle, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void;
|
||||
|
||||
$postMessage(handle: WebviewPanelHandle, value: any): Promise<boolean>;
|
||||
|
||||
$registerSerializer(viewType: string): void;
|
||||
$unregisterSerializer(viewType: string): void;
|
||||
|
||||
$registerEditorProvider(viewType: string): void;
|
||||
$registerEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void;
|
||||
$unregisterEditorProvider(viewType: string): void;
|
||||
}
|
||||
|
||||
@@ -579,7 +583,7 @@ export interface ExtHostWebviewsShape {
|
||||
$onDidChangeWebviewPanelViewStates(newState: WebviewPanelViewStateData): void;
|
||||
$onDidDisposeWebviewPanel(handle: WebviewPanelHandle): Promise<void>;
|
||||
$deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: modes.IWebviewOptions & modes.IWebviewPanelOptions): Promise<void>;
|
||||
$resolveWebviewEditor(resource: UriComponents, newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: modes.IWebviewOptions & modes.IWebviewPanelOptions): Promise<void>;
|
||||
$resolveWebviewEditor(resource: UriComponents, newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, position: EditorViewColumn, options: modes.IWebviewOptions & modes.IWebviewPanelOptions): Promise<void>;
|
||||
$save(handle: WebviewPanelHandle): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import * as vscode from 'vscode';
|
||||
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import * as types from 'vs/workbench/api/common/extHostTypes';
|
||||
@@ -27,7 +27,7 @@ export class ExtHostApiCommands {
|
||||
}
|
||||
|
||||
private _commands: ExtHostCommands;
|
||||
private _disposables: IDisposable[] = [];
|
||||
private readonly _disposables = new DisposableStore();
|
||||
|
||||
private constructor(commands: ExtHostCommands) {
|
||||
this._commands = commands;
|
||||
@@ -239,7 +239,7 @@ export class ExtHostApiCommands {
|
||||
this._register(OpenFolderAPICommand.ID, adjustHandler(OpenFolderAPICommand.execute), {
|
||||
description: 'Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.',
|
||||
args: [
|
||||
{ name: 'uri', description: '(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder', constraint: (value: any) => value === undefined || value instanceof URI },
|
||||
{ name: 'uri', description: '(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder', constraint: (value: any) => value === undefined || URI.isUri(value) },
|
||||
{ name: 'options', description: '(optional) Options. Object with the following properties: `forceNewWindow `: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `noRecentEntry`: Whether the opened URI will appear in the \'Open Recent\' list. Defaults to true. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.', constraint: (value: any) => value === undefined || typeof value === 'object' || typeof value === 'boolean' }
|
||||
]
|
||||
});
|
||||
@@ -288,7 +288,7 @@ export class ExtHostApiCommands {
|
||||
|
||||
private _register(id: string, handler: (...args: any[]) => any, description?: ICommandHandlerDescription): void {
|
||||
const disposable = this._commands.registerCommand(false, id, handler, this, description);
|
||||
this._disposables.push(disposable);
|
||||
this._disposables.add(disposable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -576,30 +576,30 @@ export class ExtHostApiCommands {
|
||||
|
||||
private async _executeCallHierarchyIncomingCallsProvider(resource: URI, position: types.Position): Promise<vscode.CallHierarchyIncomingCall[]> {
|
||||
type IncomingCallDto = {
|
||||
source: ICallHierarchyItemDto;
|
||||
sourceRanges: IRange[];
|
||||
from: ICallHierarchyItemDto;
|
||||
fromRanges: IRange[];
|
||||
};
|
||||
const args = { resource, position: typeConverters.Position.from(position) };
|
||||
const calls = await this._commands.executeCommand<IncomingCallDto[]>('_executeCallHierarchyIncomingCalls', args);
|
||||
|
||||
const result: vscode.CallHierarchyIncomingCall[] = [];
|
||||
for (const call of calls) {
|
||||
result.push(new types.CallHierarchyIncomingCall(typeConverters.CallHierarchyItem.to(call.source), <vscode.Range[]>call.sourceRanges.map(typeConverters.Range.to)));
|
||||
result.push(new types.CallHierarchyIncomingCall(typeConverters.CallHierarchyItem.to(call.from), <vscode.Range[]>call.fromRanges.map(typeConverters.Range.to)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private async _executeCallHierarchyOutgoingCallsProvider(resource: URI, position: types.Position): Promise<vscode.CallHierarchyOutgoingCall[]> {
|
||||
type OutgoingCallDto = {
|
||||
sourceRanges: IRange[];
|
||||
target: ICallHierarchyItemDto;
|
||||
fromRanges: IRange[];
|
||||
to: ICallHierarchyItemDto;
|
||||
};
|
||||
const args = { resource, position: typeConverters.Position.from(position) };
|
||||
const calls = await this._commands.executeCommand<OutgoingCallDto[]>('_executeCallHierarchyOutgoingCalls', args);
|
||||
|
||||
const result: vscode.CallHierarchyOutgoingCall[] = [];
|
||||
for (const call of calls) {
|
||||
result.push(new types.CallHierarchyOutgoingCall(typeConverters.CallHierarchyItem.to(call.target), <vscode.Range[]>call.sourceRanges.map(typeConverters.Range.to)));
|
||||
result.push(new types.CallHierarchyOutgoingCall(typeConverters.CallHierarchyItem.to(call.to), <vscode.Range[]>call.fromRanges.map(typeConverters.Range.to)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
this._checkDisposed();
|
||||
let toSync: vscode.Uri[] = [];
|
||||
|
||||
if (first instanceof URI) {
|
||||
if (URI.isUri(first)) {
|
||||
|
||||
if (!diagnostics) {
|
||||
// remove this entry
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ensureValidWordDefinition, getWordAtText } from 'vs/editor/common/model
|
||||
import { MainThreadDocumentsShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { EndOfLine, Position, Range } from 'vs/workbench/api/common/extHostTypes';
|
||||
import * as vscode from 'vscode';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
|
||||
const _modeId2WordDefinition = new Map<string, RegExp>();
|
||||
export function setWordDefinitionFor(modeId: string, wordDefinition: RegExp | undefined): void {
|
||||
@@ -48,17 +49,8 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
this._isDirty = false;
|
||||
}
|
||||
|
||||
equalLines(lines: string[]): boolean {
|
||||
const len = lines.length;
|
||||
if (len !== this._lines.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (lines[i] !== this._lines[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
equalLines(lines: readonly string[]): boolean {
|
||||
return equals(this._lines, lines);
|
||||
}
|
||||
|
||||
get document(): vscode.TextDocument {
|
||||
|
||||
@@ -1021,7 +1021,7 @@ class CallHierarchyAdapter {
|
||||
if (!calls) {
|
||||
return undefined;
|
||||
}
|
||||
return calls.map(call => (<[extHostProtocol.ICallHierarchyItemDto, IRange[]]>[typeConvert.CallHierarchyItem.from(call.source), call.sourceRanges.map(typeConvert.Range.from)]));
|
||||
return calls.map(call => (<[extHostProtocol.ICallHierarchyItemDto, IRange[]]>[typeConvert.CallHierarchyItem.from(call.from), call.fromRanges.map(typeConvert.Range.from)]));
|
||||
}
|
||||
|
||||
async provideCallsFrom(uri: URI, position: IPosition, token: CancellationToken): Promise<[extHostProtocol.ICallHierarchyItemDto, IRange[]][] | undefined> {
|
||||
@@ -1031,7 +1031,7 @@ class CallHierarchyAdapter {
|
||||
if (!calls) {
|
||||
return undefined;
|
||||
}
|
||||
return calls.map(call => (<[extHostProtocol.ICallHierarchyItemDto, IRange[]]>[typeConvert.CallHierarchyItem.from(call.target), call.sourceRanges.map(typeConvert.Range.from)]));
|
||||
return calls.map(call => (<[extHostProtocol.ICallHierarchyItemDto, IRange[]]>[typeConvert.CallHierarchyItem.from(call.to), call.fromRanges.map(typeConvert.Range.from)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -234,16 +234,16 @@ class ExtHostQuickInput implements QuickInput {
|
||||
private static _nextId = 1;
|
||||
_id = ExtHostQuickPick._nextId++;
|
||||
|
||||
private _title: string;
|
||||
private _steps: number;
|
||||
private _totalSteps: number;
|
||||
private _title: string | undefined;
|
||||
private _steps: number | undefined;
|
||||
private _totalSteps: number | undefined;
|
||||
private _visible = false;
|
||||
private _expectingHide = false;
|
||||
private _enabled = true;
|
||||
private _busy = false;
|
||||
private _ignoreFocusOut = true;
|
||||
private _value = '';
|
||||
private _placeholder: string;
|
||||
private _placeholder: string | undefined;
|
||||
private _buttons: QuickInputButton[] = [];
|
||||
private _handlesToButtons = new Map<number, QuickInputButton>();
|
||||
private readonly _onDidAcceptEmitter = new Emitter<void>();
|
||||
@@ -268,7 +268,7 @@ class ExtHostQuickInput implements QuickInput {
|
||||
return this._title;
|
||||
}
|
||||
|
||||
set title(title: string) {
|
||||
set title(title: string | undefined) {
|
||||
this._title = title;
|
||||
this.update({ title });
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class ExtHostQuickInput implements QuickInput {
|
||||
return this._steps;
|
||||
}
|
||||
|
||||
set step(step: number) {
|
||||
set step(step: number | undefined) {
|
||||
this._steps = step;
|
||||
this.update({ step });
|
||||
}
|
||||
@@ -286,7 +286,7 @@ class ExtHostQuickInput implements QuickInput {
|
||||
return this._totalSteps;
|
||||
}
|
||||
|
||||
set totalSteps(totalSteps: number) {
|
||||
set totalSteps(totalSteps: number | undefined) {
|
||||
this._totalSteps = totalSteps;
|
||||
this.update({ totalSteps });
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class ExtHostQuickInput implements QuickInput {
|
||||
return this._placeholder;
|
||||
}
|
||||
|
||||
set placeholder(placeholder: string) {
|
||||
set placeholder(placeholder: string | undefined) {
|
||||
this._placeholder = placeholder;
|
||||
this.update({ placeholder });
|
||||
}
|
||||
@@ -398,7 +398,7 @@ class ExtHostQuickInput implements QuickInput {
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
dispose(): void {
|
||||
if (this._disposed) {
|
||||
return;
|
||||
}
|
||||
@@ -455,7 +455,7 @@ function getIconUris(iconPath: QuickInputButton['iconPath']): { dark: URI, light
|
||||
function getLightIconUri(iconPath: QuickInputButton['iconPath']) {
|
||||
if (iconPath && !(iconPath instanceof ThemeIcon)) {
|
||||
if (typeof iconPath === 'string'
|
||||
|| iconPath instanceof URI) {
|
||||
|| URI.isUri(iconPath)) {
|
||||
return getIconUri(iconPath);
|
||||
}
|
||||
return getIconUri((iconPath as any).light);
|
||||
@@ -471,7 +471,7 @@ function getDarkIconUri(iconPath: QuickInputButton['iconPath']) {
|
||||
}
|
||||
|
||||
function getIconUri(iconPath: string | URI) {
|
||||
if (iconPath instanceof URI) {
|
||||
if (URI.isUri(iconPath)) {
|
||||
return iconPath;
|
||||
}
|
||||
return URI.file(iconPath);
|
||||
@@ -587,9 +587,9 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
|
||||
|
||||
class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
|
||||
|
||||
private _password: boolean;
|
||||
private _prompt: string;
|
||||
private _validationMessage: string;
|
||||
private _password = false;
|
||||
private _prompt: string | undefined;
|
||||
private _validationMessage: string | undefined;
|
||||
|
||||
constructor(proxy: MainThreadQuickOpenShape, extensionId: ExtensionIdentifier, onDispose: () => void) {
|
||||
super(proxy, extensionId, onDispose);
|
||||
@@ -609,7 +609,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
|
||||
return this._prompt;
|
||||
}
|
||||
|
||||
set prompt(prompt: string) {
|
||||
set prompt(prompt: string | undefined) {
|
||||
this._prompt = prompt;
|
||||
this.update({ prompt });
|
||||
}
|
||||
@@ -618,7 +618,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
|
||||
return this._validationMessage;
|
||||
}
|
||||
|
||||
set validationMessage(validationMessage: string) {
|
||||
set validationMessage(validationMessage: string | undefined) {
|
||||
this._validationMessage = validationMessage;
|
||||
this.update({ validationMessage });
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { asPromise } from 'vs/base/common/async';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { MainContext, MainThreadSCMShape, SCMRawResource, SCMRawResourceSplice, SCMRawResourceSplices, IMainContext, ExtHostSCMShape, ICommandDto } from './extHost.protocol';
|
||||
import { sortedDiff } from 'vs/base/common/arrays';
|
||||
import { sortedDiff, equals } from 'vs/base/common/arrays';
|
||||
import { comparePaths } from 'vs/base/common/comparers';
|
||||
import * as vscode from 'vscode';
|
||||
import { ISplice } from 'vs/base/common/sequence';
|
||||
@@ -126,18 +126,8 @@ function commandEquals(a: vscode.Command, b: vscode.Command): boolean {
|
||||
&& (a.arguments && b.arguments ? compareArgs(a.arguments, b.arguments) : a.arguments === b.arguments);
|
||||
}
|
||||
|
||||
function commandListEquals(a: vscode.Command[], b: vscode.Command[]): boolean {
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (!commandEquals(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
function commandListEquals(a: readonly vscode.Command[], b: readonly vscode.Command[]): boolean {
|
||||
return equals(a, b, commandEquals);
|
||||
}
|
||||
|
||||
export interface IValidateInput {
|
||||
@@ -174,9 +164,9 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
|
||||
this._placeholder = placeholder;
|
||||
}
|
||||
|
||||
private _validateInput: IValidateInput;
|
||||
private _validateInput: IValidateInput | undefined;
|
||||
|
||||
get validateInput(): IValidateInput {
|
||||
get validateInput(): IValidateInput | undefined {
|
||||
if (!this._extension.enableProposedApi) {
|
||||
throw new Error(`[${this._extension.identifier.value}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this._extension.identifier.value}`);
|
||||
}
|
||||
@@ -184,7 +174,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
|
||||
return this._validateInput;
|
||||
}
|
||||
|
||||
set validateInput(fn: IValidateInput) {
|
||||
set validateInput(fn: IValidateInput | undefined) {
|
||||
if (!this._extension.enableProposedApi) {
|
||||
throw new Error(`[${this._extension.identifier.value}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this._extension.identifier.value}`);
|
||||
}
|
||||
@@ -405,6 +395,10 @@ class ExtHostSourceControl implements vscode.SourceControl {
|
||||
}
|
||||
|
||||
set commitTemplate(commitTemplate: string | undefined) {
|
||||
if (commitTemplate === this._commitTemplate) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._commitTemplate = commitTemplate;
|
||||
this._proxy.$updateSourceControl(this.handle, { commitTemplate });
|
||||
}
|
||||
@@ -667,7 +661,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return asPromise(() => sourceControl.inputBox.validateInput(value, cursorPosition)).then(result => {
|
||||
return asPromise(() => sourceControl.inputBox.validateInput!(value, cursorPosition)).then(result => {
|
||||
if (!result) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
||||
private _id: number;
|
||||
private _alignment: number;
|
||||
private _priority?: number;
|
||||
private _disposed: boolean;
|
||||
private _visible: boolean;
|
||||
private _disposed: boolean = false;
|
||||
private _visible: boolean = false;
|
||||
|
||||
private _statusId: string;
|
||||
private _statusName: string;
|
||||
|
||||
private _text: string;
|
||||
private _tooltip: string;
|
||||
private _color: string | ThemeColor;
|
||||
private _command: string;
|
||||
private _text: string = '';
|
||||
private _tooltip?: string;
|
||||
private _color?: string | ThemeColor;
|
||||
private _command?: string;
|
||||
|
||||
private _timeoutHandle: any;
|
||||
private _proxy: MainThreadStatusBarShape;
|
||||
@@ -54,15 +54,15 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
||||
return this._text;
|
||||
}
|
||||
|
||||
public get tooltip(): string {
|
||||
public get tooltip(): string | undefined {
|
||||
return this._tooltip;
|
||||
}
|
||||
|
||||
public get color(): string | ThemeColor {
|
||||
public get color(): string | ThemeColor | undefined {
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public get command(): string {
|
||||
public get command(): string | undefined {
|
||||
return this._command;
|
||||
}
|
||||
|
||||
@@ -71,17 +71,17 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
||||
this.update();
|
||||
}
|
||||
|
||||
public set tooltip(tooltip: string) {
|
||||
public set tooltip(tooltip: string | undefined) {
|
||||
this._tooltip = tooltip;
|
||||
this.update();
|
||||
}
|
||||
|
||||
public set color(color: string | ThemeColor) {
|
||||
public set color(color: string | ThemeColor | undefined) {
|
||||
this._color = color;
|
||||
this.update();
|
||||
}
|
||||
|
||||
public set command(command: string) {
|
||||
public set command(command: string | undefined) {
|
||||
this._command = command;
|
||||
this.update();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export namespace ProcessExecutionOptionsDTO {
|
||||
}
|
||||
|
||||
export namespace ProcessExecutionDTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.ProcessExecutionDTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ProcessExecutionDTO {
|
||||
if (value) {
|
||||
const candidate = value as tasks.ProcessExecutionDTO;
|
||||
return candidate && !!candidate.process;
|
||||
@@ -133,7 +133,7 @@ export namespace ShellExecutionOptionsDTO {
|
||||
}
|
||||
|
||||
export namespace ShellExecutionDTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.ShellExecutionDTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ShellExecutionDTO {
|
||||
if (value) {
|
||||
const candidate = value as tasks.ShellExecutionDTO;
|
||||
return candidate && (!!candidate.commandLine || !!candidate.command);
|
||||
@@ -170,19 +170,19 @@ export namespace ShellExecutionDTO {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace CustomExecution2DTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined): value is tasks.CustomExecution2DTO {
|
||||
export namespace CustomExecutionDTO {
|
||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.CustomExecutionDTO {
|
||||
if (value) {
|
||||
let candidate = value as tasks.CustomExecution2DTO;
|
||||
return candidate && candidate.customExecution === 'customExecution2';
|
||||
let candidate = value as tasks.CustomExecutionDTO;
|
||||
return candidate && candidate.customExecution === 'customExecution';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function from(value: vscode.CustomExecution2): tasks.CustomExecution2DTO {
|
||||
export function from(value: vscode.CustomExecution): tasks.CustomExecutionDTO {
|
||||
return {
|
||||
customExecution: 'customExecution2'
|
||||
customExecution: 'customExecution'
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -220,13 +220,13 @@ export namespace TaskDTO {
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
let execution: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecution2DTO | undefined;
|
||||
let execution: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined;
|
||||
if (value.execution instanceof types.ProcessExecution) {
|
||||
execution = ProcessExecutionDTO.from(value.execution);
|
||||
} else if (value.execution instanceof types.ShellExecution) {
|
||||
execution = ShellExecutionDTO.from(value.execution);
|
||||
} else if ((<vscode.Task2>value).execution2 && (<vscode.Task2>value).execution2 instanceof types.CustomExecution2) {
|
||||
execution = CustomExecution2DTO.from(<types.CustomExecution2>(<vscode.Task2>value).execution2);
|
||||
} else if ((<vscode.Task2>value).execution2 && (<vscode.Task2>value).execution2 instanceof types.CustomExecution) {
|
||||
execution = CustomExecutionDTO.from(<types.CustomExecution>(<vscode.Task2>value).execution2);
|
||||
}
|
||||
|
||||
const definition: tasks.TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
||||
@@ -373,9 +373,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
protected _handleCounter: number;
|
||||
protected _handlers: Map<number, HandlerData>;
|
||||
protected _taskExecutions: Map<string, TaskExecutionImpl>;
|
||||
protected _providedCustomExecutions2: Map<string, types.CustomExecution2>;
|
||||
protected _providedCustomExecutions2: Map<string, types.CustomExecution>;
|
||||
private _notProvidedCustomExecutions: Set<string>; // Used for custom executions tasks that are created and run through executeTask.
|
||||
protected _activeCustomExecutions2: Map<string, types.CustomExecution2>;
|
||||
protected _activeCustomExecutions2: Map<string, types.CustomExecution>;
|
||||
private _lastStartedTask: string | undefined;
|
||||
protected readonly _onDidExecuteTask: Emitter<vscode.TaskStartEvent> = new Emitter<vscode.TaskStartEvent>();
|
||||
protected readonly _onDidTerminateTask: Emitter<vscode.TaskEndEvent> = new Emitter<vscode.TaskEndEvent>();
|
||||
@@ -399,9 +399,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
this._handleCounter = 0;
|
||||
this._handlers = new Map<number, HandlerData>();
|
||||
this._taskExecutions = new Map<string, TaskExecutionImpl>();
|
||||
this._providedCustomExecutions2 = new Map<string, types.CustomExecution2>();
|
||||
this._providedCustomExecutions2 = new Map<string, types.CustomExecution>();
|
||||
this._notProvidedCustomExecutions = new Set<string>();
|
||||
this._activeCustomExecutions2 = new Map<string, types.CustomExecution2>();
|
||||
this._activeCustomExecutions2 = new Map<string, types.CustomExecution>();
|
||||
}
|
||||
|
||||
public registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable {
|
||||
@@ -454,15 +454,15 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
}
|
||||
|
||||
public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number): Promise<void> {
|
||||
const execution2: types.CustomExecution2 | undefined = this._providedCustomExecutions2.get(execution.id);
|
||||
if (execution2) {
|
||||
const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id);
|
||||
if (customExecution) {
|
||||
if (this._activeCustomExecutions2.get(execution.id) !== undefined) {
|
||||
throw new Error('We should not be trying to start the same custom task executions twice.');
|
||||
}
|
||||
|
||||
// Clone the custom execution to keep the original untouched. This is important for multiple runs of the same task.
|
||||
this._activeCustomExecutions2.set(execution.id, execution2);
|
||||
this._terminalService.attachPtyToTerminal(terminalId, await execution2.callback());
|
||||
this._activeCustomExecutions2.set(execution.id, customExecution);
|
||||
this._terminalService.attachPtyToTerminal(terminalId, await customExecution.callback());
|
||||
}
|
||||
this._lastStartedTask = execution.id;
|
||||
|
||||
@@ -573,8 +573,8 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
throw new Error('Unexpected: The resolved task definition must be the same object as the original task definition. The task definition cannot be changed.');
|
||||
}
|
||||
|
||||
if (CustomExecution2DTO.is(resolvedTaskDTO.execution)) {
|
||||
await this.addCustomExecution2(resolvedTaskDTO, <vscode.Task2>resolvedTask, true);
|
||||
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
|
||||
await this.addCustomExecution(resolvedTaskDTO, <vscode.Task2>resolvedTask, true);
|
||||
}
|
||||
|
||||
return await this.resolveTaskInternal(resolvedTaskDTO);
|
||||
@@ -588,12 +588,12 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
return this._handleCounter++;
|
||||
}
|
||||
|
||||
protected async addCustomExecution2(taskDTO: tasks.TaskDTO, task: vscode.Task2, isProvided: boolean): Promise<void> {
|
||||
protected async addCustomExecution(taskDTO: tasks.TaskDTO, task: vscode.Task2, isProvided: boolean): Promise<void> {
|
||||
const taskId = await this._proxy.$createTaskId(taskDTO);
|
||||
if (!isProvided && !this._providedCustomExecutions2.has(taskId)) {
|
||||
this._notProvidedCustomExecutions.add(taskId);
|
||||
}
|
||||
this._providedCustomExecutions2.set(taskId, <types.CustomExecution2>(<vscode.Task2>task).execution2);
|
||||
this._providedCustomExecutions2.set(taskId, <types.CustomExecution>(<vscode.Task2>task).execution2);
|
||||
}
|
||||
|
||||
protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
||||
@@ -619,7 +619,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
|
||||
}
|
||||
|
||||
private customExecutionComplete(execution: tasks.TaskExecutionDTO): void {
|
||||
const extensionCallback2: vscode.CustomExecution2 | undefined = this._activeCustomExecutions2.get(execution.id);
|
||||
const extensionCallback2: vscode.CustomExecution | undefined = this._activeCustomExecutions2.get(execution.id);
|
||||
if (extensionCallback2) {
|
||||
this._activeCustomExecutions2.delete(execution.id);
|
||||
}
|
||||
@@ -674,8 +674,8 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||
// If this task is a custom execution, then we need to save it away
|
||||
// in the provided custom execution map that is cleaned up after the
|
||||
// task is executed.
|
||||
if (CustomExecution2DTO.is(dto.execution)) {
|
||||
await this.addCustomExecution2(dto, <vscode.Task2>task, false);
|
||||
if (CustomExecutionDTO.is(dto.execution)) {
|
||||
await this.addCustomExecution(dto, <vscode.Task2>task, false);
|
||||
} else {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
@@ -692,12 +692,12 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||
}
|
||||
|
||||
const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
||||
if (taskDTO && CustomExecution2DTO.is(taskDTO.execution)) {
|
||||
if (taskDTO && CustomExecutionDTO.is(taskDTO.execution)) {
|
||||
taskDTOs.push(taskDTO);
|
||||
// The ID is calculated on the main thread task side, so, let's call into it here.
|
||||
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
|
||||
// is invoked, we have to be able to map it back to our data.
|
||||
taskIdPromises.push(this.addCustomExecution2(taskDTO, <vscode.Task2>task, true));
|
||||
taskIdPromises.push(this.addCustomExecution(taskDTO, <vscode.Task2>task, true));
|
||||
} else {
|
||||
console.warn('Only custom execution tasks supported.');
|
||||
}
|
||||
@@ -710,7 +710,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||
}
|
||||
|
||||
protected async resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
|
||||
if (CustomExecution2DTO.is(resolvedTaskDTO.execution)) {
|
||||
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
|
||||
return resolvedTaskDTO;
|
||||
} else {
|
||||
console.warn('Only custom execution tasks supported.');
|
||||
|
||||
@@ -170,8 +170,8 @@ export interface TreeNode extends IDisposable { // {{SQL CARBON EDIT}} export in
|
||||
// {{SQL CARBON EDIT}}
|
||||
export class ExtHostTreeView<T> extends Disposable {
|
||||
|
||||
private static LABEL_HANDLE_PREFIX = '0';
|
||||
private static ID_HANDLE_PREFIX = '1';
|
||||
private static readonly LABEL_HANDLE_PREFIX = '0';
|
||||
private static readonly ID_HANDLE_PREFIX = '1';
|
||||
|
||||
private readonly dataProvider: vscode.TreeDataProvider<T>;
|
||||
|
||||
@@ -557,7 +557,7 @@ export class ExtHostTreeView<T> extends Disposable {
|
||||
private getLightIconPath(extensionTreeItem: vscode.TreeItem): URI | undefined {
|
||||
if (extensionTreeItem.iconPath && !(extensionTreeItem.iconPath instanceof ThemeIcon)) {
|
||||
if (typeof extensionTreeItem.iconPath === 'string'
|
||||
|| extensionTreeItem.iconPath instanceof URI) {
|
||||
|| URI.isUri(extensionTreeItem.iconPath)) {
|
||||
return this.getIconPath(extensionTreeItem.iconPath);
|
||||
}
|
||||
return this.getIconPath((<{ light: string | URI; dark: string | URI }>extensionTreeItem.iconPath).light);
|
||||
@@ -573,7 +573,7 @@ export class ExtHostTreeView<T> extends Disposable {
|
||||
}
|
||||
|
||||
private getIconPath(iconPath: string | URI): URI {
|
||||
if (iconPath instanceof URI) {
|
||||
if (URI.isUri(iconPath)) {
|
||||
return iconPath;
|
||||
}
|
||||
return URI.file(iconPath);
|
||||
|
||||
@@ -255,12 +255,12 @@ export namespace MarkdownString {
|
||||
}
|
||||
|
||||
// extract uris into a separate object
|
||||
const resUris: { [href: string]: UriComponents } = Object.create(null);
|
||||
const resUris: { [href: string]: UriComponents; } = Object.create(null);
|
||||
res.uris = resUris;
|
||||
|
||||
const collectUri = (href: string): string => {
|
||||
try {
|
||||
let uri = URI.parse(href, true);
|
||||
let uri = URI.parse(href);
|
||||
uri = uri.with({ query: _uriMassage(uri.query, resUris) });
|
||||
resUris[href] = uri;
|
||||
} catch (e) {
|
||||
@@ -277,13 +277,13 @@ export namespace MarkdownString {
|
||||
return res;
|
||||
}
|
||||
|
||||
function _uriMassage(part: string, bucket: { [n: string]: UriComponents }): string {
|
||||
function _uriMassage(part: string, bucket: { [n: string]: UriComponents; }): string {
|
||||
if (!part) {
|
||||
return part;
|
||||
}
|
||||
let data: any;
|
||||
try {
|
||||
data = parse(decodeURIComponent(part));
|
||||
data = parse(part);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
@@ -291,7 +291,7 @@ export namespace MarkdownString {
|
||||
return part;
|
||||
}
|
||||
data = cloneAndChange(data, value => {
|
||||
if (value instanceof URI) {
|
||||
if (URI.isUri(value)) {
|
||||
const key = `__uri_${Math.random().toString(16).slice(2, 8)}`;
|
||||
bucket[key] = value;
|
||||
return key;
|
||||
@@ -303,9 +303,7 @@ export namespace MarkdownString {
|
||||
}
|
||||
|
||||
export function to(value: htmlContent.IMarkdownString): vscode.MarkdownString {
|
||||
const ret = new htmlContent.MarkdownString(value.value);
|
||||
ret.isTrusted = value.isTrusted;
|
||||
return ret;
|
||||
return new htmlContent.MarkdownString(value.value, value.isTrusted);
|
||||
}
|
||||
|
||||
export function fromStrict(value: string | types.MarkdownString): undefined | string | htmlContent.IMarkdownString {
|
||||
@@ -515,7 +513,7 @@ export namespace WorkspaceEdit {
|
||||
|
||||
export namespace SymbolKind {
|
||||
|
||||
const _fromMapping: { [kind: number]: modes.SymbolKind } = Object.create(null);
|
||||
const _fromMapping: { [kind: number]: modes.SymbolKind; } = Object.create(null);
|
||||
_fromMapping[types.SymbolKind.File] = modes.SymbolKind.File;
|
||||
_fromMapping[types.SymbolKind.Module] = modes.SymbolKind.Module;
|
||||
_fromMapping[types.SymbolKind.Namespace] = modes.SymbolKind.Namespace;
|
||||
@@ -905,7 +903,7 @@ export namespace DocumentLink {
|
||||
let target: URI | undefined = undefined;
|
||||
if (link.url) {
|
||||
try {
|
||||
target = typeof link.url === 'string' ? URI.parse(link.url, true) : URI.revive(link.url);
|
||||
target = typeof link.url === 'string' ? URI.parse(link.url) : URI.revive(link.url);
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@@ -614,12 +614,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
}
|
||||
|
||||
has(uri: URI): boolean {
|
||||
for (const edit of this._edits) {
|
||||
if (edit._type === 2 && edit.uri.toString() === uri.toString()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return this._edits.some(edit => edit._type === 2 && edit.uri.toString() === uri.toString());
|
||||
}
|
||||
|
||||
set(uri: URI, edits: TextEdit[]): void {
|
||||
@@ -1166,22 +1161,22 @@ export class CallHierarchyItem {
|
||||
|
||||
export class CallHierarchyIncomingCall {
|
||||
|
||||
source: vscode.CallHierarchyItem;
|
||||
sourceRanges: vscode.Range[];
|
||||
from: vscode.CallHierarchyItem;
|
||||
fromRanges: vscode.Range[];
|
||||
|
||||
constructor(item: vscode.CallHierarchyItem, sourceRanges: vscode.Range[]) {
|
||||
this.sourceRanges = sourceRanges;
|
||||
this.source = item;
|
||||
constructor(item: vscode.CallHierarchyItem, fromRanges: vscode.Range[]) {
|
||||
this.fromRanges = fromRanges;
|
||||
this.from = item;
|
||||
}
|
||||
}
|
||||
export class CallHierarchyOutgoingCall {
|
||||
|
||||
target: vscode.CallHierarchyItem;
|
||||
sourceRanges: vscode.Range[];
|
||||
to: vscode.CallHierarchyItem;
|
||||
fromRanges: vscode.Range[];
|
||||
|
||||
constructor(item: vscode.CallHierarchyItem, sourceRanges: vscode.Range[]) {
|
||||
this.sourceRanges = sourceRanges;
|
||||
this.target = item;
|
||||
constructor(item: vscode.CallHierarchyItem, fromRanges: vscode.Range[]) {
|
||||
this.fromRanges = fromRanges;
|
||||
this.to = item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1227,7 +1222,9 @@ export class MarkdownString {
|
||||
|
||||
appendText(value: string): MarkdownString {
|
||||
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
|
||||
this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
|
||||
this.value += value
|
||||
.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
.replace('\n', '\n\n');
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1472,7 +1469,7 @@ export class DocumentLink {
|
||||
tooltip?: string;
|
||||
|
||||
constructor(range: Range, target: URI | undefined) {
|
||||
if (target && !(target instanceof URI)) {
|
||||
if (target && !(URI.isUri(target))) {
|
||||
throw illegalArgument('target');
|
||||
}
|
||||
if (!Range.isRange(range) || range.isEmpty) {
|
||||
@@ -1624,6 +1621,7 @@ export class ProcessExecution implements vscode.ProcessExecution {
|
||||
if (typeof process !== 'string') {
|
||||
throw illegalArgument('process');
|
||||
}
|
||||
this._args = [];
|
||||
this._process = process;
|
||||
if (varg1 !== undefined) {
|
||||
if (Array.isArray(varg1)) {
|
||||
@@ -1633,9 +1631,6 @@ export class ProcessExecution implements vscode.ProcessExecution {
|
||||
this._options = varg1;
|
||||
}
|
||||
}
|
||||
if (this._args === undefined) {
|
||||
this._args = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1687,9 +1682,9 @@ export class ProcessExecution implements vscode.ProcessExecution {
|
||||
@es5ClassCompat
|
||||
export class ShellExecution implements vscode.ShellExecution {
|
||||
|
||||
private _commandLine: string;
|
||||
private _command: string | vscode.ShellQuotedString;
|
||||
private _args: (string | vscode.ShellQuotedString)[];
|
||||
private _commandLine: string | undefined;
|
||||
private _command: string | vscode.ShellQuotedString | undefined;
|
||||
private _args: (string | vscode.ShellQuotedString)[] = [];
|
||||
private _options: vscode.ShellExecutionOptions | undefined;
|
||||
|
||||
constructor(commandLine: string, options?: vscode.ShellExecutionOptions);
|
||||
@@ -1714,11 +1709,11 @@ export class ShellExecution implements vscode.ShellExecution {
|
||||
}
|
||||
}
|
||||
|
||||
get commandLine(): string {
|
||||
get commandLine(): string | undefined {
|
||||
return this._commandLine;
|
||||
}
|
||||
|
||||
set commandLine(value: string) {
|
||||
set commandLine(value: string | undefined) {
|
||||
if (typeof value !== 'string') {
|
||||
throw illegalArgument('commandLine');
|
||||
}
|
||||
@@ -1726,7 +1721,7 @@ export class ShellExecution implements vscode.ShellExecution {
|
||||
}
|
||||
|
||||
get command(): string | vscode.ShellQuotedString {
|
||||
return this._command;
|
||||
return this._command ? this._command : '';
|
||||
}
|
||||
|
||||
set command(value: string | vscode.ShellQuotedString) {
|
||||
@@ -1781,7 +1776,7 @@ export enum TaskScope {
|
||||
Workspace = 2
|
||||
}
|
||||
|
||||
export class CustomExecution2 implements vscode.CustomExecution2 {
|
||||
export class CustomExecution implements vscode.CustomExecution {
|
||||
private _callback: () => Thenable<vscode.Pseudoterminal>;
|
||||
constructor(callback: () => Thenable<vscode.Pseudoterminal>) {
|
||||
this._callback = callback;
|
||||
@@ -1812,7 +1807,7 @@ export class Task implements vscode.Task2 {
|
||||
private _definition: vscode.TaskDefinition;
|
||||
private _scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;
|
||||
private _name: string;
|
||||
private _execution: ProcessExecution | ShellExecution | CustomExecution2 | undefined;
|
||||
private _execution: ProcessExecution | ShellExecution | CustomExecution | undefined;
|
||||
private _problemMatchers: string[];
|
||||
private _hasDefinedMatchers: boolean;
|
||||
private _isBackground: boolean;
|
||||
@@ -1821,26 +1816,26 @@ export class Task implements vscode.Task2 {
|
||||
private _presentationOptions: vscode.TaskPresentationOptions;
|
||||
private _runOptions: vscode.RunOptions;
|
||||
|
||||
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, arg2: string | (vscode.TaskScope.Global | vscode.TaskScope.Workspace) | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) {
|
||||
this.definition = definition;
|
||||
this._definition = this.definition = definition;
|
||||
let problemMatchers: string | string[];
|
||||
if (typeof arg2 === 'string') {
|
||||
this.name = arg2;
|
||||
this.source = arg3;
|
||||
this._name = this.name = arg2;
|
||||
this._source = this.source = arg3;
|
||||
this.execution = arg4;
|
||||
problemMatchers = arg5;
|
||||
} else if (arg2 === TaskScope.Global || arg2 === TaskScope.Workspace) {
|
||||
this.target = arg2;
|
||||
this.name = arg3;
|
||||
this.source = arg4;
|
||||
this._name = this.name = arg3;
|
||||
this._source = this.source = arg4;
|
||||
this.execution = arg5;
|
||||
problemMatchers = arg6;
|
||||
} else {
|
||||
this.target = arg2;
|
||||
this.name = arg3;
|
||||
this.source = arg4;
|
||||
this._name = this.name = arg3;
|
||||
this._source = this.source = arg4;
|
||||
this.execution = arg5;
|
||||
problemMatchers = arg6;
|
||||
}
|
||||
@@ -1887,7 +1882,7 @@ export class Task implements vscode.Task2 {
|
||||
type: Task.ShellType,
|
||||
id: this._execution.computeId()
|
||||
};
|
||||
} else if (this._execution instanceof CustomExecution2) {
|
||||
} else if (this._execution instanceof CustomExecution) {
|
||||
this._definition = {
|
||||
type: Task.ExtensionCallbackType,
|
||||
id: this._execution.computeId()
|
||||
@@ -1934,18 +1929,18 @@ export class Task implements vscode.Task2 {
|
||||
}
|
||||
|
||||
get execution(): ProcessExecution | ShellExecution | undefined {
|
||||
return (this._execution instanceof CustomExecution2) ? undefined : this._execution;
|
||||
return (this._execution instanceof CustomExecution) ? undefined : this._execution;
|
||||
}
|
||||
|
||||
set execution(value: ProcessExecution | ShellExecution | undefined) {
|
||||
this.execution2 = value;
|
||||
}
|
||||
|
||||
get execution2(): ProcessExecution | ShellExecution | CustomExecution2 | undefined {
|
||||
get execution2(): ProcessExecution | ShellExecution | CustomExecution | undefined {
|
||||
return this._execution;
|
||||
}
|
||||
|
||||
set execution2(value: ProcessExecution | ShellExecution | CustomExecution2 | undefined) {
|
||||
set execution2(value: ProcessExecution | ShellExecution | CustomExecution | undefined) {
|
||||
if (value === null) {
|
||||
value = undefined;
|
||||
}
|
||||
@@ -2059,7 +2054,7 @@ export class TreeItem {
|
||||
constructor(label: string | vscode.TreeItemLabel, collapsibleState?: vscode.TreeItemCollapsibleState)
|
||||
constructor(resourceUri: URI, collapsibleState?: vscode.TreeItemCollapsibleState)
|
||||
constructor(arg1: string | vscode.TreeItemLabel | URI, public collapsibleState: vscode.TreeItemCollapsibleState = TreeItemCollapsibleState.None) {
|
||||
if (arg1 instanceof URI) {
|
||||
if (URI.isUri(arg1)) {
|
||||
this.resourceUri = arg1;
|
||||
} else {
|
||||
this.label = arg1;
|
||||
|
||||
@@ -7,8 +7,9 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { IExtensionDescription, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
|
||||
import { asWebviewUri, WebviewInitData } from 'vs/workbench/api/common/shared/webview';
|
||||
import * as vscode from 'vscode';
|
||||
@@ -18,7 +19,7 @@ import { Disposable } from './extHostTypes';
|
||||
type IconPath = URI | { light: URI, dark: URI };
|
||||
|
||||
export class ExtHostWebview implements vscode.Webview {
|
||||
private _html: string;
|
||||
private _html: string = '';
|
||||
private _isDisposed: boolean = false;
|
||||
private _hasCalledAsWebviewUri = false;
|
||||
|
||||
@@ -30,7 +31,8 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
private readonly _proxy: MainThreadWebviewsShape,
|
||||
private _options: vscode.WebviewOptions,
|
||||
private readonly _initData: WebviewInitData,
|
||||
private readonly _extensionId: ExtensionIdentifier | undefined,
|
||||
private readonly _workspace: IExtHostWorkspace | undefined,
|
||||
private readonly _extension: IExtensionDescription,
|
||||
) { }
|
||||
|
||||
public dispose() {
|
||||
@@ -56,10 +58,10 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
this.assertNotDisposed();
|
||||
if (this._html !== value) {
|
||||
this._html = value;
|
||||
if (this._initData.isExtensionDevelopmentDebug && this._extensionId && !this._hasCalledAsWebviewUri) {
|
||||
if (this._initData.isExtensionDevelopmentDebug && !this._hasCalledAsWebviewUri) {
|
||||
if (/(["'])vscode-resource:([^\s'"]+?)(["'])/i.test(value)) {
|
||||
this._hasCalledAsWebviewUri = true;
|
||||
console.warn(`${this._extensionId.value} created a webview that appears to use the vscode-resource scheme directly. Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri`);
|
||||
console.warn(`${this._extension.identifier.value} created a webview that appears to use the vscode-resource scheme directly. Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri`);
|
||||
}
|
||||
}
|
||||
this._proxy.$setHtml(this._handle, value);
|
||||
@@ -73,7 +75,7 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
|
||||
public set options(newOptions: vscode.WebviewOptions) {
|
||||
this.assertNotDisposed();
|
||||
this._proxy.$setOptions(this._handle, convertWebviewOptions(newOptions));
|
||||
this._proxy.$setOptions(this._handle, convertWebviewOptions(this._extension, this._workspace, newOptions));
|
||||
this._options = newOptions;
|
||||
}
|
||||
|
||||
@@ -261,12 +263,13 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
|
||||
private readonly _proxy: MainThreadWebviewsShape;
|
||||
private readonly _webviewPanels = new Map<WebviewPanelHandle, ExtHostWebviewEditor>();
|
||||
private readonly _serializers = new Map<string, vscode.WebviewPanelSerializer>();
|
||||
private readonly _serializers = new Map<string, { readonly serializer: vscode.WebviewPanelSerializer, readonly extension: IExtensionDescription }>();
|
||||
private readonly _editorProviders = new Map<string, { readonly provider: vscode.WebviewEditorProvider, readonly extension: IExtensionDescription }>();
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
private readonly initData: WebviewInitData
|
||||
private readonly initData: WebviewInitData,
|
||||
private readonly workspace: IExtHostWorkspace | undefined,
|
||||
) {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadWebviews);
|
||||
}
|
||||
@@ -285,15 +288,16 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
};
|
||||
|
||||
const handle = ExtHostWebviews.newHandle();
|
||||
this._proxy.$createWebviewPanel(handle, viewType, title, webviewShowOptions, convertWebviewOptions(options), extension.identifier, extension.extensionLocation);
|
||||
this._proxy.$createWebviewPanel({ id: extension.identifier, location: extension.extensionLocation }, handle, viewType, title, webviewShowOptions, convertWebviewOptions(extension, this.workspace, options));
|
||||
|
||||
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, extension.identifier);
|
||||
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension);
|
||||
const panel = new ExtHostWebviewEditor(handle, this._proxy, viewType, title, viewColumn, options, webview);
|
||||
this._webviewPanels.set(handle, panel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public registerWebviewPanelSerializer(
|
||||
extension: IExtensionDescription,
|
||||
viewType: string,
|
||||
serializer: vscode.WebviewPanelSerializer
|
||||
): vscode.Disposable {
|
||||
@@ -301,7 +305,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
throw new Error(`Serializer for '${viewType}' already registered`);
|
||||
}
|
||||
|
||||
this._serializers.set(viewType, serializer);
|
||||
this._serializers.set(viewType, { serializer, extension });
|
||||
this._proxy.$registerSerializer(viewType);
|
||||
|
||||
return new Disposable(() => {
|
||||
@@ -314,13 +318,14 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
extension: IExtensionDescription,
|
||||
viewType: string,
|
||||
provider: vscode.WebviewEditorProvider,
|
||||
options?: vscode.WebviewPanelOptions,
|
||||
): vscode.Disposable {
|
||||
if (this._editorProviders.has(viewType)) {
|
||||
throw new Error(`Editor provider for '${viewType}' already registered`);
|
||||
}
|
||||
|
||||
this._editorProviders.set(viewType, { extension, provider, });
|
||||
this._proxy.$registerEditorProvider(viewType);
|
||||
this._proxy.$registerEditorProvider({ id: extension.identifier, location: extension.extensionLocation }, viewType, options || {});
|
||||
|
||||
return new Disposable(() => {
|
||||
this._editorProviders.delete(viewType);
|
||||
@@ -397,12 +402,13 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
position: EditorViewColumn,
|
||||
options: modes.IWebviewOptions & modes.IWebviewPanelOptions
|
||||
): Promise<void> {
|
||||
const serializer = this._serializers.get(viewType);
|
||||
if (!serializer) {
|
||||
const entry = this._serializers.get(viewType);
|
||||
if (!entry) {
|
||||
return Promise.reject(new Error(`No serializer found for '${viewType}'`));
|
||||
}
|
||||
const { serializer, extension } = entry;
|
||||
|
||||
const webview = new ExtHostWebview(webviewHandle, this._proxy, options, this.initData, undefined);
|
||||
const webview = new ExtHostWebview(webviewHandle, this._proxy, options, this.initData, this.workspace, extension);
|
||||
const revivedPanel = new ExtHostWebviewEditor(webviewHandle, this._proxy, viewType, title, typeof position === 'number' && position >= 0 ? typeConverters.ViewColumn.to(position) : undefined, options, webview);
|
||||
this._webviewPanels.set(webviewHandle, revivedPanel);
|
||||
return Promise.resolve(serializer.deserializeWebviewPanel(revivedPanel, state));
|
||||
@@ -417,7 +423,6 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
handle: WebviewPanelHandle,
|
||||
viewType: string,
|
||||
title: string,
|
||||
state: any,
|
||||
position: EditorViewColumn,
|
||||
options: modes.IWebviewOptions & modes.IWebviewPanelOptions
|
||||
): Promise<void> {
|
||||
@@ -426,10 +431,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
return Promise.reject(new Error(`No provider found for '${viewType}'`));
|
||||
}
|
||||
const { provider, extension } = entry;
|
||||
|
||||
this._proxy.$setExtension(handle, extension.identifier, extension.extensionLocation);
|
||||
|
||||
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, extension.identifier);
|
||||
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension);
|
||||
const revivedPanel = new ExtHostWebviewEditor(handle, this._proxy, viewType, title, typeof position === 'number' && position >= 0 ? typeConverters.ViewColumn.to(position) : undefined, options, webview);
|
||||
this._webviewPanels.set(handle, revivedPanel);
|
||||
return Promise.resolve(provider.resolveWebviewEditor(URI.revive(resource), revivedPanel));
|
||||
@@ -445,18 +447,22 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
}
|
||||
|
||||
function convertWebviewOptions(
|
||||
options: vscode.WebviewPanelOptions & vscode.WebviewOptions
|
||||
extension: IExtensionDescription,
|
||||
workspace: IExtHostWorkspace | undefined,
|
||||
options: vscode.WebviewPanelOptions & vscode.WebviewOptions,
|
||||
): modes.IWebviewOptions {
|
||||
return {
|
||||
...options,
|
||||
portMapping: options.portMapping
|
||||
? options.portMapping.map((x): modes.IWebviewPortMapping => {
|
||||
// Handle old proposed api
|
||||
if ('port' in x) {
|
||||
return { webviewPort: (x as any).port, extensionHostPort: (x as any).resolvedPort };
|
||||
}
|
||||
return { webviewPort: x.webviewPort, extensionHostPort: x.extensionHostPort };
|
||||
})
|
||||
: undefined,
|
||||
localResourceRoots: options.localResourceRoots || getDefaultLocalResourceRoots(extension, workspace)
|
||||
};
|
||||
}
|
||||
|
||||
function getDefaultLocalResourceRoots(
|
||||
extension: IExtensionDescription,
|
||||
workspace: IExtHostWorkspace | undefined,
|
||||
): URI[] {
|
||||
return [
|
||||
...(workspace && workspace.getWorkspaceFolders() || []).map(x => x.uri),
|
||||
extension.extensionLocation,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { IExtensionPointUser, ExtensionMessageCollector, ExtensionsRegistry } fr
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { MenuId, MenuRegistry, ILocalizedString, IMenuItem } from 'vs/platform/actions/common/actions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IDisposable, dispose, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
|
||||
namespace schema {
|
||||
|
||||
@@ -392,7 +392,7 @@ commandsExtensionPoint.setHandler(extensions => {
|
||||
}
|
||||
});
|
||||
|
||||
let _menuRegistrations: IDisposable[] = [];
|
||||
const _menuRegistrations = new DisposableStore();
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyMenuItem[] }>({
|
||||
extensionPoint: 'menus',
|
||||
@@ -400,7 +400,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
|
||||
}).setHandler(extensions => {
|
||||
|
||||
// remove all previous menu registrations
|
||||
_menuRegistrations = dispose(_menuRegistrations);
|
||||
_menuRegistrations.clear();
|
||||
|
||||
for (let extension of extensions) {
|
||||
const { value, collector } = extension;
|
||||
@@ -455,7 +455,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
|
||||
order,
|
||||
when: ContextKeyExpr.deserialize(item.when)
|
||||
} as IMenuItem);
|
||||
_menuRegistrations.push(registration);
|
||||
_menuRegistrations.add(registration);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ export interface ShellExecutionDTO {
|
||||
options?: ShellExecutionOptionsDTO;
|
||||
}
|
||||
|
||||
export interface CustomExecution2DTO {
|
||||
customExecution: 'customExecution2';
|
||||
export interface CustomExecutionDTO {
|
||||
customExecution: 'customExecution';
|
||||
}
|
||||
|
||||
export interface TaskSourceDTO {
|
||||
@@ -84,7 +84,7 @@ export interface TaskHandleDTO {
|
||||
export interface TaskDTO {
|
||||
_id: string;
|
||||
name?: string;
|
||||
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecution2DTO | undefined;
|
||||
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | undefined;
|
||||
definition: TaskDefinitionDTO;
|
||||
isBackground?: boolean;
|
||||
source: TaskSourceDTO;
|
||||
|
||||
Reference in New Issue
Block a user