Merge branch 'master' into tyriar/open_recently_closed_file

This commit is contained in:
Daniel Imms 2016-04-21 11:21:25 -07:00
commit 001fc597a2
163 changed files with 10427 additions and 2092 deletions

View file

@ -1,5 +1,4 @@
{
// Check https://github.com/facebook/mention-bot on how to configure this file
"maxReviewers": 2,
"userBlacklistForPR": ["alexandrudima", "aeschli", "weinand", "bpasero", "isidorn", "joaomoreno", "jrieken", "dbaeumer", "egamma"]
}

23
build/npm/postinstall.js Normal file
View file

@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const cp = require('child_process');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const extensions = [
'vscode-api-tests',
'vscode-colorize-tests',
'json',
'typescript',
'php',
'javascript'
];
extensions.forEach(extension => {
cp.spawnSync(npm, ['install'], {
cwd: `extensions/${ extension }`,
stdio: 'inherit'
});
});

View file

@ -7,5 +7,19 @@
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

View file

@ -1,6 +1,6 @@
{
"comments": {
"lineComment": "//"
"lineComment": "//-"
},
"brackets": [
["{", "}"],

View file

@ -6,7 +6,7 @@
"contributes": {
"languages": [{
"id": "jade",
"extensions": [ ".jade" ],
"extensions": [ ".jade", ".pug" ],
"aliases": [ "Jade", "jade" ],
"configuration": "./jade.configuration.json"
}],

View file

@ -1,4 +1,7 @@
package foo;
import org.junit.Test;
import org.junit.runners.*;
/*
* Multi line comment

View file

@ -1,4 +1,48 @@
[
{
"c": "package",
"t": "java.keyword.meta.other.package",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)"
}
},
{
"c": " ",
"t": "java.meta.package",
"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": "java.meta.modifier.package.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.package.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.package.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.package.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.package.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.package.java rgb(212, 212, 212)"
}
},
{
"c": ";",
"t": "java.meta.package.punctuation.terminator",
"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": "import",
"t": "import.java.keyword.meta.other",
@ -25,55 +69,165 @@
"c": "org",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier rgb(86, 156, 214)"
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ".",
"t": "import.java.meta.modifier.punctuation.separator.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier rgb(86, 156, 214)"
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": "junit",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier rgb(86, 156, 214)"
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ".",
"t": "import.java.meta.modifier.punctuation.separator.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier rgb(86, 156, 214)"
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": "Test",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier rgb(86, 156, 214)"
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ";",
"t": "import.java.meta.punctuation.terminator",
"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": "import",
"t": "import.java.keyword.meta.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)"
}
},
{
"c": " ",
"t": "import.java.meta",
"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": "org",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ".",
"t": "import.java.meta.modifier.punctuation.separator.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": "junit",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ".",
"t": "import.java.meta.modifier.punctuation.separator.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": "runners",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": ".",
"t": "import.java.meta.modifier.punctuation.separator.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{
"c": "*",
"t": "import.java.meta.modifier.storage",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.storage.modifier.import.java rgb(212, 212, 212)",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.storage.modifier.import.java rgb(0, 0, 0)",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.storage.modifier.import.java rgb(212, 212, 212)"
}
},
{

View file

@ -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",

View file

@ -111,12 +111,14 @@ export class BowerJSONContribution implements IJSONContribution {
}
public collectValueSuggestions(resource: string, location: Location, collector: ISuggestionsCollector): Thenable<any> {
// not implemented. Could be do done calling the bower command. Waiting for web API: https://github.com/bower/registry/issues/26
let proposal = new CompletionItem(localize('json.bower.latest.version', 'latest'));
proposal.insertText = '"{{latest}}"';
proposal.kind = CompletionItemKind.Value;
proposal.documentation = 'The latest version of the package';
collector.add(proposal);
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']))) {
// not implemented. Could be do done calling the bower command. Waiting for web API: https://github.com/bower/registry/issues/26
let proposal = new CompletionItem(localize('json.bower.latest.version', 'latest'));
proposal.insertText = '"{{latest}}"';
proposal.kind = CompletionItemKind.Value;
proposal.documentation = 'The latest version of the package';
collector.add(proposal);
}
return Promise.resolve(null);
}
@ -162,15 +164,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;
}

View file

@ -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);

View file

@ -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';
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);
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.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);
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;
}

View file

@ -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"

View file

@ -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"
},

View file

@ -5,7 +5,7 @@
'use strict';
import Json = require('jsonc-parser');
import {IJSONSchema} from './jsonSchema';
import {IJSONSchema, IJSONSchemaMap} from './jsonSchema';
import {XHROptions, XHRResponse, getErrorStatusDescription} from 'request-light';
import URI from './utils/uri';
import Strings = require('./utils/strings');
@ -411,36 +411,54 @@ export class JSONSchemaService implements IJSONSchemaService {
});
};
let resolveRefs = (node: any, parentSchema: any): Thenable<any> => {
let toWalk = [node];
let seen: any[] = [];
let resolveRefs = (node: IJSONSchema, parentSchema: IJSONSchema): Thenable<any> => {
let toWalk : IJSONSchema[] = [node];
let seen: IJSONSchema[] = [];
let openPromises: Thenable<any>[] = [];
let collectEntries = (...entries: IJSONSchema[]) => {
for (let entry of entries) {
if (typeof entry === 'object') {
toWalk.push(entry);
}
}
};
let collectMapEntries = (...maps: IJSONSchemaMap[]) => {
for (let map of maps) {
if (typeof map === 'object') {
for (let key in map) {
let entry = map[key];
toWalk.push(entry);
}
}
}
};
let collectArrayEntries = (...arrays: IJSONSchema[][]) => {
for (let array of arrays) {
if (Array.isArray(array)) {
toWalk.push.apply(toWalk, array);
}
}
};
while (toWalk.length) {
let next = toWalk.pop();
if (seen.indexOf(next) >= 0) {
continue;
}
seen.push(next);
if (Array.isArray(next)) {
next.forEach(item => {
toWalk.push(item);
});
} else if (next) {
if (next.$ref) {
let segments = next.$ref.split('#', 2);
if (segments[0].length > 0) {
openPromises.push(resolveExternalLink(next, segments[0], segments[1]));
continue;
} else {
resolveLink(next, parentSchema, segments[1]);
}
}
for (let key in next) {
toWalk.push(next[key]);
if (next.$ref) {
let segments = next.$ref.split('#', 2);
if (segments[0].length > 0) {
openPromises.push(resolveExternalLink(next, segments[0], segments[1]));
continue;
} else {
resolveLink(next, parentSchema, segments[1]);
}
}
collectEntries(next.items, next.additionalProperties, next.not);
collectMapEntries(next.definitions, next.properties, next.patternProperties, <IJSONSchemaMap> next.dependencies);
collectArrayEntries(next.anyOf, next.allOf, next.oneOf, <IJSONSchema[]> next.items);
}
return Promise.all(openPromises);
};

View file

@ -73,6 +73,44 @@ suite('JSON Schema', () => {
});
});
test('Resolving $refs 2', function(testDone) {
var service = new SchemaService.JSONSchemaService(requestServiceMock);
service.setSchemaContributions({ schemas: {
"http://json.schemastore.org/swagger-2.0" : {
id: 'http://json.schemastore.org/swagger-2.0',
type: 'object',
properties: {
"responseValue": {
"$ref": "#/definitions/jsonReference"
}
},
definitions: {
"jsonReference": {
"type": "object",
"required": [ "$ref" ],
"properties": {
"$ref": {
"type": "string"
}
}
}
}
}
}
});
service.getResolvedSchema('http://json.schemastore.org/swagger-2.0').then(fs => {
assert.deepEqual(fs.schema.properties['responseValue'], {
type: 'object',
required: [ "$ref" ],
properties: { $ref: { type: 'string' }}
});
}).then(() => testDone(), (error) => {
testDone(error);
});
});
test('FileSchema', function(testDone) {
var service = new SchemaService.JSONSchemaService(requestServiceMock);

View file

@ -24,7 +24,7 @@ export function startsWith(haystack: string, needle: string): boolean {
export function endsWith(haystack: string, needle: string): boolean {
let diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === haystack.length - needle.length;
return haystack.lastIndexOf(needle) === diff;
} else if (diff === 0) {
return haystack === needle;
} else {
@ -34,4 +34,4 @@ export function endsWith(haystack: string, needle: string): boolean {
export function convertSimple2RegExpPattern(pattern: string): string {
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,5 @@
from banana import *
class Monkey:
# Bananas the monkey can eat.
capacity = 10
@ -10,4 +9,58 @@ class Monkey:
def feeding_frenzy(self):
eat(9.25)
return "Yum yum"
return "Yum yum"
if 1900 < year < 2100 and 1 <= month <= 12 \
and 1 <= day <= 31 and 0 <= hour < 24 \
and 0 <= minute < 60 and 0 <= second < 60: # Looks like a valid date
return 1
def firstn(g, n):
for i in range(n):
yield g.next()
reduce(lambda x,y: x+y, [47,11,42,13])
woerter = {"house" : "Haus", "cat":"Katze", "black":"schwarz"}
mydictionary = {
'foo': 23, #comment
'bar': "hello" #sqadsad
}
def steuern(einkommen):
"""Berechnung der zu zahlenden Steuern fuer ein zu versteuerndes Einkommen von x"""
if einkommen <= 8004:
steuer = 0
elif einkommen <= 13469:
y = (einkommen -8004.0)/10000.0
steuer = (912.17 * y + 1400)*y
else:
steuer = einkommen * 0.44 - 15694
return steuer
def beliebig(x, y, *mehr):
print "x=", x, ", x=", y
print "mehr: ", mehr
class Memoize:
def __init__(self, fn):
self.fn = fn
self.memo = {}
def __call__(self, *args):
if args not in self.memo:
self.memo[args] = self.fn(*args)
return self.memo[args]
res = re.search(r"([0-9-]*)\s*([A-Za-z]+),\s+(.*)", i)
while True:
try:
n = raw_input("Number: ")
n = int(n)
break
except ValueError:
print("Not a number")
async with EXPR as VAR:
BLOCK

File diff suppressed because it is too large Load diff

View file

@ -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"
}]
}
}
}

View file

@ -278,6 +278,13 @@
"settings": {
"foreground": "#b5cea8"
}
},
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"settings": {
"foreground": "#d4d4d4"
}
}
]
}

View file

@ -253,6 +253,13 @@
"settings": {
"foreground": "#b5cea8"
}
},
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"settings": {
"foreground": "#d4d4d4"
}
}
]
}

View file

@ -267,6 +267,13 @@
"settings": {
"foreground": "#09885a"
}
},
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"settings": {
"foreground": "#000000"
}
}
]
}

View 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,

View file

@ -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",

View file

@ -9,7 +9,7 @@
* ------------------------------------------------------------------------------------------ */
'use strict';
import { env, languages, commands, workspace, window, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range } from 'vscode';
import { env, languages, commands, workspace, window, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range, DocumentFilter } from 'vscode';
// This must be the first statement otherwise modules might got loaded with
// the wrong locale.
@ -130,16 +130,17 @@ class LanguageProvider {
this.formattingProvider.updateConfiguration(config);
this.description.modeIds.forEach(modeId => {
languages.registerCompletionItemProvider(modeId, this.completionItemProvider, '.');
languages.registerHoverProvider(modeId, hoverProvider);
languages.registerDefinitionProvider(modeId, definitionProvider);
languages.registerDocumentHighlightProvider(modeId, documentHighlightProvider);
languages.registerReferenceProvider(modeId, referenceProvider);
languages.registerDocumentSymbolProvider(modeId, documentSymbolProvider);
languages.registerSignatureHelpProvider(modeId, signatureHelpProvider, '(', ',');
languages.registerRenameProvider(modeId, renameProvider);
languages.registerDocumentRangeFormattingEditProvider(modeId, this.formattingProvider);
languages.registerOnTypeFormattingEditProvider(modeId, this.formattingProvider, ';', '}', '\n');
let selector: DocumentFilter = { scheme: 'file', language: modeId };
languages.registerCompletionItemProvider(selector, this.completionItemProvider, '.');
languages.registerHoverProvider(selector, hoverProvider);
languages.registerDefinitionProvider(selector, definitionProvider);
languages.registerDocumentHighlightProvider(selector, documentHighlightProvider);
languages.registerReferenceProvider(selector, referenceProvider);
languages.registerDocumentSymbolProvider(selector, documentSymbolProvider);
languages.registerSignatureHelpProvider(selector, signatureHelpProvider, '(', ',');
languages.registerRenameProvider(selector, renameProvider);
languages.registerDocumentRangeFormattingEditProvider(selector, this.formattingProvider);
languages.registerOnTypeFormattingEditProvider(selector, this.formattingProvider, ';', '}', '\n');
languages.registerWorkspaceSymbolProvider(new WorkspaceSymbolProvider(client, modeId));
languages.setLanguageConfiguration(modeId, {
indentationRules: {

View file

@ -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>;

View file

@ -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
}
public static Trace: boolean = process.env.TSS_TRACE || false;
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;
}
}
}
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`);
}
}
}

View file

@ -0,0 +1,4 @@
function foo(isAll, startTime, endTime) {
const timeRange = isAll ? '所有时间' : `${startTime} - ${endTime}`;
return true;
}

View file

@ -0,0 +1,4 @@
function* foo2() {
yield 'bar';
yield* ['bar'];
}

View file

@ -0,0 +1,3 @@
function foo3() {
const foo = (): any => ({ 'bar': 'baz' })
}

View file

@ -0,0 +1,5 @@
{
"compilerOptions": {
"target": "es6"
}
}

View file

@ -0,0 +1,387 @@
[
{
"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)"
}
}
]

View file

@ -0,0 +1,178 @@
[
{
"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)"
}
}
]

View file

@ -0,0 +1,288 @@
[
{
"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": "foo3",
"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": " ",
"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": "foo",
"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": " = ",
"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.decl.expr.function.meta.paren.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": "any",
"t": "annotation.block.decl.expr.function.meta.primitive.support.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.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.keyword.meta.operator.return.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.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": "annotation.block.cover.decl.expr.function.meta.paren.return.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.brace.cover.curly.decl.expr.function.meta.object.paren.return.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.cover.decl.declaration.expr.field.function.meta.object.paren.return.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": "'bar'",
"t": "annotation.block.cover.decl.declaration.expr.field.function.meta.object.paren.return.ts.type.var.var-single-variable.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.cover.decl.declaration.expr.field.function.meta.object.paren.return.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": "'baz'",
"t": "annotation.block.cover.decl.declaration.expr.field.function.meta.object.paren.return.single.string.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.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": "annotation.block.cover.decl.declaration.expr.field.function.meta.object.paren.return.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.brace.cover.curly.decl.expr.function.meta.object.paren.return.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.cover.decl.expr.function.meta.paren.return.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.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)"
}
}
]

View file

@ -0,0 +1,222 @@
[
{
"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)"
}
}
]

View file

@ -10,6 +10,7 @@
"exclude": [
"node_modules",
"server",
"out"
"out",
"test/colorize-fixtures"
]
}

View file

@ -1,6 +1,6 @@
{
"name": "Code",
"version": "1.0.0",
"version": "1.0.1",
"electronVersion": "0.37.6",
"author": {
"name": "Microsoft Corporation"
@ -13,7 +13,7 @@
"scripts": {
"test": "mocha",
"preinstall": "node build/npm/preinstall.js",
"postinstall": "npm --prefix extensions/vscode-api-tests/ install extensions/vscode-api-tests/ && npm --prefix extensions/vscode-colorize-tests/ install extensions/vscode-colorize-tests/ && npm --prefix extensions/json/ install extensions/json/ && npm --prefix extensions/typescript/ install extensions/typescript/ && npm --prefix extensions/php/ install extensions/php/ && npm --prefix extensions/javascript/ install extensions/javascript/",
"postinstall": "node build/npm/postinstall.js",
"watch": "gulp watch"
},
"dependencies": {

View file

@ -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 \

View file

@ -2,19 +2,18 @@
* 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 { globals } from 'vs/base/common/platform';
export const enableSendASmile = environment('enableSendASmile');
import {globals} from 'vs/base/common/platform';
// Telemetry endpoint (used in the standalone editor) for hosts that want to collect editor telemetry
export const standaloneEditorTelemetryEndpoint:string = environment('telemetryEndpoint', null);
export const standaloneEditorTelemetryEndpoint: string = environment('telemetryEndpoint', null);
// Option for hosts to overwrite the worker script url (used in the standalone editor)
export const getCrossOriginWorkerScriptUrl:(workerId:string, label:string)=>string = environment('getWorkerUrl', null);
export const getCrossOriginWorkerScriptUrl: (workerId: string, label: string) => string = environment('getWorkerUrl', null);
function environment(name:string, fallback:any = false):any {
function environment(name: string, fallback: any = false): any {
if (globals.MonacoEnvironment && globals.MonacoEnvironment.hasOwnProperty(name)) {
return globals.MonacoEnvironment[name];
}
@ -22,6 +21,6 @@ function environment(name:string, fallback:any = false):any {
return fallback;
}
export function workersCount(defaultCount:number): number {
export function workersCount(defaultCount: number): number {
return environment('workersCount', defaultCount);
}

View file

@ -8,6 +8,7 @@ import strings = require('vs/base/common/strings');
import paths = require('vs/base/common/paths');
const CACHE: { [glob: string]: RegExp } = Object.create(null);
const MAX_CACHED = 10000;
export interface IExpression {
[pattern: string]: boolean | SiblingClause | any;
@ -233,8 +234,10 @@ function globToRegExp(pattern: string): RegExp {
// Convert to regexp and be ready for errors
let result = toRegExp(regEx);
// Make sure to cache
CACHE[pattern] = result;
// Make sure to cache (bounded)
if (Object.getOwnPropertyNames(CACHE).length < MAX_CACHED) {
CACHE[pattern] = result;
}
return result;
}
@ -247,6 +250,28 @@ function toRegExp(regEx: string): RegExp {
}
}
function testWithCache(glob: string, pattern: RegExp, cache: { [glob: string]: boolean }): boolean {
let res = cache[glob];
if (typeof res !== 'boolean') {
res = pattern.test(glob);
// Make sure to cache (bounded)
if (Object.getOwnPropertyNames(cache).length < MAX_CACHED) {
cache[glob] = res;
}
}
return res;
}
// regexes to check for trival glob patterns that just check for String#endsWith
const trivia1 = /^\*\*\/\*\.[\w\.-]+$/; // **/*.something
const trivia2 = /^\*\*\/[\w\.-]+$/; // **/something
const trivia3 = /^{\*\*\/\*\.[\w\.-]+(,\*\*\/\*\.[\w\.-]+)*}$/; // {**/*.something,**/*.else}
const T1_CACHE: { [glob: string]: boolean } = Object.create(null);
const T2_CACHE: { [glob: string]: boolean } = Object.create(null);
const T3_CACHE: { [glob: string]: boolean } = Object.create(null);
/**
* Simplified glob matching. Supports a subset of glob patterns:
* - * matches anything inside a path segment
@ -264,7 +289,26 @@ export function match(arg1: string | IExpression, path: string, siblings?: strin
// Glob with String
if (typeof arg1 === 'string') {
var regExp = globToRegExp(arg1);
// common pattern: **/*.txt just need endsWith check
if (testWithCache(arg1, trivia1, T1_CACHE)) {
return strings.endsWith(path, arg1.substr(4)); // '**/*'.length === 4
}
// common pattern: **/some.txt just need basename check
if (testWithCache(arg1, trivia2, T2_CACHE)) {
const base = arg1.substr(3); // '**/'.length === 3
return path === base || strings.endsWith(path, `/${base}`) || strings.endsWith(path, `\\${base}`);
}
// repetition of common patterns (see above) {**/*.txt,**/*.png}
if (testWithCache(arg1, trivia3, T3_CACHE)) {
return arg1.slice(1, -1).split(',').some(pattern => match(pattern, path));
}
const regExp = globToRegExp(arg1);
return regExp && regExp.test(path);
}

View file

@ -164,7 +164,7 @@ export function startsWith(haystack: string, needle: string): boolean {
export function endsWith(haystack: string, needle: string): boolean {
let diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === haystack.length - needle.length;
return haystack.lastIndexOf(needle) === diff;
} else if (diff === 0) {
return haystack === needle;
} else {
@ -589,4 +589,12 @@ export function appendWithLimit(first: string, second: string, maxLength: number
export function safeBtoa(str: string): string {
return btoa(encodeURIComponent(str)); // we use encodeURIComponent because btoa fails for non Latin 1 values
}
export function repeat(s:string, count: number): string {
var result = '';
for (var i = 0; i < count; i++) {
result += s;
}
return result;
}

View file

@ -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}>;

View file

@ -6,9 +6,8 @@
'use strict';
import { Promise, TPromise } from 'vs/base/common/winjs.base';
import { assign } from 'vs/base/common/objects';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { Emitter } from 'vs/base/common/event';
import Event, { Emitter } from 'vs/base/common/event';
enum RequestType {
Common,
@ -18,9 +17,9 @@ enum RequestType {
interface IRawRequest {
id: number;
type: RequestType;
serviceName?: string;
channelName?: string;
name?: string;
args?: any[];
arg?: any;
}
interface IRequest {
@ -52,56 +51,37 @@ export interface IMessagePassingProtocol {
onMessage(callback: (response: any) => void): void;
}
export interface IServiceCtor<T> {
new? (): T;
new? (arg0: any): T;
new? (a0: any, a1: any): T;
new? (a0: any, a1: any, a2: any): T;
new? (a0: any, a1: any, a2: any, a3: any): T;
new? (a0: any, a1: any, a2: any, a3: any, a4: any): T;
prototype: any;
}
enum ServiceState {
enum State {
Uninitialized,
Idle
}
export interface IServiceMap {
[name: string]: any;
export interface IChannel {
call(command: string, arg: any): TPromise<any>;
}
export interface IServer {
registerChannel(channelName: string, channel: IChannel): void;
}
export interface IClient {
getService<TService>(serviceName: string, serviceCtor: IServiceCtor<TService>): TService;
}
const ServiceEventProperty = '$__SERVICE_EVENT';
/**
* Use this as a property decorator.
*/
export function ServiceEvent<T>(target: T, key: string): void {
target[key] = { [ServiceEventProperty]: true };
}
export function isServiceEvent(target: any): boolean {
return target[ServiceEventProperty];
getChannel<T extends IChannel>(channelName: string): T;
}
export class Server {
private services: IServiceMap;
private channels: { [name: string]: IChannel };
private activeRequests: { [id: number]: IDisposable; };
constructor(private protocol: IMessagePassingProtocol) {
this.services = Object.create(null);
this.channels = Object.create(null);
this.activeRequests = Object.create(null);
this.protocol.onMessage(r => this.onMessage(r));
this.protocol.send(<IRawResponse> { type: ResponseType.Initialize });
}
registerService<TService>(serviceName: string, service: TService): void {
this.services[serviceName] = service;
registerChannel(channelName: string, channel: IChannel): void {
this.channels[channelName] = channel;
}
private onMessage(request: IRawRequest): void {
@ -117,42 +97,15 @@ export class Server {
}
private onCommonRequest(request: IRawRequest): void {
const service = this.services[request.serviceName];
const servicePrototype = service.constructor.prototype;
const prototypeMethod = servicePrototype && servicePrototype[request.name];
const isEvent = prototypeMethod && prototypeMethod[ServiceEventProperty];
const method = service[request.name];
const channel = this.channels[request.channelName];
let promise: Promise;
if (isEvent) {
let disposable: IDisposable;
promise = new Promise(
(c, e, p) => disposable = method.call(service, p),
() => disposable.dispose()
);
} else {
if (!method) {
promise = Promise.wrapError(new Error(`${ request.name } is not a valid method on ${ request.serviceName }`));
} else {
try {
promise = method.call(service, ...request.args);
} catch (err) {
promise = Promise.wrapError(err);
}
}
if (!Promise.is(promise)) {
const message = `'${ request.name }' did not return a promise`;
console.warn(message);
promise = Promise.wrapError(new Error(message));
}
try {
promise = channel.call(request.name, request.arg);
} catch (err) {
promise = Promise.wrapError(err);
}
this.onPromiseRequest(promise, request);
}
private onPromiseRequest(promise: Promise, request: IRawRequest): void {
const id = request.id;
const requestPromise = promise.then(data => {
@ -197,57 +150,36 @@ export class Server {
export class Client implements IClient {
private state: ServiceState;
private state: State;
private bufferedRequests: IRequest[];
private handlers: { [id: number]: IHandler; };
private lastRequestId: number;
constructor(private protocol: IMessagePassingProtocol) {
this.state = ServiceState.Uninitialized;
this.state = State.Uninitialized;
this.bufferedRequests = [];
this.handlers = Object.create(null);
this.lastRequestId = 0;
this.protocol.onMessage(r => this.onMessage(r));
}
getService<TService>(serviceName: string, serviceCtor: IServiceCtor<TService>): TService {
const props = Object.keys(serviceCtor.prototype)
.filter(key => key !== 'constructor');
return <TService> props.reduce((service, key) => {
if (serviceCtor.prototype[key][ServiceEventProperty]) {
let promise: Promise;
const emitter = new Emitter<any>({
onFirstListenerAdd: () => {
promise = this.request(serviceName, key)
.then(null, null, event => emitter.fire(event));
},
onLastListenerRemove: () => {
promise.cancel();
promise = null;
}
});
return assign(service, { [key]: emitter.event });
}
return assign(service, { [key]: (...args) => this.request(serviceName, key, ...args) });
}, {});
getChannel<T extends IChannel>(channelName: string): T {
const call = (command, arg) => this.request(channelName, command, arg);
return { call } as T;
}
private request(serviceName: string, name: string, ...args: any[]): Promise {
private request(channelName: string, name: string, arg: any): Promise {
const request = {
raw: {
id: this.lastRequestId++,
type: RequestType.Common,
serviceName,
channelName,
name,
args
arg
}
};
if (this.state === ServiceState.Uninitialized) {
if (this.state === State.Uninitialized) {
return this.bufferRequest(request);
}
@ -302,7 +234,7 @@ export class Client implements IClient {
}, () => {
request.flush = null;
if (this.state !== ServiceState.Uninitialized) {
if (this.state !== State.Uninitialized) {
if (flushedRequest) {
flushedRequest.cancel();
flushedRequest = null;
@ -322,8 +254,8 @@ export class Client implements IClient {
}
private onMessage(response: IRawResponse): void {
if (this.state === ServiceState.Uninitialized && response.type === ResponseType.Initialize) {
this.state = ServiceState.Idle;
if (this.state === State.Uninitialized && response.type === ResponseType.Initialize) {
this.state = State.Idle;
this.bufferedRequests.forEach(r => r.flush && r.flush());
this.bufferedRequests = null;
return;
@ -344,49 +276,32 @@ export class Client implements IClient {
}
}
/**
* Useful when the service itself is needed right away but the client
* is wrapped within a promise.
*/
export function getService<TService>(clientPromise: TPromise<IClient>, serviceName: string, serviceCtor: IServiceCtor<TService>): TService {
let _servicePromise: TPromise<TService>;
let servicePromise = () => {
if (!_servicePromise) {
_servicePromise = clientPromise.then(client => client.getService(serviceName, serviceCtor));
export function getDelayedChannel<T extends IChannel>(promise: TPromise<IChannel>): T {
const call = (command, arg) => promise.then(c => c.call(command, arg));
return { call } as T;
}
export function eventToCall(event: Event<any>): TPromise<any> {
let disposable: IDisposable;
return new Promise(
(c, e, p) => disposable = event(p),
() => disposable.dispose()
);
}
export function eventFromCall<T>(channel: IChannel, name: string): Event<T> {
let promise: Promise;
const emitter = new Emitter<any>({
onFirstListenerAdd: () => {
promise = channel.call(name, null).then(null, err => null, e => emitter.fire(e));
},
onLastListenerRemove: () => {
promise.cancel();
promise = null;
}
return _servicePromise;
};
});
return Object.keys(serviceCtor.prototype)
.filter(key => key !== 'constructor')
.reduce((result, key) => {
if (isServiceEvent(serviceCtor.prototype[key])) {
let promise: TPromise<void>;
let disposable: IDisposable;
const emitter = new Emitter<any>({
onFirstListenerAdd: () => {
promise = servicePromise().then(service => {
disposable = service[key](e => emitter.fire(e));
});
},
onLastListenerRemove: () => {
if (disposable) {
disposable.dispose();
disposable = null;
}
promise.cancel();
promise = null;
}
});
return assign(result, { [key]: emitter.event });
}
return assign(result, {
[key]: (...args) => {
return servicePromise().then(service => service[key](...args));
}
});
}, {} as TService);
return emitter.event;
}

View file

@ -3,12 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import cp = require('child_process');
import { ChildProcess, fork } from 'child_process';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Promise} from 'vs/base/common/winjs.base';
import { Delayer } from 'vs/base/common/async';
import { clone, assign } from 'vs/base/common/objects';
import { IServiceCtor, Server as IPCServer, Client as IPCClient, IServiceMap } from 'vs/base/common/service';
import { Server as IPCServer, Client as IPCClient, IClient, IChannel } from 'vs/base/parts/ipc/common/ipc';
export class Server extends IPCServer {
constructor() {
@ -21,7 +21,7 @@ export class Server extends IPCServer {
}
}
export interface IServiceOptions {
export interface IIPCOptions {
/**
* A descriptive name for the server this connection is to. Used in logging.
@ -29,7 +29,7 @@ export interface IServiceOptions {
serverName: string;
/**
* Time in millies before killing the service process. The next request after killing will start it again.
* Time in millies before killing the ipc process. The next request after killing will start it again.
*/
timeout?:number;
@ -39,7 +39,7 @@ export interface IServiceOptions {
args?:string[];
/**
* Environment key-value pairs to be passed to the process that gets spawned for the service.
* Environment key-value pairs to be passed to the process that gets spawned for the ipc.
*/
env?:any;
@ -54,43 +54,41 @@ export interface IServiceOptions {
debugBrk?:number;
}
export class Client implements IDisposable {
export class Client implements IClient, IDisposable {
private disposeDelayer: Delayer<void>;
private activeRequests: Promise[];
private child: cp.ChildProcess;
private child: ChildProcess;
private _client: IPCClient;
private services: IServiceMap;
private channels: { [name: string]: IChannel };
constructor(private modulePath: string, private options: IServiceOptions) {
const timeout = options && options.timeout ? options.timeout : Number.MAX_VALUE;
constructor(private modulePath: string, private options: IIPCOptions) {
const timeout = options && options.timeout ? options.timeout : 60000;
this.disposeDelayer = new Delayer<void>(timeout);
this.activeRequests = [];
this.child = null;
this._client = null;
this.services = Object.create(null);
this.channels = Object.create(null);
}
getService<TService>(serviceName: string, serviceCtor: IServiceCtor<TService>): TService {
return <TService>Object.keys(serviceCtor.prototype)
.filter(key => key !== 'constructor')
.reduce((service, key) => assign(service, { [key]: (...args) => this.request(serviceName, serviceCtor, key, ...args) }), {});
getChannel<T extends IChannel>(channelName: string): T {
const call = (command, arg) => this.request(channelName, command, arg);
return { call } as T;
}
protected request<TService>(serviceName: string, serviceCtor: IServiceCtor<TService>, name: string, ...args: any[]): Promise {
protected request(channelName: string, name: string, arg: any): Promise {
this.disposeDelayer.cancel();
let service = this.services[serviceName];
if (!service) {
service = this.services[serviceName] = this.client.getService(serviceName, serviceCtor);
}
const request: Promise = service[name].apply(service, args);
const channel = this.channels[channelName] || (this.channels[channelName] = this.client.getChannel(channelName));
const request: Promise = channel.call(name, arg);
// Progress doesn't propagate across 'then', we need to create a promise wrapper
const result = new Promise((c, e, p) => {
request.then(c, e, p).done(() => {
if (!this.activeRequests) {
return;
}
this.activeRequests.splice(this.activeRequests.indexOf(result), 1);
this.disposeDelayer.trigger(() => this.disposeClient());
});
@ -121,7 +119,7 @@ export class Client implements IDisposable {
}
}
this.child = cp.fork(this.modulePath, args, forkOpts);
this.child = fork(this.modulePath, args, forkOpts);
this._client = new IPCClient({
send: r => this.child && this.child.connected && this.child.send(r),
onMessage: cb => {
@ -129,7 +127,7 @@ export class Client implements IDisposable {
// Handle console logs specially
if (msg && msg.type === '__$console') {
let args = ['%c[Service Library: ' + this.options.serverName + ']', 'color: darkgreen'];
let args = ['%c[IPC Library: ' + this.options.serverName + ']', 'color: darkgreen'];
try {
const parsed = JSON.parse(msg.arguments);
args = args.concat(Object.getOwnPropertyNames(parsed).map(o => parsed[o]));
@ -151,7 +149,7 @@ export class Client implements IDisposable {
const onExit = () => this.disposeClient();
process.once('exit', onExit);
this.child.on('error', err => console.warn('Service "' + this.options.serverName + '" errored with ' + err));
this.child.on('error', err => console.warn('IPC "' + this.options.serverName + '" errored with ' + err));
this.child.on('exit', (code: any, signal: any) => {
process.removeListener('exit', onExit);
@ -162,7 +160,7 @@ export class Client implements IDisposable {
}
if (code && signal !== 'SIGTERM') {
console.warn('Service "' + this.options.serverName + '" crashed with exit code ' + code);
console.warn('IPC "' + this.options.serverName + '" crashed with exit code ' + code);
this.disposeDelayer.cancel();
this.disposeClient();
}
@ -177,7 +175,7 @@ export class Client implements IDisposable {
this.child.kill();
this.child = null;
this._client = null;
this.services = Object.create(null);
this.channels = Object.create(null);
}
}

View file

@ -5,11 +5,11 @@
'use strict';
import net = require('net');
import { Socket, Server as NetServer, createConnection, createServer } from 'net';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { Server as IPCServer, Client as IPCClient, IServiceCtor, IServiceMap, IMessagePassingProtocol, IClient } from 'vs/base/common/service';
import { TPromise } from 'vs/base/common/winjs.base';
import { Server as IPCServer, Client as IPCClient, IMessagePassingProtocol, IServer, IClient, IChannel } from 'vs/base/parts/ipc/common/ipc';
function bufferIndexOf(buffer: Buffer, value: number, start = 0) {
while (start < buffer.length && buffer[start] !== value) {
@ -24,7 +24,7 @@ class Protocol implements IMessagePassingProtocol {
private static Boundary = new Buffer([0]);
private buffer: Buffer;
constructor(private socket: net.Socket) {
constructor(private socket: Socket) {
this.buffer = null;
}
@ -64,47 +64,47 @@ class Protocol implements IMessagePassingProtocol {
}
}
export class Server implements IDisposable {
export class Server implements IServer, IDisposable {
private services: IServiceMap;
private channels: { [name: string]: IChannel };
constructor(private server: net.Server) {
this.services = Object.create(null);
constructor(private server: NetServer) {
this.channels = Object.create(null);
this.server.on('connection', (socket: net.Socket) => {
this.server.on('connection', (socket: Socket) => {
const ipcServer = new IPCServer(new Protocol(socket));
Object.keys(this.services)
.forEach(name => ipcServer.registerService(name, this.services[name]));
Object.keys(this.channels)
.forEach(name => ipcServer.registerChannel(name, this.channels[name]));
socket.once('close', () => ipcServer.dispose());
});
}
registerService<TService>(serviceName: string, service: TService) {
this.services[serviceName] = service;
registerChannel(channelName: string, channel: IChannel): void {
this.channels[channelName] = channel;
}
dispose(): void {
this.services = null;
this.channels = null;
this.server.close();
this.server = null;
}
}
export class Client implements IDisposable, IClient {
export class Client implements IClient, IDisposable {
private ipcClient: IPCClient;
private _onClose = new Emitter<void>();
get onClose(): Event<void> { return this._onClose.event; }
constructor(private socket: net.Socket) {
constructor(private socket: Socket) {
this.ipcClient = new IPCClient(new Protocol(socket));
socket.once('close', () => this._onClose.fire());
}
getService<TService>(serviceName: string, serviceCtor: IServiceCtor<TService>): TService {
return this.ipcClient.getService(serviceName, serviceCtor);
getChannel<T extends IChannel>(channelName: string): T {
return this.ipcClient.getChannel(channelName) as T;
}
dispose(): void {
@ -118,7 +118,7 @@ export function serve(port: number): TPromise<Server>;
export function serve(namedPipe: string): TPromise<Server>;
export function serve(hook: any): TPromise<Server> {
return new TPromise<Server>((c, e) => {
const server = net.createServer();
const server = createServer();
server.on('error', e);
server.listen(hook, () => {
@ -132,7 +132,7 @@ export function connect(port: number): TPromise<Client>;
export function connect(namedPipe: string): TPromise<Client>;
export function connect(hook: any): TPromise<Client> {
return new TPromise<Client>((c, e) => {
const socket = net.createConnection(hook, () => {
const socket = createConnection(hook, () => {
socket.removeListener('error', e);
c(new Client(socket));
});

View file

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------------------------
* 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 * as assert from 'assert';
import { TPromise } from 'vs/base/common/winjs.base';
import { Client } from 'vs/base/parts/ipc/node/ipc.cp';
import uri from 'vs/base/common/uri';
import { always } from 'vs/base/common/async';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { ITestChannel, TestServiceClient } from './testService';
function createClient(): Client {
return new Client(uri.parse(require.toUrl('bootstrap')).fsPath, {
serverName: 'TestServer',
env: { AMD_ENTRYPOINT: 'vs/base/parts/ipc/test/node/testApp', verbose: true }
});
}
suite('IPC', () => {
suite('child process', () => {
test('createChannel', () => {
if (process.env['VSCODE_PID']) {
return; // TODO@Ben find out why test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const result = service.pong('ping').then(r => {
assert.equal(r.incoming, 'ping');
assert.equal(r.outgoing, 'pong');
});
return always(result, () => client.dispose());
});
test('cancellation', () => {
if (process.env['VSCODE_PID']) {
return; // TODO@Ben find out why test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const res = service.cancelMe();
setTimeout(() => res.cancel(), 50);
const result = res.then(
() => assert.fail('Unexpected'),
err => assert.ok(err && isPromiseCanceledError(err))
);
return always(result, () => client.dispose());
});
test('events', () => {
if (process.env['VSCODE_PID']) {
return; // TODO@Ben find out why test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const event = new TPromise((c, e) => {
service.onMarco(({ answer }) => {
try {
assert.equal(answer, 'polo');
c(null);
} catch (err) {
e(err);
}
});
});
const request = service.marco();
const result = TPromise.join<any>([request, event]);
return always(result, () => client.dispose());
});
test('event dispose', () => {
if (process.env['VSCODE_PID']) {
return; // TODO@Ben find out why test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
let count = 0;
const disposable = service.onMarco(() => count++);
const result = service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 1);
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
disposable.dispose();
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
});
});
});
return always(result, () => client.dispose());
});
});
});

View file

@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Server } from 'vs/base/node/service.cp';
import { TestService } from 'vs/base/test/node/service/testService';
import { Server } from 'vs/base/parts/ipc/node/ipc.cp';
import { TestChannel, TestService } from './testService';
const server = new Server();
server.registerService('TestService', new TestService());
const service = new TestService();
server.registerChannel('test', new TestChannel(service));

View file

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------------------------
* 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 { TPromise } from 'vs/base/common/winjs.base';
import { IChannel, eventToCall, eventFromCall } from 'vs/base/parts/ipc/common/ipc';
import Event, { Emitter } from 'vs/base/common/event';
export interface IMarcoPoloEvent {
answer: string;
}
export interface ITestService {
onMarco: Event<IMarcoPoloEvent>;
marco(): TPromise<string>;
pong(ping:string): TPromise<{ incoming:string, outgoing:string }>;
cancelMe(): TPromise<boolean>;
}
export class TestService implements ITestService {
private _onMarco = new Emitter<IMarcoPoloEvent>();
onMarco: Event<IMarcoPoloEvent> = this._onMarco.event;
marco(): TPromise<string> {
this._onMarco.fire({ answer: 'polo' });
return TPromise.as('polo');
}
pong(ping:string): TPromise<{ incoming:string, outgoing:string }> {
return TPromise.as({ incoming: ping, outgoing: 'pong' });
}
cancelMe(): TPromise<boolean> {
return TPromise.timeout(100).then(() => true);
}
}
export interface ITestChannel extends IChannel {
call(command: 'marco'): TPromise<any>;
call(command: 'pong', ping: string): TPromise<any>;
call(command: 'cancelMe'): TPromise<any>;
call(command: string, ...args: any[]): TPromise<any>;
}
export class TestChannel implements ITestChannel {
constructor(private testService: ITestService) { }
call(command: string, ...args: any[]): TPromise<any> {
switch (command) {
case 'pong': return this.testService.pong(args[0]);
case 'cancelMe': return this.testService.cancelMe();
case 'marco': return this.testService.marco();
case 'event:marco': return eventToCall(this.testService.onMarco);
default: return TPromise.wrapError(new Error('command not found'));
}
}
}
export class TestServiceClient implements ITestService {
private _onMarco: Event<IMarcoPoloEvent>;
get onMarco(): Event<IMarcoPoloEvent> { return this._onMarco; };
constructor(private channel: ITestChannel) {
this._onMarco = eventFromCall(channel, 'event:marco');
}
marco(): TPromise<string> {
return this.channel.call('marco');
}
pong(ping:string): TPromise<{ incoming:string, outgoing:string }> {
return this.channel.call('pong', ping);
}
cancelMe(): TPromise<boolean> {
return this.channel.call('cancelMe');
}
}

View file

@ -75,6 +75,7 @@
.quick-open-widget .quick-open-tree .quick-open-entry-meta {
opacity: 0.7;
line-height: normal;
}
.quick-open-widget .quick-open-tree .quick-open-entry-description {

View file

@ -150,4 +150,11 @@ suite('Strings', () => {
assert.strictEqual(strings.appendWithLimit('ab', 'cdefgh', 4), '...efgh');
assert.strictEqual(strings.appendWithLimit('abcdef', 'ghijk', 7), '...efghijk');
});
test('repeat', () => {
assert.strictEqual(strings.repeat(' ', 4), ' ');
assert.strictEqual(strings.repeat(' ', 1), ' ');
assert.strictEqual(strings.repeat(' ', 0), '');
assert.strictEqual(strings.repeat('abc', 2), 'abcabc');
});
});

View file

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------------------------
* 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 * as assert from 'assert';
import { Client } from 'vs/base/node/service.cp';
import uri from 'vs/base/common/uri';
import {isPromiseCanceledError} from 'vs/base/common/errors';
import {TestService} from 'vs/base/test/node/service/testService';
function createService() {
const server = new Client(
uri.parse(require.toUrl('bootstrap')).fsPath,
{
serverName: 'TestServer',
env: { AMD_ENTRYPOINT: 'vs/base/test/node/service/testApp', verbose: true }
}
);
return server.getService<TestService>('TestService', TestService);
}
suite('Service', () => {
test('createService', function (done: () => void) {
if (process.env['VSCODE_PID']) {
return done(); // TODO@Ben find out why test fails when run from within VS Code
}
const testService = createService();
const res = testService.pong('ping');
res.then(r => {
assert.equal(r.incoming, 'ping');
assert.equal(r.outgoing, 'pong');
done();
});
});
test('cancellation', function (done: () => void) {
const testService = createService();
const res = testService.cancelMe();
setTimeout(() => {
res.cancel();
}, 50);
res.then(r => {
assert.fail('Unexpected');
done();
}, (error) => {
assert.ok(isPromiseCanceledError(error));
done();
});
});
});

View file

@ -218,8 +218,8 @@ export class StandaloneKeybindingService extends KeybindingService {
private _dynamicKeybindings: IKeybindingItem[];
private _dynamicCommands: ICommandsMap;
constructor(configurationService: IConfigurationService, domNode: HTMLElement) {
super(configurationService);
constructor(configurationService: IConfigurationService, messageService: IMessageService, domNode: HTMLElement) {
super(configurationService, messageService);
this._dynamicKeybindings = [];
this._dynamicCommands = Object.create(null);

View file

@ -122,7 +122,7 @@ export function ensureDynamicPlatformServices(domElement:HTMLElement, services:
var r:IDisposable[] = [];
if (typeof services.keybindingService === 'undefined') {
var keybindingService = new StandaloneKeybindingService(services.configurationService, domElement);
var keybindingService = new StandaloneKeybindingService(services.configurationService, services.messageService, domElement);
r.push(keybindingService);
services.keybindingService = keybindingService;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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: configuration.brackets.map(pair => {
let [open, close] = pair;
return { open: open, close: close };
})
autoClosingPairs: this._mapCharacterPairs(configuration.autoClosingPairs)
};
} else if (configuration.brackets) {
richEditConfig.__characterPairSupport = {
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 };
});
}
}

View file

@ -69,7 +69,7 @@ MonacoEditorLanguages.push({
});
MonacoEditorLanguages.push({
id: 'jade',
extensions: [ '.jade' ],
extensions: [ '.jade', '.pug' ],
aliases: [ 'Jade', 'jade' ],
defModule: 'vs/editor/standalone-languages/jade'
});

View file

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import strings = require('vs/base/common/strings');
import Json = require('vs/base/common/json');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
@ -28,7 +29,7 @@ export function format(model: EditorCommon.IMirrorModel, range: EditorCommon.IRa
var indentLevel = 0;
var indentValue: string;
if (options.insertSpaces) {
indentValue = repeat(' ', options.tabSize);
indentValue = strings.repeat(' ', options.tabSize);
} else {
indentValue = '\t';
}
@ -36,7 +37,7 @@ export function format(model: EditorCommon.IMirrorModel, range: EditorCommon.IRa
var scanner = Json.createScanner(value, false);
function newLineAndIndent(): string {
return model.getEOL() + repeat(indentValue, initialIndentLevel + indentLevel);
return model.getEOL() + strings.repeat(indentValue, initialIndentLevel + indentLevel);
}
function scanNext(): Json.SyntaxKind {
var token = scanner.scan();
@ -57,7 +58,7 @@ export function format(model: EditorCommon.IMirrorModel, range: EditorCommon.IRa
var firstToken = scanNext();
if (firstToken !== Json.SyntaxKind.EOF) {
var firstTokenStart = model.getPositionFromOffset(scanner.getTokenOffset() + rangeOffset);
var initialIndent = repeat(indentValue, initialIndentLevel);
var initialIndent = strings.repeat(indentValue, initialIndentLevel);
addEdit(initialIndent, { startLineNumber: range.startLineNumber, startColumn: range.startColumn, endLineNumber: firstTokenStart.lineNumber, endColumn: firstTokenStart.column });
}
@ -126,14 +127,6 @@ export function format(model: EditorCommon.IMirrorModel, range: EditorCommon.IRa
return editOperations;
}
function repeat(s:string, count: number): string {
var result = '';
for (var i = 0; i < count; i++) {
result += s;
}
return result;
}
function computeIndentLevel(line: string, options: Modes.IFormattingOptions): number {
var i = 0;
var nChars = 0;

View file

@ -9,7 +9,7 @@ import nls = require('vs/nls');
import Objects = require('vs/base/common/objects');
import Json = require('vs/base/common/json');
import http = require('vs/base/common/http');
import {IJSONSchema} from 'vs/base/common/jsonSchema';
import {IJSONSchema, IJSONSchemaMap} from 'vs/base/common/jsonSchema';
import Strings = require('vs/base/common/strings');
import URI from 'vs/base/common/uri';
import Types = require('vs/base/common/types');
@ -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 {
@ -411,37 +392,56 @@ export class JSONSchemaService implements IJSONSchemaService {
});
};
var resolveRefs = (node:any, parentSchema: any) : WinJS.Promise => {
var toWalk = [ node ];
var seen: any[] = [];
let resolveRefs = (node: IJSONSchema, parentSchema: IJSONSchema): WinJS.Promise => {
let toWalk : IJSONSchema[] = [node];
let seen: IJSONSchema[] = [];
var openPromises: WinJS.Promise[] = [];
let collectEntries = (...entries: IJSONSchema[]) => {
for (let entry of entries) {
if (typeof entry === 'object') {
toWalk.push(entry);
}
}
};
let collectMapEntries = (...maps: IJSONSchemaMap[]) => {
for (let map of maps) {
if (typeof map === 'object') {
for (let key in map) {
let entry = map[key];
toWalk.push(entry);
}
}
}
};
let collectArrayEntries = (...arrays: IJSONSchema[][]) => {
for (let array of arrays) {
if (Array.isArray(array)) {
toWalk.push.apply(toWalk, array);
}
}
};
while (toWalk.length) {
var next = toWalk.pop();
let next = toWalk.pop();
if (seen.indexOf(next) >= 0) {
continue;
}
seen.push(next);
if (Array.isArray(next)) {
next.forEach(item => {
toWalk.push(item);
});
} else if (Types.isObject(next)) {
if (next.$ref) {
var segments = next.$ref.split('#', 2);
if (segments[0].length > 0) {
openPromises.push(resolveExternalLink(next, segments[0], segments[1]));
continue;
} else {
resolveLink(next, parentSchema, segments[1]);
}
}
for (var key in next) {
toWalk.push(next[key]);
if (next.$ref) {
let segments = next.$ref.split('#', 2);
if (segments[0].length > 0) {
openPromises.push(resolveExternalLink(next, segments[0], segments[1]));
continue;
} else {
resolveLink(next, parentSchema, segments[1]);
}
}
collectEntries(next.items, next.additionalProperties, next.not);
collectMapEntries(next.definitions, next.properties, next.patternProperties, <IJSONSchemaMap> next.dependencies);
collectArrayEntries(next.anyOf, next.allOf, next.oneOf, <IJSONSchema[]> next.items);
}
return WinJS.Promise.join(openPromises);
};

View file

@ -79,6 +79,44 @@ suite('JSON - schema', () => {
});
test('Resolving $refs 2', function(testDone) {
var service = new SchemaService.JSONSchemaService(requestServiceMock);
service.setSchemaContributions({ schemas: {
"http://json.schemastore.org/swagger-2.0" : {
id: 'http://json.schemastore.org/swagger-2.0',
type: 'object',
properties: {
"responseValue": {
"$ref": "#/definitions/jsonReference"
}
},
definitions: {
"jsonReference": {
"type": "object",
"required": [ "$ref" ],
"properties": {
"$ref": {
"type": "string"
}
}
}
}
}
}
});
service.getResolvedSchema('http://json.schemastore.org/swagger-2.0').then(fs => {
assert.deepEqual(fs.schema.properties['responseValue'], {
type: 'object',
required: [ "$ref" ],
properties: { $ref: { type: 'string' }}
});
}).then(() => testDone(), (error) => {
testDone(error);
});
});
test('FileSchema', function(testDone) {
var service = new SchemaService.JSONSchemaService(requestServiceMock);
@ -336,55 +374,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);

View file

@ -6,6 +6,7 @@
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import {IEventEmitter} from 'vs/base/common/eventEmitter';
import Event from 'vs/base/common/event';
import {TPromise} from 'vs/base/common/winjs.base';
export const IConfigurationService = createDecorator<IConfigurationService>('configurationService');
@ -18,6 +19,12 @@ export interface IConfigurationService extends IEventEmitter {
*/
getConfiguration<T>(section?: string): T;
/**
* Similar to #getConfiguration() but ensures that the latest configuration
* from disk is fetched.
*/
loadConfiguration<T>(section?: string): TPromise<T>;
/**
* Returns iff the workspace has configuration or not.
*/

View file

@ -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() {

View file

@ -90,7 +90,7 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
}
public initialize(): TPromise<void> {
return this.loadConfiguration().then(() => null);
return this.doLoadConfiguration().then(() => null);
}
protected abstract resolveContents(resource: uri[]): TPromise<IContent[]>;
@ -117,15 +117,17 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
return result;
}
private loadConfiguration(section?: string): TPromise<any> {
return this.doLoadConfiguration().then((res: ILoadConfigResult) => {
this.cachedConfig = res;
public loadConfiguration(section?: string): TPromise<any> {
return this.getConfiguration(section);
});
// Reset caches to ensure we are hitting the disk
this.bulkFetchFromWorkspacePromise = null;
this.workspaceFilePathToConfiguration = Object.create(null);
// Load configuration
return this.doLoadConfiguration(section);
}
private doLoadConfiguration(): TPromise<ILoadConfigResult> {
private doLoadConfiguration(section?: string): TPromise<any> {
// Load globals
const globals = this.loadGlobalConfiguration();
@ -148,6 +150,10 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
consolidated: consolidated,
globals: globals
};
}).then((res: ILoadConfigResult) => {
this.cachedConfig = res;
return this.getConfiguration(section);
});
}
@ -192,7 +198,7 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
protected handleConfigurationChange(): void {
if (!this.reloadConfigurationScheduler) {
this.reloadConfigurationScheduler = new RunOnceScheduler(() => {
this.loadConfiguration().then((config) => this.emit(ConfigurationServiceEventTypes.UPDATED, { config: config })).done(null, errors.onUnexpectedError);
this.doLoadConfiguration().then((config) => this.emit(ConfigurationServiceEventTypes.UPDATED, { config: config })).done(null, errors.onUnexpectedError);
}, ConfigurationService.RELOAD_CONFIGURATION_DELAY);
}

View file

@ -167,7 +167,7 @@ export function getDefaultValues(): any {
}
export function getDefaultValuesContent(): string {
export function getDefaultValuesContent(indent: string): string {
let lastEntry = -1;
let result: string[] = [];
result.push('{');
@ -177,9 +177,9 @@ export function getDefaultValuesContent(): string {
if (config.title) {
if (isTop) {
result.push('');
result.push('\t//-------- ' + config.title + ' --------');
result.push(indent + '//-------- ' + config.title + ' --------');
} else {
result.push('\t// ' + config.title);
result.push(indent + '// ' + config.title);
}
result.push('');
}
@ -192,12 +192,12 @@ export function getDefaultValuesContent(): string {
defaultValue = getDefaultValue(prop.type);
}
if (prop.description) {
result.push('\t// ' + prop.description);
result.push(indent + '// ' + prop.description);
}
let valueString = JSON.stringify(defaultValue, null, '\t');
let valueString = JSON.stringify(defaultValue, null, indent);
if (valueString && (typeof defaultValue === 'object')) {
valueString = addIndent(valueString);
valueString = addIndent(valueString, indent);
}
if (lastEntry !== -1) {
@ -205,7 +205,7 @@ export function getDefaultValuesContent(): string {
}
lastEntry = result.length;
result.push('\t' + JSON.stringify(key) + ': ' + valueString);
result.push(indent + JSON.stringify(key) + ': ' + valueString);
result.push('');
});
}
@ -216,8 +216,8 @@ export function getDefaultValuesContent(): string {
return result.join('\n');
}
function addIndent(str: string): string {
return str.split('\n').join('\n\t');
function addIndent(str: string, indent: string): string {
return str.split('\n').join('\n' + indent);
}
function getDefaultValue(type: string | string[]): any {

View file

@ -8,7 +8,6 @@ import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import {IEventEmitter} from 'vs/base/common/eventEmitter';
import {ISelection} from 'vs/platform/selection/common/selection';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
export const IEditorService = createDecorator<IEditorService>('editorService');
@ -105,11 +104,6 @@ export interface IEditor {
*/
getControl(): IEventEmitter;
/**
* Returns the selection of this editor.
*/
getSelection(): ISelection;
/**
* Asks the underlying control to focus.
*/

View file

@ -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);
schemaRegistry.registerSchema(schemaId, schema);

View 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);
}
}

View file

@ -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
};
}

View file

@ -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);
});
}
});

View file

@ -131,16 +131,10 @@ export abstract class AbstractKeybindingService {
public serviceId = IKeybindingService;
protected _myContextId: number;
protected _instantiationService: IInstantiationService;
protected _messageService: IMessageService;
constructor(myContextId: number) {
this._myContextId = myContextId;
this._instantiationService = null;
this._messageService = null;
}
public setMessageService(messageService: IMessageService): void {
this._messageService = messageService;
}
public createKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
@ -194,8 +188,9 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
private _firstTimeComputingResolver: boolean;
private _currentChord: number;
private _currentChordStatusMessage: IDisposable;
private _messageService: IMessageService;
constructor(configurationService: IConfigurationService) {
constructor(configurationService: IConfigurationService, messageService: IMessageService) {
super(0);
this._lastContextId = 0;
this._contexts = Object.create(null);
@ -206,6 +201,7 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
this._currentChordStatusMessage = null;
this._configurationContext = new ConfigurationContext(configurationService);
this._toDispose.push(this._configurationContext);
this._messageService = messageService;
}
protected _beginListening(domNode: HTMLElement): void {

View file

@ -1,37 +0,0 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
}

View file

@ -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>;
}
}
export const NullLifecycleService: ILifecycleService = {
serviceId: null,
onWillShutdown: () => ({ dispose() { } }),
onShutdown: () => ({ dispose() { } })
};

View file

@ -1,24 +0,0 @@
/*---------------------------------------------------------------------------------------------
* 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();

View file

@ -1,45 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export interface ISelection {
/**
* Returns if the selection is empty or not.
*/
isEmpty(): boolean;
}
export interface IStructuredSelection extends ISelection {
/**
* Returns an array of selected elements.
*/
toArray(): any[];
}
export class Selection implements ISelection {
static EMPTY = new Selection([]);
private _selection: any[];
constructor(selection: any[]) {
this._selection = selection || [];
}
public get selection() {
return this._selection;
}
public isEmpty(): boolean {
return this._selection.length === 0;
}
}
export class StructuredSelection extends Selection implements IStructuredSelection {
public toArray(): any[] {
return this.selection;
}
}

View file

@ -23,6 +23,7 @@ import {ExtHostMessageService} from 'vs/workbench/api/node/extHostMessageService
import {ExtHostEditors} from 'vs/workbench/api/node/extHostEditors';
import {ExtHostLanguages} from 'vs/workbench/api/node/extHostLanguages';
import {ExtHostLanguageFeatures} from 'vs/workbench/api/node/extHostLanguageFeatures';
import * as ExtHostTypeConverters from 'vs/workbench/api/node/extHostTypeConverters';
import {registerApiCommands} from 'vs/workbench/api/node/extHostApiCommands';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
import Modes = require('vs/editor/common/modes');
@ -148,6 +149,10 @@ export class ExtHostAPIImplementation {
const extHostStatusBar = new ExtHostStatusBar(this._threadService);
const extHostOutputService = new ExtHostOutputService(this._threadService);
// the converter might create delegate commands to avoid sending args
// around all the time
ExtHostTypeConverters.Command.initialize(extHostCommands);
// env namespace
let telemetryInfo: ITelemetryInfo;
this.env = Object.freeze({

View 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;

View file

@ -87,7 +87,7 @@ class CodeLensAdapter implements modes.ICodeLensSupport {
data.symbols.push(<modes.ICodeLensSymbol>{
id: String(i),
range: TypeConverters.fromRange(lens.range),
command: TypeConverters.Command.from(lens.command, { commands: this._commands, disposables: data.disposables })
command: TypeConverters.Command.from(lens.command, data.disposables)
});
});
@ -144,7 +144,7 @@ class CodeLensAdapter implements modes.ICodeLensSupport {
};
}
symbol.command = TypeConverters.Command.from(command, { commands: this._commands, disposables: cachedData.disposables });
symbol.command = TypeConverters.Command.from(command, cachedData.disposables);
return symbol;
});
});
@ -315,7 +315,6 @@ class QuickFixAdapter implements modes.IQuickFixSupport {
});
this._cachedCommands = dispose(this._cachedCommands);
const ctx = { commands: this._commands, disposables: this._cachedCommands };
return asWinJsPromise(token => this._provider.provideCodeActions(doc, ran, { diagnostics: allDiagnostics }, token)).then(commands => {
if (!Array.isArray(commands)) {
@ -323,7 +322,7 @@ class QuickFixAdapter implements modes.IQuickFixSupport {
}
return commands.map((command, i) => {
return <modes.IQuickFix> {
command: TypeConverters.Command.from(command, ctx),
command: TypeConverters.Command.from(command, this._cachedCommands),
score: i
};
});

View file

@ -494,10 +494,23 @@ export namespace SignatureHelp {
export namespace Command {
const _delegateId = '_internal_delegate_command';
const _cache: { [id: string]: vscode.Command } = Object.create(null);
let _idPool = 1;
export function from(command: vscode.Command, context: { commands: ExtHostCommands; disposables: IDisposable[]; }): modes.ICommand {
export function initialize(commands: ExtHostCommands) {
return commands.registerCommand(_delegateId, (args: [string]) => {
const [id] = args;
const command = _cache[id];
if (!command) {
// handle already disposed delegations graceful
return;
}
return commands.executeCommand(command.command, ...command.arguments);
});
}
export function from(command: vscode.Command, disposables: IDisposable[]): modes.ICommand {
if (!command) {
return;
@ -510,22 +523,29 @@ export namespace Command {
if (!isFalsyOrEmpty(command.arguments)) {
// keep command around
const id = `${command.command}-no-args-wrapper-${_idPool++}`;
result.id = id;
// redirect to delegate command and store actual command
const id = `delegate/${_idPool++}/for/${command.command}`;
result.id = _delegateId;
result.arguments = [id];
_cache[id] = command;
const disposable1 = context.commands.registerCommand(id, () => context.commands.executeCommand(command.command, ..._cache[id].arguments));
const disposable2 = { dispose() { delete _cache[id]; } };
context.disposables.push(disposable1, disposable2);
disposables.push({
dispose() {
delete _cache[id];
}
});
}
return result;
}
export function to(command: modes.ICommand): vscode.Command {
let result = _cache[command.id];
let result: vscode.Command;
if (command.id === _delegateId) {
let [key] = command.arguments;
result = _cache[key];
}
if (!result) {
result = {
command: command.id,

View file

@ -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);

View file

@ -10,6 +10,7 @@ import URI from 'vs/base/common/uri';
import labels = require('vs/base/common/labels');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import strings = require('vs/base/common/strings');
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput';
import {getDefaultValuesContent} from 'vs/platform/configuration/common/model';
@ -85,7 +86,7 @@ export class BaseOpenSettingsAction extends BaseTwoEditorsAction {
}
protected open(emptySettingsContents: string, settingsResource: URI): TPromise<IEditor> {
return this.openTwoEditors(DefaultSettingsInput.getInstance(this.instantiationService), settingsResource, emptySettingsContents);
return this.openTwoEditors(DefaultSettingsInput.getInstance(this.instantiationService, this.configurationService), settingsResource, emptySettingsContents);
}
}
@ -190,9 +191,10 @@ export class OpenWorkspaceSettingsAction extends BaseOpenSettingsAction {
class DefaultSettingsInput extends StringEditorInput {
private static INSTANCE: DefaultSettingsInput;
public static getInstance(instantiationService: IInstantiationService): DefaultSettingsInput {
public static getInstance(instantiationService: IInstantiationService, configurationService: IConfigurationService): DefaultSettingsInput {
if (!DefaultSettingsInput.INSTANCE) {
let defaults = getDefaultValuesContent();
let editorConfig = configurationService.getConfiguration<any>();
let defaults = getDefaultValuesContent(editorConfig.editor.insertSpaces ? strings.repeat(' ', editorConfig.editor.tabSize) : '\t');
let defaultsHeader = '// ' + nls.localize('defaultSettingsHeader', "Overwrite settings by placing them into your settings file.");
DefaultSettingsInput.INSTANCE = instantiationService.createInstance(DefaultSettingsInput, nls.localize('defaultName', "Default Settings"), null, defaultsHeader + '\n' + defaults, 'application/json', false);

View file

@ -13,7 +13,6 @@ import {CompositeEvent} from 'vs/workbench/common/events';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {IComposite} from 'vs/workbench/common/composite';
import {ISelection, Selection} from 'vs/platform/selection/common/selection';
/**
* Internal composite events to communicate with composite container.
@ -178,13 +177,6 @@ export abstract class Composite extends WorkbenchComponent implements IComposite
this.emit(EventType.INTERNAL_COMPOSITE_TITLE_AREA_UPDATE, new CompositeEvent(this.getId()));
}
/**
* Returns an array of elements that are selected in the composite.
*/
public getSelection(): ISelection {
return Selection.EMPTY;
}
/**
* Returns true if this composite is currently visible and false otherwise.
*/

View file

@ -23,9 +23,9 @@ import {IViewlet} from 'vs/workbench/common/viewlet';
import {Composite, CompositeDescriptor, CompositeRegistry} from 'vs/workbench/browser/composite';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {StructuredSelection} from 'vs/platform/selection/common/selection';
export abstract class Viewlet extends Composite implements IViewlet {
public getOptimalWidth(): number {
return null;
}
@ -136,14 +136,6 @@ export abstract class ViewerViewlet extends Viewlet {
return this.viewer;
}
public getSelection(): StructuredSelection {
if (!this.viewer) {
return new StructuredSelection([]); // return early if viewlet has not yet been created
}
return new StructuredSelection(this.viewer.getSelection());
}
public dispose(): void {
// Dispose Viewer
@ -367,10 +359,6 @@ export abstract class AdaptiveCollapsibleViewletView extends FixedCollapsibleVie
focus(this.tree);
}
public getSelection(): StructuredSelection {
return new StructuredSelection(this.tree.getSelection());
}
protected reveal(element: any, relativeTop?: number): TPromise<void> {
return reveal(this.tree, element, relativeTop);
}
@ -490,10 +478,6 @@ export abstract class CollapsibleViewletView extends CollapsibleView implements
focus(this.tree);
}
public getSelection(): StructuredSelection {
return new StructuredSelection(this.tree.getSelection());
}
protected reveal(element: any, relativeTop?: number): TPromise<void> {
return reveal(this.tree, element, relativeTop);
}

View file

@ -329,7 +329,8 @@ export class Workbench implements IPartService {
this.toShutdown.push(this.editorPart);
this.editorService = new WorkbenchEditorService(
this.editorPart,
this.untitledEditorService
this.untitledEditorService,
this.instantiationService
);
serviceCollection.set(IWorkbenchEditorService, this.editorService);
@ -362,7 +363,6 @@ export class Workbench implements IPartService {
(<WorkbenchMessageService>this.messageService).setWorkbenchServices(this.quickOpen, this.statusbarPart);
}
(<UntitledEditorService>this.untitledEditorService).setInstantiationService(this.instantiationService);
this.editorService.setInstantiationService(this.instantiationService);
// Set the some services to registries that have been created eagerly
(<AbstractKeybindingService><any>this.keybindingService).setInstantiationService(this.instantiationService);

View file

@ -27,8 +27,8 @@ exports.collectModules= function(excludes) {
createModuleDescription('vs/workbench/parts/search/browser/openAnythingHandler', excludes),
createModuleDescription('vs/workbench/parts/git/browser/gitViewlet', excludes),
createModuleDescription('vs/workbench/parts/git/electron-browser/gitApp', []),
createModuleDescription('vs/workbench/parts/git/electron-main/askpass', []),
createModuleDescription('vs/workbench/parts/git/node/gitApp', []),
createModuleDescription('vs/workbench/parts/git/node/askpass', []),
createModuleDescription('vs/workbench/parts/output/common/outputMode', languageMainExcludes),
createModuleDescription('vs/workbench/parts/output/common/outputWorker', languageWorkerExcludes),

View file

@ -5,7 +5,6 @@
import {IEventEmitter} from 'vs/base/common/eventEmitter';
import {IAction, IActionItem} from 'vs/base/common/actions';
import {ISelection} from 'vs/platform/selection/common/selection';
export interface IComposite {
@ -39,11 +38,6 @@ export interface IComposite {
*/
getControl(): IEventEmitter;
/**
* Returns the selection of this composite.
*/
getSelection(): ISelection;
/**
* Asks the underlying control to focus.
*/

View file

@ -172,10 +172,7 @@
});
}
window.MonacoEnvironment = {
'enableSendASmile' : !!configuration.sendASmile
};
window.MonacoEnvironment = {};
var timers = window.MonacoEnvironment.timers = {
start: new Date()
};

View file

@ -13,7 +13,6 @@ import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRe
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import platform = require('vs/base/common/platform');
import {KbExpr} from 'vs/platform/keybinding/common/keybindingService';
import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService';
import {CloseEditorAction, ReloadWindowAction, ShowStartupPerformance, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleDevToolsAction, ToggleFullScreenAction, ToggleMenuBarAction, OpenRecentAction, CloseFolderAction, CloseWindowAction, NewWindowAction, CloseMessagesAction} from 'vs/workbench/electron-browser/actions';
// Contribute Global Actions
@ -31,7 +30,7 @@ workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ZoomOu
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ZoomResetAction, ZoomResetAction.ID, ZoomResetAction.LABEL), viewCategory, ['reset', 'zoom']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowStartupPerformance, ShowStartupPerformance.ID, ShowStartupPerformance.LABEL), developerCategory, ['startup', 'performance']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReloadWindowAction, ReloadWindowAction.ID, ReloadWindowAction.LABEL), ['reload', 'window']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseMessagesAction, CloseMessagesAction.ID, CloseMessagesAction.LABEL, { primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, KbExpr.has(WorkbenchMessageService.GLOBAL_MESSAGES_SHOWING_CONTEXT)), ['close', 'messages', 'notification']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseMessagesAction, CloseMessagesAction.ID, CloseMessagesAction.LABEL, { primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, KbExpr.has('globalMessageVisible')), ['close', 'messages', 'notification']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseEditorAction, CloseEditorAction.ID, CloseEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] } }), viewCategory, ['close', 'editor']);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleFullScreenAction, ToggleFullScreenAction.ID, ToggleFullScreenAction.LABEL, { primary: KeyCode.F11, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_F } }), viewCategory, ['toggle', 'fullscreen']);
if (platform.isWindows || platform.isLinux) {

View file

@ -72,7 +72,7 @@ import {InstantiationService} from 'vs/platform/instantiation/common/instantiati
import {IContextViewService, IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IEventService} from 'vs/platform/event/common/event';
import {IFileService} from 'vs/platform/files/common/files';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IMarkerService} from 'vs/platform/markers/common/markers';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
@ -87,10 +87,10 @@ import {IUntitledEditorService, UntitledEditorService} from 'vs/workbench/servic
import {CrashReporter} from 'vs/workbench/electron-browser/crashReporter';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import {ThemeService} from 'vs/workbench/services/themes/electron-browser/themeService';
import {getService } from 'vs/base/common/service';
import {connect} from 'vs/base/node/service.net';
import {getDelayedChannel} from 'vs/base/parts/ipc/common/ipc';
import {connect} from 'vs/base/parts/ipc/node/ipc.net';
import {IExtensionsChannel, ExtensionsChannelClient} from 'vs/workbench/parts/extensions/common/extensionsIpc';
import {IExtensionsService} from 'vs/workbench/parts/extensions/common/extensions';
import {ExtensionsService} from 'vs/workbench/parts/extensions/node/extensionsService';
import {ReloadWindowAction} from 'vs/workbench/electron-browser/actions';
// self registering service
@ -111,7 +111,7 @@ export interface ICoreServices {
*/
export class WorkbenchShell {
private storageService: IStorageService;
private messageService: IMessageService;
private messageService: MessageService;
private eventService: IEventService;
private contextViewService: ContextViewService;
private windowService: IWindowService;
@ -135,6 +135,8 @@ export class WorkbenchShell {
private options: IOptions;
private workbench: Workbench;
private messagesShowingContextKey: IKeybindingContextKey<boolean>;
constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, configuration: IConfiguration, options: IOptions) {
this.container = container;
@ -169,6 +171,7 @@ export class WorkbenchShell {
}
const sharedProcessClientPromise = connect(process.env['VSCODE_SHARED_IPC_HOOK']);
sharedProcessClientPromise.done(service => {
service.onClose(() => {
this.messageService.show(Severity.Error, {
@ -178,7 +181,13 @@ export class WorkbenchShell {
});
}, errors.onUnexpectedError);
serviceCollection.set(IExtensionsService, getService<IExtensionsService>(sharedProcessClientPromise, 'ExtensionService', ExtensionsService));
const extensionsChannelPromise = sharedProcessClientPromise
.then(client => client.getChannel<IExtensionsChannel>('extensions'));
const channel = getDelayedChannel<IExtensionsChannel>(extensionsChannelPromise);
const extensionsService = new ExtensionsChannelClient(channel);
serviceCollection.set(IExtensionsService, extensionsService);
// Workbench
this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.configuration, this.options, serviceCollection);
@ -242,10 +251,7 @@ export class WorkbenchShell {
let disableWorkspaceStorage = this.configuration.env.extensionTestsPath || (!this.workspace && !this.configuration.env.extensionDevelopmentPath); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state
this.storageService = new Storage(this.contextService, window.localStorage, disableWorkspaceStorage ? inMemoryLocalStorageInstance : window.localStorage);
if (this.configuration.env.isBuilt
&& !this.configuration.env.extensionDevelopmentPath // no telemetry in a window for extension development!
&& !!this.configuration.env.enableTelemetry) {
if (this.configuration.env.isBuilt && !this.configuration.env.extensionDevelopmentPath && !!this.configuration.env.enableTelemetry) {
this.telemetryService = new ElectronTelemetryService(this.configurationService, this.storageService, {
cleanupPatterns: [
[new RegExp(escapeRegExpCharacters(this.configuration.env.appRoot), 'gi'), '<APP_ROOT>'],
@ -258,10 +264,7 @@ export class WorkbenchShell {
this.telemetryService = NullTelemetryService;
}
this.keybindingService = new WorkbenchKeybindingService(this.configurationService, this.contextService, this.eventService, this.telemetryService, <any>window);
this.messageService = new MessageService(this.contextService, this.windowService, this.telemetryService, this.keybindingService);
this.keybindingService.setMessageService(this.messageService);
this.messageService = new MessageService(this.contextService, this.windowService, this.telemetryService);
let fileService = new FileService(
this.configurationService,
@ -270,13 +273,20 @@ export class WorkbenchShell {
this.messageService
);
this.contextViewService = new ContextViewService(this.container, this.telemetryService, this.messageService);
let lifecycleService = new LifecycleService(this.messageService, this.windowService);
lifecycleService.onShutdown(() => fileService.dispose());
this.threadService = new MainThreadService(this.contextService, this.messageService, this.windowService, lifecycleService);
let extensionService = new MainProcessExtensionService(this.contextService, this.threadService, this.messageService, this.telemetryService);
this.keybindingService = new WorkbenchKeybindingService(this.configurationService, this.contextService, this.eventService, this.telemetryService, this.messageService, extensionService, <any>window);
this.messagesShowingContextKey = this.keybindingService.createKey('globalMessageVisible', false);
this.messageService.onMessagesShowing(() => this.messagesShowingContextKey.set(true));
this.messageService.onMessagesCleared(() => this.messagesShowingContextKey.reset());
this.contextViewService = new ContextViewService(this.container, this.telemetryService, this.messageService);
let requestService = new RequestService(
this.contextService,
this.configurationService,
@ -286,9 +296,6 @@ export class WorkbenchShell {
let markerService = new MainProcessMarkerService(this.threadService);
let extensionService = new MainProcessExtensionService(this.contextService, this.threadService, this.messageService, this.telemetryService);
this.keybindingService.setExtensionService(extensionService);
let modeService = new MainThreadModeServiceImpl(this.threadService, extensionService, this.configurationService);
let modelService = new ModelServiceImpl(this.threadService, markerService, modeService, this.configurationService, this.messageService);
let editorWorkerService = new EditorWorkerServiceImpl(modelService);

View file

@ -17,15 +17,47 @@ import lifecycle = require('vs/workbench/electron-main/lifecycle');
import menu = require('vs/workbench/electron-main/menus');
import settings = require('vs/workbench/electron-main/settings');
import {Instance as UpdateManager} from 'vs/workbench/electron-main/update-manager';
import {Server, serve, connect} from 'vs/base/node/service.net';
import {Server, serve, connect} from 'vs/base/parts/ipc/node/ipc.net';
import {getUserEnvironment} from 'vs/base/node/env';
import {TPromise} from 'vs/base/common/winjs.base';
import {AskpassChannel} from 'vs/workbench/parts/git/common/gitIpc';
import {GitAskpassService} from 'vs/workbench/parts/git/electron-main/askpassService';
import {spawnSharedProcess} from 'vs/workbench/electron-main/sharedProcess';
import {IChannel} from 'vs/base/parts/ipc/common/ipc';
import {Mutex} from 'windows-mutex';
export class LaunchService {
public start(args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): TPromise<void> {
interface ILaunchService {
start(args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): TPromise<void>;
}
export interface ILaunchChannel extends IChannel {
call(command: 'start', args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): TPromise<void>;
call(command: string, ...args: any[]): TPromise<any>;
}
class LaunchChannel implements ILaunchChannel {
constructor(private service: ILaunchService) { }
call(command: string, ...args: any[]): TPromise<any> {
switch (command) {
case 'start': return this.service.start(args[0], args[1]);
}
}
}
class LaunchChannelClient implements ILaunchService {
constructor(private channel: ILaunchChannel) { }
start(args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): TPromise<void> {
return this.channel.call('start', args, userEnv);
}
}
class LaunchService {
start(args: env.ICommandLineArguments, userEnv: env.IProcessEnvironment): TPromise<void> {
env.log('Received data from other instance', args);
// Otherwise handle in windows manager
@ -118,8 +150,13 @@ function main(ipcServer: Server, userEnv: env.IProcessEnvironment): void {
}
// Register IPC services
ipcServer.registerService('LaunchService', new LaunchService());
ipcServer.registerService('GitAskpassService', new GitAskpassService());
const launchService = new LaunchService();
const launchChannel = new LaunchChannel(launchService);
ipcServer.registerChannel('launch', launchChannel);
const askpassService = new GitAskpassService();
const askpassChannel = new AskpassChannel(askpassService);
ipcServer.registerChannel('askpass', askpassChannel);
// Used by sub processes to communicate back to the main instance
process.env['VSCODE_PID'] = '' + process.pid;
@ -238,7 +275,8 @@ function setupIPC(): TPromise<Server> {
env.log('Sending env to running instance...');
const service = client.getService<LaunchService>('LaunchService', LaunchService);
const channel = client.getChannel<ILaunchChannel>('launch');
const service = new LaunchChannelClient(channel);
return service.start(env.cliArgs, process.env)
.then(() => client.dispose())

View file

@ -610,7 +610,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));

View file

@ -5,7 +5,7 @@
import * as fs from 'fs';
import platform = require('vs/base/common/platform');
import { serve, Server, connect } from 'vs/base/node/service.net';
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
import { TPromise } from 'vs/base/common/winjs.base';
// Services
@ -14,6 +14,7 @@ import { WorkspaceContextService } from 'vs/workbench/services/workspace/common/
import { EventService } from 'vs/platform/event/common/eventService';
// Extra services
import { ExtensionsChannel } from 'vs/workbench/parts/extensions/common/extensionsIpc';
import { ExtensionsService } from 'vs/workbench/parts/extensions/node/extensionsService';
interface IInitData {
@ -43,12 +44,12 @@ function setupPlanB(parentPid: number): void {
}
function main(server: Server, initData: IInitData): void {
const eventService = new EventService();
const contextService = new WorkspaceContextService(eventService, null, initData.configuration, initData.contextServiceOptions);
const extensionService = new ExtensionsService(contextService);
const channel = new ExtensionsChannel(extensionService);
server.registerService('ExtensionService', extensionService);
server.registerChannel('extensions', channel);
// eventually clean up old extensions
setTimeout(() => extensionService.removeDeprecatedExtensions(), 5000);

View file

@ -6,10 +6,7 @@
'use strict';
import nls = require('vs/nls');
import pfs = require('vs/base/node/pfs');
import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import paths = require('vs/base/common/paths');
@ -28,9 +25,9 @@ import {RemoteTelemetryService} from 'vs/platform/telemetry/common/remoteTelemet
import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/baseWorkspaceContextService';
import {ExtensionScanner, MessagesCollector} from 'vs/workbench/node/extensionPoints';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {Client} from 'vs/base/node/service.net';
import {Client} from 'vs/base/parts/ipc/node/ipc.net';
import {IExtensionsChannel, ExtensionsChannelClient} from 'vs/workbench/parts/extensions/common/extensionsIpc';
import {IExtensionsService} from 'vs/workbench/parts/extensions/common/extensions';
import {ExtensionsService} from 'vs/workbench/parts/extensions/node/extensionsService';
const DIRNAME = URI.parse(require.toUrl('./')).fsPath;
const BASE_PATH = paths.normalize(paths.join(DIRNAME, '../../../..'));
@ -66,7 +63,11 @@ export function createServices(remoteCom: IMainProcessExtHostIPC, initData: IIni
services.set(ITelemetryService, telemetryService);
services.set(IThreadService, threadService);
services.set(IExtensionService, new ExtHostExtensionService(threadService, telemetryService));
services.set(IExtensionsService, sharedProcessClient.getService<IExtensionsService>('ExtensionService', ExtensionsService)); // Connect to shared process services
// Connect to shared process services
const channel = sharedProcessClient.getChannel<IExtensionsChannel>('extensions');
const extensionsService = new ExtensionsChannelClient(channel);
services.set(IExtensionsService, extensionsService);
let instantiationService = new InstantiationService(services);
threadService.setInstantiationService(instantiationService);

View file

@ -8,7 +8,7 @@
import {onUnexpectedError} from 'vs/base/common/errors';
import { TPromise } from 'vs/base/common/winjs.base';
import { ExtensionHostMain, createServices, IInitData, exit } from 'vs/workbench/node/extensionHostMain';
import { Client, connect } from 'vs/base/node/service.net';
import { Client, connect } from 'vs/base/parts/ipc/node/ipc.net';
import { create as createIPC, IMainProcessExtHostIPC } from 'vs/platform/extensions/common/ipcRemoteCom';
import marshalling = require('vs/base/common/marshalling');

View file

@ -211,17 +211,8 @@ export class CallStackDataSource implements tree.IDataSource {
return this.getThreadChildren(element);
}
const threads = (<model.Model> element).getThreads();
const threadsArray: debug.IThread[] = [];
Object.keys(threads).forEach(threadId => {
threadsArray.push(threads[threadId]);
});
if (threadsArray.length === 1) {
return this.getThreadChildren(threadsArray[0]);
} else {
return TPromise.as(threadsArray);
}
const threads = (<model.Model>element).getThreads();
return TPromise.as(Object.keys(threads).map(ref => threads[ref]));
}
private getThreadChildren(thread: debug.IThread): TPromise<any> {

View file

@ -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);
}));

View file

@ -16,7 +16,7 @@ import treeimpl = require('vs/base/parts/tree/browser/treeImpl');
import splitview = require('vs/base/browser/ui/splitview/splitview');
import viewlet = require('vs/workbench/browser/viewlet');
import debug = require('vs/workbench/parts/debug/common/debug');
import model = require('vs/workbench/parts/debug/common/debugModel');
import { StackFrame, Expression, Variable, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel';
import viewer = require('vs/workbench/parts/debug/browser/debugViewer');
import debugactions = require('vs/workbench/parts/debug/electron-browser/debugActions');
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@ -89,7 +89,7 @@ export class VariablesView extends viewlet.CollapsibleViewletView {
this.toDispose.push(this.tree.addListener2(events.EventType.FOCUS, (e: tree.IFocusEvent) => {
const isMouseClick = (e.payload && e.payload.origin === 'mouse');
const isVariableType = (e.focus instanceof model.Variable);
const isVariableType = (e.focus instanceof Variable);
if(isMouseClick && isVariableType) {
this.telemetryService.publicLog('debug/variables/selected');
@ -128,7 +128,7 @@ export class WatchExpressionsView extends viewlet.CollapsibleViewletView {
super(actionRunner, !!settings[WatchExpressionsView.MEMENTO], nls.localize('expressionsSection', "Expressions Section"), messageService, contextMenuService);
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(we => {
// only expand when a new watch expression is added.
if (we instanceof model.Expression) {
if (we instanceof Expression) {
this.expand();
}
}));
@ -162,7 +162,7 @@ export class WatchExpressionsView extends viewlet.CollapsibleViewletView {
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(we => this.onWatchExpressionsUpdated(we)));
this.toDispose.push(this.debugService.getViewModel().onDidSelectExpression(expression => {
if (!expression || !(expression instanceof model.Expression)) {
if (!expression || !(expression instanceof Expression)) {
return;
}
@ -179,7 +179,7 @@ export class WatchExpressionsView extends viewlet.CollapsibleViewletView {
private onWatchExpressionsUpdated(expression: debug.IExpression): void {
this.tree.refresh().done(() => {
return expression instanceof model.Expression ? this.tree.reveal(expression): TPromise.as(true);
return expression instanceof Expression ? this.tree.reveal(expression): TPromise.as(true);
}, errors.onUnexpectedError);
}
@ -225,21 +225,17 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
accessibilityProvider: this.instantiationService.createInstance(viewer.CallstackAccessibilityProvider)
}, debugTreeOptions(nls.localize('callStackAriaLabel', "Debug Call Stack")));
const debugModel = this.debugService.getModel();
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (element instanceof model.StackFrame) {
if (element instanceof StackFrame) {
const stackFrame = <debug.IStackFrame> element;
this.debugService.setFocusedStackFrameAndEvaluate(stackFrame).done(null, errors.onUnexpectedError);
const isMouse = (e.payload.origin === 'mouse');
const isMouse = (e.payload && e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
@ -268,36 +264,38 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
this.toDispose.push(this.tree.addListener2(events.EventType.FOCUS, (e: tree.IFocusEvent) => {
const isMouseClick = (e.payload && e.payload.origin === 'mouse');
const isStackFrameType = (e.focus instanceof model.StackFrame);
const isStackFrameType = (e.focus instanceof StackFrame);
if (isMouseClick && isStackFrameType) {
this.telemetryService.publicLog('debug/callStack/selected');
}
}));
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);
const model = this.debugService.getModel();
this.toDispose.push(model.onDidChangeCallStack(() => {
const threads = model.getThreads();
const threadsArray = Object.keys(threads).map(ref => threads[ref]);
this.tree.setInput(threadsArray.length === 1 ? threadsArray[0] : model).done(() => {
const focussedThread = model.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);
}));
}
@ -346,16 +344,16 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
compare(tree: tree.ITree, element: any, otherElement: any): number {
const first = <debug.IBreakpoint> element;
const second = <debug.IBreakpoint> otherElement;
if (first instanceof model.ExceptionBreakpoint) {
if (first instanceof ExceptionBreakpoint) {
return -1;
}
if (second instanceof model.ExceptionBreakpoint) {
if (second instanceof ExceptionBreakpoint) {
return 1;
}
if (first instanceof model.FunctionBreakpoint) {
if (first instanceof FunctionBreakpoint) {
return -1;
}
if(second instanceof model.FunctionBreakpoint) {
if(second instanceof FunctionBreakpoint) {
return 1;
}
@ -377,7 +375,7 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
return;
}
const element = e.selection[0];
if (!(element instanceof model.Breakpoint)) {
if (!(element instanceof Breakpoint)) {
return;
}
@ -398,7 +396,7 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
}));
this.toDispose.push(this.debugService.getViewModel().onDidSelectFunctionBreakpoint(fbp => {
if (!fbp || !(fbp instanceof model.FunctionBreakpoint)) {
if (!fbp || !(fbp instanceof FunctionBreakpoint)) {
return;
}

View file

@ -338,8 +338,12 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
for (let pattern of ReplExpressionsRenderer.FILE_LOCATION_PATTERNS) {
pattern.lastIndex = 0; // the holy grail of software development
var match = pattern.exec(text);
var resource = match && URI.file(match[1]);
const match = pattern.exec(text);
let resource = null;
try {
resource = match && URI.file(match[1]);
} catch (e) { }
if (resource) {
linkContainer = document.createElement('span');

View file

@ -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,39 +429,29 @@ 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;
this.threads[reference].stopped = false;
if (removeThreads) {
delete this.threads[reference];
} else {
this.threads[reference].clearCallStack();
this.threads[reference].stoppedDetails = undefined;
}
} else {
Object.keys(this.threads).forEach(ref => {
this.threads[ref].clearCallStack();
this.threads[ref].stoppedDetails = undefined;
this.threads[ref].stopped = false;
});
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;
}
}
}
}
this._onDidChangeCallStack.fire();
}
public continueThreads(): void {
for (let ref in this.threads) {
if (this.threads.hasOwnProperty(ref)) {
this.threads[ref].stopped = false;
}
}
this.clearThreads(false);
}
public getBreakpoints(): debug.IBreakpoint[] {
return this.breakpoints;
}
@ -714,29 +704,29 @@ 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);
}
if (data.stoppedDetails) {
// Set the availability of the threads' callstacks depending on
// whether the thread is stopped or not
for (let ref in this.threads) {
if (this.threads.hasOwnProperty(ref)) {
if (data.allThreadsStopped) {
// Only update the details if all the threads are stopped
// because we don't want to overwrite the details of other
// threads that have stopped for a different reason
this.threads[ref].stoppedDetails = data.stoppedDetails;
}
this.threads[ref].stopped = data.allThreadsStopped;
if (data.allThreadsStopped) {
Object.keys(this.threads).forEach(ref => {
// Only update the details if all the threads are stopped
// because we don't want to overwrite the details of other
// threads that have stopped for a different reason
this.threads[ref].stoppedDetails = data.stoppedDetails;
this.threads[ref].stopped = true;
this.threads[ref].clearCallStack();
}
});
} else {
// One thread is stopped, only update that thread.
this.threads[data.threadId].stoppedDetails = data.stoppedDetails;
this.threads[data.threadId].clearCallStack();
this.threads[data.threadId].stopped = true;
}
this.threads[data.threadId].stoppedDetails = data.stoppedDetails;
this.threads[data.threadId].stopped = true;
}
this._onDidChangeCallStack.fire();

Some files were not shown because too many files have changed in this diff Show more