提交 a9f54a84 编写于 作者: J Joao Moreno

Merge remote-tracking branch 'origin/master' into ipc

......@@ -7,5 +7,19 @@
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
"contributes": {
"languages": [{
"id": "jade",
"extensions": [ ".jade" ],
"extensions": [ ".jade", ".pug" ],
"aliases": [ "Jade", "jade" ],
"configuration": "./jade.configuration.json"
}],
......
......@@ -10,7 +10,7 @@
"dependencies": {
"vscode-nls": "^1.0.4",
"request-light": "^0.1.0",
"jsonc-parser": "^0.1.0"
"jsonc-parser": "^0.2.0"
},
"scripts": {
"compile": "gulp compile-extension:javascript",
......
......@@ -162,15 +162,17 @@ export class BowerJSONContribution implements IJSONContribution {
public getInfoContribution(resource: string, location: Location): Thenable<MarkedString[]> {
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']))) {
let pack = location.segments[location.segments.length - 1];
let htmlContent : MarkedString[] = [];
htmlContent.push(localize('json.bower.package.hover', '{0}', pack));
return this.getInfo(pack).then(documentation => {
if (documentation) {
htmlContent.push(documentation);
}
return htmlContent;
});
let pack = location.path[location.path.length - 1];
if (typeof pack === 'string') {
let htmlContent : MarkedString[] = [];
htmlContent.push(localize('json.bower.package.hover', '{0}', pack));
return this.getInfo(pack).then(documentation => {
if (documentation) {
htmlContent.push(documentation);
}
return htmlContent;
});
}
}
return null;
}
......
......@@ -120,7 +120,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {
let collectPromise : Thenable<any> = null;
if (location.completeProperty) {
if (location.isAtPropertyKey) {
let addValue = !location.previousNode || !location.previousNode.columnOffset;
let scanner = createScanner(document.getText(), true);
scanner.setPosition(offset);
......@@ -128,7 +128,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {
let isLast = scanner.getToken() === SyntaxKind.CloseBraceToken || scanner.getToken() === SyntaxKind.EOF;
collectPromise = this.jsonContribution.collectPropertySuggestions(fileName, location, currentWord, addValue, isLast, collector);
} else {
if (location.segments.length === 0) {
if (location.path.length === 0) {
collectPromise = this.jsonContribution.collectDefaultSuggestions(fileName, collector);
} else {
collectPromise = this.jsonContribution.collectValueSuggestions(fileName, location, collector);
......
......@@ -117,44 +117,45 @@ export class PackageJSONContribution implements IJSONContribution {
public collectValueSuggestions(fileName: string, location: Location, result: ISuggestionsCollector): Thenable<any> {
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']) || location.matches(['optionalDependencies', '*']) || location.matches(['peerDependencies', '*']))) {
let currentKey = location.segments[location.segments.length - 1];
let queryUrl = 'http://registry.npmjs.org/' + encodeURIComponent(currentKey) + '/latest';
return this.xhr({
url : queryUrl
}).then((success) => {
try {
let obj = JSON.parse(success.responseText);
if (obj && obj.version) {
let version = obj.version;
let name = JSON.stringify(version);
let proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.latestversion', 'The currently latest version of the package');
result.add(proposal);
name = JSON.stringify('^' + version);
proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.majorversion', 'Matches the most recent major version (1.x.x)');
result.add(proposal);
name = JSON.stringify('~' + version);
proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.minorversion', 'Matches the most recent minor version (1.2.x)');
result.add(proposal);
let currentKey = location.path[location.path.length - 1];
if (typeof currentKey === 'string') {
let queryUrl = 'http://registry.npmjs.org/' + encodeURIComponent(currentKey) + '/latest';
return this.xhr({
url : queryUrl
}).then((success) => {
try {
let obj = JSON.parse(success.responseText);
if (obj && obj.version) {
let version = obj.version;
let name = JSON.stringify(version);
let proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.latestversion', 'The currently latest version of the package');
result.add(proposal);
name = JSON.stringify('^' + version);
proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.majorversion', 'Matches the most recent major version (1.x.x)');
result.add(proposal);
name = JSON.stringify('~' + version);
proposal = new CompletionItem(name);
proposal.kind = CompletionItemKind.Property;
proposal.insertText = name;
proposal.documentation = localize('json.npm.minorversion', 'Matches the most recent minor version (1.2.x)');
result.add(proposal);
}
} catch (e) {
// ignore
}
} catch (e) {
// ignore
}
return 0;
}, (error) => {
return 0;
});
return 0;
}, (error) => {
return 0;
});
}
}
return null;
}
......@@ -204,16 +205,17 @@ export class PackageJSONContribution implements IJSONContribution {
public getInfoContribution(fileName: string, location: Location): Thenable<MarkedString[]> {
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']) || location.matches(['optionalDependencies', '*']) || location.matches(['peerDependencies', '*']))) {
let pack = location.segments[location.segments.length - 1];
let htmlContent : MarkedString[] = [];
htmlContent.push(localize('json.npm.package.hover', '{0}', pack));
return this.getInfo(pack).then(infos => {
infos.forEach(info => {
htmlContent.push(info);
let pack = location.path[location.path.length - 1];
if (typeof pack === 'string') {
let htmlContent : MarkedString[] = [];
htmlContent.push(localize('json.npm.package.hover', '{0}', pack));
return this.getInfo(pack).then(infos => {
infos.forEach(info => {
htmlContent.push(info);
});
return htmlContent;
});
return htmlContent;
});
}
}
return null;
}
......
......@@ -67,6 +67,10 @@
"fileMatch": "%APP_SETTINGS_HOME%/settings.json",
"url": "vscode://schemas/settings"
},
{
"fileMatch": "%APP_SETTINGS_HOME%/locale.json",
"url": "vscode://schemas/locale"
},
{
"fileMatch": "/.vscode/settings.json",
"url": "vscode://schemas/settings"
......
......@@ -9,7 +9,7 @@
},
"dependencies": {
"request-light": "^0.1.0",
"jsonc-parser": "^0.1.0",
"jsonc-parser": "^0.2.0",
"vscode-languageserver": "^1.3.0",
"vscode-nls": "^1.0.4"
},
......
......@@ -6,8 +6,8 @@
"contributes": {
"languages": [{
"id": "ruby",
"extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp", ".rake" ],
"filenames": [ "rakefile", "gemfile" ],
"extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp", ".rake", ".ru" ],
"filenames": [ "rakefile", "gemfile", "guardfile" ],
"aliases": [ "Ruby", "rb" ],
"configuration": "./ruby.configuration.json"
}],
......@@ -17,4 +17,4 @@
"path": "./syntaxes/Ruby.plist"
}]
}
}
\ No newline at end of file
}
......@@ -81,6 +81,12 @@
"default": true,
"description": "%typescript.validate.enable%"
},
"typescript.tsserver.trace": {
"type": "string",
"enum": ["off", "messages", "verbose"],
"default": "off",
"description": "%typescript.tsserver.trace%"
},
"typescript.format.insertSpaceAfterCommaDelimiter": {
"type": "boolean",
"default": true,
......
......@@ -4,6 +4,7 @@
"configuration.typescript": "TypeScript configuration",
"typescript.useCodeSnippetsOnMethodSuggest.dec": "Complete functions with their parameter signature.",
"typescript.tsdk.desc": "Specifies the folder path containing the tsserver and lib*.d.ts files to use.",
"typescript.tsserver.trace": "Enables tracing of messages send to the TS server",
"typescript.validate.enable": "Enable / disable TypeScript validation",
"format.insertSpaceAfterCommaDelimiter": "Defines space handling after a comma delimiter",
"format.insertSpaceAfterSemicolonInForStatements": " Defines space handling after a semicolon in a for statement",
......
......@@ -18,7 +18,6 @@ export interface ITypescriptServiceClient {
asAbsolutePath(resource: Uri): string;
asUrl(filepath: string): Uri;
trace: boolean;
logTelemetry(eventName: string, properties?: { [prop: string]: string });
execute(command:'configure', args: Proto.ConfigureRequestArguments, token?: CancellationToken):Promise<Proto.ConfigureResponse>;
......
......@@ -12,7 +12,7 @@ import * as fs from 'fs';
import * as electron from './utils/electron';
import { Reader } from './utils/wireProtocol';
import { workspace, window, Uri, CancellationToken } from 'vscode';
import { workspace, window, Uri, CancellationToken, OutputChannel } from 'vscode';
import * as Proto from './protocol';
import { ITypescriptServiceClient, ITypescriptServiceClientHost } from './typescriptService';
......@@ -45,15 +45,35 @@ interface IPackageInfo {
aiKey: string;
}
export default class TypeScriptServiceClient implements ITypescriptServiceClient {
enum Trace {
Off, Messages, Verbose
}
namespace Trace {
export function fromString(value: string): Trace {
value = value.toLowerCase();
switch (value) {
case 'off':
return Trace.Off;
case 'messages':
return Trace.Messages;
case 'verbose':
return Trace.Verbose;
default:
return Trace.Off;
}
}
}
public static Trace: boolean = process.env.TSS_TRACE || false;
export default class TypeScriptServiceClient implements ITypescriptServiceClient {
private host: ITypescriptServiceClientHost;
private pathSeparator: string;
private _onReady: { promise: Promise<void>; resolve: () => void; reject: () => void; };
private tsdk: string;
private trace: Trace;
private output: OutputChannel;
private servicePromise: Promise<cp.ChildProcess>;
private lastError: Error;
private reader: Reader<Proto.Response>;
......@@ -90,7 +110,9 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.pendingResponses = 0;
this.callbacks = Object.create(null);
this.tsdk = workspace.getConfiguration().get<string>('typescript.tsdk', null);
this.trace = this.readTrace();
workspace.onDidChangeConfiguration(() => {
this.trace = this.readTrace();
let oldTask = this.tsdk;
this.tsdk = workspace.getConfiguration().get<string>('typescript.tsdk', null);
if (this.servicePromise === null && oldTask !== this.tsdk) {
......@@ -103,12 +125,19 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.startService();
}
public onReady(): Promise<void> {
return this._onReady.promise;
private readTrace(): Trace {
let result: Trace = Trace.fromString(workspace.getConfiguration().get<string>('typescript.tsserver.trace', 'off'));
if (result === Trace.Off && !!process.env.TSS_TRACE) {
result = Trace.Messages;
}
if (result !== Trace.Off && !this.output) {
this.output = window.createOutputChannel(localize('channelName', 'TypeScript'));
}
return result;
}
public get trace(): boolean {
return TypeScriptServiceClient.Trace;
public onReady(): Promise<void> {
return this._onReady.promise;
}
private get packageInfo(): IPackageInfo {
......@@ -326,9 +355,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private sendRequest(requestItem: RequestItem): void {
let serverRequest = requestItem.request;
if (TypeScriptServiceClient.Trace) {
console.log('TypeScript Service: sending request ' + serverRequest.command + '(' + serverRequest.seq + '). Response expected: ' + (requestItem.callbacks ? 'yes' : 'no') + '. Current queue length: ' + this.requestQueue.length);
}
this.traceRequest(serverRequest, !!requestItem.callbacks);
if (requestItem.callbacks) {
this.callbacks[serverRequest.seq] = requestItem.callbacks;
this.pendingResponses++;
......@@ -349,14 +376,14 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
for (let i = 0; i < this.requestQueue.length; i++) {
if (this.requestQueue[i].request.seq === seq) {
this.requestQueue.splice(i, 1);
if (TypeScriptServiceClient.Trace) {
console.log('TypeScript Service: canceled request with sequence number ' + seq);
if (this.trace !== Trace.Off) {
this.output.append(`TypeScript Service: canceled request with sequence number ${seq}\n`);
}
return true;
}
}
if (TypeScriptServiceClient.Trace) {
console.log('TypeScript Service: tried to cancel request with sequence number ' + seq + '. But request got already delivered.');
if (this.trace !== Trace.Off) {
this.output.append(`TypeScript Service: tried to cancel request with sequence number ${seq}. But request got already delivered.`);
}
return false;
}
......@@ -367,19 +394,23 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
let response: Proto.Response = <Proto.Response>message;
let p = this.callbacks[response.request_seq];
if (p) {
if (TypeScriptServiceClient.Trace) {
console.log('TypeScript Service: request ' + response.command + '(' + response.request_seq + ') took ' + (Date.now() - p.start) + 'ms. Success: ' + response.success + ((!response.success) ? ('. Message: ' + response.message) : ''));
}
this.traceResponse(response, p.start);
delete this.callbacks[response.request_seq];
this.pendingResponses--;
if (response.success) {
p.c(response);
} else {
this.logTelemetry('requestFailed', {
id: response.request_seq.toString(),
command: response.command,
message: response.message ? response.message : 'No detailed message provided'
});
p.e(response);
}
}
} else if (message.type === 'event') {
let event: Proto.Event = <Proto.Event>message;
this.traceEvent(event);
if (event.event === 'syntaxDiag') {
this.host.syntaxDiagnosticsReceived(event);
}
......@@ -393,4 +424,34 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.sendNextRequests();
}
}
private traceRequest(request: Proto.Request, responseExpected: boolean): void {
if (this.trace === Trace.Off) {
return;
}
this.output.append(`Sending request: ${request.command} (${request.seq}). Response expected: ${responseExpected ? 'yes' : 'no'}. Current queue length: ${this.requestQueue.length}\n`);
if (this.trace === Trace.Verbose && request.arguments) {
this.output.append(`Arguments: ${JSON.stringify(request.arguments, null, 4)}\n\n`);
}
}
private traceResponse(response: Proto.Response, startTime: number): void {
if (this.trace === Trace.Off) {
return;
}
this.output.append(`Response received: ${response.command} (${response.request_seq}). Request took ${Date.now() - startTime} ms. Success: ${response.success} ${!response.success ? '. Message: ' + response.message : ''}\n`);
if (this.trace === Trace.Verbose && response.body) {
this.output.append(`Result: ${JSON.stringify(response.body, null, 4)}\n\n`);
}
}
private traceEvent(event: Proto.Event): void {
if (this.trace === Trace.Off) {
return;
}
this.output.append(`Event received: ${event.event} (${event.seq}).\n`);
if (this.trace === Trace.Verbose && event.body) {
this.output.append(`Data: ${JSON.stringify(event.body, null, 4)}\n\n`);
}
}
}
\ No newline at end of file
function foo(isAll, startTime, endTime) {
const timeRange = isAll ? '所有时间' : `${startTime} - ${endTime}`;
return true;
}
\ No newline at end of file
function* foo2() {
yield 'bar';
yield* ['bar'];
}
\ No newline at end of file
{
"compilerOptions": {
"target": "es6"
}
}
\ No newline at end of file
[
{
"c": "function",
"t": "function.meta.storage.ts.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.type rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.type rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.type rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.type rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.type rgb(86, 156, 214)"
}
},
{
"c": " ",
"t": "function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "foo",
"t": "entity.function.meta.name.ts",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function rgb(220, 220, 170)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function rgb(121, 94, 38)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "(",
"t": "brace.function.meta.parameter.round.ts.type",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "isAll",
"t": "function.meta.name.parameter.ts.type.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.parameter.type.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.parameter.type.variable rgb(0, 16, 128)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": ",",
"t": "function.meta.parameter.ts.type",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "function.meta.name.parameter.ts.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.type.name rgb(78, 201, 176)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.type.name rgb(38, 127, 153)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "startTime",
"t": "function.meta.name.parameter.ts.type.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.parameter.type.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.parameter.type.variable rgb(0, 16, 128)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": ",",
"t": "function.meta.parameter.ts.type",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "function.meta.name.parameter.ts.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.type.name rgb(78, 201, 176)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.type.name rgb(38, 127, 153)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "endTime",
"t": "function.meta.name.parameter.ts.type.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.parameter.type.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.parameter.type.variable rgb(0, 16, 128)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": ")",
"t": "brace.function.meta.parameter.round.ts.type",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "{",
"t": "block.brace.curly.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\t",
"t": "block.decl.expr.function.meta.ts.var",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "const",
"t": "block.decl.expr.function.meta.storage.ts.type.var",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.type rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.type rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.type rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.type rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.type rgb(86, 156, 214)"
}
},
{
"c": " ",
"t": "block.decl.expr.function.meta.ts.var",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "timeRange",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " = isAll ? ",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "'所有时间'",
"t": "block.decl.expr.function.meta.single.string.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
},
{
"c": " ",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": ": `",
"t": "annotation.block.decl.expr.function.meta.ts.type.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.type.annotation rgb(78, 201, 176)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.type.annotation rgb(38, 127, 153)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "$",
"t": "annotation.block.decl.expr.function.meta.name.ts.type.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.meta.type.annotation rgb(78, 201, 176)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.meta.type.annotation rgb(38, 127, 153)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "{",
"t": "block.brace.curly.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "startTime",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "}",
"t": "block.brace.curly.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "-",
"t": "arithmetic.block.decl.expr.function.keyword.meta.operator.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword.operator rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword.operator rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword.operator rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword.operator rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword.operator rgb(212, 212, 212)"
}
},
{
"c": " $",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "{",
"t": "block.brace.curly.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "endTime",
"t": "block.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "}",
"t": "block.brace.curly.decl.expr.function.meta.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "`;",
"t": "block.decl.expr.function.meta.string.template.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
},
{
"c": "\treturn true;",
"t": "block.decl.expr.function.meta.string.template.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
},
{
"c": "}",
"t": "block.decl.expr.function.meta.string.template.ts.var.var-single-variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
}
]
\ No newline at end of file
[
{
"c": "function",
"t": "function.meta.storage.ts.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.type rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.type rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.type rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.type rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.type rgb(86, 156, 214)"
}
},
{
"c": "* foo2",
"t": "function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "()",
"t": "brace.function.meta.parameter.round.ts.type",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "{",
"t": "block.brace.curly.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\tyield ",
"t": "block.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "'bar'",
"t": "block.decl.function.meta.single.string.ts",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
},
{
"c": ";",
"t": "block.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\tyield",
"t": "block.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "*",
"t": "arithmetic.block.decl.function.keyword.meta.operator.ts",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword.operator rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword.operator rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword.operator rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword.operator rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword.operator rgb(212, 212, 212)"
}
},
{
"c": " ",
"t": "block.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "[",
"t": "array.block.brace.decl.function.literal.meta.square.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "'bar'",
"t": "array.block.decl.function.literal.meta.single.string.ts",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string rgb(206, 145, 120)"
}
},
{
"c": "]",
"t": "array.block.brace.decl.function.literal.meta.square.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": ";",
"t": "block.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "}",
"t": "block.brace.curly.decl.function.meta.ts",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
}
]
\ No newline at end of file
[
{
"c": "{",
"t": "begin.definition.dictionary.json.meta.punctuation.structure",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\t",
"t": "dictionary.json.meta.structure",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\"",
"t": "begin.dictionary.json.meta.property-name.punctuation.structure.support.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": "compilerOptions",
"t": "dictionary.json.meta.property-name.structure.support.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": "\"",
"t": "dictionary.end.json.meta.property-name.punctuation.structure.support.type",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": ":",
"t": "dictionary.json.key-value.meta.punctuation.separator.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "dictionary.json.meta.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "{",
"t": "begin.definition.dictionary.json.meta.punctuation.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\t\t",
"t": "dictionary.json.meta.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\"",
"t": "begin.dictionary.json.meta.property-name.punctuation.structure.support.type.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": "target",
"t": "dictionary.json.meta.property-name.structure.support.type.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": "\"",
"t": "dictionary.end.json.meta.property-name.punctuation.structure.support.type.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.support.type.property-name rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.support.type.property-name rgb(4, 81, 165)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.support.type.property-name rgb(156, 220, 254)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.support.type.property-name rgb(4, 81, 165)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.support.type.property-name rgb(212, 212, 212)"
}
},
{
"c": ":",
"t": "dictionary.json.key-value.meta.punctuation.separator.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": " ",
"t": "dictionary.json.meta.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "\"",
"t": "begin.definition.dictionary.double.json.meta.punctuation.quoted.string.structure.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string.value rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string.value rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string.value rgb(206, 145, 120)"
}
},
{
"c": "es6",
"t": "dictionary.double.json.meta.quoted.string.structure.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string.value rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string.value rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string.value rgb(206, 145, 120)"
}
},
{
"c": "\"",
"t": "definition.dictionary.double.end.json.meta.punctuation.quoted.string.structure.value",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string.value rgb(206, 145, 120)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string.value rgb(206, 145, 120)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string rgb(163, 21, 21)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string.value rgb(206, 145, 120)"
}
},
{
"c": "\t",
"t": "dictionary.json.meta.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "}",
"t": "definition.dictionary.end.json.meta.punctuation.structure.value",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
},
{
"c": "}",
"t": "definition.dictionary.end.json.meta.punctuation.structure",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
"dark_vs": ".vs-dark .token rgb(212, 212, 212)",
"light_vs": ".vs .token rgb(0, 0, 0)",
"hc_black": ".hc-black .token rgb(255, 255, 255)"
}
}
]
\ No newline at end of file
......@@ -10,6 +10,7 @@
"exclude": [
"node_modules",
"server",
"out"
"out",
"test/colorize-fixtures"
]
}
\ No newline at end of file
{
"name": "Code",
"version": "1.0.0",
"version": "1.0.1",
"electronVersion": "0.37.6",
"author": {
"name": "Microsoft Corporation"
......
......@@ -8,6 +8,15 @@ else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
# Node modules
test -d node_modules || ./scripts/npm.sh install
# Get electron
./node_modules/.bin/gulp electron
# Build
test -d out || ./node_modules/.bin/gulp compile
# Unit Tests
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 \
......
......@@ -20,9 +20,6 @@ export interface SiblingClause {
const PATH_REGEX = '[/\\\\]'; // any slash or backslash
const NO_PATH_REGEX = '[^/\\\\]'; // any non-slash and non-backslash
const BEGINS_WITH_PATH_REGEX = PATH_REGEX + '.*?'; // anything that begins with a path or just the path itself
const ENDS_WITH_PATH_REGEX = '.+?' + PATH_REGEX;
function starsToRegExp(starCount: number): string {
switch (starCount) {
case 0:
......@@ -30,11 +27,10 @@ function starsToRegExp(starCount: number): string {
case 1:
return NO_PATH_REGEX + '*?'; // 1 star matches any number of characters except path separator (/ and \) - non greedy (?)
default:
// Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times
// Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times
// Group is non capturing because we don't need to capture at all (?:...)
// Overall we use non-greedy matching because it could be that we match too much
return '(?:' + BEGINS_WITH_PATH_REGEX + '|' + ENDS_WITH_PATH_REGEX + ')*?';
return '(?:' + PATH_REGEX + '|' + NO_PATH_REGEX + '+' + PATH_REGEX + '|' + PATH_REGEX + NO_PATH_REGEX + '+)*?';
}
}
......@@ -251,6 +247,10 @@ function toRegExp(regEx: string): RegExp {
}
}
// regexes to check for trival glob patterns that just check for String#endsWith
const trivia1 = /^\*\*\/\*\.\w+$/;
const trivia2 = /^{\*\*\/\*\.\w+(,\*\*\/\*\.\w+)*}$/;
/**
* Simplified glob matching. Supports a subset of glob patterns:
* - * matches anything inside a path segment
......@@ -268,6 +268,16 @@ export function match(arg1: string | IExpression, path: string, siblings?: strin
// Glob with String
if (typeof arg1 === 'string') {
if (trivia1.test(arg1)) {
// common pattern: **/*.txt just need endsWith check
return strings.endsWith(path, arg1.substr(4)); // '**/*'.length === 4
} else if (trivia2.test(arg1)) {
// repetition of common patterns (see above) {**/*.txt,**/*.png}
return arg1.slice(1, -1).split(',').some(pattern => match(pattern, path));
}
var regExp = globToRegExp(arg1);
return regExp && regExp.test(path);
}
......
......@@ -92,7 +92,7 @@ export declare class TPromise<V> {
public cancel():void;
public static as<ValueType>(value:ValueType):TPromise<ValueType>;
public static is(value: any): boolean;
public static is(value: any): value is TPromise<any>;
public static timeout(delay:number):TPromise<void>;
public static join<ValueType>(promises:TPromise<ValueType>[]):TPromise<ValueType[]>;
public static join<ValueType>(promises: {[n:string]:TPromise<ValueType>}):TPromise<{[n:string]:ValueType}>;
......
......@@ -705,7 +705,7 @@ export interface ICommentsConfiguration {
}
/**
* Interface used to support insertion of matching characters like brackets and qoutes.
* Interface used to support insertion of matching characters like brackets and quotes.
*/
export interface IAutoClosingPair {
open:string;
......
......@@ -294,7 +294,9 @@ export class QuickFixSelectionWidget implements IContentWidget {
if (focus) {
elementsToRefresh.push(focus);
this._ariaAlert(getAriaAlertLabel(focus));
if (isQuickFix(focus)) {
this._ariaAlert(getAriaAlertLabel(focus));
}
}
oldFocus = focus;
......
......@@ -12,6 +12,12 @@
color: inherit;
}
.monaco-editor .rename-box { font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback"; }
.monaco-editor:lang(zh-Hans) .rename-box { font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
.monaco-editor:lang(zh-Hant) .rename-box { font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", "Noto Sans", "PingFang TC", "Microsoft Jhenghei", "Source Han Sans TC", "Source Han Sans", "Source Han Sans TW", sans-serif; }
.monaco-editor:lang(ja) .rename-box { font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", "Noto Sans", "Hiragino Kaku Gothic Pro", "Meiryo", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", "Sazanami Gothic", "IPA Gothic", sans-serif; }
.monaco-shell:lang(ko) .rename-box { font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", "Noto Sans", "Apple SD Gothic Neo", "AppleGothic", "Malgun Gothic", "Nanum Gothic", "Dotom", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
.monaco-editor.vs-dark .rename-box {
box-shadow: 0 2px 8px #000;
}
......
......@@ -9,6 +9,7 @@ import {parse} from 'vs/base/common/json';
import {readFile} from 'vs/base/node/pfs';
import {IRichEditConfiguration} from 'vs/editor/common/modes/supports/richEditSupport';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IAutoClosingPair} from 'vs/editor/common/modes';
type CharacterPair = [string, string];
......@@ -20,6 +21,8 @@ interface ICommentRule {
interface ILanguageConfiguration {
comments?: ICommentRule;
brackets?: CharacterPair[];
autoClosingPairs?: CharacterPair[];
surroundingPairs?: CharacterPair[];
}
export class LanguageConfigurationFileHandler {
......@@ -75,15 +78,29 @@ export class LanguageConfigurationFileHandler {
if (configuration.brackets) {
richEditConfig.brackets = configuration.brackets;
}
if (configuration.autoClosingPairs) {
richEditConfig.__characterPairSupport = {
autoClosingPairs: this._mapCharacterPairs(configuration.autoClosingPairs)
};
} else if (configuration.brackets) {
richEditConfig.__characterPairSupport = {
autoClosingPairs: configuration.brackets.map(pair => {
let [open, close] = pair;
return { open: open, close: close };
})
autoClosingPairs: this._mapCharacterPairs(configuration.brackets)
};
}
if (richEditConfig.__characterPairSupport && configuration.surroundingPairs) {
richEditConfig.__characterPairSupport.surroundingPairs = this._mapCharacterPairs(configuration.surroundingPairs);
}
this._modeService.registerRichEditSupport(modeId, richEditConfig);
}
private _mapCharacterPairs(pairs:CharacterPair[]): IAutoClosingPair[] {
return pairs.map(pair => {
let [open, close] = pair;
return { open: open, close: close };
});
}
}
......@@ -69,7 +69,7 @@ MonacoEditorLanguages.push({
});
MonacoEditorLanguages.push({
id: 'jade',
extensions: [ '.jade' ],
extensions: [ '.jade', '.pug' ],
aliases: [ 'Jade', 'jade' ],
defModule: 'vs/editor/standalone-languages/jade'
});
......
......@@ -266,25 +266,6 @@ export class JSONSchemaService implements IJSONSchemaService {
this.contributionSchemas[id] = this.addSchemaHandle(id, schemas[id]);
}
}
if (schemaContributions.schemaAssociations) {
var schemaAssociations = schemaContributions.schemaAssociations;
for (let pattern in schemaAssociations) {
var associations = schemaAssociations[pattern];
if (this.contextService) {
let env = this.contextService.getConfiguration().env;
if (env) {
pattern = pattern.replace(/%APP_SETTINGS_HOME%/, URI.file(env.appSettingsHome).toString());
}
}
this.contributionAssociations[pattern] = associations;
var fpa = this.getOrAddFilePatternAssociation(pattern);
associations.forEach(schemaId => {
var id = this.normalizeId(schemaId);
fpa.addSchema(id);
});
}
}
}
private addSchemaHandle(id:string, unresolvedSchemaContent?: IJSONSchema) : SchemaHandle {
......
......@@ -336,55 +336,6 @@ suite('JSON - schema', () => {
});
});
test('Schema contributions', function(testDone) {
var service = new SchemaService.JSONSchemaService(requestServiceMock);
service.setSchemaContributions({ schemas: {
"http://myschemastore/myschemabar" : {
id: 'main',
type: 'object',
properties: {
foo: {
type: 'string'
}
}
}
}, schemaAssociations: {
'*.bar': ['http://myschemastore/myschemabar', 'http://myschemastore/myschemafoo']
}});
var id2 = 'http://myschemastore/myschemafoo';
var schema2:JsonSchema.IJSONSchema = {
type: 'object',
properties: {
child: {
type: 'string'
}
}
};
service.registerExternalSchema(id2, null, schema2);
service.getSchemaForResource('main.bar', null).then(resolvedSchema => {
assert.deepEqual(resolvedSchema.errors, []);
assert.equal(2, resolvedSchema.schema.allOf.length);
service.clearExternalSchemas();
return service.getSchemaForResource('main.bar', null).then(resolvedSchema => {
assert.equal(resolvedSchema.errors.length, 1);
assert.ok(resolvedSchema.errors[0].indexOf("Problems loading reference 'http://myschemastore/myschemafoo'") === 0);
service.clearExternalSchemas();
service.registerExternalSchema(id2, null, schema2);
return service.getSchemaForResource('main.bar', null).then(resolvedSchema => {
assert.equal(resolvedSchema.errors.length, 0);
});
});
}).done(() => testDone(), (error) => {
testDone(error);
});
});
test('Resolving circular $refs', function(testDone) {
var service : SchemaService.IJSONSchemaService = new SchemaService.JSONSchemaService(requestServiceMock);
......
......@@ -62,10 +62,6 @@ class ConfigurationRegistry implements IConfigurationRegistry {
this._onDidRegisterConfiguration = new Emitter<IConfigurationRegistry>();
contributionRegistry.registerSchema(schemaId, this.configurationSchema);
contributionRegistry.addSchemaFileAssociation('vscode://defaultsettings/settings.json', schemaId);
contributionRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/settings.json', schemaId);
contributionRegistry.addSchemaFileAssociation('/.vscode/settings.json', schemaId);
}
public get onDidRegisterConfiguration() {
......
......@@ -438,5 +438,4 @@ const PRExtensions = {
Registry.add(PRExtensions.ExtensionsRegistry, new ExtensionsRegistryImpl());
export const ExtensionsRegistry: IExtensionsRegistry = Registry.as(PRExtensions.ExtensionsRegistry);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('/package.json', schemaId);
\ No newline at end of file
schemaRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
......@@ -201,7 +201,7 @@ export class InstantiationService implements IInstantiationService {
for (let root of roots) {
// create instance and overwrite the service collections
const instance = this._createInstance(root.data.desc, []);
this._services.set(id, instance);
this._services.set(root.data.id, instance);
graph.removeNode(root.data);
}
}
......
......@@ -16,7 +16,6 @@ export const Extensions = {
export interface ISchemaContributions {
schemas?: { [id: string]: IJSONSchema };
schemaAssociations?: { [pattern: string]: string[] };
}
export interface IJSONContributionRegistry {
......@@ -26,11 +25,6 @@ export interface IJSONContributionRegistry {
*/
registerSchema(uri: string, unresolvedSchemaContent: IJSONSchema): void;
/**
* Register a schema association
*/
addSchemaFileAssociation(pattern: string, uri: string): void;
/**
* Get all schemas
*/
......@@ -58,12 +52,10 @@ function normalizeId(id: string) {
class JSONContributionRegistry implements IJSONContributionRegistry {
private schemasById: { [id: string]: IJSONSchema };
private schemaAssociations: { [pattern: string]: string[] };
private eventEmitter: IEventEmitter;
constructor() {
this.schemasById = {};
this.schemaAssociations = {};
this.eventEmitter = new EventEmitter();
}
......@@ -76,20 +68,9 @@ class JSONContributionRegistry implements IJSONContributionRegistry {
this.eventEmitter.emit('registryChanged', {});
}
public addSchemaFileAssociation(pattern: string, uri: string): void {
let uris = this.schemaAssociations[pattern];
if (!uris) {
uris = [];
this.schemaAssociations[pattern] = uris;
}
uris.push(uri);
this.eventEmitter.emit('registryChanged', {});
}
public getSchemaContributions(): ISchemaContributions {
return {
schemas: this.schemasById,
schemaAssociations: this.schemaAssociations
};
}
......
......@@ -6,9 +6,7 @@
import nls = require('vs/nls');
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
import {Registry} from 'vs/platform/platform';
import URI from 'vs/base/common/uri';
import JSONContributionRegistry = require('vs/platform/jsonschemas/common/jsonContributionRegistry');
import strings = require('vs/base/common/strings');
import paths = require('vs/base/common/paths');
......@@ -17,8 +15,6 @@ interface IJSONValidationExtensionPoint {
url: string;
}
let schemaRegistry = <JSONContributionRegistry.IJSONContributionRegistry>Registry.as(JSONContributionRegistry.Extensions.JSONContribution);
let configurationExtPoint = ExtensionsRegistry.registerExtensionPoint<IJSONValidationExtensionPoint[]>('jsonValidation', {
description: nls.localize('contributes.jsonValidation', 'Contributes json schema configuration.'),
type: 'array',
......@@ -72,11 +68,6 @@ export class JSONValidationExtensionPoint {
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension"));
return;
}
let fileMatch = extension.fileMatch;
if (!strings.startsWith(extension.fileMatch, '/')) {
fileMatch = '/' + fileMatch;
}
schemaRegistry.addSchemaFileAssociation(fileMatch, uri);
});
}
});
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import Event, {Emitter} from 'vs/base/common/event';
import {ILifecycleService, IBeforeShutdownParticipant} from './lifecycle';
export class BaseLifecycleService implements ILifecycleService {
public serviceId = ILifecycleService;
private _beforeShutdownParticipants: IBeforeShutdownParticipant[];
private _onShutdown: Emitter<void>;
constructor() {
this._beforeShutdownParticipants = [];
this._onShutdown = new Emitter<void>();
}
protected fireShutdown(): void {
this._onShutdown.fire();
}
public addBeforeShutdownParticipant(p: IBeforeShutdownParticipant): void {
this._beforeShutdownParticipants.push(p);
}
protected get beforeShutdownParticipants(): IBeforeShutdownParticipant[] {
return this._beforeShutdownParticipants;
}
public get onShutdown(): Event<void> {
return this._onShutdown.event;
}
}
......@@ -4,23 +4,24 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import winjs = require('vs/base/common/winjs.base');
import {TPromise} from 'vs/base/common/winjs.base';
import Event from 'vs/base/common/event';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
export const ILifecycleService = createDecorator<ILifecycleService>('lifecycleService');
export interface IBeforeShutdownParticipant {
/**
* Called when the window is about to close. Clients have a chance to veto the closing by either returning
* a boolean "true" directly or via a promise that resolves to a boolean. Returning a promise is useful
* in cases of long running operations on shutdown.
*
* Note: It is absolutely important to avoid long running promises on this call. Please try hard to return
* a boolean directly. Returning a promise has quite an impact on the shutdown sequence!
*/
beforeShutdown(): boolean | winjs.TPromise<boolean>;
/**
* An event that is send out when the window is about to close. Clients have a chance to veto the closing by either calling veto
* with a boolean "true" directly or with a promise that resolves to a boolean. Returning a promise is useful
* in cases of long running operations on shutdown.
*
* Note: It is absolutely important to avoid long running promises on this call. Please try hard to return
* a boolean directly. Returning a promise has quite an impact on the shutdown sequence!
*/
export interface ShutdownEvent {
veto(value: boolean | TPromise<boolean>): void;
}
/**
......@@ -32,13 +33,20 @@ export interface ILifecycleService {
serviceId: ServiceIdentifier<any>;
/**
* Participate before shutting down to be able to veto.
* Fired before shutdown happens. Allows listeners to veto against the
* shutdown.
*/
addBeforeShutdownParticipant(p: IBeforeShutdownParticipant): void;
onWillShutdown: Event<ShutdownEvent>;
/**
* Fired when no client is preventing the shutdown from happening. Can be used to dispose heavy resources
* like running processes. Can also be used to save UI state to storage.
*/
onShutdown: Event<void>;
}
\ No newline at end of file
}
export const NullLifecycleService: ILifecycleService = {
serviceId: null,
onWillShutdown: () => ({ dispose() { } }),
onShutdown: () => ({ dispose() { } })
};
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import Event, {Emitter} from 'vs/base/common/event';
import {ILifecycleService, IBeforeShutdownParticipant} from 'vs/platform/lifecycle/common/lifecycle';
class NullLifecycleService implements ILifecycleService {
public serviceId = ILifecycleService;
private _onShutdown: Emitter<any> = new Emitter<any>();
public addBeforeShutdownParticipant(p: IBeforeShutdownParticipant): void {
}
public get onShutdown(): Event<any> {
return this._onShutdown.event;
}
}
export const Instance: ILifecycleService = new NullLifecycleService();
\ No newline at end of file
......@@ -613,6 +613,9 @@ export class MainThreadDocuments {
if (input.getResource().toString() !== uri.toString()) {
throw new Error(`expected URI ${uri.toString() } BUT GOT ${input.getResource().toString() }`);
}
if (!this._modelIsSynced[uri.toString()]) {
throw new Error(`expected URI ${uri.toString()} to have come to LIFE`);
}
return this._proxy._acceptModelDirty(uri.toString()); // mark as dirty
}).then(() => {
return true;
......
......@@ -20,6 +20,10 @@ import { IEditor } from 'vs/platform/editor/common/editor';
import { IFileService } from 'vs/platform/files/common/files';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
class ConfigureLocaleAction extends Action {
public static ID = 'workbench.action.configureLocale';
......@@ -64,3 +68,26 @@ class ConfigureLocaleAction extends Action {
let workbenchActionsRegistry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLocaleAction, ConfigureLocaleAction.ID, ConfigureLocaleAction.LABEL), ['configure', 'language', 'locale', 'nls', 'i18n']);
let schemaId = 'vscode://schemas/locale';
// Keep en-US since we generated files with that content.
let schema : IJSONSchema =
{
id: schemaId,
description: 'Locale Definition file',
type: 'object',
default: {
'locale': 'en'
},
required: ['locale'],
properties: {
locale: {
type: 'string',
enum: ['de', 'en', 'en-US', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-CN', 'zh-tw'],
description: nls.localize('JsonSchema.locale', 'The UI Language to use.')
}
}
};
let jsonRegistry = <IJSONContributionRegistry>Registry.as(JSONExtensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
......@@ -607,7 +607,16 @@ export class VSCodeMenu {
}
}
}) : null,
env.product.privacyStatementUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "&&Privacy Statement")), click: () => openUrl(env.product.privacyStatementUrl, 'openPrivacyStatement') }) : null,
env.product.privacyStatementUrl ? new MenuItem({
label: mnemonicLabel(nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "&&Privacy Statement")), click: () => {
if (platform.language) {
let queryArgChar = env.product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
openUrl(`${env.product.privacyStatementUrl}${queryArgChar}lang=${platform.language}`, 'openPrivacyStatement');
} else {
openUrl(env.product.privacyStatementUrl, 'openPrivacyStatement');
}
}
}) : null,
(env.product.licenseUrl || env.product.privacyStatementUrl) ? __separator__() : null,
toggleDevToolsItem,
]).forEach((item) => helpMenu.append(item));
......
......@@ -51,6 +51,7 @@ export class DebugViewlet extends Viewlet {
this.progressRunner = null;
this.viewletSettings = this.getMemento(storageService, memento.Scope.WORKSPACE);
this.toDispose = [];
this.views = [];
this.toDispose.push(this.debugService.onDidChangeState((state) => {
this.onDebugServiceStateChange(state);
}));
......
......@@ -276,28 +276,27 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
}));
this.toDispose.push(debugModel.onDidChangeCallStack(() => {
this.tree.refresh().done(null, errors.onUnexpectedError);
}));
this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(sf => {
const focussedThread = sf ? this.debugService.getModel().getThreads()[sf.threadId] : null;
if (!focussedThread) {
this.pauseMessage.hide();
return;
}
this.tree.expand(focussedThread);
this.tree.setFocus(this.debugService.getViewModel().getFocusedStackFrame());
if (focussedThread.stoppedDetails && focussedThread.stoppedDetails.reason) {
this.pauseMessageLabel.text(nls.localize('debugStopped', "Paused on {0}", focussedThread.stoppedDetails.reason));
if (focussedThread.stoppedDetails.text) {
this.pauseMessageLabel.title(focussedThread.stoppedDetails.text);
this.tree.refresh().done(() => {
const focussedThread = this.debugService.getModel().getThreads()[this.debugService.getViewModel().getFocusedThreadId()];
if (!focussedThread) {
this.pauseMessage.hide();
return;
}
focussedThread.stoppedDetails.reason === 'exception' ? this.pauseMessageLabel.addClass('exception') : this.pauseMessageLabel.removeClass('exception');
this.pauseMessage.show();
} else {
this.pauseMessage.hide();
}
return this.tree.expand(focussedThread).then(() => {
this.tree.setSelection([this.debugService.getViewModel().getFocusedStackFrame()]);
if (focussedThread.stoppedDetails && focussedThread.stoppedDetails.reason) {
this.pauseMessageLabel.text(nls.localize('debugStopped', "Paused on {0}", focussedThread.stoppedDetails.reason));
if (focussedThread.stoppedDetails.text) {
this.pauseMessageLabel.title(focussedThread.stoppedDetails.text);
}
focussedThread.stoppedDetails.reason === 'exception' ? this.pauseMessageLabel.addClass('exception') : this.pauseMessageLabel.removeClass('exception');
this.pauseMessage.show();
} else {
this.pauseMessage.hide();
}
});
}, errors.onUnexpectedError);
}));
}
......
......@@ -141,7 +141,7 @@ export class Thread implements debug.IThread {
private getCallStackImpl(debugService: debug.IDebugService, startFrame: number): TPromise<debug.IStackFrame[]> {
let session = debugService.getActiveSession();
return session.stackTrace({ threadId: this.threadId, startFrame, levels: 20 }).then(response => {
this.stoppedDetails.totalFrames = response.body.totalFrames || response.body.stackFrames.length;
this.stoppedDetails.totalFrames = response.body.totalFrames;
return response.body.stackFrames.map((rsf, level) => {
if (!rsf) {
return new StackFrame(this.threadId, 0, new Source({ name: 'unknown' }, false), nls.localize('unknownStack', "Unknown stack location"), undefined, undefined);
......@@ -429,23 +429,21 @@ export class Model implements debug.IModel {
public clearThreads(removeThreads: boolean, reference: number = undefined): void {
if (reference) {
this.threads[reference].clearCallStack();
this.threads[reference].stoppedDetails = undefined;
if (removeThreads) {
delete this.threads[reference];
} else {
this.threads[reference].clearCallStack();
this.threads[reference].stoppedDetails = undefined;
this.threads[reference] = null;
}
} else {
Object.keys(this.threads).forEach(ref => {
this.threads[ref].clearCallStack();
this.threads[ref].stoppedDetails = undefined;
});
if (removeThreads) {
this.threads = {};
ExpressionContainer.allValues = {};
} else {
for (let ref in this.threads) {
if (this.threads.hasOwnProperty(ref)) {
this.threads[ref].clearCallStack();
this.threads[ref].stoppedDetails = undefined;
}
}
}
}
......@@ -714,7 +712,8 @@ export class Model implements debug.IModel {
}
public rawUpdate(data: debug.IRawModelUpdate): void {
if (data.thread) {
if (data.thread && !this.threads[data.threadId]) {
// A new thread came in, initialize it.
this.threads[data.threadId] = new Thread(data.thread.name, data.thread.id);
}
......
......@@ -241,17 +241,14 @@ export class DebugService implements debug.IDebugService {
this.setStateAndEmit(debug.State.Stopped);
const threadId = event.body.threadId;
this.getThreadData(threadId).done(() => {
let thread = this.model.getThreads()[threadId];
this.getThreadData().done(() => {
this.model.rawUpdate({
threadId: threadId,
threadId,
stoppedDetails: event.body,
allThreadsStopped: event.body.allThreadsStopped
});
thread.getCallStack(this).then(callStack => {
this.windowService.getWindow().focus();
this.model.getThreads()[threadId].getCallStack(this).then(callStack => {
if (callStack.length > 0) {
// focus first stack frame from top that has source location
const stackFrameToFocus = arrays.first(callStack, sf => sf.source && sf.source.available, callStack[0]);
......@@ -275,15 +272,7 @@ export class DebugService implements debug.IDebugService {
this.toDisposeOnSessionEnd.push(this.session.onDidThread(event => {
if (event.body.reason === 'started') {
this.session.threads().done((result) => {
const thread = result.body.threads.filter(thread => thread.id === event.body.threadId).pop();
if (thread) {
this.model.rawUpdate({
threadId: thread.id,
thread: thread
});
}
}, errors.onUnexpectedError);
this.getThreadData().done(null, errors.onUnexpectedError);
} else if (event.body.reason === 'exited') {
this.model.clearThreads(true, event.body.threadId);
}
......@@ -340,19 +329,10 @@ export class DebugService implements debug.IDebugService {
this.appendReplOutput(event.body.output, outputSeverity);
}
private getThreadData(threadId: number): TPromise<void> {
return this.model.getThreads()[threadId] ? TPromise.as(undefined) :
this.session.threads().then((response: DebugProtocol.ThreadsResponse) => {
const thread = response.body.threads.filter(t => t.id === threadId).pop();
if (!thread) {
throw new Error(nls.localize('debugNoThread', "Did not get a thread from debug adapter with id {0}.", threadId));
}
this.model.rawUpdate({
threadId: thread.id,
thread: thread
});
});
private getThreadData(): TPromise<void> {
return this.session.threads().then(response => {
response.body.threads.forEach(thread => this.model.rawUpdate({ threadId: thread.id, thread }));
});
}
private loadBreakpoints(): debug.IBreakpoint[] {
......@@ -418,6 +398,7 @@ export class DebugService implements debug.IDebugService {
public setFocusedStackFrameAndEvaluate(focusedStackFrame: debug.IStackFrame): TPromise<void> {
this.viewModel.setFocusedStackFrame(focusedStackFrame);
this.windowService.getWindow().focus();
if (focusedStackFrame) {
return this.model.evaluateWatchExpressions(this.session, focusedStackFrame);
} else {
......
......@@ -142,7 +142,6 @@ const schema: IJSONSchema = {
const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>platform.Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
jsonRegistry.addSchemaFileAssociation('/.vscode/launch.json', schemaId);
export class ConfigurationManager implements debug.IConfigurationManager {
......
......@@ -4,12 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import Event from 'vs/base/common/event';
import ee = require('vs/base/common/eventEmitter');
import uri from 'vs/base/common/uri';
import severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import editor = require('vs/editor/common/editorCommon');
import editorbrowser = require('vs/editor/browser/editorBrowser');
import debug = require('vs/workbench/parts/debug/common/debug');
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
......@@ -109,7 +105,7 @@ export class MockDebugService implements debug.IDebugService {
}
class MockRawSession extends ee.EventEmitter implements debug.IRawDebugSession {
class MockRawSession implements debug.IRawDebugSession {
public get configuration(): { type: string, isAttach: boolean, capabilities: DebugProtocol.Capabilites } {
return {
......
......@@ -7,9 +7,6 @@ import assert = require('assert');
import uri from 'vs/base/common/uri';
import severity from 'vs/base/common/severity';
import debugmodel = require('vs/workbench/parts/debug/common/debugModel');
import debug = require('vs/workbench/parts/debug/common/debug');
import { TPromise } from 'vs/base/common/winjs.base';
import { DebugService } from 'vs/workbench/parts/debug/electron-browser/debugService';
import * as sinon from 'sinon';
import { MockDebugService } from 'vs/workbench/parts/debug/test/common/mockDebugService';
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import URI from 'vs/base/common/uri';
import {toObject} from 'vs/base/common/objects';
import {forEach} from 'vs/base/common/collections';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {TPromise as Promise} from 'vs/base/common/winjs.base';
import {match} from 'vs/base/common/glob';
......@@ -13,17 +13,13 @@ import {IModelService} from 'vs/editor/common/services/modelService';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
interface ExtensionRecommendations {
[id: string]: string;
}
export class ExtensionTipsService implements IExtensionTipsService {
serviceId = IExtensionTipsService;
private _recommendations: { [id: string]: boolean; };
private _recommendations: { [id: string]: boolean; } = Object.create(null);
private _availableRecommendations: { [pattern: string]: string[] } = Object.create(null);
private _disposables: IDisposable[] = [];
private _availableRecommendations: ExtensionRecommendations;
constructor(
@IGalleryService private _galleryService: IGalleryService,
......@@ -35,19 +31,34 @@ export class ExtensionTipsService implements IExtensionTipsService {
return;
}
this._recommendations = toObject(JSON.parse(_storageService.get('extensionsAssistant/recommendations', StorageScope.GLOBAL, '[]')), id => id, () => true);
const extensionTips = contextService.getConfiguration().env.extensionTips;
if (!extensionTips) {
return;
}
if (extensionTips) {
this._availableRecommendations = extensionTips;
this._disposables.push(this._modelService.onModelAdded(model => {
this._suggest(model.getAssociatedResource());
}));
// retrieve ids of previous recommendations
const storedRecommendations = <string[]>JSON.parse(_storageService.get('extensionsAssistant/recommendations', StorageScope.GLOBAL, '[]'));
for (let id of storedRecommendations) {
this._recommendations[id] = true;
}
for (let model of this._modelService.getModels()) {
this._suggest(model.getAssociatedResource());
// group ids by pattern, like {**/*.md} -> [ext.foo1, ext.bar2]
this._availableRecommendations = Object.create(null);
forEach(extensionTips, entry => {
let {key: id, value: pattern} = entry;
let ids = this._availableRecommendations[pattern];
if (!ids) {
this._availableRecommendations[pattern] = [id];
} else {
ids.push(id);
}
});
this._disposables.push(this._modelService.onModelAdded(model => {
this._suggest(model.getAssociatedResource());
}));
for (let model of this._modelService.getModels()) {
this._suggest(model.getAssociatedResource());
}
}
......@@ -63,17 +74,25 @@ export class ExtensionTipsService implements IExtensionTipsService {
return;
}
const ids = Object.keys(this._availableRecommendations);
const recommendations = ids
.filter(id => match(this._availableRecommendations[id], uri.fsPath));
recommendations.forEach(r => this._recommendations[r] = true);
this._storageService.store(
'extensionsAssistant/recommendations',
JSON.stringify(Object.keys(this._recommendations)),
StorageScope.GLOBAL
);
// re-schedule this bit of the operation to be off
// the critical path - in case glob-match is slow
setImmediate(() => {
forEach(this._availableRecommendations, entry => {
let {key: pattern, value: ids} = entry;
if (match(pattern, uri.fsPath)) {
for (let id of ids) {
this._recommendations[id] = true;
}
}
});
this._storageService.store(
'extensionsAssistant/recommendations',
JSON.stringify(Object.keys(this._recommendations)),
StorageScope.GLOBAL
);
});
}
dispose() {
......
......@@ -1058,7 +1058,6 @@ export class PasteFileAction extends BaseFileAction {
return pasteAction.run().then(() => {
this.tree.DOMFocus();
fileToCopy = null;
});
}
}
......
......@@ -76,7 +76,7 @@ export abstract class TextFileService implements ITextFileService {
private registerListeners(): void {
// Lifecycle
this.lifecycleService.addBeforeShutdownParticipant(this);
this.lifecycleService.onWillShutdown(event => event.veto(this.beforeShutdown()));
this.lifecycleService.onShutdown(this.dispose, this);
// Configuration changes
......
......@@ -16,7 +16,7 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {ILifecycleService, NullLifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IFileService} from 'vs/platform/files/common/files';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {InstantiationService} from 'vs/platform/instantiation/common/instantiationService';
......@@ -25,7 +25,7 @@ import {IPartService} from 'vs/workbench/services/part/common/partService';
import {ITextFileService} from 'vs/workbench/parts/files/common/files';
import {TextFileService} from 'vs/workbench/parts/files/browser/textFileServices';
import {FileTracker} from 'vs/workbench/parts/files/browser/fileTracker';
import {TestFileService, TestLifecycleService, TestEditorService, TestPartService, TestConfigurationService, TestEventService, TestContextService, TestStorageService} from 'vs/workbench/test/browser/servicesTestUtils';
import {TestFileService, TestEditorService, TestPartService, TestConfigurationService, TestEventService, TestContextService, TestStorageService} from 'vs/workbench/test/browser/servicesTestUtils';
import {createMockModelService, createMockModeService} from 'vs/editor/test/common/servicesTestUtils';
function toResource(path) {
......@@ -52,7 +52,7 @@ suite('Files - FileEditorInput', () => {
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
services.set(ITelemetryService, telemetryService);
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IConfigurationService, new TestConfigurationService());
services.set(ITextFileService, <ITextFileService> instantiationService.createInstance(<any> TextFileService));
......@@ -142,7 +142,7 @@ suite('Files - FileEditorInput', () => {
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
services.set(ITelemetryService, telemetryService);
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IConfigurationService, new TestConfigurationService());
services.set(ITextFileService, <ITextFileService> instantiationService.createInstance(<any> TextFileService));
......@@ -185,7 +185,7 @@ suite('Files - FileEditorInput', () => {
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
services.set(ITelemetryService, telemetryService);
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IConfigurationService, new TestConfigurationService());
services.set(ITextFileService, <ITextFileService> instantiationService.createInstance(<any> TextFileService));
......
......@@ -20,7 +20,7 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {ILifecycleService, NullLifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IFileService} from 'vs/platform/files/common/files';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
......@@ -29,7 +29,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
import PartService = require('vs/workbench/services/part/common/partService');
import {TextFileService} from 'vs/workbench/parts/files/browser/textFileServices';
import {ITextFileService, EventType} from 'vs/workbench/parts/files/common/files';
import {TestFileService, TestLifecycleService, TestPartService, TestEditorService, TestConfigurationService, TestUntitledEditorService, TestStorageService, TestContextService, TestMessageService, TestEventService} from 'vs/workbench/test/browser/servicesTestUtils';
import {TestFileService, TestPartService, TestEditorService, TestConfigurationService, TestUntitledEditorService, TestStorageService, TestContextService, TestMessageService, TestEventService} from 'vs/workbench/test/browser/servicesTestUtils';
import {createMockModelService, createMockModeService} from 'vs/editor/test/common/servicesTestUtils';
function toResource(path) {
......@@ -60,7 +60,7 @@ suite('Files - TextFileEditorModel', () => {
services.set(PartService.IPartService, new TestPartService());
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IConfigurationService, new TestConfigurationService());
baseInstantiationService = new InstantiationService(services);
......
......@@ -163,5 +163,4 @@ let schema : IJSONSchema = {
};
let schemaRegistry = <JSONContributionRegistry.IJSONContributionRegistry>platform.Registry.as(JSONContributionRegistry.Extensions.JSONContribution);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/snippets/*.json', schemaId);
\ No newline at end of file
schemaRegistry.registerSchema(schemaId, schema);
\ No newline at end of file
......@@ -600,7 +600,7 @@ class TaskService extends EventEmitter implements ITaskService {
this.disposeTaskSystemListeners();
});
lifecycleService.addBeforeShutdownParticipant(this);
lifecycleService.onWillShutdown(event => event.veto(this.beforeShutdown()));
}
private disposeTaskSystemListeners(): void {
......@@ -1308,4 +1308,3 @@ let schema : IJSONSchema =
};
let jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registry.as(jsonContributionRegistry.Extensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);
jsonRegistry.addSchemaFileAssociation('/.vscode/tasks.json', schemaId);
......@@ -314,5 +314,3 @@ let schema : IJSONSchema = {
let schemaRegistry = <IJSONContributionRegistry>Registry.as(Extensions.JSONContribution);
schemaRegistry.registerSchema(schemaId, schema);
schemaRegistry.addSchemaFileAssociation('vscode://defaultsettings/keybindings.json', schemaId);
schemaRegistry.addSchemaFileAssociation('%APP_SETTINGS_HOME%/keybindings.json', schemaId);
......@@ -5,100 +5,91 @@
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import errors = require('vs/base/common/errors');
import {ILifecycleService, ShutdownEvent} from 'vs/platform/lifecycle/common/lifecycle';
import {IMessageService} from 'vs/platform/message/common/message';
import {BaseLifecycleService} from 'vs/platform/lifecycle/common/baseLifecycleService';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import severity from 'vs/base/common/severity';
import {ipcRenderer as ipc} from 'electron';
import Event, {Emitter} from 'vs/base/common/event';
export class LifecycleService implements ILifecycleService {
export class LifecycleService extends BaseLifecycleService {
public serviceId = ILifecycleService;
private _onWillShutdown = new Emitter<ShutdownEvent>();
private _onShutdown = new Emitter<void>();
constructor(
private messageService: IMessageService,
private _messageService: IMessageService,
private windowService: IWindowService
) {
super();
this._registerListeners();
}
this.registerListeners();
public get onWillShutdown(): Event<ShutdownEvent> {
return this._onWillShutdown.event;
}
private registerListeners(): void {
let windowId = this.windowService.getWindowId();
public get onShutdown(): Event<void> {
return this._onShutdown.event;
}
private _registerListeners(): void {
const windowId = this.windowService.getWindowId();
// Main side indicates that window is about to unload, check for vetos
ipc.on('vscode:beforeUnload', (event, reply: { okChannel: string, cancelChannel: string }) => {
let veto = this.beforeUnload();
if (typeof veto === 'boolean') {
ipc.send(veto ? reply.cancelChannel : reply.okChannel, windowId);
}
else {
veto.done(v => ipc.send(v ? reply.cancelChannel : reply.okChannel, windowId));
}
this._onBeforeUnload().done(veto => {
if (veto) {
ipc.send(reply.cancelChannel, windowId);
} else {
this._onShutdown.fire();
ipc.send(reply.okChannel, windowId);
}
});
});
}
private beforeUnload(): boolean|TPromise<boolean> {
let veto = this.vetoShutdown();
private _onBeforeUnload(): TPromise<boolean> {
if (typeof veto === 'boolean') {
return this.handleVeto(veto);
}
const vetos: (boolean | TPromise<boolean>)[] = [];
else {
return veto.then(v => this.handleVeto(v));
}
}
private handleVeto(veto: boolean): boolean {
if (!veto) {
try {
this.fireShutdown();
} catch (error) {
errors.onUnexpectedError(error); // unexpected program error and we cause shutdown to cancel in this case
return false;
this._onWillShutdown.fire({
veto(value) {
vetos.push(value);
}
});
if (vetos.length === 0) {
return TPromise.as(false);
}
return veto;
}
const promises: TPromise<void>[] = [];
let lazyValue = false;
private vetoShutdown(): boolean|TPromise<boolean> {
let participants = this.beforeShutdownParticipants;
let vetoPromises: TPromise<void>[] = [];
let hasPromiseWithVeto = false;
for (let valueOrPromise of vetos) {
for (let i = 0; i < participants.length; i++) {
let participantVeto = participants[i].beforeShutdown();
if (participantVeto === true) {
return true; // return directly when any veto was provided
// veto, done
if (valueOrPromise === true) {
return TPromise.as(true);
}
else if (participantVeto === false) {
continue; // skip
if (TPromise.is(valueOrPromise)) {
promises.push(valueOrPromise.then(value => {
if (value) {
// veto, done
lazyValue = true;
}
}, err => {
// error, treated like a veto, done
this._messageService.show(Severity.Error, errors.toErrorMessage(err));
lazyValue = true;
}));
}
// We have a promise
let vetoPromise = (<TPromise<boolean>>participantVeto).then(veto => {
if (veto) {
hasPromiseWithVeto = true;
}
}, (error) => {
hasPromiseWithVeto = true;
this.messageService.show(severity.Error, errors.toErrorMessage(error));
});
vetoPromises.push(vetoPromise);
}
if (vetoPromises.length === 0) {
return false; // return directly when no veto was provided
}
return TPromise.join(vetoPromises).then(() => hasPromiseWithVeto);
return TPromise.join(promises).then(() => lazyValue);
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ import {IMainProcessExtHostIPC, create} from 'vs/platform/extensions/common/ipcR
import {SyncDescriptor0} from 'vs/platform/instantiation/common/descriptors';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {MainThreadService as CommonMainThreadService} from 'vs/platform/thread/common/mainThreadService';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {ILifecycleService, ShutdownEvent} from 'vs/platform/lifecycle/common/lifecycle';
import {IConfiguration, IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import {ChildProcess, fork} from 'child_process';
......@@ -109,7 +109,7 @@ class ExtensionHostProcessManager {
this.unsentMessages = [];
this.extensionHostProcessReady = false;
lifecycleService.addBeforeShutdownParticipant(this);
lifecycleService.onWillShutdown(this._onWillShutdown, this);
}
public startExtensionHostProcess(onExtensionHostMessage: (msg: any) => void): void {
......@@ -322,7 +322,7 @@ class ExtensionHostProcessManager {
}
}
public beforeShutdown(): boolean | TPromise<boolean> {
private _onWillShutdown(event: ShutdownEvent): void{
// If the extension development host was started without debugger attached we need
// to communicate this back to the main side to terminate the debug session
......@@ -332,9 +332,7 @@ class ExtensionHostProcessManager {
payload: true
}, this.contextService.getConfiguration().env.extensionDevelopmentPath /* target */);
return TPromise.timeout(100 /* wait a bit for IPC to get delivered */).then(() => false);
event.veto(TPromise.timeout(100 /* wait a bit for IPC to get delivered */).then(() => false));
}
return false;
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {ILifecycleService, NullLifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IFileService} from 'vs/platform/files/common/files';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {InstantiationService} from 'vs/platform/instantiation/common/instantiationService';
......@@ -29,7 +29,7 @@ import {FileEditorInput} from 'vs/workbench/parts/files/browser/editors/fileEdit
import {TextFileEditorModel} from 'vs/workbench/parts/files/common/editors/textFileEditorModel';
import {ITextFileService} from 'vs/workbench/parts/files/common/files';
import {TextFileService} from 'vs/workbench/parts/files/browser/textFileServices';
import {TestEventService, TestLifecycleService, TestPartService, TestStorageService, TestConfigurationService, TestRequestService, TestContextService, TestWorkspace, TestEditorService, MockRequestService} from 'vs/workbench/test/browser/servicesTestUtils';
import {TestEventService, TestPartService, TestStorageService, TestConfigurationService, TestRequestService, TestContextService, TestWorkspace, TestEditorService, MockRequestService} from 'vs/workbench/test/browser/servicesTestUtils';
import {Viewlet} from 'vs/workbench/browser/viewlet';
import {EventType} from 'vs/workbench/common/events';
import {ITelemetryService, NullTelemetryService} from 'vs/platform/telemetry/common/telemetry';
......@@ -264,7 +264,7 @@ suite('Workbench UI Services', () => {
services.set(PartService.IPartService, new TestPartService());
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IFileService, <any> TestFileService);
let inst = new InstantiationService(services);
......@@ -363,7 +363,7 @@ suite('Workbench UI Services', () => {
services.set(IUntitledEditorService, new UntitledEditorService());
services.set(IWorkbenchEditorService, editorService);
services.set(PartService.IPartService, new TestPartService());
services.set(ILifecycleService, new TestLifecycleService());
services.set(ILifecycleService, NullLifecycleService);
services.set(IConfigurationService, new TestConfigurationService());
let inst = new InstantiationService(services);
services.set(ITextFileService, <ITextFileService> inst.createInstance(<any>TextFileService));
......
......@@ -14,7 +14,6 @@ import {NullTelemetryService} from 'vs/platform/telemetry/common/telemetry';
import Storage = require('vs/workbench/common/storage');
import WorkbenchEditorCommon = require('vs/workbench/common/editor');
import Event from 'vs/base/common/event';
import LifecycleService = require('vs/platform/lifecycle/common/baseLifecycleService');
import Types = require('vs/base/common/types');
import Severity from 'vs/base/common/severity';
import http = require('vs/base/common/http');
......@@ -174,8 +173,6 @@ export class TestEventService extends EventEmitter.EventEmitter implements IEven
public serviceId = IEventService;
}
export class TestLifecycleService extends LifecycleService.BaseLifecycleService { }
export class TestStorageService extends EventEmitter.EventEmitter implements IStorageService {
public serviceId = IStorageService;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册