Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -2,14 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Event } from 'vs/base/common/event';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { URI } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { Event } from 'vs/base/common/event';
import URI from 'vs/base/common/uri';
export interface IExtensionDescription {
readonly id: string;
@@ -37,6 +35,17 @@ export interface IExtensionDescription {
enableProposedApi?: boolean;
}
export const nullExtensionDescription = Object.freeze(<IExtensionDescription>{
id: 'nullExtensionDescription',
name: 'Null Extension Description',
version: '0.0.0',
publisher: 'vscode',
enableProposedApi: false,
engines: { vscode: '' },
extensionLocation: URI.parse('void:location'),
isBuiltin: false,
});
export const IExtensionService = createDecorator<IExtensionService>('extensionService');
export interface IMessage {
@@ -118,7 +127,19 @@ export class ExtensionPointContribution<T> {
}
}
export interface IExtensionService {
export const ExtensionHostLogFileName = 'exthost';
export interface IWillActivateEvent {
readonly event: string;
readonly activation: Thenable<void>;
}
export interface IResponsiveStateChangeEvent {
target: ICpuProfilerTarget;
isResponsive: boolean;
}
export interface IExtensionService extends ICpuProfilerTarget {
_serviceBrand: any;
/**
@@ -137,26 +158,43 @@ export interface IExtensionService {
*/
onDidChangeExtensionsStatus: Event<string[]>;
/**
* An event that is fired when activation happens.
*/
onWillActivateByEvent: Event<IWillActivateEvent>;
/**
* An event that is fired when an extension host changes its
* responsive-state.
*/
onDidChangeResponsiveChange: Event<IResponsiveStateChangeEvent>;
/**
* Send an activation event and activate interested extensions.
*/
activateByEvent(activationEvent: string): TPromise<void>;
activateByEvent(activationEvent: string): Thenable<void>;
/**
* An promise that resolves when the installed extensions are registered after
* their extension points got handled.
*/
whenInstalledExtensionsRegistered(): TPromise<boolean>;
whenInstalledExtensionsRegistered(): Promise<boolean>;
/**
* Return all registered extensions
*/
getExtensions(): TPromise<IExtensionDescription[]>;
getExtensions(): Promise<IExtensionDescription[]>;
/**
* Return a specific extension
* @param id An extension id
*/
getExtension(id: string): Promise<IExtensionDescription | undefined>;
/**
* Read all contributions to an extension point.
*/
readExtensionPointContributions<T>(extPoint: IExtensionPoint<T>): TPromise<ExtensionPointContribution<T>[]>;
readExtensionPointContributions<T>(extPoint: IExtensionPoint<T>): Promise<ExtensionPointContribution<T>[]>;
/**
* Get information about extensions status.
@@ -164,14 +202,9 @@ export interface IExtensionService {
getExtensionsStatus(): { [id: string]: IExtensionsStatus };
/**
* Check if the extension host can be profiled.
* Return the inspect port or 0.
*/
canProfileExtensionHost(): boolean;
/**
* Begin an extension host process profile session.
*/
startExtensionHostProfile(): TPromise<ProfileSession>;
getInspectPort(): number;
/**
* Restarts the extension host.
@@ -189,6 +222,29 @@ export interface IExtensionService {
stopExtensionHost(): void;
}
export interface ProfileSession {
stop(): TPromise<IExtensionHostProfile>;
export interface ICpuProfilerTarget {
/**
* Check if the extension host can be profiled.
*/
canProfileExtensionHost(): boolean;
/**
* Begin an extension host process profile session.
*/
startExtensionHostProfile(): Promise<ProfileSession>;
}
export interface ProfileSession {
stop(): Promise<IExtensionHostProfile>;
}
export function checkProposedApiEnabled(extension: IExtensionDescription): void {
if (!extension.enableProposedApi) {
throwProposedApiError(extension);
}
}
export function throwProposedApiError(extension: IExtensionDescription): never {
throw new Error(`[${extension.id}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${extension.id}`);
}

View File

@@ -2,16 +2,15 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import Severity from 'vs/base/common/severity';
import { IMessage, IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import { EXTENSION_IDENTIFIER_PATTERN } from 'vs/platform/extensionManagement/common/extensionManagement';
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { EXTENSION_IDENTIFIER_PATTERN } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionDescription, IMessage } from 'vs/workbench/services/extensions/common/extensions';
const hasOwnProperty = Object.hasOwnProperty;
const schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
@@ -72,8 +71,8 @@ export interface IExtensionPoint<T> {
export class ExtensionPoint<T> implements IExtensionPoint<T> {
public readonly name: string;
private _handler: IExtensionPointHandler<T>;
private _users: IExtensionPointUser<T>[];
private _handler: IExtensionPointHandler<T> | null;
private _users: IExtensionPointUser<T>[] | null;
private _done: boolean;
constructor(name: string) {
@@ -120,7 +119,7 @@ export class ExtensionPoint<T> implements IExtensionPoint<T> {
}
const schemaId = 'vscode://schemas/vscode-extensions';
const schema: IJSONSchema = {
export const schema = {
properties: {
engines: {
type: 'object',
@@ -215,6 +214,11 @@ const schema: IJSONSchema = {
description: nls.localize('vscode.extension.activationEvents.onDebugResolve', 'An activation event emitted whenever a debug session with the specific type is about to be launched (and a corresponding resolveDebugConfiguration method needs to be called).'),
body: 'onDebugResolve:${6:type}'
},
{
label: 'onDebugAdapterProtocolTracker',
description: nls.localize('vscode.extension.activationEvents.onDebugAdapterProtocolTracker', 'An activation event emitted whenever a debug session with the specific type is about to be launched and a debug protocol tracker might be needed.'),
body: 'onDebugAdapterProtocolTracker:${6:type}'
},
{
label: 'workspaceContains',
description: nls.localize('vscode.extension.activationEvents.workspaceContains', 'An activation event emitted whenever a folder is opened that contains at least a file matching the specified glob pattern.'),