Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -4,199 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionPoint } from 'vs/platform/extensions/common/extensionsRegistry';
import Event from 'vs/base/common/event';
export interface IExtensionDescription {
readonly id: string;
readonly name: string;
readonly uuid?: string;
readonly displayName?: string;
readonly version: string;
readonly publisher: string;
readonly isBuiltin: boolean;
readonly extensionFolderPath: string;
readonly extensionDependencies?: string[];
readonly activationEvents?: string[];
readonly engines: {
vscode: string;
// {{SQL CARBON EDIT}}
sqlops?: string;
};
readonly main?: string;
readonly contributes?: { [point: string]: any; };
readonly keywords?: string[];
readonly repository?: {
url: string;
};
enableProposedApi?: boolean;
}
export const MANIFEST_CACHE_FOLDER = 'CachedExtensions';
export const USER_MANIFEST_CACHE_FILE = 'user';
export const BUILTIN_MANIFEST_CACHE_FILE = 'builtin';
export const IExtensionService = createDecorator<IExtensionService>('extensionService');
export interface IMessage {
type: Severity;
message: string;
source: string;
extensionId: string;
extensionPointId: string;
}
export interface IExtensionsStatus {
messages: IMessage[];
activationTimes: ActivationTimes;
runtimeErrors: Error[];
}
/**
* e.g.
* ```
* {
* startTime: 1511954813493000,
* endTime: 1511954835590000,
* deltas: [ 100, 1500, 123456, 1500, 100000 ],
* ids: [ 'idle', 'self', 'extension1', 'self', 'idle' ]
* }
* ```
*/
export interface IExtensionHostProfile {
/**
* Profiling start timestamp in microseconds.
*/
startTime: number;
/**
* Profiling end timestamp in microseconds.
*/
endTime: number;
/**
* Duration of segment in microseconds.
*/
deltas: number[];
/**
* Segment identifier: extension id or one of the four known strings.
*/
ids: ProfileSegmentId[];
/**
* Get the information as a .cpuprofile.
*/
data: object;
/**
* Get the aggregated time per segmentId
*/
getAggregatedTimes(): Map<ProfileSegmentId, number>;
}
/**
* Extension id or one of the four known program states.
*/
export type ProfileSegmentId = string | 'idle' | 'program' | 'gc' | 'self';
export class ActivationTimes {
constructor(
public readonly startup: boolean,
public readonly codeLoadingTime: number,
public readonly activateCallTime: number,
public readonly activateResolvedTime: number,
public readonly activationEvent: string
) {
}
}
export class ExtensionPointContribution<T> {
readonly description: IExtensionDescription;
readonly value: T;
constructor(description: IExtensionDescription, value: T) {
this.description = description;
this.value = value;
}
}
export interface IExtensionHostInformation {
inspectPort: number;
}
export interface IExtensionService {
_serviceBrand: any;
/**
* TODO@Ben: Delete this and use `whenInstalledExtensionsRegistered`
* An event emitted when extensions are registered after their extension points got handled.
*
* This event will also fire on startup to signal the installed extensions.
*
* @returns the extensions that got registered
*/
onDidRegisterExtensions: Event<IExtensionDescription[]>;
/**
* @event
* Fired when extensions status changes.
* The event contains the ids of the extensions that have changed.
*/
onDidChangeExtensionsStatus: Event<string[]>;
/**
* Send an activation event and activate interested extensions.
*/
activateByEvent(activationEvent: string): TPromise<void>;
/**
* An promise that resolves when the installed extensions are registered after
* their extension points got handled.
*/
whenInstalledExtensionsRegistered(): TPromise<boolean>;
/**
* Return all registered extensions
*/
getExtensions(): TPromise<IExtensionDescription[]>;
/**
* Read all contributions to an extension point.
*/
readExtensionPointContributions<T>(extPoint: IExtensionPoint<T>): TPromise<ExtensionPointContribution<T>[]>;
/**
* Get information about extensions status.
*/
getExtensionsStatus(): { [id: string]: IExtensionsStatus };
/**
* Begin an extension host process profile session.
*/
startExtensionHostProfile(): TPromise<ProfileSession>;
/**
* Restarts the extension host.
*/
restartExtensionHost(): void;
/**
* Starts the extension host.
*/
startExtensionHost(): void;
/**
* Stops the extension host.
*/
stopExtensionHost(): void;
/**
*
*/
getExtensionHostInformation(): IExtensionHostInformation;
}
export interface ProfileSession {
stop(): TPromise<IExtensionHostProfile>;
}

View File

@@ -1,309 +0,0 @@
/*---------------------------------------------------------------------------------------------
* 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/platform/extensions/common/extensions';
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';
const hasOwnProperty = Object.hasOwnProperty;
const schemaRegistry = <IJSONContributionRegistry>Registry.as(Extensions.JSONContribution);
export class ExtensionMessageCollector {
private readonly _messageHandler: (msg: IMessage) => void;
private readonly _extension: IExtensionDescription;
private readonly _extensionPointId: string;
constructor(
messageHandler: (msg: IMessage) => void,
extension: IExtensionDescription,
extensionPointId: string
) {
this._messageHandler = messageHandler;
this._extension = extension;
this._extensionPointId = extensionPointId;
}
private _msg(type: Severity, message: string): void {
this._messageHandler({
type: type,
message: message,
source: this._extension.extensionFolderPath,
extensionId: this._extension.id,
extensionPointId: this._extensionPointId
});
}
public error(message: string): void {
this._msg(Severity.Error, message);
}
public warn(message: string): void {
this._msg(Severity.Warning, message);
}
public info(message: string): void {
this._msg(Severity.Info, message);
}
}
export interface IExtensionPointUser<T> {
description: IExtensionDescription;
value: T;
collector: ExtensionMessageCollector;
}
export interface IExtensionPointHandler<T> {
(extensions: IExtensionPointUser<T>[]): void;
}
export interface IExtensionPoint<T> {
name: string;
setHandler(handler: IExtensionPointHandler<T>): void;
}
export class ExtensionPoint<T> implements IExtensionPoint<T> {
public readonly name: string;
private _handler: IExtensionPointHandler<T>;
private _users: IExtensionPointUser<T>[];
private _done: boolean;
constructor(name: string) {
this.name = name;
this._handler = null;
this._users = null;
this._done = false;
}
setHandler(handler: IExtensionPointHandler<T>): void {
if (this._handler !== null || this._done) {
throw new Error('Handler already set!');
}
this._handler = handler;
this._handle();
}
acceptUsers(users: IExtensionPointUser<T>[]): void {
if (this._users !== null || this._done) {
throw new Error('Users already set!');
}
this._users = users;
this._handle();
}
private _handle(): void {
if (this._handler === null || this._users === null) {
return;
}
this._done = true;
let handler = this._handler;
this._handler = null;
let users = this._users;
this._users = null;
try {
handler(users);
} catch (err) {
onUnexpectedError(err);
}
}
}
const schemaId = 'vscode://schemas/vscode-extensions';
const schema: IJSONSchema = {
properties: {
engines: {
type: 'object',
properties: {
'vscode': {
type: 'string',
description: nls.localize('vscode.extension.engines.vscode', 'For VS Code extensions, specifies the VS Code version that the extension is compatible with. Cannot be *. For example: ^0.10.5 indicates compatibility with a minimum VS Code version of 0.10.5.'),
default: '^0.10.0',
}
}
},
publisher: {
description: nls.localize('vscode.extension.publisher', 'The publisher of the VS Code extension.'),
type: 'string'
},
displayName: {
description: nls.localize('vscode.extension.displayName', 'The display name for the extension used in the VS Code gallery.'),
type: 'string'
},
categories: {
description: nls.localize('vscode.extension.categories', 'The categories used by the VS Code gallery to categorize the extension.'),
type: 'array',
uniqueItems: true,
items: {
type: 'string',
enum: ['Languages', 'Snippets', 'Linters', 'Themes', 'Debuggers', 'Other', 'Keymaps', 'Formatters', 'Extension Packs', 'SCM Providers', 'Azure']
}
},
galleryBanner: {
type: 'object',
description: nls.localize('vscode.extension.galleryBanner', 'Banner used in the VS Code marketplace.'),
properties: {
color: {
description: nls.localize('vscode.extension.galleryBanner.color', 'The banner color on the VS Code marketplace page header.'),
type: 'string'
},
theme: {
description: nls.localize('vscode.extension.galleryBanner.theme', 'The color theme for the font used in the banner.'),
type: 'string',
enum: ['dark', 'light']
}
}
},
contributes: {
description: nls.localize('vscode.extension.contributes', 'All contributions of the VS Code extension represented by this package.'),
type: 'object',
properties: {
// extensions will fill in
},
default: {}
},
preview: {
type: 'boolean',
description: nls.localize('vscode.extension.preview', 'Sets the extension to be flagged as a Preview in the Marketplace.'),
},
activationEvents: {
description: nls.localize('vscode.extension.activationEvents', 'Activation events for the VS Code extension.'),
type: 'array',
items: {
type: 'string',
defaultSnippets: [
{
label: 'onLanguage',
description: nls.localize('vscode.extension.activationEvents.onLanguage', 'An activation event emitted whenever a file that resolves to the specified language gets opened.'),
body: 'onLanguage:${1:languageId}'
},
{
label: 'onCommand',
description: nls.localize('vscode.extension.activationEvents.onCommand', 'An activation event emitted whenever the specified command gets invoked.'),
body: 'onCommand:${2:commandId}'
},
{
label: 'onDebug',
description: nls.localize('vscode.extension.activationEvents.onDebug', 'An activation event emitted whenever a user is about to start debugging or about to setup debug configurations.'),
body: 'onDebug'
},
{
label: 'onDebugInitialConfigurations',
description: nls.localize('vscode.extension.activationEvents.onDebugInitialConfigurations', 'An activation event emitted whenever a "launch.json" needs to be created (and all provideDebugConfigurations methods need to be called).'),
body: 'onDebugInitialConfigurations'
},
{
label: 'onDebugResolve',
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: '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.'),
body: 'workspaceContains:${4:filePattern}'
},
{
label: 'onView',
body: 'onView:${5:viewId}',
description: nls.localize('vscode.extension.activationEvents.onView', 'An activation event emitted whenever the specified view is expanded.'),
},
{
label: '*',
description: nls.localize('vscode.extension.activationEvents.star', 'An activation event emitted on VS Code startup. To ensure a great end user experience, please use this activation event in your extension only when no other activation events combination works in your use-case.'),
body: '*'
}
],
}
},
badges: {
type: 'array',
description: nls.localize('vscode.extension.badges', 'Array of badges to display in the sidebar of the Marketplace\'s extension page.'),
items: {
type: 'object',
required: ['url', 'href', 'description'],
properties: {
url: {
type: 'string',
description: nls.localize('vscode.extension.badges.url', 'Badge image URL.')
},
href: {
type: 'string',
description: nls.localize('vscode.extension.badges.href', 'Badge link.')
},
description: {
type: 'string',
description: nls.localize('vscode.extension.badges.description', 'Badge description.')
}
}
}
},
extensionDependencies: {
description: nls.localize('vscode.extension.extensionDependencies', 'Dependencies to other extensions. The identifier of an extension is always ${publisher}.${name}. For example: vscode.csharp.'),
type: 'array',
uniqueItems: true,
items: {
type: 'string',
pattern: EXTENSION_IDENTIFIER_PATTERN
}
},
scripts: {
type: 'object',
properties: {
'vscode:prepublish': {
description: nls.localize('vscode.extension.scripts.prepublish', 'Script executed before the package is published as a VS Code extension.'),
type: 'string'
}
}
},
icon: {
type: 'string',
description: nls.localize('vscode.extension.icon', 'The path to a 128x128 pixel icon.')
}
}
};
export class ExtensionsRegistryImpl {
private _extensionPoints: { [extPoint: string]: ExtensionPoint<any>; };
constructor() {
this._extensionPoints = {};
}
public registerExtensionPoint<T>(extensionPoint: string, deps: IExtensionPoint<any>[], jsonSchema: IJSONSchema): IExtensionPoint<T> {
if (hasOwnProperty.call(this._extensionPoints, extensionPoint)) {
throw new Error('Duplicate extension point: ' + extensionPoint);
}
let result = new ExtensionPoint<T>(extensionPoint);
this._extensionPoints[extensionPoint] = result;
schema.properties['contributes'].properties[extensionPoint] = jsonSchema;
schemaRegistry.registerSchema(schemaId, schema);
return result;
}
public getExtensionPoints(): ExtensionPoint<any>[] {
return Object.keys(this._extensionPoints).map(point => this._extensionPoints[point]);
}
}
const PRExtensions = {
ExtensionsRegistry: 'ExtensionsRegistry'
};
Registry.add(PRExtensions.ExtensionsRegistry, new ExtensionsRegistryImpl());
export const ExtensionsRegistry: ExtensionsRegistryImpl = Registry.as(PRExtensions.ExtensionsRegistry);
schemaRegistry.registerSchema(schemaId, schema);