mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
Merge from vscode 817eb6b0c720a4ecbc13c020afbbebfed667aa09 (#7356)
This commit is contained in:
@@ -70,12 +70,16 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
interface INewWindowAPICommandOptions {
|
||||
reuseWindow?: boolean;
|
||||
remoteAuthority?: string;
|
||||
}
|
||||
|
||||
export class NewWindowAPICommand {
|
||||
public static ID = 'vscode.newWindow';
|
||||
public static execute(executor: ICommandsExecutor, options?: INewWindowAPICommandOptions): Promise<any> {
|
||||
return executor.executeCommand('_files.newWindow', options);
|
||||
return executor.executeCommand('_files.newWindow', {
|
||||
reuse: options && options.reuseWindow,
|
||||
remoteAuthority: options && options.remoteAuthority
|
||||
});
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand({
|
||||
|
||||
@@ -238,7 +238,7 @@ function validateProperties(configuration: IConfigurationNode, extension: IExten
|
||||
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
|
||||
jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
|
||||
allowComments: true,
|
||||
allowsTrailingCommas: true,
|
||||
allowTrailingCommas: true,
|
||||
default: {
|
||||
folders: [
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ import { ExtHostDocumentContentProvider } from 'vs/workbench/api/common/extHostD
|
||||
import { ExtHostDocumentSaveParticipant } from 'vs/workbench/api/common/extHostDocumentSaveParticipant';
|
||||
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
|
||||
import { IExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { ExtensionActivatedByAPI } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
import { ExtHostFileSystem } from 'vs/workbench/api/common/extHostFileSystem';
|
||||
import { ExtHostFileSystemEventService } from 'vs/workbench/api/common/extHostFileSystemEventService';
|
||||
@@ -250,6 +249,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
openExternal(uri: URI) {
|
||||
return extHostWindow.openUri(uri, { allowTunneling: !!initData.remote.isRemote });
|
||||
},
|
||||
resolveExternalUri(uri: URI) {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWindow.resolveExternalUri(uri, { allowTunneling: !!initData.remote.isRemote });
|
||||
},
|
||||
get remoteName() {
|
||||
return getRemoteName(initData.remote.authority);
|
||||
},
|
||||
@@ -272,12 +275,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
getExtension(extensionId: string): Extension<any> | undefined {
|
||||
const desc = extensionRegistry.getExtensionDescription(extensionId);
|
||||
if (desc) {
|
||||
return new Extension(extensionService, desc, extensionKind);
|
||||
return new Extension(extensionService, extension.identifier, desc, extensionKind);
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
get all(): Extension<any>[] {
|
||||
return extensionRegistry.getAllExtensionDescriptions().map((desc) => new Extension(extensionService, desc, extensionKind));
|
||||
return extensionRegistry.getAllExtensionDescriptions().map((desc) => new Extension(extensionService, extension.identifier, desc, extensionKind));
|
||||
},
|
||||
get onDidChange() {
|
||||
return extensionRegistry.onDidChange;
|
||||
@@ -760,7 +763,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
registerDebugAdapterTrackerFactory(debugType: string, factory: vscode.DebugAdapterTrackerFactory) {
|
||||
return undefined;
|
||||
},
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession) {
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSessionOrOptions?: vscode.DebugSession | vscode.DebugSessionOptions) {
|
||||
return undefined;
|
||||
},
|
||||
addBreakpoints(breakpoints: vscode.Breakpoint[]) {
|
||||
@@ -907,6 +910,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
CallHierarchyOutgoingCall: extHostTypes.CallHierarchyOutgoingCall,
|
||||
CallHierarchyIncomingCall: extHostTypes.CallHierarchyIncomingCall,
|
||||
CallHierarchyItem: extHostTypes.CallHierarchyItem,
|
||||
DebugConsoleMode: extHostTypes.DebugConsoleMode,
|
||||
Decoration: extHostTypes.Decoration,
|
||||
WebviewEditorState: extHostTypes.WebviewEditorState,
|
||||
UIKind: UIKind
|
||||
@@ -917,6 +921,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
class Extension<T> implements vscode.Extension<T> {
|
||||
|
||||
private _extensionService: IExtHostExtensionService;
|
||||
private _originExtensionId: ExtensionIdentifier;
|
||||
private _identifier: ExtensionIdentifier;
|
||||
|
||||
readonly id: string;
|
||||
@@ -924,8 +929,9 @@ class Extension<T> implements vscode.Extension<T> {
|
||||
readonly packageJSON: IExtensionDescription;
|
||||
readonly extensionKind: vscode.ExtensionKind;
|
||||
|
||||
constructor(extensionService: IExtHostExtensionService, description: IExtensionDescription, kind: extHostTypes.ExtensionKind) {
|
||||
constructor(extensionService: IExtHostExtensionService, originExtensionId: ExtensionIdentifier, description: IExtensionDescription, kind: extHostTypes.ExtensionKind) {
|
||||
this._extensionService = extensionService;
|
||||
this._originExtensionId = originExtensionId;
|
||||
this._identifier = description.identifier;
|
||||
this.id = description.identifier.value;
|
||||
this.extensionPath = path.normalize(originalFSPath(description.extensionLocation));
|
||||
@@ -945,6 +951,6 @@ class Extension<T> implements vscode.Extension<T> {
|
||||
}
|
||||
|
||||
activate(): Thenable<T> {
|
||||
return this._extensionService.activateByIdWithErrors(this._identifier, new ExtensionActivatedByAPI(false)).then(() => this.exports);
|
||||
return this._extensionService.activateByIdWithErrors(this._identifier, { startup: false, extensionId: this._originExtensionId, activationEvent: 'api' }).then(() => this.exports);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@ import { ThemeColor } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
|
||||
import * as tasks from 'vs/workbench/api/common/shared/tasks';
|
||||
import { IRevealOptions, ITreeItem } from 'vs/workbench/common/views';
|
||||
import { IAdapterDescriptor, IConfig } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { IAdapterDescriptor, IConfig, IDebugSessionReplMode } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
import { ITerminalDimensions, IShellLaunchConfig } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId, IRPCProtocol } from 'vs/workbench/services/extensions/common/proxyIdentifier';
|
||||
import * as search from 'vs/workbench/services/search/common/search';
|
||||
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { ITreeItem as sqlITreeItem } from 'sql/workbench/common/views';
|
||||
@@ -649,9 +650,9 @@ export interface MainThreadTaskShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadExtensionServiceShape extends IDisposable {
|
||||
$activateExtension(extensionId: ExtensionIdentifier, activationEvent: string | null): Promise<void>;
|
||||
$activateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void>;
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): void;
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, startup: boolean, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationEvent: string | null): void;
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationReason: ExtensionActivationReason): void;
|
||||
$onExtensionActivationError(extensionId: ExtensionIdentifier, error: ExtensionActivationError): Promise<void>;
|
||||
$onExtensionRuntimeError(extensionId: ExtensionIdentifier, error: SerializedError): void;
|
||||
$onExtensionHostExit(code: number): void;
|
||||
@@ -716,6 +717,11 @@ export interface IDebugConfiguration {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface IStartDebuggingOptions {
|
||||
parentSessionID?: DebugSessionUUID;
|
||||
repl?: IDebugSessionReplMode;
|
||||
}
|
||||
|
||||
export interface MainThreadDebugServiceShape extends IDisposable {
|
||||
$registerDebugTypes(debugTypes: string[]): void;
|
||||
$sessionCached(sessionID: string): void;
|
||||
@@ -726,7 +732,7 @@ export interface MainThreadDebugServiceShape extends IDisposable {
|
||||
$registerDebugAdapterDescriptorFactory(type: string, handle: number): Promise<void>;
|
||||
$unregisterDebugConfigurationProvider(handle: number): void;
|
||||
$unregisterDebugAdapterDescriptorFactory(handle: number): void;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, parentSessionID: string | undefined): Promise<boolean>;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise<boolean>;
|
||||
$setDebugSessionName(id: DebugSessionUUID, name: string): void;
|
||||
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise<any>;
|
||||
$appendDebugConsole(value: string): void;
|
||||
@@ -742,6 +748,7 @@ export interface IOpenUriOptions {
|
||||
export interface MainThreadWindowShape extends IDisposable {
|
||||
$getWindowVisibility(): Promise<boolean>;
|
||||
$openUri(uri: UriComponents, options: IOpenUriOptions): Promise<boolean>;
|
||||
$resolveExternalUri(uri: UriComponents, options: IOpenUriOptions): Promise<UriComponents>;
|
||||
}
|
||||
|
||||
// -- extension host
|
||||
@@ -882,7 +889,7 @@ export interface ExtHostExtensionServiceShape {
|
||||
$resolveAuthority(remoteAuthority: string, resolveAttempt: number): Promise<IResolveAuthorityResult>;
|
||||
$startExtensionHost(enabledExtensionIds: ExtensionIdentifier[]): Promise<void>;
|
||||
$activateByEvent(activationEvent: string): Promise<void>;
|
||||
$activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<boolean>;
|
||||
$activate(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<boolean>;
|
||||
$setRemoteEnvironment(env: { [key: string]: string | null }): Promise<void>;
|
||||
|
||||
$deltaExtensions(toAdd: IExtensionDescription[], toRemove: ExtensionIdentifier[]): Promise<void>;
|
||||
|
||||
@@ -239,7 +239,7 @@ export class ExtHostCommentThread implements vscode.CommentThread {
|
||||
return this._uri;
|
||||
}
|
||||
|
||||
private _onDidUpdateCommentThread = new Emitter<void>();
|
||||
private readonly _onDidUpdateCommentThread = new Emitter<void>();
|
||||
readonly onDidUpdateCommentThread = this._onDidUpdateCommentThread.event;
|
||||
|
||||
set range(range: vscode.Range) {
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface IExtHostDebugService extends ExtHostDebugServiceShape {
|
||||
|
||||
addBreakpoints(breakpoints0: vscode.Breakpoint[]): Promise<void>;
|
||||
removeBreakpoints(breakpoints0: vscode.Breakpoint[]): Promise<void>;
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession): Promise<boolean>;
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, options: vscode.DebugSessionOptions): Promise<boolean>;
|
||||
registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable;
|
||||
registerDebugAdapterDescriptorFactory(extension: IExtensionDescription, type: string, factory: vscode.DebugAdapterDescriptorFactory): vscode.Disposable;
|
||||
registerDebugAdapterTrackerFactory(type: string, factory: vscode.DebugAdapterTrackerFactory): vscode.Disposable;
|
||||
|
||||
@@ -15,10 +15,10 @@ import * as vscode from 'vscode';
|
||||
|
||||
export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
|
||||
private _onDidAddDocument = new Emitter<vscode.TextDocument>();
|
||||
private _onDidRemoveDocument = new Emitter<vscode.TextDocument>();
|
||||
private _onDidChangeDocument = new Emitter<vscode.TextDocumentChangeEvent>();
|
||||
private _onDidSaveDocument = new Emitter<vscode.TextDocument>();
|
||||
private readonly _onDidAddDocument = new Emitter<vscode.TextDocument>();
|
||||
private readonly _onDidRemoveDocument = new Emitter<vscode.TextDocument>();
|
||||
private readonly _onDidChangeDocument = new Emitter<vscode.TextDocumentChangeEvent>();
|
||||
private readonly _onDidSaveDocument = new Emitter<vscode.TextDocument>();
|
||||
|
||||
readonly onDidAddDocument: Event<vscode.TextDocument> = this._onDidAddDocument.event;
|
||||
readonly onDidRemoveDocument: Event<vscode.TextDocument> = this._onDidRemoveDocument.event;
|
||||
|
||||
@@ -7,20 +7,17 @@ import * as assert from 'vs/base/common/assert';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ExtHostDocumentsAndEditorsShape, IDocumentsAndEditorsDelta, MainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { ExtHostTextEditor } from 'vs/workbench/api/common/extHostTextEditor';
|
||||
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import { Disposable } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
|
||||
export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsShape {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
private _disposables: Disposable[] = [];
|
||||
|
||||
private _activeEditorId: string | null = null;
|
||||
|
||||
private readonly _editors = new Map<string, ExtHostTextEditor>();
|
||||
@@ -40,10 +37,6 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
|
||||
@IExtHostRpcService private readonly _extHostRpc: IExtHostRpcService,
|
||||
) { }
|
||||
|
||||
dispose() {
|
||||
this._disposables = dispose(this._disposables);
|
||||
}
|
||||
|
||||
$acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void {
|
||||
|
||||
const removedDocuments: ExtHostDocumentData[] = [];
|
||||
|
||||
@@ -161,20 +161,13 @@ export interface IExtensionsActivatorHost {
|
||||
actualActivateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension>;
|
||||
}
|
||||
|
||||
export class ExtensionActivatedByEvent {
|
||||
constructor(
|
||||
public readonly startup: boolean,
|
||||
public readonly activationEvent: string
|
||||
) { }
|
||||
export interface ExtensionActivationReason {
|
||||
readonly startup: boolean;
|
||||
readonly extensionId: ExtensionIdentifier;
|
||||
readonly activationEvent: string;
|
||||
}
|
||||
|
||||
export class ExtensionActivatedByAPI {
|
||||
constructor(
|
||||
public readonly startup: boolean
|
||||
) { }
|
||||
}
|
||||
|
||||
export type ExtensionActivationReason = ExtensionActivatedByEvent | ExtensionActivatedByAPI;
|
||||
type ActivationIdAndReason = { id: ExtensionIdentifier, reason: ExtensionActivationReason };
|
||||
|
||||
export class ExtensionsActivator {
|
||||
|
||||
@@ -217,12 +210,15 @@ export class ExtensionsActivator {
|
||||
return activatedExtension;
|
||||
}
|
||||
|
||||
public activateByEvent(activationEvent: string, reason: ExtensionActivationReason): Promise<void> {
|
||||
public activateByEvent(activationEvent: string, startup: boolean): Promise<void> {
|
||||
if (this._alreadyActivatedEvents[activationEvent]) {
|
||||
return NO_OP_VOID_PROMISE;
|
||||
}
|
||||
const activateExtensions = this._registry.getExtensionDescriptionsForActivationEvent(activationEvent);
|
||||
return this._activateExtensions(activateExtensions.map(e => e.identifier), reason).then(() => {
|
||||
return this._activateExtensions(activateExtensions.map(e => ({
|
||||
id: e.identifier,
|
||||
reason: { startup, extensionId: e.identifier, activationEvent }
|
||||
}))).then(() => {
|
||||
this._alreadyActivatedEvents[activationEvent] = true;
|
||||
});
|
||||
}
|
||||
@@ -233,20 +229,23 @@ export class ExtensionsActivator {
|
||||
throw new Error('Extension `' + extensionId + '` is not known');
|
||||
}
|
||||
|
||||
return this._activateExtensions([desc.identifier], reason);
|
||||
return this._activateExtensions([{
|
||||
id: desc.identifier,
|
||||
reason
|
||||
}]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle semantics related to dependencies for `currentExtension`.
|
||||
* semantics: `redExtensions` must wait for `greenExtensions`.
|
||||
*/
|
||||
private _handleActivateRequest(currentExtensionId: ExtensionIdentifier, greenExtensions: { [id: string]: ExtensionIdentifier; }, redExtensions: ExtensionIdentifier[]): void {
|
||||
if (this._hostExtensionsMap.has(ExtensionIdentifier.toKey(currentExtensionId))) {
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtensionId)] = currentExtensionId;
|
||||
private _handleActivateRequest(currentActivation: ActivationIdAndReason, greenExtensions: { [id: string]: ActivationIdAndReason; }, redExtensions: ActivationIdAndReason[]): void {
|
||||
if (this._hostExtensionsMap.has(ExtensionIdentifier.toKey(currentActivation.id))) {
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentActivation.id)] = currentActivation;
|
||||
return;
|
||||
}
|
||||
|
||||
const currentExtension = this._registry.getExtensionDescription(currentExtensionId)!;
|
||||
const currentExtension = this._registry.getExtensionDescription(currentActivation.id)!;
|
||||
const depIds = (typeof currentExtension.extensionDependencies === 'undefined' ? [] : currentExtension.extensionDependencies);
|
||||
let currentExtensionGetsGreenLight = true;
|
||||
|
||||
@@ -276,7 +275,10 @@ export class ExtensionsActivator {
|
||||
if (this._hostExtensionsMap.has(ExtensionIdentifier.toKey(depId))) {
|
||||
// must first wait for the dependency to activate
|
||||
currentExtensionGetsGreenLight = false;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = this._hostExtensionsMap.get(ExtensionIdentifier.toKey(depId))!;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = {
|
||||
id: this._hostExtensionsMap.get(ExtensionIdentifier.toKey(depId))!,
|
||||
reason: currentActivation.reason
|
||||
};
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -284,7 +286,10 @@ export class ExtensionsActivator {
|
||||
if (depDesc) {
|
||||
// must first wait for the dependency to activate
|
||||
currentExtensionGetsGreenLight = false;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = depDesc.identifier;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = {
|
||||
id: depDesc.identifier,
|
||||
reason: currentActivation.reason
|
||||
};
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -296,33 +301,33 @@ export class ExtensionsActivator {
|
||||
}
|
||||
|
||||
if (currentExtensionGetsGreenLight) {
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtension.identifier)] = currentExtensionId;
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtension.identifier)] = currentActivation;
|
||||
} else {
|
||||
redExtensions.push(currentExtensionId);
|
||||
redExtensions.push(currentActivation);
|
||||
}
|
||||
}
|
||||
|
||||
private _activateExtensions(extensionIds: ExtensionIdentifier[], reason: ExtensionActivationReason): Promise<void> {
|
||||
// console.log('_activateExtensions: ', extensionIds.map(p => p.value));
|
||||
if (extensionIds.length === 0) {
|
||||
private _activateExtensions(extensions: ActivationIdAndReason[]): Promise<void> {
|
||||
// console.log('_activateExtensions: ', extensions.map(p => p.id.value));
|
||||
if (extensions.length === 0) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
extensionIds = extensionIds.filter((p) => !this._activatedExtensions.has(ExtensionIdentifier.toKey(p)));
|
||||
if (extensionIds.length === 0) {
|
||||
extensions = extensions.filter((p) => !this._activatedExtensions.has(ExtensionIdentifier.toKey(p.id)));
|
||||
if (extensions.length === 0) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
const greenMap: { [id: string]: ExtensionIdentifier; } = Object.create(null),
|
||||
red: ExtensionIdentifier[] = [];
|
||||
const greenMap: { [id: string]: ActivationIdAndReason; } = Object.create(null),
|
||||
red: ActivationIdAndReason[] = [];
|
||||
|
||||
for (let i = 0, len = extensionIds.length; i < len; i++) {
|
||||
this._handleActivateRequest(extensionIds[i], greenMap, red);
|
||||
for (let i = 0, len = extensions.length; i < len; i++) {
|
||||
this._handleActivateRequest(extensions[i], greenMap, red);
|
||||
}
|
||||
|
||||
// Make sure no red is also green
|
||||
for (let i = 0, len = red.length; i < len; i++) {
|
||||
const redExtensionKey = ExtensionIdentifier.toKey(red[i]);
|
||||
const redExtensionKey = ExtensionIdentifier.toKey(red[i].id);
|
||||
if (greenMap[redExtensionKey]) {
|
||||
delete greenMap[redExtensionKey];
|
||||
}
|
||||
@@ -330,16 +335,16 @@ export class ExtensionsActivator {
|
||||
|
||||
const green = Object.keys(greenMap).map(id => greenMap[id]);
|
||||
|
||||
// console.log('greenExtensions: ', green.map(p => p.id));
|
||||
// console.log('redExtensions: ', red.map(p => p.id));
|
||||
// console.log('greenExtensions: ', green.map(p => p.id.value));
|
||||
// console.log('redExtensions: ', red.map(p => p.id.value));
|
||||
|
||||
if (red.length === 0) {
|
||||
// Finally reached only leafs!
|
||||
return Promise.all(green.map((p) => this._activateExtension(p, reason))).then(_ => undefined);
|
||||
return Promise.all(green.map((p) => this._activateExtension(p.id, p.reason))).then(_ => undefined);
|
||||
}
|
||||
|
||||
return this._activateExtensions(green, reason).then(_ => {
|
||||
return this._activateExtensions(red, reason);
|
||||
return this._activateExtensions(green).then(_ => {
|
||||
return this._activateExtensions(red);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ExtHostExtensionServiceShape, IInitData, MainContext, MainThreadExtensionServiceShape, MainThreadTelemetryShape, MainThreadWorkspaceShape, IResolveAuthorityResult } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostConfiguration, IExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration';
|
||||
import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionModule, HostExtension, ExtensionActivationTimesFragment } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { ActivatedExtension, EmptyExtension, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionModule, HostExtension, ExtensionActivationTimesFragment } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { ExtHostStorage, IExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
|
||||
import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
|
||||
import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -60,6 +60,7 @@ type TelemetryActivationEventFragment = {
|
||||
activationEvents: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
isBuiltin: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
|
||||
reason: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
reasonId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
|
||||
export abstract class AbstractExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
@@ -139,8 +140,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
|
||||
actualActivateExtension: async (extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension> => {
|
||||
if (hostExtensions.has(ExtensionIdentifier.toKey(extensionId))) {
|
||||
const activationEvent = (reason instanceof ExtensionActivatedByEvent ? reason.activationEvent : null);
|
||||
await this._mainThreadExtensionsProxy.$activateExtension(extensionId, activationEvent);
|
||||
await this._mainThreadExtensionsProxy.$activateExtension(extensionId, reason);
|
||||
return new HostExtension();
|
||||
}
|
||||
const extensionDescription = this._registry.getExtensionDescription(extensionId)!;
|
||||
@@ -195,8 +195,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
}
|
||||
|
||||
private _activateByEvent(activationEvent: string, startup: boolean): Promise<void> {
|
||||
const reason = new ExtensionActivatedByEvent(startup, activationEvent);
|
||||
return this._activator.activateByEvent(activationEvent, reason);
|
||||
return this._activator.activateByEvent(activationEvent, startup);
|
||||
}
|
||||
|
||||
private _activateById(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void> {
|
||||
@@ -285,8 +284,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
this._mainThreadExtensionsProxy.$onWillActivateExtension(extensionDescription.identifier);
|
||||
return this._doActivateExtension(extensionDescription, reason).then((activatedExtension) => {
|
||||
const activationTimes = activatedExtension.activationTimes;
|
||||
const activationEvent = (reason instanceof ExtensionActivatedByEvent ? reason.activationEvent : null);
|
||||
this._mainThreadExtensionsProxy.$onDidActivateExtension(extensionDescription.identifier, activationTimes.startup, activationTimes.codeLoadingTime, activationTimes.activateCallTime, activationTimes.activateResolvedTime, activationEvent);
|
||||
this._mainThreadExtensionsProxy.$onDidActivateExtension(extensionDescription.identifier, activationTimes.codeLoadingTime, activationTimes.activateCallTime, activationTimes.activateResolvedTime, reason);
|
||||
this._logExtensionActivationTimes(extensionDescription, reason, 'success', activationTimes);
|
||||
return activatedExtension;
|
||||
}, (err) => {
|
||||
@@ -467,7 +465,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
if (await this._hostUtils.exists(path.join(URI.revive(uri).fsPath, fileName))) {
|
||||
// the file was found
|
||||
return (
|
||||
this._activateById(extensionId, new ExtensionActivatedByEvent(true, `workspaceContains:${fileName}`))
|
||||
this._activateById(extensionId, { startup: true, extensionId, activationEvent: `workspaceContains:${fileName}` })
|
||||
.then(undefined, err => console.error(err))
|
||||
);
|
||||
}
|
||||
@@ -488,7 +486,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
|
||||
const timer = setTimeout(async () => {
|
||||
tokenSource.cancel();
|
||||
this._activateById(extensionId, new ExtensionActivatedByEvent(true, `workspaceContainsTimeout:${globPatterns.join(',')}`))
|
||||
this._activateById(extensionId, { startup: true, extensionId, activationEvent: `workspaceContainsTimeout:${globPatterns.join(',')}` })
|
||||
.then(undefined, err => console.error(err));
|
||||
}, AbstractExtHostExtensionService.WORKSPACE_CONTAINS_TIMEOUT);
|
||||
|
||||
@@ -507,7 +505,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
if (exists) {
|
||||
// a file was found matching one of the glob patterns
|
||||
return (
|
||||
this._activateById(extensionId, new ExtensionActivatedByEvent(true, `workspaceContains:${globPatterns.join(',')}`))
|
||||
this._activateById(extensionId, { startup: true, extensionId, activationEvent: `workspaceContains:${globPatterns.join(',')}` })
|
||||
.then(undefined, err => console.error(err))
|
||||
);
|
||||
}
|
||||
@@ -681,13 +679,13 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
);
|
||||
}
|
||||
|
||||
public async $activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<boolean> {
|
||||
public async $activate(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<boolean> {
|
||||
await this._readyToRunExtensions.wait();
|
||||
if (!this._registry.getExtensionDescription(extensionId)) {
|
||||
// unknown extension => ignore
|
||||
return false;
|
||||
}
|
||||
await this._activateById(extensionId, new ExtensionActivatedByEvent(false, activationEvent));
|
||||
await this._activateById(extensionId, reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -743,12 +741,10 @@ type TelemetryActivationEvent = {
|
||||
activationEvents: string | null;
|
||||
isBuiltin: boolean;
|
||||
reason: string;
|
||||
reasonId: string;
|
||||
};
|
||||
|
||||
function getTelemetryActivationEvent(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): TelemetryActivationEvent {
|
||||
const reasonStr = reason instanceof ExtensionActivatedByEvent ? reason.activationEvent :
|
||||
reason instanceof ExtensionActivatedByAPI ? 'api' :
|
||||
'';
|
||||
const event = {
|
||||
id: extensionDescription.identifier.value,
|
||||
name: extensionDescription.name,
|
||||
@@ -756,7 +752,8 @@ function getTelemetryActivationEvent(extensionDescription: IExtensionDescription
|
||||
publisherDisplayName: extensionDescription.publisher,
|
||||
activationEvents: extensionDescription.activationEvents ? extensionDescription.activationEvents.join(',') : null,
|
||||
isBuiltin: extensionDescription.isBuiltin,
|
||||
reason: reasonStr
|
||||
reason: reason.activationEvent,
|
||||
reasonId: reason.extensionId.value,
|
||||
};
|
||||
|
||||
return event;
|
||||
|
||||
@@ -16,9 +16,9 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
|
||||
|
||||
class FileSystemWatcher implements vscode.FileSystemWatcher {
|
||||
|
||||
private _onDidCreate = new Emitter<vscode.Uri>();
|
||||
private _onDidChange = new Emitter<vscode.Uri>();
|
||||
private _onDidDelete = new Emitter<vscode.Uri>();
|
||||
private readonly _onDidCreate = new Emitter<vscode.Uri>();
|
||||
private readonly _onDidChange = new Emitter<vscode.Uri>();
|
||||
private readonly _onDidDelete = new Emitter<vscode.Uri>();
|
||||
private _disposable: Disposable;
|
||||
private _config: number;
|
||||
|
||||
|
||||
@@ -246,10 +246,10 @@ class ExtHostQuickInput implements QuickInput {
|
||||
private _placeholder: string;
|
||||
private _buttons: QuickInputButton[] = [];
|
||||
private _handlesToButtons = new Map<number, QuickInputButton>();
|
||||
private _onDidAcceptEmitter = new Emitter<void>();
|
||||
private _onDidChangeValueEmitter = new Emitter<string>();
|
||||
private _onDidTriggerButtonEmitter = new Emitter<QuickInputButton>();
|
||||
private _onDidHideEmitter = new Emitter<void>();
|
||||
private readonly _onDidAcceptEmitter = new Emitter<void>();
|
||||
private readonly _onDidChangeValueEmitter = new Emitter<string>();
|
||||
private readonly _onDidTriggerButtonEmitter = new Emitter<QuickInputButton>();
|
||||
private readonly _onDidHideEmitter = new Emitter<void>();
|
||||
private _updateTimeout: any;
|
||||
private _pendingUpdate: TransferQuickInput = { id: this._id };
|
||||
|
||||
@@ -486,9 +486,9 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
|
||||
private _matchOnDescription = true;
|
||||
private _matchOnDetail = true;
|
||||
private _activeItems: T[] = [];
|
||||
private _onDidChangeActiveEmitter = new Emitter<T[]>();
|
||||
private readonly _onDidChangeActiveEmitter = new Emitter<T[]>();
|
||||
private _selectedItems: T[] = [];
|
||||
private _onDidChangeSelectionEmitter = new Emitter<T[]>();
|
||||
private readonly _onDidChangeSelectionEmitter = new Emitter<T[]>();
|
||||
|
||||
constructor(proxy: MainThreadQuickOpenShape, extensionId: ExtensionIdentifier, enableProposedApi: boolean, onDispose: () => void) {
|
||||
super(proxy, extensionId, onDispose);
|
||||
|
||||
@@ -157,7 +157,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
|
||||
this.updateValue(value);
|
||||
}
|
||||
|
||||
private _onDidChange = new Emitter<string>();
|
||||
private readonly _onDidChange = new Emitter<string>();
|
||||
|
||||
get onDidChange(): Event<string> {
|
||||
return this._onDidChange.event;
|
||||
@@ -233,9 +233,9 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
|
||||
private _resourceStatesMap: Map<ResourceStateHandle, vscode.SourceControlResourceState> = new Map<ResourceStateHandle, vscode.SourceControlResourceState>();
|
||||
private _resourceStatesCommandsMap: Map<ResourceStateHandle, vscode.Command> = new Map<ResourceStateHandle, vscode.Command>();
|
||||
|
||||
private _onDidUpdateResourceStates = new Emitter<void>();
|
||||
private readonly _onDidUpdateResourceStates = new Emitter<void>();
|
||||
readonly onDidUpdateResourceStates = this._onDidUpdateResourceStates.event;
|
||||
private _onDidDispose = new Emitter<void>();
|
||||
private readonly _onDidDispose = new Emitter<void>();
|
||||
readonly onDidDispose = this._onDidDispose.event;
|
||||
|
||||
private _handlesSnapshot: number[] = [];
|
||||
@@ -451,7 +451,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
private _onDidChangeSelection = new Emitter<boolean>();
|
||||
private readonly _onDidChangeSelection = new Emitter<boolean>();
|
||||
readonly onDidChangeSelection = this._onDidChangeSelection.event;
|
||||
|
||||
private handle: number = ExtHostSourceControl._handlePool++;
|
||||
@@ -535,7 +535,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
private _sourceControls: Map<ProviderHandle, ExtHostSourceControl> = new Map<ProviderHandle, ExtHostSourceControl>();
|
||||
private _sourceControlsByExtension: Map<string, ExtHostSourceControl[]> = new Map<string, ExtHostSourceControl[]>();
|
||||
|
||||
private _onDidChangeActiveProvider = new Emitter<vscode.SourceControl>();
|
||||
private readonly _onDidChangeActiveProvider = new Emitter<vscode.SourceControl>();
|
||||
get onDidChangeActiveProvider(): Event<vscode.SourceControl> { return this._onDidChangeActiveProvider.event; }
|
||||
|
||||
private _selectedSourceControlHandles = new Set<number>();
|
||||
|
||||
@@ -20,7 +20,7 @@ export class ExtHostStorage implements ExtHostStorageShape {
|
||||
|
||||
private _proxy: MainThreadStorageShape;
|
||||
|
||||
private _onDidChangeStorage = new Emitter<IStorageChangeEvent>();
|
||||
private readonly _onDidChangeStorage = new Emitter<IStorageChangeEvent>();
|
||||
readonly onDidChangeStorage = this._onDidChangeStorage.event;
|
||||
|
||||
constructor(mainContext: IExtHostRpcService) {
|
||||
|
||||
@@ -2352,6 +2352,22 @@ export enum CommentMode {
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region debug
|
||||
export enum DebugConsoleMode {
|
||||
/**
|
||||
* Debug session should have a separate debug console.
|
||||
*/
|
||||
Separate = 0,
|
||||
|
||||
/**
|
||||
* Debug session should share debug console with its parent session.
|
||||
* This value has no effect for sessions which do not have a parent session.
|
||||
*/
|
||||
MergeWithParent = 1
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
@es5ClassCompat
|
||||
export class QuickInputButtons {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ExtHostWindow implements ExtHostWindowShape {
|
||||
|
||||
private _proxy: MainThreadWindowShape;
|
||||
|
||||
private _onDidChangeWindowState = new Emitter<WindowState>();
|
||||
private readonly _onDidChangeWindowState = new Emitter<WindowState>();
|
||||
readonly onDidChangeWindowState: Event<WindowState> = this._onDidChangeWindowState.event;
|
||||
|
||||
private _state = ExtHostWindow.InitialState;
|
||||
@@ -53,4 +53,15 @@ export class ExtHostWindow implements ExtHostWindowShape {
|
||||
}
|
||||
return this._proxy.$openUri(stringOrUri, options);
|
||||
}
|
||||
|
||||
async resolveExternalUri(uri: URI, options: IOpenUriOptions): Promise<URI> {
|
||||
if (isFalsyOrWhitespace(uri.scheme)) {
|
||||
return Promise.reject('Invalid scheme - cannot be empty');
|
||||
} else if (!new Set([Schemas.http, Schemas.https]).has(uri.scheme)) {
|
||||
return Promise.reject(`Invalid scheme '${uri.scheme}'`);
|
||||
}
|
||||
|
||||
const result = await this._proxy.$resolveExternalUri(uri, options);
|
||||
return URI.from(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ namespace schema {
|
||||
case 'menuBar/file': return MenuId.MenubarFileMenu;
|
||||
case 'scm/title': return MenuId.SCMTitle;
|
||||
case 'scm/sourceControl': return MenuId.SCMSourceControl;
|
||||
case 'scm/resourceGroup/context': return MenuId.SCMResourceGroupContext;
|
||||
case 'scm/resourceState/context': return MenuId.SCMResourceContext;
|
||||
case 'scm/resourceFolder/context': return MenuId.SCMResourceFolderContext;
|
||||
case 'scm/resourceGroup/context': return MenuId.SCMResourceGroupContext;
|
||||
case 'scm/change/title': return MenuId.SCMChangeContext;
|
||||
case 'statusBar/windowIndicator': return MenuId.StatusBarWindowIndicatorMenu;
|
||||
case 'view/title': return MenuId.ViewTitle;
|
||||
|
||||
Reference in New Issue
Block a user