mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fix conflicts
This commit is contained in:
commit
adfa422641
|
@ -9,7 +9,7 @@
|
|||
a code editor with what developers need for their core edit-build-debug cycle. Code
|
||||
provides comprehensive editing and debugging support, an extensibility model, and lightweight integration with existing tools.
|
||||
|
||||
VS Code is updated monthly with new features and bug fixes. You can download it for Windows, Mac and Linux on [VS Code's website](https://code.visualstudio.com/Download). To get the latest releases everyday, you can install the [Insiders version of VS Code](https://code.visualstudio.com/insiders). This builds from the master branch and is updated at least daily.
|
||||
VS Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on [VS Code's website](https://code.visualstudio.com/Download). To get the latest releases everyday, you can install the [Insiders version of VS Code](https://code.visualstudio.com/insiders). This builds from the master branch and is updated at least daily.
|
||||
|
||||
<p align="center">
|
||||
<img alt="VS Code in action" src="https://cloud.githubusercontent.com/assets/11839736/16642200/6624dde0-43bd-11e6-8595-c81885ba0dc2.png">
|
||||
|
|
|
@ -43,8 +43,8 @@ const nodeModules = ['electron', 'original-fs']
|
|||
// Build
|
||||
|
||||
const builtInExtensions = [
|
||||
{ name: 'ms-vscode.node-debug', version: '1.16.3' },
|
||||
{ name: 'ms-vscode.node-debug2', version: '1.16.0' }
|
||||
{ name: 'ms-vscode.node-debug', version: '1.16.5' },
|
||||
{ name: 'ms-vscode.node-debug2', version: '1.16.3' }
|
||||
];
|
||||
|
||||
const excludedExtensions = [
|
||||
|
|
|
@ -87,7 +87,11 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
|
|||
var doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE;
|
||||
var info = this.findDescribingParent(node);
|
||||
// Ignore strings in import and export nodes.
|
||||
if (info && info.ignoreUsage) {
|
||||
if (info && info.isImport && doubleQuoted) {
|
||||
this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
||||
this.createReplacement(node.getStart(), 1, '\''),
|
||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
||||
]));
|
||||
return;
|
||||
}
|
||||
var callInfo = info ? info.callInfo : null;
|
||||
|
@ -161,7 +165,7 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
|
|||
return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } };
|
||||
}
|
||||
else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) {
|
||||
return { ignoreUsage: true };
|
||||
return { isImport: true };
|
||||
}
|
||||
else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration
|
||||
|| kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration
|
||||
|
@ -172,6 +176,7 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
|
|||
node = parent;
|
||||
}
|
||||
};
|
||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double qoutes for imports.';
|
||||
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
|
||||
return NoUnexternalizedStringsRuleWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
|
|
@ -45,6 +45,8 @@ interface KeyMessagePair {
|
|||
|
||||
class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
||||
|
||||
private static ImportFailureMessage = 'Do not use double qoutes for imports.';
|
||||
|
||||
private static DOUBLE_QUOTE: string = '"';
|
||||
|
||||
private signatures: Map<boolean>;
|
||||
|
@ -101,7 +103,15 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||
let doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE;
|
||||
let info = this.findDescribingParent(node);
|
||||
// Ignore strings in import and export nodes.
|
||||
if (info && info.ignoreUsage) {
|
||||
if (info && info.isImport && doubleQuoted) {
|
||||
this.addFailureAtNode(
|
||||
node,
|
||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage,
|
||||
new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
||||
this.createReplacement(node.getStart(), 1, '\''),
|
||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
||||
])
|
||||
);
|
||||
return;
|
||||
}
|
||||
let callInfo = info ? info.callInfo : null;
|
||||
|
@ -170,7 +180,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||
occurrences.push({ key: keyNode, message: messageNode });
|
||||
}
|
||||
|
||||
private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, ignoreUsage?: boolean; } {
|
||||
private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, isImport?: boolean; } {
|
||||
let parent: ts.Node;
|
||||
while ((parent = node.parent)) {
|
||||
let kind = parent.kind;
|
||||
|
@ -178,7 +188,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||
let callExpression = parent as ts.CallExpression;
|
||||
return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(<any>node) } };
|
||||
} else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) {
|
||||
return { ignoreUsage: true };
|
||||
return { isImport: true };
|
||||
} else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration
|
||||
|| kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration
|
||||
|| kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.ModuleDeclaration
|
||||
|
@ -188,4 +198,4 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||
node = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,16 +5,7 @@
|
|||
|
||||
declare module monaco {
|
||||
|
||||
interface Thenable<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
|
||||
}
|
||||
type Thenable<T> = PromiseLike<T>;
|
||||
|
||||
export interface IDisposable {
|
||||
dispose(): void;
|
||||
|
@ -41,7 +32,7 @@ declare module monaco {
|
|||
Error = 3,
|
||||
}
|
||||
|
||||
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
|
||||
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, Promise
|
||||
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
|
||||
#include(vs/base/common/uri): URI
|
||||
#include(vs/editor/common/standalone/standaloneBase): KeyCode, KeyMod
|
||||
|
|
|
@ -24,6 +24,7 @@ npmInstall('extensions'); // node modules shared by all extensions
|
|||
const extensions = [
|
||||
'vscode-api-tests',
|
||||
'vscode-colorize-tests',
|
||||
'azure-account',
|
||||
'json',
|
||||
'configuration-editing',
|
||||
'extension-editing',
|
||||
|
|
|
@ -16,6 +16,9 @@ echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
|||
step "Install dependencies" \
|
||||
npm install
|
||||
|
||||
step "Hygiene" \
|
||||
npm run gulp -- hygiene
|
||||
|
||||
step "Mix in repository from vscode-distro" \
|
||||
npm run gulp -- mixin
|
||||
|
||||
|
@ -23,7 +26,7 @@ step "Install distro dependencies" \
|
|||
node build/tfs/common/installDistro.js
|
||||
|
||||
step "Build minified & upload source maps" \
|
||||
npm run gulp -- --max_old_space_size=4096 vscode-darwin-min upload-vscode-sourcemaps
|
||||
npm run gulp -- vscode-darwin-min upload-vscode-sourcemaps
|
||||
|
||||
# step "Create loader snapshot"
|
||||
# node build/lib/snapshotLoader.js
|
||||
|
|
|
@ -19,7 +19,7 @@ step "Install distro dependencies" \
|
|||
node build/tfs/common/installDistro.js
|
||||
|
||||
step "Build minified & upload source maps" \
|
||||
npm run gulp -- --max_old_space_size=4096 vscode-darwin-min
|
||||
npm run gulp -- vscode-darwin-min
|
||||
|
||||
step "Run smoke test" \
|
||||
pushd test/smoke
|
||||
|
|
|
@ -18,6 +18,9 @@ echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
|||
step "Install dependencies" \
|
||||
npm install --arch=$ARCH --unsafe-perm
|
||||
|
||||
step "Hygiene" \
|
||||
npm run gulp -- hygiene
|
||||
|
||||
step "Mix in repository from vscode-distro" \
|
||||
npm run gulp -- mixin
|
||||
|
||||
|
@ -28,7 +31,7 @@ step "Install distro dependencies" \
|
|||
node build/tfs/common/installDistro.js --arch=$ARCH
|
||||
|
||||
step "Build minified" \
|
||||
npm run gulp -- --max_old_space_size=4096 "vscode-linux-$ARCH-min"
|
||||
npm run gulp -- "vscode-linux-$ARCH-min"
|
||||
|
||||
# step "Create loader snapshot"
|
||||
# node build/lib/snapshotLoader.js --arch=$ARCH
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
. ./build/tfs/common/common.sh
|
||||
|
||||
step "Build Debian package" \
|
||||
npm run gulp -- --max_old_space_size=4096 "vscode-linux-$ARCH-build-deb"
|
||||
npm run gulp -- "vscode-linux-$ARCH-build-deb"
|
||||
|
||||
step "Build RPM package" \
|
||||
npm run gulp -- --max_old_space_size=4096 "vscode-linux-$ARCH-build-rpm"
|
||||
npm run gulp -- "vscode-linux-$ARCH-build-rpm"
|
||||
|
||||
(cd $BUILD_SOURCESDIRECTORY/build/tfs/common && \
|
||||
step "Install build dependencies" \
|
||||
|
|
|
@ -24,7 +24,7 @@ step "Install distro dependencies" \
|
|||
node build/tfs/common/installDistro.js --arch=$ARCH
|
||||
|
||||
step "Build minified" \
|
||||
npm run gulp -- --max_old_space_size=4096 "vscode-linux-$ARCH-min"
|
||||
npm run gulp -- "vscode-linux-$ARCH-min"
|
||||
|
||||
function configureEnvironment {
|
||||
id -u testuser &>/dev/null || (useradd -m testuser; chpasswd <<< testuser:testpassword)
|
||||
|
|
|
@ -19,6 +19,10 @@ step "Install dependencies" {
|
|||
exec { & npm install }
|
||||
}
|
||||
|
||||
step "Hygiene" {
|
||||
exec { & npm run gulp -- hygiene }
|
||||
}
|
||||
|
||||
$env:VSCODE_MIXIN_PASSWORD = $mixinPassword
|
||||
step "Mix in repository from vscode-distro" {
|
||||
exec { & npm run gulp -- mixin }
|
||||
|
@ -33,7 +37,7 @@ step "Install distro dependencies" {
|
|||
}
|
||||
|
||||
step "Build minified" {
|
||||
exec { & npm run gulp -- --max_old_space_size=4096 "vscode-win32-$global:arch-min" }
|
||||
exec { & npm run gulp -- "vscode-win32-$global:arch-min" }
|
||||
}
|
||||
|
||||
# step "Create loader snapshot" {
|
||||
|
|
|
@ -6,7 +6,7 @@ Param(
|
|||
. .\build\tfs\win32\lib.ps1
|
||||
|
||||
step "Create archive and setup package" {
|
||||
exec { & npm run gulp -- --max_old_space_size=4096 "vscode-win32-$global:arch-archive" "vscode-win32-$global:arch-setup" }
|
||||
exec { & npm run gulp -- "vscode-win32-$global:arch-archive" "vscode-win32-$global:arch-setup" }
|
||||
}
|
||||
|
||||
done
|
|
@ -34,7 +34,7 @@ step "Install distro dependencies" {
|
|||
}
|
||||
|
||||
step "Build minified" {
|
||||
exec { & npm run gulp -- --max_old_space_size=4096 "vscode-win32-$global:arch-min" }
|
||||
exec { & npm run gulp -- "vscode-win32-$global:arch-min" }
|
||||
}
|
||||
|
||||
step "Run smoke test" {
|
||||
|
|
4
extensions/azure-account/.vscodeignore
Normal file
4
extensions/azure-account/.vscodeignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
test/**
|
||||
src/**
|
||||
tsconfig.json
|
||||
npm-shrinkwrap.json
|
521
extensions/azure-account/npm-shrinkwrap.json
generated
Normal file
521
extensions/azure-account/npm-shrinkwrap.json
generated
Normal file
|
@ -0,0 +1,521 @@
|
|||
{
|
||||
"name": "azure-account",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@types/copy-paste": {
|
||||
"version": "1.1.30",
|
||||
"from": "@types/copy-paste@>=1.1.30 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/copy-paste/-/copy-paste-1.1.30.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"@types/form-data": {
|
||||
"version": "2.2.0",
|
||||
"from": "@types/form-data@*",
|
||||
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.0.tgz",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.0.24",
|
||||
"from": "@types/node@*",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.24.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "6.0.87",
|
||||
"from": "@types/node@>=6.0.40 <7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.87.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"@types/opn": {
|
||||
"version": "3.0.28",
|
||||
"from": "@types/opn@>=3.0.28 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/opn/-/opn-3.0.28.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"@types/request": {
|
||||
"version": "0.0.45",
|
||||
"from": "@types/request@>=0.0.45 <0.0.46",
|
||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-0.0.45.tgz",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.0.24",
|
||||
"from": "@types/node@*",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.24.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/uuid": {
|
||||
"version": "2.0.30",
|
||||
"from": "@types/uuid@>=2.0.29 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-2.0.30.tgz",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.0.24",
|
||||
"from": "@types/node@*",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.24.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"adal-node": {
|
||||
"version": "0.1.22",
|
||||
"from": "adal-node@>=0.1.22 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.22.tgz"
|
||||
},
|
||||
"ajv": {
|
||||
"version": "4.11.8",
|
||||
"from": "ajv@>=4.9.1 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz"
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.3",
|
||||
"from": "asn1@>=0.2.3 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz"
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "0.2.0",
|
||||
"from": "assert-plus@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz"
|
||||
},
|
||||
"async": {
|
||||
"version": "2.5.0",
|
||||
"from": "async@>=0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz"
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"from": "asynckit@>=0.4.0 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.6.0",
|
||||
"from": "aws-sign2@>=0.6.0 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz"
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.6.0",
|
||||
"from": "aws4@>=1.2.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz"
|
||||
},
|
||||
"azure-arm-resource": {
|
||||
"version": "2.0.0-preview",
|
||||
"from": "azure-arm-resource@>=2.0.0-preview <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/azure-arm-resource/-/azure-arm-resource-2.0.0-preview.tgz"
|
||||
},
|
||||
"base64url": {
|
||||
"version": "2.0.0",
|
||||
"from": "base64url@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz"
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.1",
|
||||
"from": "bcrypt-pbkdf@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
|
||||
"optional": true
|
||||
},
|
||||
"boom": {
|
||||
"version": "2.10.1",
|
||||
"from": "boom@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
|
||||
},
|
||||
"buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"from": "buffer-equal-constant-time@1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz"
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"from": "caseless@>=0.12.0 <0.13.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz"
|
||||
},
|
||||
"co": {
|
||||
"version": "4.6.0",
|
||||
"from": "co@>=4.6.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz"
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.5",
|
||||
"from": "combined-stream@>=1.0.5 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
|
||||
},
|
||||
"copy-paste": {
|
||||
"version": "1.3.0",
|
||||
"from": "copy-paste@>=1.3.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/copy-paste/-/copy-paste-1.3.0.tgz"
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"from": "core-util-is@1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"cryptiles": {
|
||||
"version": "2.0.5",
|
||||
"from": "cryptiles@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"from": "dashdash@>=1.12.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"from": "assert-plus@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"date-utils": {
|
||||
"version": "1.2.21",
|
||||
"from": "date-utils@*",
|
||||
"resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz"
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"from": "delayed-stream@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
|
||||
},
|
||||
"duplexer": {
|
||||
"version": "0.1.1",
|
||||
"from": "duplexer@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz"
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.1",
|
||||
"from": "ecc-jsbn@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
|
||||
"optional": true
|
||||
},
|
||||
"ecdsa-sig-formatter": {
|
||||
"version": "1.0.9",
|
||||
"from": "ecdsa-sig-formatter@1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz"
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.1",
|
||||
"from": "extend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz"
|
||||
},
|
||||
"extsprintf": {
|
||||
"version": "1.3.0",
|
||||
"from": "extsprintf@1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz"
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"from": "forever-agent@>=0.6.1 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.1.4",
|
||||
"from": "form-data@>=2.1.1 <2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz"
|
||||
},
|
||||
"getpass": {
|
||||
"version": "0.1.7",
|
||||
"from": "getpass@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"from": "assert-plus@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "1.0.5",
|
||||
"from": "har-schema@>=1.0.5 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz"
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "4.2.1",
|
||||
"from": "har-validator@>=4.2.1 <4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz"
|
||||
},
|
||||
"hawk": {
|
||||
"version": "3.1.3",
|
||||
"from": "hawk@>=3.1.3 <3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz"
|
||||
},
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"from": "hoek@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.1.1",
|
||||
"from": "http-signature@>=1.1.0 <1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz"
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.18",
|
||||
"from": "iconv-lite@>=0.4.8 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz"
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "1.1.5",
|
||||
"from": "is-buffer@>=1.1.5 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz"
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"from": "is-stream@>=1.1.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz"
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"from": "is-typedarray@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
|
||||
},
|
||||
"is-wsl": {
|
||||
"version": "1.1.0",
|
||||
"from": "is-wsl@>=1.1.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz"
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"from": "isstream@>=0.1.2 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"from": "jsbn@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"optional": true
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.2.3",
|
||||
"from": "json-schema@0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz"
|
||||
},
|
||||
"json-stable-stringify": {
|
||||
"version": "1.0.1",
|
||||
"from": "json-stable-stringify@>=1.0.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz"
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"from": "json-stringify-safe@>=5.0.1 <5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
|
||||
},
|
||||
"jsonify": {
|
||||
"version": "0.0.0",
|
||||
"from": "jsonify@>=0.0.0 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz"
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"from": "jsprim@>=1.2.2 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"from": "assert-plus@1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"jwa": {
|
||||
"version": "1.1.5",
|
||||
"from": "jwa@>=1.1.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz"
|
||||
},
|
||||
"jws": {
|
||||
"version": "3.1.4",
|
||||
"from": "jws@>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz"
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.4",
|
||||
"from": "lodash@>=4.14.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz"
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.29.0",
|
||||
"from": "mime-db@>=1.29.0 <1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz"
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.16",
|
||||
"from": "mime-types@>=2.1.7 <2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz"
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.18.1",
|
||||
"from": "moment@>=2.14.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz"
|
||||
},
|
||||
"ms-rest": {
|
||||
"version": "2.2.1",
|
||||
"from": "ms-rest@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.2.1.tgz",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "7.0.42",
|
||||
"from": "@types/node@>=7.0.10 <8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.42.tgz"
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.1.0",
|
||||
"from": "uuid@^3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ms-rest-azure": {
|
||||
"version": "2.2.3",
|
||||
"from": "ms-rest-azure@>=2.2.3 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.2.3.tgz",
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "7.0.42",
|
||||
"from": "@types/node@^7.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.42.tgz"
|
||||
},
|
||||
"async": {
|
||||
"version": "0.2.7",
|
||||
"from": "async@0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-0.2.7.tgz"
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.1.0",
|
||||
"from": "uuid@^3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-uuid": {
|
||||
"version": "1.4.7",
|
||||
"from": "node-uuid@1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz"
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.8.2",
|
||||
"from": "oauth-sign@>=0.8.1 <0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz"
|
||||
},
|
||||
"opn": {
|
||||
"version": "5.1.0",
|
||||
"from": "opn@>=5.1.0 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/opn/-/opn-5.1.0.tgz"
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "0.2.0",
|
||||
"from": "performance-now@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz"
|
||||
},
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"from": "punycode@>=1.4.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz"
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.4.0",
|
||||
"from": "qs@>=6.4.0 <6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz"
|
||||
},
|
||||
"request": {
|
||||
"version": "2.81.0",
|
||||
"from": "request@>=2.52.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz",
|
||||
"dependencies": {
|
||||
"uuid": {
|
||||
"version": "3.1.0",
|
||||
"from": "uuid@>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"from": "safe-buffer@>=5.0.1 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz"
|
||||
},
|
||||
"sntp": {
|
||||
"version": "1.0.9",
|
||||
"from": "sntp@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz"
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.13.1",
|
||||
"from": "sshpk@>=1.7.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"from": "assert-plus@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"from": "stringstream@>=0.0.4 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
|
||||
},
|
||||
"sync-exec": {
|
||||
"version": "0.6.2",
|
||||
"from": "sync-exec@>=0.6.0 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/sync-exec/-/sync-exec-0.6.2.tgz",
|
||||
"optional": true
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"from": "through@>=2.3.4 <2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.3.2",
|
||||
"from": "tough-cookie@>=2.3.0 <2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz"
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.5",
|
||||
"from": "tunnel@>=0.0.2 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz"
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"from": "tunnel-agent@>=0.6.0 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz"
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"from": "tweetnacl@>=0.14.0 <0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"optional": true
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.8.3",
|
||||
"from": "underscore@>=1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz"
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"from": "verror@1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"from": "assert-plus@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
"from": "vscode-nls@>=2.0.2 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
|
||||
},
|
||||
"xmldom": {
|
||||
"version": "0.1.27",
|
||||
"from": "xmldom@>=0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz"
|
||||
},
|
||||
"xpath.js": {
|
||||
"version": "1.0.7",
|
||||
"from": "xpath.js@>=1.0.5 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.0.7.tgz"
|
||||
}
|
||||
}
|
||||
}
|
70
extensions/azure-account/package.json
Normal file
70
extensions/azure-account/package.json
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"name": "azure-account",
|
||||
"version": "0.1.0",
|
||||
"publisher": "vscode",
|
||||
"engines": {
|
||||
"vscode": "*"
|
||||
},
|
||||
"enableProposedApi": true,
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "azure-account.login",
|
||||
"title": "%azure-account.commands.login%",
|
||||
"category": "%azure-account.commands.azure%"
|
||||
},
|
||||
{
|
||||
"command": "azure-account.logout",
|
||||
"title": "%azure-account.commands.logout%",
|
||||
"category": "%azure-account.commands.azure%"
|
||||
},
|
||||
{
|
||||
"command": "azure-account.addFilter",
|
||||
"title": "%azure-account.commands.addResourceFilter%",
|
||||
"category": "%azure-account.commands.azure%"
|
||||
},
|
||||
{
|
||||
"command": "azure-account.removeFilter",
|
||||
"title": "%azure-account.commands.removeResourceFilter%",
|
||||
"category": "%azure-account.commands.azure%"
|
||||
},
|
||||
{
|
||||
"command": "azure-account.createAccount",
|
||||
"title": "%azure-account.commands.createAccount%",
|
||||
"category": "%azure-account.commands.azure%"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "Azure configuration",
|
||||
"properties": {
|
||||
"azure.resourceFilter": {
|
||||
"type": "array",
|
||||
"default": null,
|
||||
"description": "The resource filter, each element is either a subscription id or a subscription id and a resource group name separated by a slash."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:azure-account",
|
||||
"watch": "gulp watch-extension:azure-account"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/copy-paste": "^1.1.30",
|
||||
"@types/node": "^6.0.40",
|
||||
"@types/opn": "^3.0.28"
|
||||
},
|
||||
"dependencies": {
|
||||
"adal-node": "^0.1.22",
|
||||
"azure-arm-resource": "^2.0.0-preview",
|
||||
"copy-paste": "^1.3.0",
|
||||
"ms-rest-azure": "^2.2.3",
|
||||
"vscode-nls": "^2.0.2",
|
||||
"opn": "^5.1.0"
|
||||
}
|
||||
}
|
8
extensions/azure-account/package.nls.json
Normal file
8
extensions/azure-account/package.nls.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"azure-account.commands.azure": "Azure",
|
||||
"azure-account.commands.login": "Login",
|
||||
"azure-account.commands.logout": "Logout",
|
||||
"azure-account.commands.addResourceFilter": "Add Resource Filter",
|
||||
"azure-account.commands.removeResourceFilter": "Remove Resource Filter",
|
||||
"azure-account.commands.createAccount": "Create an Account"
|
||||
}
|
472
extensions/azure-account/src/azure-account.ts
Normal file
472
extensions/azure-account/src/azure-account.ts
Normal file
|
@ -0,0 +1,472 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const adal = require('adal-node');
|
||||
const MemoryCache = adal.MemoryCache;
|
||||
const AuthenticationContext = adal.AuthenticationContext;
|
||||
const CacheDriver = require('adal-node/lib/cache-driver');
|
||||
const createLogContext = require('adal-node/lib/log').createLogContext;
|
||||
|
||||
import { DeviceTokenCredentials, AzureEnvironment } from 'ms-rest-azure';
|
||||
import { SubscriptionClient, ResourceManagementClient, SubscriptionModels } from 'azure-arm-resource';
|
||||
import * as opn from 'opn';
|
||||
import * as copypaste from 'copy-paste';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
import { window, commands, credentials, EventEmitter, MessageItem, ExtensionContext, workspace, ConfigurationTarget } from 'vscode';
|
||||
import { AzureAccount, AzureSession, AzureLoginStatus, AzureResourceFilter } from './typings/azure-account.api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const defaultEnvironment = (<any>AzureEnvironment).Azure;
|
||||
const commonTenantId = 'common';
|
||||
const authorityHostUrl = defaultEnvironment.activeDirectoryEndpointUrl;
|
||||
const clientId = '04b07795-8ddb-461a-bbee-02f9e1bf7b46';
|
||||
const authorityUrl = `${authorityHostUrl}${commonTenantId}`;
|
||||
const resource = defaultEnvironment.activeDirectoryResourceId;
|
||||
|
||||
const credentialsService = 'VSCode Public Azure';
|
||||
const credentialsAccount = 'Refresh Token';
|
||||
|
||||
interface DeviceLogin {
|
||||
userCode: string;
|
||||
deviceCode: string;
|
||||
verificationUrl: string;
|
||||
expiresIn: number;
|
||||
interval: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface TokenResponse {
|
||||
tokenType: string;
|
||||
expiresIn: number;
|
||||
expiresOn: string;
|
||||
resource: string;
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
userId: string;
|
||||
isUserIdDisplayable: boolean;
|
||||
familyName: string;
|
||||
givenName: string;
|
||||
oid: string;
|
||||
tenantId: string;
|
||||
isMRRT: boolean;
|
||||
_clientId: string;
|
||||
_authority: string;
|
||||
}
|
||||
|
||||
interface AzureAccountWriteable extends AzureAccount {
|
||||
status: AzureLoginStatus;
|
||||
}
|
||||
|
||||
class AzureLoginError extends Error {
|
||||
constructor(message: string, public _reason: any) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
export class AzureLoginHelper {
|
||||
|
||||
private onStatusChanged = new EventEmitter<AzureLoginStatus>();
|
||||
private onSessionsChanged = new EventEmitter<void>();
|
||||
private onFiltersChanged = new EventEmitter<void>();
|
||||
private tokenCache = new MemoryCache();
|
||||
private oldResourceFilter: string;
|
||||
|
||||
constructor(context: ExtensionContext) {
|
||||
const subscriptions = context.subscriptions;
|
||||
subscriptions.push(commands.registerCommand('azure-account.login', () => this.login().catch(console.error)));
|
||||
subscriptions.push(commands.registerCommand('azure-account.logout', () => this.logout().catch(console.error)));
|
||||
subscriptions.push(commands.registerCommand('azure-account.askForLogin', () => this.askForLogin().catch(console.error)));
|
||||
subscriptions.push(commands.registerCommand('azure-account.addFilter', () => this.addFilter().catch(console.error)));
|
||||
subscriptions.push(commands.registerCommand('azure-account.removeFilter', () => this.removeFilter().catch(console.error)));
|
||||
subscriptions.push(this.api.onSessionsChanged(() => this.updateFilters().catch(console.error)));
|
||||
subscriptions.push(workspace.onDidChangeConfiguration(() => this.updateFilters(true).catch(console.error)));
|
||||
this.initialize()
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
api: AzureAccount = {
|
||||
status: 'Initializing',
|
||||
onStatusChanged: this.onStatusChanged.event,
|
||||
sessions: [],
|
||||
onSessionsChanged: this.onSessionsChanged.event,
|
||||
filters: [],
|
||||
onFiltersChanged: this.onFiltersChanged.event,
|
||||
credentials
|
||||
};
|
||||
|
||||
async login() {
|
||||
try {
|
||||
this.beginLoggingIn();
|
||||
const deviceLogin = await deviceLogin1();
|
||||
const copyAndOpen: MessageItem = { title: localize('azure-account.copyAndOpen', "Copy & Open") };
|
||||
const close: MessageItem = { title: localize('azure-account.close', "Close"), isCloseAffordance: true };
|
||||
const response = await window.showInformationMessage(deviceLogin.message, copyAndOpen, close);
|
||||
if (response === copyAndOpen) {
|
||||
copypaste.copy(deviceLogin.userCode);
|
||||
opn(deviceLogin.verificationUrl);
|
||||
}
|
||||
const tokenResponse = await deviceLogin2(deviceLogin);
|
||||
const refreshToken = tokenResponse.refreshToken;
|
||||
const tokenResponses = await tokensFromToken(tokenResponse);
|
||||
await credentials.writeSecret(credentialsService, credentialsAccount, refreshToken);
|
||||
await this.updateSessions(tokenResponses);
|
||||
} finally {
|
||||
this.updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await credentials.deleteSecret(credentialsService, credentialsAccount);
|
||||
await this.updateSessions([]);
|
||||
this.updateStatus();
|
||||
}
|
||||
|
||||
private async initialize() {
|
||||
try {
|
||||
const refreshToken = await credentials.readSecret(credentialsService, credentialsAccount);
|
||||
if (refreshToken) {
|
||||
this.beginLoggingIn();
|
||||
const tokenResponse = await tokenFromRefreshToken(refreshToken);
|
||||
const tokenResponses = await tokensFromToken(tokenResponse);
|
||||
await this.updateSessions(tokenResponses);
|
||||
}
|
||||
} catch (err) {
|
||||
if (!(err instanceof AzureLoginError)) {
|
||||
throw err;
|
||||
}
|
||||
} finally {
|
||||
this.updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
private beginLoggingIn() {
|
||||
if (this.api.status !== 'LoggedIn') {
|
||||
(<AzureAccountWriteable>this.api).status = 'LoggingIn';
|
||||
this.onStatusChanged.fire(this.api.status);
|
||||
}
|
||||
}
|
||||
|
||||
private updateStatus() {
|
||||
const status = this.api.sessions.length ? 'LoggedIn' : 'LoggedOut';
|
||||
if (this.api.status !== status) {
|
||||
(<AzureAccountWriteable>this.api).status = status;
|
||||
this.onStatusChanged.fire(this.api.status);
|
||||
}
|
||||
}
|
||||
|
||||
private async updateSessions(tokenResponses: TokenResponse[]) {
|
||||
await clearTokenCache(this.tokenCache);
|
||||
for (const tokenResponse of tokenResponses) {
|
||||
await addTokenToCache(this.tokenCache, tokenResponse);
|
||||
}
|
||||
const sessions = this.api.sessions;
|
||||
sessions.splice(0, sessions.length, ...tokenResponses.map<AzureSession>(tokenResponse => ({
|
||||
environment: defaultEnvironment,
|
||||
userId: tokenResponse.userId,
|
||||
tenantId: tokenResponse.tenantId,
|
||||
credentials: new DeviceTokenCredentials({ username: tokenResponse.userId, clientId, tokenCache: this.tokenCache, domain: tokenResponse.tenantId })
|
||||
})));
|
||||
this.onSessionsChanged.fire();
|
||||
}
|
||||
|
||||
private async askForLogin() {
|
||||
if (this.api.status === 'LoggedIn') {
|
||||
return;
|
||||
}
|
||||
const login = { title: localize('azure-account.login', "Login") };
|
||||
const cancel = { title: 'Cancel', isCloseAffordance: true };
|
||||
const result = await window.showInformationMessage(localize('azure-account.loginFirst', "Not logged in, log in first."), login, cancel);
|
||||
return result === login && commands.executeCommand('azure-account.login');
|
||||
}
|
||||
|
||||
private async addFilter() {
|
||||
if (this.api.status !== 'LoggedIn') {
|
||||
return commands.executeCommand('azure-account.askForLogin');
|
||||
}
|
||||
|
||||
const azureConfig = workspace.getConfiguration('azure');
|
||||
const resourceFilter = azureConfig.get<string[]>('resourceFilter') || [];
|
||||
|
||||
const subscriptionItems: { session: AzureSession; subscription: SubscriptionModels.Subscription }[] = [];
|
||||
for (const session of this.api.sessions) {
|
||||
const credentials = session.credentials;
|
||||
const client = new SubscriptionClient(credentials);
|
||||
const subscriptions = await listAll(client.subscriptions, client.subscriptions.list());
|
||||
subscriptionItems.push(...subscriptions.filter(subscription => resourceFilter.indexOf(`${session.tenantId}/${subscription.subscriptionId}`) === -1)
|
||||
.map(subscription => ({
|
||||
session,
|
||||
subscription
|
||||
})));
|
||||
}
|
||||
subscriptionItems.sort((a, b) => a.subscription.displayName!.localeCompare(b.subscription.displayName!));
|
||||
const subscriptionResult = await window.showQuickPick(subscriptionItems.map(subscription => ({
|
||||
label: subscription.subscription.displayName!,
|
||||
description: subscription.subscription.subscriptionId!,
|
||||
subscription
|
||||
})));
|
||||
if (!subscriptionResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { session, subscription } = subscriptionResult.subscription;
|
||||
const client = new ResourceManagementClient(session.credentials, subscription.subscriptionId!);
|
||||
const resourceGroups = await listAll(client.resourceGroups, client.resourceGroups.list());
|
||||
const resourceGroupFilters: AzureResourceFilter[] = [
|
||||
{
|
||||
...subscriptionResult.subscription,
|
||||
allResourceGroups: true,
|
||||
resourceGroups
|
||||
}
|
||||
];
|
||||
resourceGroupFilters.push(...resourceGroups.filter(resourceGroup => resourceFilter.indexOf(`${session.tenantId}/${subscription.subscriptionId}/${resourceGroup.name}`) === -1)
|
||||
.map(resourceGroup => ({
|
||||
session,
|
||||
subscription,
|
||||
allResourceGroups: false,
|
||||
resourceGroups: [resourceGroup]
|
||||
})));
|
||||
resourceGroupFilters.sort((a, b) => (!a.allResourceGroups ? a.resourceGroups[0].name! : '').localeCompare(!b.allResourceGroups ? b.resourceGroups[0].name! : ''));
|
||||
const resourceGroupResult = await window.showQuickPick(resourceGroupFilters.map(resourceGroup => (!resourceGroup.allResourceGroups ? {
|
||||
label: resourceGroup.resourceGroups[0].name!,
|
||||
description: resourceGroup.resourceGroups[0].location,
|
||||
resourceGroup
|
||||
} : {
|
||||
label: localize('azure-account.entireSubscription', "Entire Subscription"),
|
||||
description: '',
|
||||
resourceGroup
|
||||
})));
|
||||
if (!resourceGroupResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
const resourceGroup = resourceGroupResult.resourceGroup;
|
||||
if (!resourceGroup.allResourceGroups) {
|
||||
resourceFilter.push(`${resourceGroup.session.tenantId}/${resourceGroup.subscription.subscriptionId}/${resourceGroup.resourceGroups[0].name}`);
|
||||
} else {
|
||||
resourceFilter.splice(0, resourceFilter.length, ...resourceFilter.filter(c => !c.startsWith(`${resourceGroup.session.tenantId}/${resourceGroup.subscription.subscriptionId}/`)));
|
||||
resourceFilter.push(`${resourceGroup.session.tenantId}/${resourceGroup.subscription.subscriptionId}`);
|
||||
}
|
||||
|
||||
const resourceFilterConfig = azureConfig.inspect<string[]>('resourceFilter');
|
||||
let target = ConfigurationTarget.Global;
|
||||
if (resourceFilterConfig) {
|
||||
if (resourceFilterConfig.workspaceFolderValue) {
|
||||
target = ConfigurationTarget.WorkspaceFolder;
|
||||
} else if (resourceFilterConfig.workspaceValue) {
|
||||
target = ConfigurationTarget.Workspace;
|
||||
} else if (resourceFilterConfig.globalValue) {
|
||||
target = ConfigurationTarget.Global;
|
||||
}
|
||||
}
|
||||
await azureConfig.update('resourceFilter', resourceFilter, target);
|
||||
}
|
||||
|
||||
private async removeFilter() {
|
||||
if (this.api.status !== 'LoggedIn') {
|
||||
return commands.executeCommand('azure-account.askForLogin');
|
||||
}
|
||||
|
||||
const azureConfig = workspace.getConfiguration('azure');
|
||||
let resourceFilter = azureConfig.get<string[]>('resourceFilter') || [];
|
||||
|
||||
const filters = resourceFilter.length ? this.api.filters.reduce((list, filter) => {
|
||||
if (filter.allResourceGroups) {
|
||||
list.push(filter);
|
||||
} else {
|
||||
list.push(...filter.resourceGroups.map(resourceGroup => ({
|
||||
...filter,
|
||||
resourceGroups: [resourceGroup]
|
||||
})));
|
||||
}
|
||||
return list;
|
||||
}, <AzureResourceFilter[]>[]) : [];
|
||||
filters.sort((a, b) => (!a.allResourceGroups ? a.resourceGroups[0].name! : `/${a.subscription.displayName}`).localeCompare(!b.allResourceGroups ? b.resourceGroups[0].name! : `/${b.subscription.displayName}`));
|
||||
const filterResult = await window.showQuickPick(filters.map(filter => (!filter.allResourceGroups ? {
|
||||
label: filter.resourceGroups[0].name!,
|
||||
description: filter.subscription.displayName!,
|
||||
filter
|
||||
} : {
|
||||
label: filter.subscription.displayName!,
|
||||
description: filter.subscription.subscriptionId!,
|
||||
filter
|
||||
})));
|
||||
if (!filterResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
const filter = filterResult.filter;
|
||||
const remove = !filter.allResourceGroups ?
|
||||
`${filter.session.tenantId}/${filter.subscription.subscriptionId}/${filter.resourceGroups[0].name}` :
|
||||
`${filter.session.tenantId}/${filter.subscription.subscriptionId}`;
|
||||
resourceFilter = resourceFilter.filter(e => e !== remove);
|
||||
|
||||
const resourceFilterConfig = azureConfig.inspect<string[]>('resourceFilter');
|
||||
let target = ConfigurationTarget.Global;
|
||||
if (resourceFilterConfig) {
|
||||
if (resourceFilterConfig.workspaceFolderValue) {
|
||||
target = ConfigurationTarget.WorkspaceFolder;
|
||||
} else if (resourceFilterConfig.workspaceValue) {
|
||||
target = ConfigurationTarget.Workspace;
|
||||
} else if (resourceFilterConfig.globalValue) {
|
||||
target = ConfigurationTarget.Global;
|
||||
}
|
||||
}
|
||||
await azureConfig.update('resourceFilter', resourceFilter.length ? resourceFilter : undefined, target);
|
||||
}
|
||||
|
||||
private async updateFilters(configChange = false) {
|
||||
const azureConfig = workspace.getConfiguration('azure');
|
||||
let resourceFilter = azureConfig.get<string[]>('resourceFilter');
|
||||
if (configChange && JSON.stringify(resourceFilter) === this.oldResourceFilter) {
|
||||
return;
|
||||
}
|
||||
this.oldResourceFilter = JSON.stringify(resourceFilter);
|
||||
if (resourceFilter && !Array.isArray(resourceFilter)) {
|
||||
resourceFilter = [];
|
||||
}
|
||||
const filters = resourceFilter && resourceFilter.map(s => typeof s === 'string' ? s.split('/') : [])
|
||||
.filter(s => s.length === 2 || s.length === 3)
|
||||
.map(([tenantId, subscriptionId, resourceGroup]) => ({ tenantId, subscriptionId, resourceGroup }));
|
||||
const tenantIds = filters && filters.reduce<Record<string, Record<string, Record<string, boolean> | boolean>>>((result, filter) => {
|
||||
const tenant = result[filter.tenantId] || (result[filter.tenantId] = {});
|
||||
const resourceGroups = tenant[filter.subscriptionId] || (tenant[filter.subscriptionId] = (filter.resourceGroup ? {} : true));
|
||||
if (typeof resourceGroups === 'object' && filter.resourceGroup) {
|
||||
resourceGroups[filter.resourceGroup] = true;
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
const newFilters: AzureResourceFilter[] = [];
|
||||
const sessions = tenantIds ? this.api.sessions.filter(session => tenantIds[session.tenantId]) : this.api.sessions;
|
||||
for (const session of sessions) {
|
||||
const client = new SubscriptionClient(session.credentials);
|
||||
const subscriptionIds = tenantIds && tenantIds[session.tenantId];
|
||||
const subscriptions = await listAll(client.subscriptions, client.subscriptions.list());
|
||||
const filteredSubscriptions = subscriptionIds ? subscriptions.filter(subscription => subscriptionIds[subscription.subscriptionId!]) : subscriptions;
|
||||
for (const subscription of filteredSubscriptions) {
|
||||
const client = new ResourceManagementClient(session.credentials, subscription.subscriptionId!);
|
||||
const resourceGroupNames = subscriptionIds && subscriptionIds[subscription.subscriptionId!];
|
||||
const allResourceGroups = !(resourceGroupNames && typeof resourceGroupNames === 'object');
|
||||
const unfilteredResourceGroups = await listAll(client.resourceGroups, client.resourceGroups.list());
|
||||
const resourceGroups = allResourceGroups ? unfilteredResourceGroups : unfilteredResourceGroups.filter(resourceGroup => (<Record<string, boolean>>resourceGroupNames!)[resourceGroup.name!]);
|
||||
newFilters.push({ session, subscription, allResourceGroups, resourceGroups });
|
||||
}
|
||||
}
|
||||
this.api.filters.splice(0, this.api.filters.length, ...newFilters);
|
||||
this.onFiltersChanged.fire();
|
||||
}
|
||||
}
|
||||
|
||||
async function deviceLogin1(): Promise<DeviceLogin> {
|
||||
return new Promise<DeviceLogin>((resolve, reject) => {
|
||||
const cache = new MemoryCache();
|
||||
const context = new AuthenticationContext(authorityUrl, null, cache);
|
||||
context.acquireUserCode(resource, clientId, 'en-us', function (err: any, response: any) {
|
||||
if (err) {
|
||||
reject(new AzureLoginError(localize('azure-account.userCodeFailed', "Aquiring user code failed"), err));
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function deviceLogin2(deviceLogin: DeviceLogin) {
|
||||
return new Promise<TokenResponse>((resolve, reject) => {
|
||||
const tokenCache = new MemoryCache();
|
||||
const context = new AuthenticationContext(authorityUrl, null, tokenCache);
|
||||
context.acquireTokenWithDeviceCode(resource, clientId, deviceLogin, function (err: any, tokenResponse: TokenResponse) {
|
||||
if (err) {
|
||||
reject(new AzureLoginError(localize('azure-account.tokenFailed', "Aquiring token with device code"), err));
|
||||
} else {
|
||||
resolve(tokenResponse);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function tokenFromRefreshToken(refreshToken: string, tenantId = commonTenantId) {
|
||||
return new Promise<TokenResponse>((resolve, reject) => {
|
||||
const tokenCache = new MemoryCache();
|
||||
const context = new AuthenticationContext(`${authorityHostUrl}${tenantId}`, null, tokenCache);
|
||||
context.acquireTokenWithRefreshToken(refreshToken, clientId, null, function (err: any, tokenResponse: TokenResponse) {
|
||||
if (err) {
|
||||
reject(new AzureLoginError(localize('azure-account.tokenFromRefreshTokenFailed', "Aquiring token with refresh token"), err));
|
||||
} else {
|
||||
resolve(tokenResponse);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function tokensFromToken(firstTokenResponse: TokenResponse) {
|
||||
const tokenResponses = [firstTokenResponse];
|
||||
const tokenCache = new MemoryCache();
|
||||
await addTokenToCache(tokenCache, firstTokenResponse);
|
||||
const credentials = new DeviceTokenCredentials({ username: firstTokenResponse.userId, clientId, tokenCache });
|
||||
const client = new SubscriptionClient(credentials);
|
||||
const tenants = await listAll(client.tenants, client.tenants.list());
|
||||
for (const tenant of tenants) {
|
||||
if (tenant.tenantId !== firstTokenResponse.tenantId) {
|
||||
const tokenResponse = await tokenFromRefreshToken(firstTokenResponse.refreshToken, tenant.tenantId);
|
||||
tokenResponses.push(tokenResponse);
|
||||
}
|
||||
}
|
||||
return tokenResponses;
|
||||
}
|
||||
|
||||
async function addTokenToCache(tokenCache: any, tokenResponse: TokenResponse) {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
const driver = new CacheDriver(
|
||||
{ _logContext: createLogContext('') },
|
||||
`${authorityHostUrl}${tokenResponse.tenantId}`,
|
||||
tokenResponse.resource,
|
||||
clientId,
|
||||
tokenCache,
|
||||
(entry: any, resource: any, callback: (err: any, response: any) => {}) => {
|
||||
callback(null, entry);
|
||||
}
|
||||
);
|
||||
driver.add(tokenResponse, function (err: any) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function clearTokenCache(tokenCache: any) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
tokenCache.find({}, (err: any, entries: any[]) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
tokenCache.remove(entries, (err: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export interface PartialList<T> extends Array<T> {
|
||||
nextLink?: string;
|
||||
}
|
||||
|
||||
export async function listAll<T>(client: { listNext(nextPageLink: string): Promise<PartialList<T>>; }, first: Promise<PartialList<T>>): Promise<T[]> {
|
||||
const all: T[] = [];
|
||||
for (let list = await first; list.length || list.nextLink; list = list.nextLink ? await client.listNext(list.nextLink) : []) {
|
||||
all.push(...list);
|
||||
}
|
||||
return all;
|
||||
}
|
53
extensions/azure-account/src/extension.ts
Normal file
53
extensions/azure-account/src/extension.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { window, ExtensionContext, commands, credentials } from 'vscode';
|
||||
import { AzureLoginHelper } from './azure-account';
|
||||
import { AzureAccount } from './typings/azure-account.api';
|
||||
import * as opn from 'opn';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export function activate(context: ExtensionContext) {
|
||||
if (!credentials) {
|
||||
return; // Proposed API not available.
|
||||
}
|
||||
const azureLogin = new AzureLoginHelper(context);
|
||||
const subscriptions = context.subscriptions;
|
||||
subscriptions.push(createStatusBarItem(azureLogin.api));
|
||||
subscriptions.push(commands.registerCommand('azure-account.createAccount', createAccount));
|
||||
return azureLogin.api;
|
||||
}
|
||||
|
||||
function createAccount() {
|
||||
opn('https://azure.microsoft.com/en-us/free');
|
||||
}
|
||||
|
||||
function createStatusBarItem(api: AzureAccount) {
|
||||
const statusBarItem = window.createStatusBarItem();
|
||||
function updateStatusBar() {
|
||||
switch (api.status) {
|
||||
case 'LoggingIn':
|
||||
statusBarItem.text = localize('azure-account.loggingIn', "Azure: Logging in...");
|
||||
statusBarItem.show();
|
||||
break;
|
||||
case 'LoggedIn':
|
||||
statusBarItem.text = localize('azure-account.loggedIn', "Azure: {0}", api.sessions[0].userId);
|
||||
statusBarItem.show();
|
||||
break;
|
||||
default:
|
||||
statusBarItem.hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
api.onStatusChanged(updateStatusBar);
|
||||
api.onSessionsChanged(updateStatusBar);
|
||||
updateStatusBar();
|
||||
return statusBarItem;
|
||||
}
|
||||
|
||||
export function deactivate() {
|
||||
}
|
41
extensions/azure-account/src/typings/azure-account.api.d.ts
vendored
Normal file
41
extensions/azure-account/src/typings/azure-account.api.d.ts
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vscode';
|
||||
import { ServiceClientCredentials } from 'ms-rest';
|
||||
import { AzureEnvironment } from 'ms-rest-azure';
|
||||
import { SubscriptionModels, ResourceModels } from 'azure-arm-resource';
|
||||
|
||||
export type AzureLoginStatus = 'Initializing' | 'LoggingIn' | 'LoggedIn' | 'LoggedOut';
|
||||
|
||||
export interface AzureAccount {
|
||||
readonly status: AzureLoginStatus;
|
||||
readonly onStatusChanged: Event<AzureLoginStatus>;
|
||||
readonly sessions: AzureSession[];
|
||||
readonly onSessionsChanged: Event<void>;
|
||||
readonly filters: AzureResourceFilter[];
|
||||
readonly onFiltersChanged: Event<void>;
|
||||
readonly credentials: Credentials;
|
||||
}
|
||||
|
||||
export interface AzureSession {
|
||||
readonly environment: AzureEnvironment;
|
||||
readonly userId: string;
|
||||
readonly tenantId: string;
|
||||
readonly credentials: ServiceClientCredentials;
|
||||
}
|
||||
|
||||
export interface AzureResourceFilter {
|
||||
readonly session: AzureSession;
|
||||
readonly subscription: SubscriptionModels.Subscription;
|
||||
readonly allResourceGroups: boolean;
|
||||
readonly resourceGroups: ResourceModels.ResourceGroup[];
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
readSecret(service: string, account: string): Thenable<string | undefined>;
|
||||
writeSecret(service: string, account: string, secret: string): Thenable<void>;
|
||||
deleteSecret(service: string, account: string): Thenable<boolean>;
|
||||
}
|
6
extensions/azure-account/src/typings/ref.d.ts
vendored
Normal file
6
extensions/azure-account/src/typings/ref.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../src/vs/vscode.d.ts'/>
|
43
extensions/azure-account/src/typings/vscode.rejected.d.ts
vendored
Normal file
43
extensions/azure-account/src/typings/vscode.rejected.d.ts
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// This is the place for API experiments and proposal.
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
/**
|
||||
* Namespace for handling credentials.
|
||||
*/
|
||||
export namespace credentials {
|
||||
|
||||
/**
|
||||
* Read a previously stored secret from the credential store.
|
||||
*
|
||||
* @param service The service of the credential.
|
||||
* @param account The account of the credential.
|
||||
* @return A promise for the secret of the credential.
|
||||
*/
|
||||
export function readSecret(service: string, account: string): Thenable<string | undefined>;
|
||||
|
||||
/**
|
||||
* Write a secret to the credential store.
|
||||
*
|
||||
* @param service The service of the credential.
|
||||
* @param account The account of the credential.
|
||||
* @param secret The secret of the credential to write to the credential store.
|
||||
* @return A promise indicating completion of the operation.
|
||||
*/
|
||||
export function writeSecret(service: string, account: string, secret: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Delete a previously stored secret from the credential store.
|
||||
*
|
||||
* @param service The service of the credential.
|
||||
* @param account The account of the credential.
|
||||
* @return A promise resolving to true if there was a secret for that service and account.
|
||||
*/
|
||||
export function deleteSecret(service: string, account: string): Thenable<boolean>;
|
||||
}
|
||||
}
|
19
extensions/azure-account/tsconfig.json
Normal file
19
extensions/azure-account/tsconfig.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "./out",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -9,6 +9,7 @@ import * as path from 'path';
|
|||
import { languages, window, commands, workspace, ExtensionContext } from 'vscode';
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, Range, TextEdit } from 'vscode-languageclient';
|
||||
import { activateColorDecorations, ColorProvider } from './colorDecorators';
|
||||
import { ConfigurationFeature } from 'vscode-languageclient/lib/proposed';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
let localize = nls.loadMessageBundle();
|
||||
|
@ -23,7 +24,7 @@ export function activate(context: ExtensionContext) {
|
|||
// The server is implemented in node
|
||||
let serverModule = context.asAbsolutePath(path.join('server', 'out', 'cssServerMain.js'));
|
||||
// The debug options for the server
|
||||
let debugOptions = { execArgv: ['--nolazy', '--debug=6004'] };
|
||||
let debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] };
|
||||
|
||||
// If the extension is launch in debug mode the debug server options are use
|
||||
// Otherwise the run options are used
|
||||
|
@ -44,6 +45,7 @@ export function activate(context: ExtensionContext) {
|
|||
|
||||
// Create the language client and start the client.
|
||||
let client = new LanguageClient('css', localize('cssserver.name', 'CSS Language Server'), serverOptions, clientOptions);
|
||||
client.registerFeature(new ConfigurationFeature(client));
|
||||
|
||||
let disposable = client.start();
|
||||
// Push the disposable to the context's subscriptions so that the
|
||||
|
|
18
extensions/css/npm-shrinkwrap.json
generated
18
extensions/css/npm-shrinkwrap.json
generated
|
@ -13,19 +13,19 @@
|
|||
"resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz"
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-jsonrpc@>=3.2.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.2.0.tgz"
|
||||
"version": "3.3.1",
|
||||
"from": "vscode-jsonrpc@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.3.1.tgz"
|
||||
},
|
||||
"vscode-languageclient": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-languageclient@3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.2.0.tgz"
|
||||
"version": "3.4.0-next.10",
|
||||
"from": "vscode-languageclient@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.4.0-next.10.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-languageserver-types@>=3.2.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.2.0.tgz"
|
||||
"version": "3.3.0",
|
||||
"from": "vscode-languageserver-types@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
|
|
|
@ -62,16 +62,19 @@
|
|||
"properties": {
|
||||
"css.validate": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%css.validate.desc%"
|
||||
},
|
||||
"css.colorDecorators.enable": {
|
||||
"type": "boolean",
|
||||
"scope": "window",
|
||||
"default": true,
|
||||
"description": "%css.colorDecorators.enable.desc%"
|
||||
},
|
||||
"css.lint.compatibleVendorPrefixes": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -82,6 +85,7 @@
|
|||
},
|
||||
"css.lint.vendorPrefix": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -92,6 +96,7 @@
|
|||
},
|
||||
"css.lint.duplicateProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -102,6 +107,7 @@
|
|||
},
|
||||
"css.lint.emptyRules": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -112,6 +118,7 @@
|
|||
},
|
||||
"css.lint.importStatement": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -122,6 +129,7 @@
|
|||
},
|
||||
"css.lint.boxModel": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -132,6 +140,7 @@
|
|||
},
|
||||
"css.lint.universalSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -142,6 +151,7 @@
|
|||
},
|
||||
"css.lint.zeroUnits": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -152,6 +162,7 @@
|
|||
},
|
||||
"css.lint.fontFaceProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -162,6 +173,7 @@
|
|||
},
|
||||
"css.lint.hexColorLength": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -172,6 +184,7 @@
|
|||
},
|
||||
"css.lint.argumentsInColorFunction": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -182,6 +195,7 @@
|
|||
},
|
||||
"css.lint.unknownProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -192,6 +206,7 @@
|
|||
},
|
||||
"css.lint.ieHack": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -202,6 +217,7 @@
|
|||
},
|
||||
"css.lint.unknownVendorSpecificProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -212,6 +228,7 @@
|
|||
},
|
||||
"css.lint.propertyIgnoredDueToDisplay": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -222,6 +239,7 @@
|
|||
},
|
||||
"css.lint.important": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -232,6 +250,7 @@
|
|||
},
|
||||
"css.lint.float": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -242,6 +261,7 @@
|
|||
},
|
||||
"css.lint.idSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -252,6 +272,7 @@
|
|||
},
|
||||
"css.trace.server": {
|
||||
"type": "string",
|
||||
"scope": "window",
|
||||
"enum": [
|
||||
"off",
|
||||
"messages",
|
||||
|
@ -274,16 +295,19 @@
|
|||
"properties": {
|
||||
"scss.validate": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%scss.validate.desc%"
|
||||
},
|
||||
"scss.colorDecorators.enable": {
|
||||
"type": "boolean",
|
||||
"scope": "window",
|
||||
"default": true,
|
||||
"description": "%scss.colorDecorators.enable.desc%"
|
||||
},
|
||||
"scss.lint.compatibleVendorPrefixes": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -294,6 +318,7 @@
|
|||
},
|
||||
"scss.lint.vendorPrefix": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -304,6 +329,7 @@
|
|||
},
|
||||
"scss.lint.duplicateProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -314,6 +340,7 @@
|
|||
},
|
||||
"scss.lint.emptyRules": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -324,6 +351,7 @@
|
|||
},
|
||||
"scss.lint.importStatement": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -334,6 +362,7 @@
|
|||
},
|
||||
"scss.lint.boxModel": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -344,6 +373,7 @@
|
|||
},
|
||||
"scss.lint.universalSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -354,6 +384,7 @@
|
|||
},
|
||||
"scss.lint.zeroUnits": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -364,6 +395,7 @@
|
|||
},
|
||||
"scss.lint.fontFaceProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -374,6 +406,7 @@
|
|||
},
|
||||
"scss.lint.hexColorLength": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -384,6 +417,7 @@
|
|||
},
|
||||
"scss.lint.argumentsInColorFunction": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -394,6 +428,7 @@
|
|||
},
|
||||
"scss.lint.unknownProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -404,6 +439,7 @@
|
|||
},
|
||||
"scss.lint.ieHack": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -414,6 +450,7 @@
|
|||
},
|
||||
"scss.lint.unknownVendorSpecificProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -424,6 +461,7 @@
|
|||
},
|
||||
"scss.lint.propertyIgnoredDueToDisplay": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -434,6 +472,7 @@
|
|||
},
|
||||
"scss.lint.important": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -444,6 +483,7 @@
|
|||
},
|
||||
"scss.lint.float": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -454,6 +494,7 @@
|
|||
},
|
||||
"scss.lint.idSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -477,16 +518,19 @@
|
|||
"properties": {
|
||||
"less.validate": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%less.validate.desc%"
|
||||
},
|
||||
"less.colorDecorators.enable": {
|
||||
"type": "boolean",
|
||||
"scope": "window",
|
||||
"default": true,
|
||||
"description": "%less.colorDecorators.enable.desc%"
|
||||
},
|
||||
"less.lint.compatibleVendorPrefixes": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -497,6 +541,7 @@
|
|||
},
|
||||
"less.lint.vendorPrefix": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -507,6 +552,7 @@
|
|||
},
|
||||
"less.lint.duplicateProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -517,6 +563,7 @@
|
|||
},
|
||||
"less.lint.emptyRules": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -527,6 +574,7 @@
|
|||
},
|
||||
"less.lint.importStatement": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -537,6 +585,7 @@
|
|||
},
|
||||
"less.lint.boxModel": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -547,6 +596,7 @@
|
|||
},
|
||||
"less.lint.universalSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -557,6 +607,7 @@
|
|||
},
|
||||
"less.lint.zeroUnits": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -567,6 +618,7 @@
|
|||
},
|
||||
"less.lint.fontFaceProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -577,6 +629,7 @@
|
|||
},
|
||||
"less.lint.hexColorLength": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -587,6 +640,7 @@
|
|||
},
|
||||
"less.lint.argumentsInColorFunction": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -597,6 +651,7 @@
|
|||
},
|
||||
"less.lint.unknownProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -607,6 +662,7 @@
|
|||
},
|
||||
"less.lint.ieHack": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -617,6 +673,7 @@
|
|||
},
|
||||
"less.lint.unknownVendorSpecificProperties": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -627,6 +684,7 @@
|
|||
},
|
||||
"less.lint.propertyIgnoredDueToDisplay": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -637,6 +695,7 @@
|
|||
},
|
||||
"less.lint.important": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -647,6 +706,7 @@
|
|||
},
|
||||
"less.lint.float": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -657,6 +717,7 @@
|
|||
},
|
||||
"less.lint.idSelector": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"enum": [
|
||||
"ignore",
|
||||
"warning",
|
||||
|
@ -674,10 +735,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"parse-color": "^1.0.0",
|
||||
"vscode-languageclient": "^3.2.0",
|
||||
"vscode-languageclient": "3.4.0-next.10",
|
||||
"vscode-nls": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
27
extensions/css/server/npm-shrinkwrap.json
generated
27
extensions/css/server/npm-shrinkwrap.json
generated
|
@ -3,29 +3,34 @@
|
|||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": {
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.3",
|
||||
"from": "vscode-css-languageservice@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.1.2.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.1.3.tgz"
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-jsonrpc@>=3.2.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.2.0.tgz"
|
||||
"version": "3.3.1",
|
||||
"from": "vscode-jsonrpc@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.3.1.tgz"
|
||||
},
|
||||
"vscode-languageserver": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-languageserver@3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.2.0.tgz"
|
||||
"version": "3.4.0-next.4",
|
||||
"from": "vscode-languageserver@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.4.0-next.4.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-languageserver-types@>=3.2.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.2.0.tgz"
|
||||
"version": "3.3.0",
|
||||
"from": "vscode-languageserver-types@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
"from": "vscode-nls@>=2.0.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "1.0.1",
|
||||
"from": "vscode-uri@>=1.0.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "^2.1.2",
|
||||
"vscode-languageserver": "^3.2.0"
|
||||
"vscode-css-languageservice": "^2.1.3",
|
||||
"vscode-languageserver": "3.4.0-next.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51"
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
createConnection, IConnection, Range,
|
||||
TextDocuments, TextDocument, InitializeParams, InitializeResult, RequestType
|
||||
} from 'vscode-languageserver';
|
||||
import { GetConfigurationRequest } from 'vscode-languageserver/lib/protocol.proposed';
|
||||
|
||||
import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService, LanguageSettings, LanguageService, Stylesheet } from 'vscode-css-languageservice';
|
||||
import { getLanguageModelCache } from './languageModelCache';
|
||||
|
@ -43,10 +44,20 @@ connection.onShutdown(() => {
|
|||
stylesheets.dispose();
|
||||
});
|
||||
|
||||
let scopedSettingsSupport = false;
|
||||
// After the server has started the client sends an initilize request. The server receives
|
||||
// in the passed params the rootPath of the workspace plus the client capabilities.
|
||||
connection.onInitialize((params: InitializeParams): InitializeResult => {
|
||||
let snippetSupport = params.capabilities && params.capabilities.textDocument && params.capabilities.textDocument.completion && params.capabilities.textDocument.completion.completionItem && params.capabilities.textDocument.completion.completionItem.snippetSupport;
|
||||
function hasClientCapability(name: string) {
|
||||
let keys = name.split('.');
|
||||
let c = params.capabilities;
|
||||
for (let i = 0; c && i < keys.length; i++) {
|
||||
c = c[keys[i]];
|
||||
}
|
||||
return !!c;
|
||||
}
|
||||
let snippetSupport = hasClientCapability('textDocument.completion.completionItem.snippetSupport');
|
||||
scopedSettingsSupport = hasClientCapability('workspace.configuration');
|
||||
return {
|
||||
capabilities: {
|
||||
// Tell the client that the server works in FULL text document sync mode
|
||||
|
@ -78,6 +89,20 @@ function getLanguageService(document: TextDocument) {
|
|||
return service;
|
||||
}
|
||||
|
||||
let documentSettings: { [key: string]: Thenable<LanguageSettings> } = {};
|
||||
function getDocumentSettings(textDocument: TextDocument): Thenable<LanguageSettings> {
|
||||
if (scopedSettingsSupport) {
|
||||
let promise = documentSettings[textDocument.uri];
|
||||
if (!promise) {
|
||||
let configRequestParam = { items: [{ scopeUri: textDocument.uri, section: textDocument.languageId }] };
|
||||
promise = connection.sendRequest(GetConfigurationRequest.type, configRequestParam).then(s => s[0]);
|
||||
documentSettings[textDocument.uri] = promise;
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
|
||||
// The settings have changed. Is send on server activation as well.
|
||||
connection.onDidChangeConfiguration(change => {
|
||||
updateConfiguration(<Settings>change.settings);
|
||||
|
@ -87,6 +112,8 @@ function updateConfiguration(settings: Settings) {
|
|||
for (let languageId in languageServices) {
|
||||
languageServices[languageId].configure(settings[languageId]);
|
||||
}
|
||||
// reset all document settings
|
||||
documentSettings = {};
|
||||
// Revalidate any open text documents
|
||||
documents.all().forEach(triggerValidation);
|
||||
}
|
||||
|
@ -123,10 +150,13 @@ function triggerValidation(textDocument: TextDocument): void {
|
|||
}
|
||||
|
||||
function validateTextDocument(textDocument: TextDocument): void {
|
||||
let settingsPromise = getDocumentSettings(textDocument);
|
||||
let stylesheet = stylesheets.get(textDocument);
|
||||
let diagnostics = getLanguageService(textDocument).doValidation(textDocument, stylesheet);
|
||||
// Send the computed diagnostics to VSCode.
|
||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
||||
settingsPromise.then(settings => {
|
||||
let diagnostics = getLanguageService(textDocument).doValidation(textDocument, stylesheet, settings);
|
||||
// Send the computed diagnostics to VSCode.
|
||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
||||
});
|
||||
}
|
||||
|
||||
connection.onCompletion(textDocumentPosition => {
|
||||
|
|
10
extensions/emmet/npm-shrinkwrap.json
generated
10
extensions/emmet/npm-shrinkwrap.json
generated
|
@ -4,8 +4,8 @@
|
|||
"dependencies": {
|
||||
"@emmetio/css-parser": {
|
||||
"version": "0.4.0",
|
||||
"from": "@emmetio/css-parser@>=0.4.0 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@emmetio/css-parser/-/css-parser-0.4.0.tgz"
|
||||
"from": "ramya-rao-a/css-parser#vscode",
|
||||
"resolved": "git://github.com/ramya-rao-a/css-parser.git#370c480ac103bd17c7bcfb34bf5d577dc40d3660"
|
||||
},
|
||||
"@emmetio/extract-abbreviation": {
|
||||
"version": "0.1.3",
|
||||
|
@ -38,9 +38,9 @@
|
|||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz"
|
||||
},
|
||||
"vscode-emmet-helper": {
|
||||
"version": "1.0.16",
|
||||
"from": "vscode-emmet-helper@>=1.0.16 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.0.16.tgz"
|
||||
"version": "1.0.17",
|
||||
"from": "vscode-emmet-helper@>=1.0.17 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.0.17.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.3.0",
|
||||
|
|
|
@ -210,9 +210,9 @@
|
|||
"dependencies": {
|
||||
|
||||
"@emmetio/html-matcher": "^0.3.1",
|
||||
"@emmetio/css-parser": "^0.4.0",
|
||||
"@emmetio/css-parser": "ramya-rao-a/css-parser#vscode",
|
||||
"@emmetio/math-expression": "^0.1.1",
|
||||
"vscode-emmet-helper": "^1.0.16",
|
||||
"vscode-emmet-helper": "^1.0.17",
|
||||
"vscode-languageserver-types": "^3.0.3",
|
||||
"image-size": "^0.5.2",
|
||||
"vscode-nls": "2.0.2"
|
||||
|
|
|
@ -95,10 +95,7 @@ export function expandEmmetAbbreviation(args): Thenable<boolean> {
|
|||
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
||||
let rootNode = parseDocument(editor.document);
|
||||
if (!rootNode) {
|
||||
return fallbackTab();
|
||||
}
|
||||
let rootNode = parseDocument(editor.document, false);
|
||||
|
||||
// When tabbed on a non empty selection, do not treat it as an emmet abbreviation, and fallback to tab instead
|
||||
if (vscode.workspace.getConfiguration('emmet')['triggerExpansionOnTab'] === true && editor.selections.find(x => !x.isEmpty)) {
|
||||
|
@ -192,21 +189,31 @@ export function isValidLocationForEmmetAbbreviation(currentNode: Node, syntax: s
|
|||
}
|
||||
|
||||
if (isStyleSheet(syntax)) {
|
||||
if (currentNode.type !== 'rule') {
|
||||
|
||||
// If current node is a rule or at-rule, then perform additional checks to ensure
|
||||
// emmet suggestions are not provided in the rule selector
|
||||
if (currentNode.type !== 'rule' && currentNode.type !== 'at-rule') {
|
||||
return true;
|
||||
}
|
||||
|
||||
const currentCssNode = <Rule>currentNode;
|
||||
|
||||
// Workaround for https://github.com/Microsoft/vscode/30188
|
||||
if (currentCssNode.parent
|
||||
&& currentCssNode.parent.type === 'rule'
|
||||
&& currentCssNode.selectorToken
|
||||
&& currentCssNode.selectorToken.start.line !== currentCssNode.selectorToken.end.line) {
|
||||
// Position is valid if it occurs after the `{` that marks beginning of rule contents
|
||||
if (position.isAfter(currentCssNode.contentStartToken.end)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Position is valid if it occurs after the `{` that marks beginning of rule contents
|
||||
return currentCssNode.selectorToken && position.isAfter(currentCssNode.selectorToken.end);
|
||||
// Workaround for https://github.com/Microsoft/vscode/30188
|
||||
// The line above the rule selector is considered as part of the selector by the css-parser
|
||||
// But we should assume it is a valid location for css properties under the parent rule
|
||||
if (currentCssNode.parent
|
||||
&& (currentCssNode.parent.type === 'rule' || currentCssNode.parent.type === 'at-rule')
|
||||
&& currentCssNode.selectorToken
|
||||
&& position.line !== currentCssNode.selectorToken.end.line) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const currentHtmlNode = <HtmlNode>currentNode;
|
||||
|
|
|
@ -72,9 +72,13 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
|
|||
const currentHtmlNode = <HtmlNode>currentNode;
|
||||
if (currentHtmlNode
|
||||
&& currentHtmlNode.close
|
||||
&& currentHtmlNode.name === 'style'
|
||||
&& getInnerRange(currentHtmlNode).contains(position)) {
|
||||
return 'css';
|
||||
if (currentHtmlNode.name === 'style') {
|
||||
return 'css';
|
||||
}
|
||||
if (currentHtmlNode.name === 'script') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,25 @@ const cssContents = `
|
|||
}
|
||||
`;
|
||||
|
||||
const scssContents = `
|
||||
.boo {
|
||||
margin: 10px;
|
||||
p10
|
||||
.hoo {
|
||||
p20
|
||||
}
|
||||
}
|
||||
@include b(alert) {
|
||||
|
||||
margin: 10px;
|
||||
p30
|
||||
|
||||
@include b(alert) {
|
||||
p40
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const bemFilterExample = 'ul.search-form._wide>li.-querystring+li.-btn_large|bem';
|
||||
const expectedBemFilterOutput = `<ul class="search-form search-form_wide">
|
||||
<li class="search-form__querystring"></li>
|
||||
|
@ -169,9 +188,10 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('Expand using bem filter', () => {
|
||||
return testHtmlExpandAbbreviation(new Selection(16, 55, 16, 55), bemFilterExample, expectedBemFilterOutput);
|
||||
});
|
||||
// TODO@Ramya test failing on our build machines on macOS
|
||||
// test('Expand using bem filter', () => {
|
||||
// return testHtmlExpandAbbreviation(new Selection(16, 55, 16, 55), bemFilterExample, expectedBemFilterOutput);
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
|
@ -186,7 +206,21 @@ suite('Tests for Expand Abbreviations (CSS)', () => {
|
|||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('Expand abbreviation (SCSS)', () => {
|
||||
return withRandomFileEditor(scssContents, 'scss', (editor, doc) => {
|
||||
editor.selections = [
|
||||
new Selection(3, 4, 3, 4),
|
||||
new Selection(5, 5, 5, 5),
|
||||
new Selection(11, 4, 11, 4),
|
||||
new Selection(14, 5, 14, 5)
|
||||
];
|
||||
return expandEmmetAbbreviation(null).then(() => {
|
||||
assert.equal(editor.document.getText(), scssContents.replace(/p(\d\d)/g, 'padding: $1px;'));
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -196,8 +230,8 @@ suite('Tests for Wrap with Abbreviations', () => {
|
|||
const multiCursors = [new Selection(2, 6, 2, 6), new Selection(3, 6, 3, 6)];
|
||||
const multiCursorsWithSelection = [new Selection(2, 2, 2, 28), new Selection(3, 2, 3, 33)];
|
||||
const multiCursorsWithFullLineSelection = [new Selection(2, 0, 2, 28), new Selection(3, 0, 3, 33)];
|
||||
|
||||
|
||||
|
||||
|
||||
test('Wrap with block element using multi cursor', () => {
|
||||
return testWrapWithAbbreviation(multiCursors, 'div', wrapBlockElementExpected);
|
||||
});
|
||||
|
@ -247,13 +281,13 @@ suite('Tests for Wrap with Abbreviations', () => {
|
|||
});
|
||||
|
||||
test('Wrap individual lines with abbreviation', () => {
|
||||
const contents = `
|
||||
const contents = `
|
||||
<ul class="nav main">
|
||||
<li class="item1">img</li>
|
||||
<li class="item2">hithere</li>
|
||||
</ul>
|
||||
`;
|
||||
const wrapIndividualLinesExpected = `
|
||||
const wrapIndividualLinesExpected = `
|
||||
<ul class="nav main">
|
||||
<ul>
|
||||
<li class="hello1"><li class="item1">img</li></li>
|
||||
|
@ -285,14 +319,14 @@ suite('Tests for Wrap with Abbreviations', () => {
|
|||
</ul>
|
||||
</ul>
|
||||
`;
|
||||
return withRandomFileEditor(contents, 'html', (editor, doc) => {
|
||||
editor.selections = [new Selection(2, 3, 3, 16)];
|
||||
return wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*|t' }).then(() => {
|
||||
assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
|
||||
return Promise.resolve();
|
||||
});
|
||||
return withRandomFileEditor(contents, 'html', (editor, doc) => {
|
||||
editor.selections = [new Selection(2, 3, 3, 16)];
|
||||
return wrapIndividualLinesWithAbbreviation({ abbreviation: 'ul>li.hello$*|t' }).then(() => {
|
||||
assert.equal(editor.document.getText(), wrapIndividualLinesExpected);
|
||||
return Promise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export const LANGUAGE_MODES: Object = {
|
|||
'slim': ['!', '.', '}', ':', '*', '$'],
|
||||
'haml': ['!', '.', '}', ':', '*', '$'],
|
||||
'xml': ['.', '}', '*', '$'],
|
||||
'xsl': ['.', '}', '*', '$'],
|
||||
'xsl': ['!', '.', '}', '*', '$'],
|
||||
'css': [':'],
|
||||
'scss': [':'],
|
||||
'sass': [':'],
|
||||
|
@ -83,6 +83,10 @@ export function parseDocument(document: vscode.TextDocument, showError: boolean
|
|||
* @param includeNodeBoundary
|
||||
*/
|
||||
export function getNode(root: Node, position: vscode.Position, includeNodeBoundary: boolean = false) {
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let currentNode = root.firstChild;
|
||||
let foundNode: Node = null;
|
||||
|
||||
|
|
|
@ -771,16 +771,6 @@
|
|||
"type": "boolean",
|
||||
"description": "%config.enableCommitSigning%",
|
||||
"default": false
|
||||
},
|
||||
"git.discardAllScope": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"all",
|
||||
"tracked",
|
||||
"prompt"
|
||||
],
|
||||
"description": "%config.discardAllScope%",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { Uri, commands, scm, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn } from 'vscode';
|
||||
import { Uri, commands, scm, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation } from 'vscode';
|
||||
import { Ref, RefType, Git, GitErrorCodes, Branch } from './git';
|
||||
import { Model, Resource, Status, CommitOptions, WorkingTreeGroup, IndexGroup, MergeGroup } from './model';
|
||||
import { toGitUri, fromGitUri } from './uri';
|
||||
|
@ -153,10 +153,10 @@ export class CommandCenter {
|
|||
|
||||
@command('git.openResource')
|
||||
async openResource(resource: Resource): Promise<void> {
|
||||
await this._openResource(resource);
|
||||
await this._openResource(resource, undefined, true);
|
||||
}
|
||||
|
||||
private async _openResource(resource: Resource, preview?: boolean): Promise<void> {
|
||||
private async _openResource(resource: Resource, preview?: boolean, preserveFocus?: boolean): Promise<void> {
|
||||
const left = this.getLeftResource(resource);
|
||||
const right = this.getRightResource(resource);
|
||||
const title = this.getTitle(resource);
|
||||
|
@ -168,8 +168,8 @@ export class CommandCenter {
|
|||
}
|
||||
|
||||
const opts: TextDocumentShowOptions = {
|
||||
preserveFocus: true,
|
||||
preview: preview,
|
||||
preserveFocus,
|
||||
preview,
|
||||
viewColumn: window.activeTextEditor && window.activeTextEditor.viewColumn || ViewColumn.One
|
||||
};
|
||||
|
||||
|
@ -278,9 +278,12 @@ export class CommandCenter {
|
|||
}
|
||||
|
||||
const clonePromise = this.git.clone(url, parentPath);
|
||||
window.setStatusBarMessage(localize('cloning', "Cloning git repository..."), clonePromise);
|
||||
|
||||
|
||||
try {
|
||||
window.withProgress({ location: ProgressLocation.SourceControl, title: localize('cloning', "Cloning git repository...") }, () => clonePromise);
|
||||
window.withProgress({ location: ProgressLocation.Window, title: localize('cloning', "Cloning git repository...") }, () => clonePromise);
|
||||
|
||||
const repositoryPath = await clonePromise;
|
||||
|
||||
const open = localize('openrepo', "Open Repository");
|
||||
|
@ -308,6 +311,8 @@ export class CommandCenter {
|
|||
|
||||
@command('git.openFile')
|
||||
async openFile(arg?: Resource | Uri, ...resourceStates: SourceControlResourceState[]): Promise<void> {
|
||||
const preserveFocus = !!arg;
|
||||
|
||||
let uris: Uri[] | undefined;
|
||||
|
||||
if (arg instanceof Uri) {
|
||||
|
@ -342,7 +347,7 @@ export class CommandCenter {
|
|||
: undefined;
|
||||
|
||||
const opts: TextDocumentShowOptions = {
|
||||
preserveFocus: true,
|
||||
preserveFocus,
|
||||
preview: preview,
|
||||
viewColumn: activeTextEditor && activeTextEditor.viewColumn || ViewColumn.One
|
||||
};
|
||||
|
@ -384,6 +389,7 @@ export class CommandCenter {
|
|||
|
||||
@command('git.openChange')
|
||||
async openChange(arg?: Resource | Uri, ...resourceStates: SourceControlResourceState[]): Promise<void> {
|
||||
const preserveFocus = !!arg;
|
||||
let resources: Resource[] | undefined = undefined;
|
||||
|
||||
if (arg instanceof Uri) {
|
||||
|
@ -412,7 +418,7 @@ export class CommandCenter {
|
|||
|
||||
const preview = resources.length === 1 ? undefined : false;
|
||||
for (const resource of resources) {
|
||||
await this._openResource(resource, preview);
|
||||
await this._openResource(resource, preview, preserveFocus);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,54 +639,73 @@ export class CommandCenter {
|
|||
|
||||
@command('git.cleanAll')
|
||||
async cleanAll(): Promise<void> {
|
||||
const config = workspace.getConfiguration('git');
|
||||
let scope = config.get<string>('discardAllScope') || 'prompt';
|
||||
let resources = this.model.workingTreeGroup.resources;
|
||||
|
||||
if (resources.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const untrackedCount = resources.reduce((s, r) => s + (r.type === Status.UNTRACKED ? 1 : 0), 0);
|
||||
const trackedResources = resources.filter(r => r.type !== Status.UNTRACKED && r.type !== Status.IGNORED);
|
||||
const untrackedResources = resources.filter(r => r.type === Status.UNTRACKED || r.type === Status.IGNORED);
|
||||
|
||||
if (scope === 'prompt' && untrackedCount > 0) {
|
||||
const message = localize('there are untracked files', "There are untracked files ({0}) which will be DELETED if discarded.\n\nWould you like to delete untracked files when discarding all changes?", untrackedCount);
|
||||
const yes = localize('yes', "Yes");
|
||||
const always = localize('always', "Always");
|
||||
const no = localize('no', "No");
|
||||
const never = localize('never', "Never");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, no, never);
|
||||
if (untrackedResources.length === 0) {
|
||||
const message = resources.length === 1
|
||||
? localize('confirm discard all single', "Are you sure you want to discard changes in {0}?", path.basename(resources[0].resourceUri.fsPath))
|
||||
: localize('confirm discard all', "Are you sure you want to discard ALL changes in {0} files?\nThis is IRREVERSIBLE!\nYour current working set will be FOREVER LOST.", resources.length);
|
||||
const yes = resources.length === 1
|
||||
? localize('discardAll multiple', "Discard 1 File")
|
||||
: localize('discardAll', "Discard All {0} Files", resources.length);
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes);
|
||||
|
||||
if (typeof pick === 'undefined') {
|
||||
if (pick !== yes) {
|
||||
return;
|
||||
} else if (pick === always) {
|
||||
await config.update('discardAllScope', 'all', true);
|
||||
} else if (pick === never) {
|
||||
await config.update('discardAllScope', 'tracked', true);
|
||||
}
|
||||
|
||||
if (pick === never || pick === no) {
|
||||
scope = 'tracked';
|
||||
await this.model.clean(...resources);
|
||||
return;
|
||||
} else if (resources.length === 1) {
|
||||
const message = localize('confirm delete', "Are you sure you want to DELETE {0}?", path.basename(resources[0].resourceUri.fsPath));
|
||||
const yes = localize('delete file', "Delete file");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes);
|
||||
|
||||
if (pick !== yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.model.clean(...resources);
|
||||
} else if (trackedResources.length === 0) {
|
||||
const message = localize('confirm delete multiple', "Are you sure you want to DELETE {0} files?", resources.length);
|
||||
const yes = localize('delete files', "Delete Files");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes);
|
||||
|
||||
if (pick !== yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.model.clean(...resources);
|
||||
|
||||
} else { // resources.length > 1 && untrackedResources.length > 0 && trackedResources.length > 0
|
||||
const untrackedMessage = untrackedResources.length === 1
|
||||
? localize('there are untracked files single', "The following untracked file will be DELETED FROM DISK if discarded: {0}.", path.basename(untrackedResources[0].resourceUri.fsPath))
|
||||
: localize('there are untracked files', "There are {0} untracked files which will be DELETED FROM DISK if discarded.", untrackedResources.length);
|
||||
|
||||
const message = localize('confirm discard all 2', "{0}\n\nThis is IRREVERSIBLE, your current working set will be FOREVER LOST.", untrackedMessage, resources.length);
|
||||
|
||||
const yesTracked = trackedResources.length === 1
|
||||
? localize('yes discard tracked', "Discard 1 Tracked File", trackedResources.length)
|
||||
: localize('yes discard tracked multiple', "Discard {0} Tracked Files", trackedResources.length);
|
||||
|
||||
const yesAll = localize('discardAll', "Discard All {0} Files", resources.length);
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yesTracked, yesAll);
|
||||
|
||||
if (pick === yesTracked) {
|
||||
resources = trackedResources;
|
||||
} else if (pick !== yesAll) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.model.clean(...resources);
|
||||
}
|
||||
|
||||
if (scope === 'tracked') {
|
||||
resources = resources.filter(r => r.type !== Status.UNTRACKED && r.type !== Status.IGNORED);
|
||||
}
|
||||
|
||||
if (resources.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = localize('confirm discard all', "Are you sure you want to discard ALL ({0}) changes?\nThis is IRREVERSIBLE!\nYour current working set will be FOREVER LOST.", resources.length);
|
||||
const yes = localize('discardAll', "Discard ALL Changes");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes);
|
||||
|
||||
if (pick !== yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.model.clean(...resources);
|
||||
}
|
||||
|
||||
private async smartCommit(
|
||||
|
|
|
@ -119,6 +119,28 @@ export class Resource implements SourceControlResourceState {
|
|||
}
|
||||
}
|
||||
|
||||
private get tooltip(): string {
|
||||
switch (this.type) {
|
||||
case Status.INDEX_MODIFIED: return localize('index modified', "Index Modified");
|
||||
case Status.MODIFIED: return localize('modified', "Modified");
|
||||
case Status.INDEX_ADDED: return localize('index added', "Index Added");
|
||||
case Status.INDEX_DELETED: return localize('index deleted', "Index Deleted");
|
||||
case Status.DELETED: return localize('deleted', "Deleted");
|
||||
case Status.INDEX_RENAMED: return localize('index renamed', "Index Renamed");
|
||||
case Status.INDEX_COPIED: return localize('index copied', "Index Copied");
|
||||
case Status.UNTRACKED: return localize('untracked', "Untracked");
|
||||
case Status.IGNORED: return localize('ignored', "Ignored");
|
||||
case Status.BOTH_DELETED: return localize('both deleted', "Both Deleted");
|
||||
case Status.ADDED_BY_US: return localize('added by us', "Added By Us");
|
||||
case Status.DELETED_BY_THEM: return localize('deleted by them', "Deleted By Them");
|
||||
case Status.ADDED_BY_THEM: return localize('added by them', "Added By Them");
|
||||
case Status.DELETED_BY_US: return localize('deleted by us', "Deleted By Us");
|
||||
case Status.BOTH_ADDED: return localize('both added', "Both Added");
|
||||
case Status.BOTH_MODIFIED: return localize('both modified', "Both Modified");
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
private get strikeThrough(): boolean {
|
||||
switch (this.type) {
|
||||
case Status.DELETED:
|
||||
|
@ -141,10 +163,11 @@ export class Resource implements SourceControlResourceState {
|
|||
get decorations(): SourceControlResourceDecorations {
|
||||
const light = { iconPath: this.getIconPath('light') };
|
||||
const dark = { iconPath: this.getIconPath('dark') };
|
||||
const tooltip = this.tooltip;
|
||||
const strikeThrough = this.strikeThrough;
|
||||
const faded = this.faded;
|
||||
|
||||
return { strikeThrough, faded, light, dark };
|
||||
return { strikeThrough, faded, tooltip, light, dark };
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -12,6 +12,8 @@ import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
|
|||
import { activateColorDecorations } from './colorDecorators';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
|
||||
import { ConfigurationFeature } from 'vscode-languageclient/lib/proposed';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
let localize = nls.loadMessageBundle();
|
||||
|
||||
|
@ -34,7 +36,7 @@ export function activate(context: ExtensionContext) {
|
|||
// The server is implemented in node
|
||||
let serverModule = context.asAbsolutePath(path.join('server', 'out', 'htmlServerMain.js'));
|
||||
// The debug options for the server
|
||||
let debugOptions = { execArgv: ['--nolazy', '--debug=6004'] };
|
||||
let debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] };
|
||||
|
||||
// If the extension is launch in debug mode the debug server options are use
|
||||
// Otherwise the run options are used
|
||||
|
@ -59,6 +61,8 @@ export function activate(context: ExtensionContext) {
|
|||
|
||||
// Create the language client and start the client.
|
||||
let client = new LanguageClient('html', localize('htmlserver.name', 'HTML Language Server'), serverOptions, clientOptions);
|
||||
client.registerFeature(new ConfigurationFeature(client));
|
||||
|
||||
let disposable = client.start();
|
||||
context.subscriptions.push(disposable);
|
||||
client.onReady().then(() => {
|
||||
|
|
20
extensions/html/npm-shrinkwrap.json
generated
20
extensions/html/npm-shrinkwrap.json
generated
|
@ -8,24 +8,24 @@
|
|||
"resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz"
|
||||
},
|
||||
"vscode-extension-telemetry": {
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.8",
|
||||
"from": "vscode-extension-telemetry@>=0.0.8 <0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.8.tgz"
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "3.1.0-alpha.1",
|
||||
"from": "vscode-jsonrpc@>=3.1.0-alpha.1 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.1.0-alpha.1.tgz"
|
||||
"version": "3.3.1",
|
||||
"from": "vscode-jsonrpc@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.3.1.tgz"
|
||||
},
|
||||
"vscode-languageclient": {
|
||||
"version": "3.1.0-alpha.1",
|
||||
"version": "3.4.0-next.10",
|
||||
"from": "vscode-languageclient@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.1.0-alpha.1.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.4.0-next.10.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.0.3",
|
||||
"from": "vscode-languageserver-types@>=3.0.2-beta.5 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.3.tgz"
|
||||
"version": "3.3.0",
|
||||
"from": "vscode-languageserver-types@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
|
@ -38,4 +38,4 @@
|
|||
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.3.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,11 +75,13 @@
|
|||
"properties": {
|
||||
"html.format.enable": {
|
||||
"type": "boolean",
|
||||
"scope": "window",
|
||||
"default": true,
|
||||
"description": "%html.format.enable.desc%"
|
||||
},
|
||||
"html.format.wrapLineLength": {
|
||||
"type": "integer",
|
||||
"scope": "resource",
|
||||
"default": 120,
|
||||
"description": "%html.format.wrapLineLength.desc%"
|
||||
},
|
||||
|
@ -88,6 +90,7 @@
|
|||
"string",
|
||||
"null"
|
||||
],
|
||||
"scope": "resource",
|
||||
"default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var",
|
||||
"description": "%html.format.unformatted.desc%"
|
||||
},
|
||||
|
@ -96,16 +99,19 @@
|
|||
"string",
|
||||
"null"
|
||||
],
|
||||
"scope": "resource",
|
||||
"default": "pre",
|
||||
"description": "%html.format.contentUnformatted.desc%"
|
||||
},
|
||||
"html.format.indentInnerHtml": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": false,
|
||||
"description": "%html.format.indentInnerHtml.desc%"
|
||||
},
|
||||
"html.format.preserveNewLines": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.format.preserveNewLines.desc%"
|
||||
},
|
||||
|
@ -114,16 +120,19 @@
|
|||
"number",
|
||||
"null"
|
||||
],
|
||||
"scope": "resource",
|
||||
"default": null,
|
||||
"description": "%html.format.maxPreserveNewLines.desc%"
|
||||
},
|
||||
"html.format.indentHandlebars": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": false,
|
||||
"description": "%html.format.indentHandlebars.desc%"
|
||||
},
|
||||
"html.format.endWithNewline": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": false,
|
||||
"description": "%html.format.endWithNewline.desc%"
|
||||
},
|
||||
|
@ -132,11 +141,13 @@
|
|||
"string",
|
||||
"null"
|
||||
],
|
||||
"scope": "resource",
|
||||
"default": "head, body, /html",
|
||||
"description": "%html.format.extraLiners.desc%"
|
||||
},
|
||||
"html.format.wrapAttributes": {
|
||||
"type": "string",
|
||||
"scope": "resource",
|
||||
"default": "auto",
|
||||
"enum": [
|
||||
"auto",
|
||||
|
@ -154,31 +165,37 @@
|
|||
},
|
||||
"html.suggest.angular1": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.suggest.angular1.desc%"
|
||||
},
|
||||
"html.suggest.ionic": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.suggest.ionic.desc%"
|
||||
},
|
||||
"html.suggest.html5": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.suggest.html5.desc%"
|
||||
},
|
||||
"html.validate.scripts": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.validate.scripts%"
|
||||
},
|
||||
"html.validate.styles": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"default": true,
|
||||
"description": "%html.validate.styles%"
|
||||
},
|
||||
"html.trace.server": {
|
||||
"type": "string",
|
||||
"scope": "window",
|
||||
"enum": [
|
||||
"off",
|
||||
"messages",
|
||||
|
@ -192,12 +209,12 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"vscode-extension-telemetry": "0.0.8",
|
||||
"vscode-languageclient": "3.1.0-alpha.1",
|
||||
"vscode-languageserver-types": "3.0.3",
|
||||
"vscode-languageclient": "3.4.0-next.10",
|
||||
"vscode-languageserver-types": "^3.3.0",
|
||||
"vscode-nls": "2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51",
|
||||
"@types/mocha": "^2.2.33"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
extensions/html/server/npm-shrinkwrap.json
generated
33
extensions/html/server/npm-shrinkwrap.json
generated
|
@ -3,16 +3,9 @@
|
|||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": {
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.3",
|
||||
"from": "vscode-css-languageservice@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.1.0.tgz",
|
||||
"dependencies": {
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.2.0",
|
||||
"from": "vscode-languageserver-types@>=3.2.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.2.0.tgz"
|
||||
}
|
||||
}
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.1.3.tgz"
|
||||
},
|
||||
"vscode-html-languageservice": {
|
||||
"version": "2.0.5",
|
||||
|
@ -20,19 +13,19 @@
|
|||
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-2.0.5.tgz"
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "3.1.0-alpha.1",
|
||||
"from": "vscode-jsonrpc@>=3.1.0-alpha.1 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.1.0-alpha.1.tgz"
|
||||
"version": "3.3.1",
|
||||
"from": "vscode-jsonrpc@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.3.1.tgz"
|
||||
},
|
||||
"vscode-languageserver": {
|
||||
"version": "3.1.0-alpha.1",
|
||||
"version": "3.4.0-next.4",
|
||||
"from": "vscode-languageserver@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.1.0-alpha.1.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.4.0-next.4.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.0.3",
|
||||
"from": "vscode-languageserver-types@>=3.0.3 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.3.tgz"
|
||||
"version": "3.3.0",
|
||||
"from": "vscode-languageserver-types@>=3.3.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "2.0.2",
|
||||
|
@ -40,9 +33,9 @@
|
|||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "1.0.0",
|
||||
"from": "vscode-uri@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.0.tgz"
|
||||
"version": "1.0.1",
|
||||
"from": "vscode-uri@latest",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "^2.1.0",
|
||||
"vscode-css-languageservice": "^2.1.3",
|
||||
"vscode-html-languageservice": "^2.0.5",
|
||||
"vscode-languageserver": "^3.1.0-alpha.1",
|
||||
"vscode-languageserver": "3.4.0-next.4",
|
||||
"vscode-languageserver-types": "^3.3.0",
|
||||
"vscode-nls": "^2.0.2",
|
||||
"vscode-uri": "^1.0.0"
|
||||
"vscode-uri": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51",
|
||||
|
@ -25,6 +26,6 @@
|
|||
"install-service-local": "npm install ../../../../vscode-css-languageservice -f -S && npm install ../../../../vscode-html-languageservice -f -S",
|
||||
"install-server-next": "npm install vscode-languageserver@next -f -S",
|
||||
"install-server-local": "npm install ../../../../vscode-languageserver-node/server -f -S",
|
||||
"test": "mocha"
|
||||
"test": "../../../node_modules/.bin/mocha"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, RequestType, DocumentRangeFormattingRequest, Disposable, DocumentSelector } from 'vscode-languageserver';
|
||||
import { createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, RequestType, DocumentRangeFormattingRequest, Disposable, DocumentSelector, GetConfigurationParams } from 'vscode-languageserver';
|
||||
import { DocumentContext } from 'vscode-html-languageservice';
|
||||
import { TextDocument, Diagnostic, DocumentLink, Range, SymbolInformation } from 'vscode-languageserver-types';
|
||||
import { getLanguageModes, LanguageModes } from './modes/languageModes';
|
||||
import { getLanguageModes, LanguageModes, Settings } from './modes/languageModes';
|
||||
|
||||
import { GetConfigurationRequest } from 'vscode-languageserver/lib/protocol.proposed';
|
||||
|
||||
import { format } from './modes/formatting';
|
||||
import { pushAll } from './utils/arrays';
|
||||
|
@ -38,10 +40,27 @@ documents.listen(connection);
|
|||
|
||||
let workspacePath: string;
|
||||
var languageModes: LanguageModes;
|
||||
var settings: any = {};
|
||||
|
||||
let clientSnippetSupport = false;
|
||||
let clientDynamicRegisterSupport = false;
|
||||
let scopedSettingsSupport = false;
|
||||
|
||||
var globalSettings: Settings = {};
|
||||
let documentSettings: { [key: string]: Thenable<Settings> } = {};
|
||||
|
||||
function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings: () => boolean): Thenable<Settings> {
|
||||
if (scopedSettingsSupport && needsDocumentSettings()) {
|
||||
let promise = documentSettings[textDocument.uri];
|
||||
if (!promise) {
|
||||
let scopeUri = textDocument.uri;
|
||||
let configRequestParam: GetConfigurationParams = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
|
||||
promise = connection.sendRequest(GetConfigurationRequest.type, configRequestParam).then(s => ({ css: s[0], html: s[1], javascript: s[2] }));
|
||||
documentSettings[textDocument.uri] = promise;
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
return Promise.resolve(void 0);
|
||||
}
|
||||
|
||||
// After the server has started the client sends an initilize request. The server receives
|
||||
// in the passed params the rootPath of the workspace plus the client capabilites
|
||||
|
@ -68,6 +87,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
|||
|
||||
clientSnippetSupport = hasClientCapability('textDocument', 'completion', 'completionItem', 'snippetSupport');
|
||||
clientDynamicRegisterSupport = hasClientCapability('workspace', 'symbol', 'dynamicRegistration');
|
||||
scopedSettingsSupport = hasClientCapability('workspace', 'configuration');
|
||||
return {
|
||||
capabilities: {
|
||||
// Tell the client that the server works in FULL text document sync mode
|
||||
|
@ -85,21 +105,13 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
|||
};
|
||||
});
|
||||
|
||||
let validation = {
|
||||
html: true,
|
||||
css: true,
|
||||
javascript: true
|
||||
};
|
||||
|
||||
let formatterRegistration: Thenable<Disposable> = null;
|
||||
|
||||
// The settings have changed. Is send on server activation as well.
|
||||
connection.onDidChangeConfiguration((change) => {
|
||||
settings = change.settings;
|
||||
let validationSettings = settings && settings.html && settings.html.validate || {};
|
||||
validation.css = validationSettings.styles !== false;
|
||||
validation.javascript = validationSettings.scripts !== false;
|
||||
globalSettings = change.settings;
|
||||
|
||||
documentSettings = {}; // reset all document settings
|
||||
languageModes.getAllModes().forEach(m => {
|
||||
if (m.configure) {
|
||||
m.configure(change.settings);
|
||||
|
@ -109,7 +121,7 @@ connection.onDidChangeConfiguration((change) => {
|
|||
|
||||
// dynamically enable & disable the formatter
|
||||
if (clientDynamicRegisterSupport) {
|
||||
let enableFormatter = settings && settings.html && settings.html.format && settings.html.format.enable;
|
||||
let enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
|
||||
if (enableFormatter) {
|
||||
if (!formatterRegistration) {
|
||||
let documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
|
||||
|
@ -154,26 +166,37 @@ function triggerValidation(textDocument: TextDocument): void {
|
|||
}, validationDelayMs);
|
||||
}
|
||||
|
||||
function validateTextDocument(textDocument: TextDocument): void {
|
||||
function isValidationEnabled(languageId: string, settings: Settings = globalSettings) {
|
||||
let validationSettings = settings && settings.html && settings.html.validate;
|
||||
if (validationSettings) {
|
||||
return languageId === 'css' && validationSettings.styles !== false || languageId === 'javascript' && validationSettings.scripts !== false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function validateTextDocument(textDocument: TextDocument) {
|
||||
let diagnostics: Diagnostic[] = [];
|
||||
if (textDocument.languageId === 'html') {
|
||||
languageModes.getAllModesInDocument(textDocument).forEach(mode => {
|
||||
if (mode.doValidation && validation[mode.getId()]) {
|
||||
pushAll(diagnostics, mode.doValidation(textDocument));
|
||||
let modes = languageModes.getAllModesInDocument(textDocument);
|
||||
let settings = await getDocumentSettings(textDocument, () => modes.some(m => m.doValidation && m.doValidation.length > 1));
|
||||
modes.forEach(mode => {
|
||||
if (mode.doValidation && isValidationEnabled(mode.getId(), settings)) {
|
||||
pushAll(diagnostics, mode.doValidation(textDocument, settings));
|
||||
}
|
||||
});
|
||||
}
|
||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
||||
}
|
||||
|
||||
connection.onCompletion(textDocumentPosition => {
|
||||
connection.onCompletion(async textDocumentPosition => {
|
||||
let document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
let mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
|
||||
if (mode && mode.doComplete) {
|
||||
if (mode.getId() !== 'html') {
|
||||
connection.telemetry.logEvent({ key: 'html.embbedded.complete', value: { languageId: mode.getId() } });
|
||||
}
|
||||
return mode.doComplete(document, textDocumentPosition.position);
|
||||
let settings = await getDocumentSettings(document, () => mode.doComplete.length > 2);
|
||||
return mode.doComplete(document, textDocumentPosition.position, settings);
|
||||
}
|
||||
return { isIncomplete: true, items: [] };
|
||||
});
|
||||
|
@ -235,13 +258,16 @@ connection.onSignatureHelp(signatureHelpParms => {
|
|||
return null;
|
||||
});
|
||||
|
||||
connection.onDocumentRangeFormatting(formatParams => {
|
||||
connection.onDocumentRangeFormatting(async formatParams => {
|
||||
let document = documents.get(formatParams.textDocument.uri);
|
||||
|
||||
let settings = await getDocumentSettings(document, () => true);
|
||||
if (!settings) {
|
||||
settings = globalSettings;
|
||||
}
|
||||
let unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
|
||||
let enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };
|
||||
|
||||
return format(languageModes, document, formatParams.range, formatParams.options, enabledModes);
|
||||
return format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
|
||||
});
|
||||
|
||||
connection.onDocumentLinks(documentLinkParam => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache';
|
||||
import { TextDocument, Position } from 'vscode-languageserver-types';
|
||||
import { getCSSLanguageService, Stylesheet } from 'vscode-css-languageservice';
|
||||
import { LanguageMode } from './languageModes';
|
||||
import { LanguageMode, Settings } from './languageModes';
|
||||
import { HTMLDocumentRegions, CSS_STYLE_RULE } from './embeddedSupport';
|
||||
|
||||
export function getCSSMode(documentRegions: LanguageModelCache<HTMLDocumentRegions>): LanguageMode {
|
||||
|
@ -22,9 +22,9 @@ export function getCSSMode(documentRegions: LanguageModelCache<HTMLDocumentRegio
|
|||
configure(options: any) {
|
||||
cssLanguageService.configure(options && options.css);
|
||||
},
|
||||
doValidation(document: TextDocument) {
|
||||
doValidation(document: TextDocument, settings: Settings) {
|
||||
let embedded = embeddedCSSDocuments.get(document);
|
||||
return cssLanguageService.doValidation(embedded, cssStylesheets.get(embedded));
|
||||
return cssLanguageService.doValidation(embedded, cssStylesheets.get(embedded), settings && settings.css);
|
||||
},
|
||||
doComplete(document: TextDocument, position: Position) {
|
||||
let embedded = embeddedCSSDocuments.get(document);
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
import { applyEdits } from '../utils/edits';
|
||||
import { TextDocument, Range, TextEdit, FormattingOptions, Position } from 'vscode-languageserver-types';
|
||||
import { LanguageModes } from './languageModes';
|
||||
import { LanguageModes, Settings } from './languageModes';
|
||||
import { pushAll } from '../utils/arrays';
|
||||
import { isEOL } from '../utils/strings';
|
||||
|
||||
export function format(languageModes: LanguageModes, document: TextDocument, formatRange: Range, formattingOptions: FormattingOptions, enabledModes: { [mode: string]: boolean }) {
|
||||
export function format(languageModes: LanguageModes, document: TextDocument, formatRange: Range, formattingOptions: FormattingOptions, settings: Settings, enabledModes: { [mode: string]: boolean }) {
|
||||
let result: TextEdit[] = [];
|
||||
|
||||
let endPos = formatRange.end;
|
||||
|
@ -40,7 +40,7 @@ export function format(languageModes: LanguageModes, document: TextDocument, for
|
|||
while (i < allRanges.length && allRanges[i].mode.getId() !== 'html') {
|
||||
let range = allRanges[i];
|
||||
if (!range.attributeValue && range.mode.format) {
|
||||
let edits = range.mode.format(document, Range.create(startPos, range.end), formattingOptions);
|
||||
let edits = range.mode.format(document, Range.create(startPos, range.end), formattingOptions, settings);
|
||||
pushAll(result, edits);
|
||||
}
|
||||
startPos = range.end;
|
||||
|
@ -54,7 +54,7 @@ export function format(languageModes: LanguageModes, document: TextDocument, for
|
|||
|
||||
// perform a html format and apply changes to a new document
|
||||
let htmlMode = languageModes.getMode('html');
|
||||
let htmlEdits = htmlMode.format(document, formatRange, formattingOptions);
|
||||
let htmlEdits = htmlMode.format(document, formatRange, formattingOptions, settings);
|
||||
let htmlFormattedContent = applyEdits(document, htmlEdits);
|
||||
let newDocument = TextDocument.create(document.uri + '.tmp', document.languageId, document.version, htmlFormattedContent);
|
||||
try {
|
||||
|
@ -68,7 +68,7 @@ export function format(languageModes: LanguageModes, document: TextDocument, for
|
|||
for (let r of embeddedRanges) {
|
||||
let mode = r.mode;
|
||||
if (mode && mode.format && enabledModes[mode.getId()] && !r.attributeValue) {
|
||||
let edits = mode.format(newDocument, r, formattingOptions);
|
||||
let edits = mode.format(newDocument, r, formattingOptions, settings);
|
||||
for (let edit of edits) {
|
||||
embeddedEdits.push(edit);
|
||||
}
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
import { getLanguageModelCache } from '../languageModelCache';
|
||||
import { LanguageService as HTMLLanguageService, HTMLDocument, DocumentContext, FormattingOptions } from 'vscode-html-languageservice';
|
||||
import { TextDocument, Position, Range } from 'vscode-languageserver-types';
|
||||
import { LanguageMode } from './languageModes';
|
||||
import { LanguageMode, Settings } from './languageModes';
|
||||
|
||||
export function getHTMLMode(htmlLanguageService: HTMLLanguageService): LanguageMode {
|
||||
let settings: any = {};
|
||||
let globalSettings: Settings = {};
|
||||
let htmlDocuments = getLanguageModelCache<HTMLDocument>(10, 60, document => htmlLanguageService.parseHTMLDocument(document));
|
||||
return {
|
||||
getId() {
|
||||
return 'html';
|
||||
},
|
||||
configure(options: any) {
|
||||
settings = options && options.html;
|
||||
globalSettings = options;
|
||||
},
|
||||
doComplete(document: TextDocument, position: Position) {
|
||||
let options = settings && settings.suggest;
|
||||
doComplete(document: TextDocument, position: Position, settings: Settings = globalSettings) {
|
||||
let options = settings && settings.html && settings.html.suggest;
|
||||
return htmlLanguageService.doComplete(document, position, htmlDocuments.get(document), options);
|
||||
},
|
||||
doHover(document: TextDocument, position: Position) {
|
||||
|
@ -35,8 +35,8 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService): LanguageM
|
|||
findDocumentSymbols(document: TextDocument) {
|
||||
return htmlLanguageService.findDocumentSymbols(document, htmlDocuments.get(document));
|
||||
},
|
||||
format(document: TextDocument, range: Range, formatParams: FormattingOptions) {
|
||||
let formatSettings = settings && settings.format;
|
||||
format(document: TextDocument, range: Range, formatParams: FormattingOptions, settings: Settings = globalSettings) {
|
||||
let formatSettings = settings && settings.html && settings.html.format;
|
||||
if (!formatSettings) {
|
||||
formatSettings = formatParams;
|
||||
} else {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { LanguageModelCache, getLanguageModelCache } from '../languageModelCache';
|
||||
import { SymbolInformation, SymbolKind, CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation, Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover, MarkedString, DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions } from 'vscode-languageserver-types';
|
||||
import { LanguageMode } from './languageModes';
|
||||
import { LanguageMode, Settings } from './languageModes';
|
||||
import { getWordAtText, startsWith, isWhitespaceOnly, repeat } from '../utils/strings';
|
||||
import { HTMLDocumentRegions } from './embeddedSupport';
|
||||
|
||||
|
@ -60,14 +60,14 @@ export function getJavascriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
};
|
||||
let jsLanguageService = ts.createLanguageService(host);
|
||||
|
||||
let settings: any = {};
|
||||
let globalSettings: Settings = {};
|
||||
|
||||
return {
|
||||
getId() {
|
||||
return 'javascript';
|
||||
},
|
||||
configure(options: any) {
|
||||
settings = options && options.javascript;
|
||||
globalSettings = options;
|
||||
},
|
||||
doValidation(document: TextDocument): Diagnostic[] {
|
||||
updateCurrentTextDocument(document);
|
||||
|
@ -242,12 +242,14 @@ export function getJavascriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
}
|
||||
return null;
|
||||
},
|
||||
format(document: TextDocument, range: Range, formatParams: FormattingOptions): TextEdit[] {
|
||||
format(document: TextDocument, range: Range, formatParams: FormattingOptions, settings: Settings = globalSettings): TextEdit[] {
|
||||
currentTextDocument = documentRegions.get(document).getEmbeddedDocument('javascript', true);
|
||||
scriptFileVersion++;
|
||||
|
||||
let formatterSettings = settings && settings.javascript && settings.javascript.format;
|
||||
|
||||
let initialIndentLevel = computeInitialIndent(document, range, formatParams);
|
||||
let formatSettings = convertOptions(formatParams, settings && settings.format, initialIndentLevel + 1);
|
||||
let formatSettings = convertOptions(formatParams, formatterSettings, initialIndentLevel + 1);
|
||||
let start = currentTextDocument.offsetAt(range.start);
|
||||
let end = currentTextDocument.offsetAt(range.end);
|
||||
let lastLineRange = null;
|
||||
|
|
|
@ -16,11 +16,21 @@ import { getCSSMode } from './cssMode';
|
|||
import { getJavascriptMode } from './javascriptMode';
|
||||
import { getHTMLMode } from './htmlMode';
|
||||
|
||||
export interface Settings {
|
||||
css?: any;
|
||||
html?: any;
|
||||
javascript?: any;
|
||||
}
|
||||
|
||||
export interface SettingProvider {
|
||||
getDocumentSettings(textDocument: TextDocument): Thenable<Settings>;
|
||||
}
|
||||
|
||||
export interface LanguageMode {
|
||||
getId();
|
||||
configure?: (options: any) => void;
|
||||
doValidation?: (document: TextDocument) => Diagnostic[];
|
||||
doComplete?: (document: TextDocument, position: Position) => CompletionList;
|
||||
configure?: (options: Settings) => void;
|
||||
doValidation?: (document: TextDocument, settings?: Settings) => Diagnostic[];
|
||||
doComplete?: (document: TextDocument, position: Position, settings?: Settings) => CompletionList;
|
||||
doResolve?: (document: TextDocument, item: CompletionItem) => CompletionItem;
|
||||
doHover?: (document: TextDocument, position: Position) => Hover;
|
||||
doSignatureHelp?: (document: TextDocument, position: Position) => SignatureHelp;
|
||||
|
@ -29,7 +39,7 @@ export interface LanguageMode {
|
|||
findDocumentLinks?: (document: TextDocument, documentContext: DocumentContext) => DocumentLink[];
|
||||
findDefinition?: (document: TextDocument, position: Position) => Definition;
|
||||
findReferences?: (document: TextDocument, position: Position) => Location[];
|
||||
format?: (document: TextDocument, range: Range, options: FormattingOptions) => TextEdit[];
|
||||
format?: (document: TextDocument, range: Range, options: FormattingOptions, settings: Settings) => TextEdit[];
|
||||
findColorSymbols?: (document: TextDocument) => Range[];
|
||||
onDocumentRemoved(document: TextDocument): void;
|
||||
dispose(): void;
|
||||
|
|
|
@ -38,7 +38,7 @@ suite('HTML Embedded Formatting', () => {
|
|||
formatOptions = FormattingOptions.create(2, true);
|
||||
}
|
||||
|
||||
let result = format(languageModes, document, range, formatOptions, { css: true, javascript: true });
|
||||
let result = format(languageModes, document, range, formatOptions, void 0, { css: true, javascript: true });
|
||||
|
||||
let actual = applyEdits(document, result);
|
||||
assert.equal(actual, expected, message);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import { getJavascriptMode } from '../modes/javascriptMode';
|
||||
import { TextDocument, Range, TextEdit, FormattingOptions } from 'vscode-languageserver-types';
|
||||
import { TextDocument } from 'vscode-languageserver-types';
|
||||
import { getLanguageModelCache } from '../languageModelCache';
|
||||
|
||||
import { getLanguageService } from 'vscode-html-languageservice';
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as path from 'path';
|
|||
import { workspace, languages, ExtensionContext, extensions, Uri, Range } from 'vscode';
|
||||
import { LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType } from 'vscode-languageclient';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { activateColorDecorations, ColorProvider } from "./colorDecorators";
|
||||
import { activateColorDecorations, ColorProvider } from './colorDecorators';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
let localize = nls.loadMessageBundle();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
|
||||
|
||||
[{
|
||||
"name": "textmate/make.tmbundle",
|
||||
"name": "fadeevab/make.tmbundle",
|
||||
"version": "0.0.0",
|
||||
"license": "TextMate Bundle License",
|
||||
"repositoryURL": "https://github.com/textmate/make.tmbundle",
|
||||
"description": "The file syntaxes/Makefile.json was derived from Makefile.plist in https://github.com/textmate/make.tmbundle.",
|
||||
"repositoryURL": "https://github.com/fadeevab/make.tmbundle",
|
||||
"description": "The file syntaxes/Makefile.json was derived from Makefile.plist in https://github.com/fadeevab/make.tmbundle.",
|
||||
"licenseDetail": [
|
||||
"Copyright (c) textmate-make.tmbundle project authors",
|
||||
"",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"publisher": "vscode",
|
||||
"engines": { "vscode": "*" },
|
||||
"scripts": {
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js textmate/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/Makefile.json"
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js fadeevab/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/Makefile.json"
|
||||
},
|
||||
"contributes": {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"information_for_contributors": [
|
||||
"This file has been converted from https://github.com/textmate/make.tmbundle/blob/master/Syntaxes/Makefile.plist",
|
||||
"This file has been converted from https://github.com/fadeevab/make.tmbundle/blob/master/Syntaxes/Makefile.plist",
|
||||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/textmate/make.tmbundle/commit/1a1827da81e20fdce56e2658451340c070ca44b7",
|
||||
"version": "https://github.com/fadeevab/make.tmbundle/commit/3c1e978bb465ffbf53a36639a69bae99ed047f08",
|
||||
"fileTypes": [
|
||||
"Makefile",
|
||||
"makefile",
|
||||
|
@ -16,6 +16,9 @@
|
|||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"include": "#variable-assignment"
|
||||
},
|
||||
|
@ -43,7 +46,7 @@
|
|||
"name": "punctuation.definition.comment.makefile"
|
||||
}
|
||||
},
|
||||
"end": "\\n",
|
||||
"end": "(?=[^\\\\])$",
|
||||
"name": "comment.line.number-sign.makefile",
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -323,12 +326,12 @@
|
|||
"name": "punctuation.separator.key-value.makefile"
|
||||
}
|
||||
},
|
||||
"end": "^(?!\\t)",
|
||||
"end": "[^\\\\]$",
|
||||
"name": "meta.scope.target.makefile",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\G",
|
||||
"end": "^",
|
||||
"end": "(?=[^\\\\])$",
|
||||
"name": "meta.scope.prerequisites.makefile",
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -427,11 +430,11 @@
|
|||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"match": "\\G(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\\.LIBPATTERNS)(?=\\s*\\))",
|
||||
"match": "(?<=\\()(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\\.LIBPATTERNS)(?=\\s*\\))",
|
||||
"name": "variable.language.makefile"
|
||||
},
|
||||
{
|
||||
"begin": "\\G(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\\s",
|
||||
"begin": "(?<=\\()(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\\s",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.function.$1.makefile"
|
||||
|
@ -450,8 +453,13 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\G(origin|flavor)\\s(?=[^\\s)]+\\s*\\))",
|
||||
"begin": "(?<=\\()(origin|flavor)\\s(?=[^\\s)]+\\s*\\))",
|
||||
"contentName": "variable.other.makefile",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.function.$1.makefile"
|
||||
}
|
||||
},
|
||||
"end": "(?=\\))",
|
||||
"name": "meta.scope.function-call.makefile",
|
||||
"patterns": [
|
||||
|
@ -461,7 +469,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\G(?!\\))",
|
||||
"begin": "(?<=\\()(?!\\))",
|
||||
"end": "(?=\\))",
|
||||
"name": "variable.other.makefile",
|
||||
"patterns": [
|
||||
|
|
|
@ -1,31 +1,41 @@
|
|||
.PHONY: all
|
||||
all: hello
|
||||
|
||||
hello: main.o factorial.o hello.o
|
||||
g++ main.o factorial.o hello.o -o hello
|
||||
.PHONY: hello
|
||||
hello: main.o factorial.o \
|
||||
hello.o $(first) $($(filter second,second)) \
|
||||
# This is a long \
|
||||
comment inside prerequisites.
|
||||
g++ main.o factorial.o hello.o -o hello
|
||||
|
||||
# There are a building steps \
|
||||
below. And the tab is at the beginning of this line.
|
||||
|
||||
main.o: main.cpp
|
||||
g++ -c main.cpp
|
||||
g++ -c main.cpp
|
||||
|
||||
factorial.o: factorial.cpp
|
||||
g++ -c factorial.cpp
|
||||
g++ -c factorial.cpp $(fake_variable)
|
||||
|
||||
hello.o: hello.cpp
|
||||
g++ -c hello.cpp
|
||||
hello.o: hello.cpp \
|
||||
$(Colorizing with tabs at the beginning of the second line of prerequisites)
|
||||
g++ -c hello.cpp -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm *o hello
|
||||
rm *o hello
|
||||
|
||||
define defined
|
||||
$(info Checkng existance of $(1))
|
||||
$(if ifeq "$(flavor $(1))" "undefined",0,1)
|
||||
$(info Checking existance of $(1) $(flavor $(1)))
|
||||
$(if $(filter undefined,$(flavor $(1))),0,1)
|
||||
endef
|
||||
|
||||
ifeq ($(call defined,TOP_DIR),0)
|
||||
TOP_DIR must be set before including paths.mk
|
||||
ifeq ($(strip $(call defined,TOP_DIR)),0)
|
||||
$(info TOP_DIR must be set before including paths.mk)
|
||||
endif
|
||||
|
||||
include $(TOP_DIR)3rdparty.mk
|
||||
-include $(TOP_DIR)3rdparty.mk
|
||||
|
||||
ifeq ($(call defined,CODIT_DIR),0)
|
||||
CODIT_DIR must be set in $(TOP_DIR)3rdparty.mk
|
||||
ifeq ($(strip $(call defined,CODIT_DIR)),0)
|
||||
$(info CODIT_DIR must be set in $(TOP_DIR)3rdparty.mk)
|
||||
endif
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@ import MDDocumentSymbolProvider from './documentSymbolProvider';
|
|||
import { ExtensionContentSecurityPolicyArbiter, PreviewSecuritySelector } from './security';
|
||||
import { MDDocumentContentProvider, getMarkdownUri, isMarkdownFile } from './previewContentProvider';
|
||||
import { TableOfContentsProvider } from './tableOfContentsProvider';
|
||||
import { Logger } from "./logger";
|
||||
import { Logger } from './logger';
|
||||
|
||||
interface IPackageInfo {
|
||||
name: string;
|
||||
|
|
|
@ -10,8 +10,8 @@ import * as path from 'path';
|
|||
import { MarkdownEngine } from './markdownEngine';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Logger } from "./logger";
|
||||
import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from "./security";
|
||||
import { Logger } from './logger';
|
||||
import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from './security';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const previewStrings = {
|
||||
|
|
|
@ -68,7 +68,7 @@ const fencedCodeBlockDefinition = (name, identifiers, sourceScope) => {
|
|||
return `<key>fenced_code_block_${name}</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\\G)(\\s*)(\`{3,}|~{3,})\\s*((${identifiers.join('|')})(\\s+[^\`~]*)?$)</string>
|
||||
<string>(^|\\G)(\\s*)(\`{3,}|~{3,})\\s*(?i:(${identifiers.join('|')})(\\s+[^\`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
|
|
@ -588,7 +588,7 @@
|
|||
<key>fenced_code_block_css</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((css|css.erb)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(css|css.erb)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -639,7 +639,7 @@
|
|||
<key>fenced_code_block_basic</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -690,7 +690,7 @@
|
|||
<key>fenced_code_block_ini</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((ini|conf)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(ini|conf)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -741,7 +741,7 @@
|
|||
<key>fenced_code_block_java</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((java|bsh)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(java|bsh)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -792,7 +792,7 @@
|
|||
<key>fenced_code_block_lua</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((lua)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(lua)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -843,7 +843,7 @@
|
|||
<key>fenced_code_block_makefile</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -894,7 +894,7 @@
|
|||
<key>fenced_code_block_perl</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((perl|pl|pm|pod|t|PL|psgi|vcl)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(perl|pl|pm|pod|t|PL|psgi|vcl)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -945,7 +945,7 @@
|
|||
<key>fenced_code_block_r</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((R|r|s|S|Rprofile)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(R|r|s|S|Rprofile)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -996,7 +996,7 @@
|
|||
<key>fenced_code_block_ruby</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1047,7 +1047,7 @@
|
|||
<key>fenced_code_block_php</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1102,7 +1102,7 @@
|
|||
<key>fenced_code_block_sql</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((sql|ddl|dml)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(sql|ddl|dml)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1153,7 +1153,7 @@
|
|||
<key>fenced_code_block_vs_net</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((vb)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(vb)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1204,7 +1204,7 @@
|
|||
<key>fenced_code_block_xml</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1255,7 +1255,7 @@
|
|||
<key>fenced_code_block_xsl</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((xsl|xslt)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(xsl|xslt)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1306,7 +1306,7 @@
|
|||
<key>fenced_code_block_yaml</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((yaml|yml)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(yaml|yml)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1357,7 +1357,7 @@
|
|||
<key>fenced_code_block_dosbatch</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((bat|batch)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(bat|batch)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1408,7 +1408,7 @@
|
|||
<key>fenced_code_block_clojure</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((clj|cljs|clojure)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(clj|cljs|clojure)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1459,7 +1459,7 @@
|
|||
<key>fenced_code_block_coffee</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((coffee|Cakefile|coffee.erb)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(coffee|Cakefile|coffee.erb)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1510,7 +1510,7 @@
|
|||
<key>fenced_code_block_c</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((c|h)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(c|h)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1561,7 +1561,7 @@
|
|||
<key>fenced_code_block_cpp</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((cpp|c\+\+|cxx)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(cpp|c\+\+|cxx)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1612,7 +1612,7 @@
|
|||
<key>fenced_code_block_diff</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((patch|diff|rej)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(patch|diff|rej)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1663,7 +1663,7 @@
|
|||
<key>fenced_code_block_dockerfile</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((dockerfile|Dockerfile)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(dockerfile|Dockerfile)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1714,7 +1714,7 @@
|
|||
<key>fenced_code_block_git_commit</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((COMMIT_EDITMSG|MERGE_MSG)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(COMMIT_EDITMSG|MERGE_MSG)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1765,7 +1765,7 @@
|
|||
<key>fenced_code_block_git_rebase</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((git-rebase-todo)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(git-rebase-todo)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1816,7 +1816,7 @@
|
|||
<key>fenced_code_block_go</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((go|golang)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(go|golang)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1867,7 +1867,7 @@
|
|||
<key>fenced_code_block_groovy</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((groovy|gvy)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(groovy|gvy)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1918,7 +1918,7 @@
|
|||
<key>fenced_code_block_jade</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((jade|pug)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(jade|pug)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -1969,7 +1969,7 @@
|
|||
<key>fenced_code_block_js</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((js|jsx|javascript|es6|mjs)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(js|jsx|javascript|es6|mjs)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2020,7 +2020,7 @@
|
|||
<key>fenced_code_block_js_regexp</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((regexp)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(regexp)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2071,7 +2071,7 @@
|
|||
<key>fenced_code_block_json</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2122,7 +2122,7 @@
|
|||
<key>fenced_code_block_less</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((less)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(less)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2173,7 +2173,7 @@
|
|||
<key>fenced_code_block_objc</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((objectivec|objective-c|mm|objc|obj-c|m|h)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(objectivec|objective-c|mm|objc|obj-c|m|h)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2224,7 +2224,7 @@
|
|||
<key>fenced_code_block_scss</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((scss)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(scss)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2275,7 +2275,7 @@
|
|||
<key>fenced_code_block_perl6</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((perl6|p6|pl6|pm6|nqp)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(perl6|p6|pl6|pm6|nqp)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2326,7 +2326,7 @@
|
|||
<key>fenced_code_block_powershell</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((powershell|ps1|psm1|psd1)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(powershell|ps1|psm1|psd1)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2377,7 +2377,7 @@
|
|||
<key>fenced_code_block_python</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2428,7 +2428,7 @@
|
|||
<key>fenced_code_block_regexp_python</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((re)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(re)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2479,7 +2479,7 @@
|
|||
<key>fenced_code_block_rust</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((rust|rs)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(rust|rs)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2530,7 +2530,7 @@
|
|||
<key>fenced_code_block_scala</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((scala|sbt)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(scala|sbt)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2581,7 +2581,7 @@
|
|||
<key>fenced_code_block_shell</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2632,7 +2632,7 @@
|
|||
<key>fenced_code_block_ts</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((typescript|ts)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(typescript|ts)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2683,7 +2683,7 @@
|
|||
<key>fenced_code_block_tsx</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((tsx)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(tsx)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2734,7 +2734,7 @@
|
|||
<key>fenced_code_block_csharp</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((cs|csharp|c#)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(cs|csharp|c#)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
@ -2785,7 +2785,7 @@
|
|||
<key>fenced_code_block_fsharp</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*((fs|fsharp|f#)(\s+[^`~]*)?$)</string>
|
||||
<string>(^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(fs|fsharp|f#)(\s+[^`~]*)?$)</string>
|
||||
<key>name</key>
|
||||
<string>markup.fenced_code.block.markdown</string>
|
||||
<key>end</key>
|
||||
|
|
6
extensions/npm-shrinkwrap.json
generated
6
extensions/npm-shrinkwrap.json
generated
|
@ -3,9 +3,9 @@
|
|||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "2.4.2",
|
||||
"from": "typescript@2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz"
|
||||
"version": "2.5.1-insiders.20170818",
|
||||
"from": "typescript@2.5.1-insiders.20170818",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.1-insiders.20170818.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.0.1",
|
||||
"description": "Dependencies shared by all extensions",
|
||||
"dependencies": {
|
||||
"typescript": "2.4.2"
|
||||
"typescript": "2.5.1-insiders.20170818"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./postinstall"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/MagicStack/MagicPython/commit/976e59dcb78cb577e79c8f2117216c06718337e0",
|
||||
"version": "https://github.com/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5",
|
||||
"name": "MagicPython",
|
||||
"scopeName": "source.python",
|
||||
"fileTypes": [
|
||||
|
@ -260,14 +260,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"codetags": {
|
||||
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.codetag.notation.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
"statement-keyword": {
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -392,8 +384,13 @@
|
|||
]
|
||||
},
|
||||
"member-access": {
|
||||
"begin": "\\.\\s*(?!\\.)",
|
||||
"begin": "(\\.)\\s*(?!\\.)",
|
||||
"end": "(?x)\n # stop when you've just read non-whitespace followed by non-word\n # i.e. when finished reading an identifier or function call\n (?<=\\S)(?=\\W) |\n # stop when seeing the start of something that's not a word,\n # i.e. when seeing a non-identifier\n (^|(?<=\\s))(?=[^\\\\\\w\\s]) |\n $\n",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.period.python"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function-call"
|
||||
|
@ -918,29 +915,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"fstring-formatting-braces": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "empty braces are illegal",
|
||||
"match": "({)(\\s*?)(})",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
},
|
||||
"2": {
|
||||
"name": "invalid.illegal.brace.python"
|
||||
},
|
||||
"3": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.python",
|
||||
"match": "({{|}})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fstring-formatting-singe-brace": {
|
||||
"name": "invalid.illegal.brace.python",
|
||||
"match": "(}(?!}))"
|
||||
|
@ -949,11 +923,14 @@
|
|||
"comment": "Import statements\n",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(?x)\n \\s* \\b(from)\\b (\\s*\\.+\\s*) (import)?\n",
|
||||
"match": "(?x)\n \\s* \\b(from)\\b \\s*(\\.+)\\s* (import)?\n",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.control.import.python"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.period.python"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.control.import.python"
|
||||
}
|
||||
|
@ -1077,8 +1054,13 @@
|
|||
}
|
||||
},
|
||||
"member-access-class": {
|
||||
"begin": "\\.\\s*(?!\\.)",
|
||||
"begin": "(\\.)\\s*(?!\\.)",
|
||||
"end": "(?<=\\S)(?=\\W)|$",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.period.python"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#call-wrapper-inheritance"
|
||||
|
@ -1671,7 +1653,7 @@
|
|||
},
|
||||
"magic-variable-names": {
|
||||
"comment": "magic variables which a class/module may have.",
|
||||
"match": "(?x)\n \\b(\n __(?:\n all | bases | builtins | class | code | debug | defaults | dict\n | doc | file | func | kwdefaults | members\n | metaclass | methods | module | mro | name\n | qualname | self | signature | slots | subclasses\n | version | weakref | wrapped | annotations | classcell\n | spec | path | package | future\n )__\n )\\b\n",
|
||||
"match": "(?x)\n \\b(\n __(?:\n all | bases | builtins | class | code | debug | defaults | dict\n | doc | file | func | kwdefaults | members\n | metaclass | methods | module | mro | name\n | qualname | self | signature | slots | subclasses\n | version | weakref | wrapped | annotations | classcell\n | spec | path | package | future | traceback\n )__\n )\\b\n",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "support.variable.magic.python"
|
||||
|
@ -1769,6 +1751,29 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"fstring-formatting-braces": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "empty braces are illegal",
|
||||
"match": "({)(\\s*?)(})",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
},
|
||||
"2": {
|
||||
"name": "invalid.illegal.brace.python"
|
||||
},
|
||||
"3": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.python",
|
||||
"match": "({{|}})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"regexp-base-common": {
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -1891,6 +1896,14 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"codetags": {
|
||||
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.codetag.notation.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
"comments-base": {
|
||||
"name": "comment.line.number-sign.python",
|
||||
"begin": "(\\#)",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/MagicStack/MagicPython/commit/df5bb18c64252f2e7b1aa87e2ed124666d314f1d",
|
||||
"version": "https://github.com/MagicStack/MagicPython/commit/361a4964a559481330764a447e7bab88d4f1b01b",
|
||||
"name": "MagicRegExp",
|
||||
"scopeName": "source.regexp.python",
|
||||
"fileTypes": [
|
||||
|
@ -43,6 +43,29 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"fstring-formatting-braces": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "empty braces are illegal",
|
||||
"match": "({)(\\s*?)(})",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
},
|
||||
"2": {
|
||||
"name": "invalid.illegal.brace.python"
|
||||
},
|
||||
"3": {
|
||||
"name": "constant.character.format.placeholder.other.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.python",
|
||||
"match": "({{|}})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"regexp-base-common": {
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -165,6 +188,14 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"codetags": {
|
||||
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.codetag.notation.python"
|
||||
}
|
||||
}
|
||||
},
|
||||
"regexp-expression": {
|
||||
"patterns": [
|
||||
{
|
||||
|
|
|
@ -407,7 +407,29 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": "banana.size",
|
||||
"c": "banana",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "size",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -2189,7 +2211,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": " g.",
|
||||
"c": " g",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -2199,6 +2221,17 @@
|
|||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "next",
|
||||
"t": "source.python meta.function-call.python meta.function-call.generic.python",
|
||||
|
@ -4499,7 +4532,18 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ".fn ",
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "fn ",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -4554,7 +4598,18 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ".memo ",
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "memo ",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -4829,7 +4884,18 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ".memo",
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "memo",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -4874,7 +4940,7 @@
|
|||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -4973,7 +5039,7 @@
|
|||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -5083,7 +5149,7 @@
|
|||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -5159,7 +5225,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": " re.",
|
||||
"c": " re",
|
||||
"t": "source.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
|
@ -5169,6 +5235,17 @@
|
|||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": ".",
|
||||
"t": "source.python punctuation.separator.period.python",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "search",
|
||||
"t": "source.python meta.function-call.python meta.function-call.generic.python",
|
||||
|
|
|
@ -243,10 +243,8 @@
|
|||
{
|
||||
"name": "JavaScript string interpolation ${}",
|
||||
"scope": [
|
||||
"punctuation.definition.template-expression.begin.js",
|
||||
"punctuation.definition.template-expression.begin.ts",
|
||||
"punctuation.definition.template-expression.end.ts",
|
||||
"punctuation.definition.template-expression.end.js",
|
||||
"punctuation.definition.template-expression.begin",
|
||||
"punctuation.definition.template-expression.end",
|
||||
"punctuation.section.embedded.coffee"
|
||||
],
|
||||
"settings": {
|
||||
|
@ -256,8 +254,7 @@
|
|||
{
|
||||
"name": "Reset JavaScript string interpolation expression",
|
||||
"scope": [
|
||||
"meta.template.expression.js",
|
||||
"meta.template.expression.ts"
|
||||
"meta.template.expression"
|
||||
],
|
||||
"settings": {
|
||||
"foreground": "#d4d4d4"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
"foreground": "#000080"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"scope": "comment",
|
||||
"settings": {
|
||||
|
@ -230,10 +229,8 @@
|
|||
{
|
||||
"name": "JavaScript string interpolation ${}",
|
||||
"scope": [
|
||||
"punctuation.definition.template-expression.begin.js",
|
||||
"punctuation.definition.template-expression.begin.ts",
|
||||
"punctuation.definition.template-expression.end.ts",
|
||||
"punctuation.definition.template-expression.end.js",
|
||||
"punctuation.definition.template-expression.begin",
|
||||
"punctuation.definition.template-expression.end",
|
||||
"punctuation.section.embedded.coffee"
|
||||
],
|
||||
"settings": {
|
||||
|
@ -243,8 +240,7 @@
|
|||
{
|
||||
"name": "Reset JavaScript string interpolation expression",
|
||||
"scope": [
|
||||
"meta.template.expression.js",
|
||||
"meta.template.expression.ts"
|
||||
"meta.template.expression"
|
||||
],
|
||||
"settings": {
|
||||
"foreground": "#ffffff"
|
||||
|
|
|
@ -239,10 +239,8 @@
|
|||
{
|
||||
"name": "JavaScript string interpolation ${}",
|
||||
"scope": [
|
||||
"punctuation.definition.template-expression.begin.js",
|
||||
"punctuation.definition.template-expression.begin.ts",
|
||||
"punctuation.definition.template-expression.end.ts",
|
||||
"punctuation.definition.template-expression.end.js",
|
||||
"punctuation.definition.template-expression.begin",
|
||||
"punctuation.definition.template-expression.end",
|
||||
"punctuation.section.embedded.coffee"
|
||||
],
|
||||
"settings": {
|
||||
|
@ -252,8 +250,7 @@
|
|||
{
|
||||
"name": "Reset JavaScript string interpolation expression",
|
||||
"scope": [
|
||||
"meta.template.expression.js",
|
||||
"meta.template.expression.ts"
|
||||
"meta.template.expression"
|
||||
],
|
||||
"settings": {
|
||||
"foreground": "#000000"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"configuration.typescript": "TypeScript",
|
||||
"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.disableAutomaticTypeAcquisition": "Disables automatic type acquisition. Requires TypeScript >= 2.0.6 and a restart after changing it.",
|
||||
"typescript.disableAutomaticTypeAcquisition": "Disables automatic type acquisition. Requires TypeScript >= 2.0.6.",
|
||||
"typescript.tsserver.log": "Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.",
|
||||
"typescript.tsserver.trace": "Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.",
|
||||
"typescript.validate.enable": "Enable/disable TypeScript validation.",
|
||||
|
|
|
@ -53,6 +53,15 @@ class SyncedBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.client.apiVersion.has240Features()) {
|
||||
const tsPluginsForDocument = this.client.plugins
|
||||
.filter(x => x.languages.indexOf(this.document.languageId) >= 0);
|
||||
|
||||
if (tsPluginsForDocument.length) {
|
||||
(args as any).plugins = tsPluginsForDocument.map(plugin => plugin.name);
|
||||
}
|
||||
}
|
||||
|
||||
this.client.execute('open', args, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP
|
|||
// Don't complete function calls inside of destructive assigments or imports
|
||||
return this.client.execute('quickinfo', args).then(infoResponse => {
|
||||
const info = infoResponse.body;
|
||||
switch (info && info.kind) {
|
||||
switch (info && info.kind as string) {
|
||||
case 'var':
|
||||
case 'let':
|
||||
case 'const':
|
||||
|
|
|
@ -71,7 +71,7 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
|
|||
let key = `${realIndent}|${item.text}`;
|
||||
if (realIndent !== 0 && !foldingMap[key] && TypeScriptDocumentSymbolProvider.shouldInclueEntry(item.text)) {
|
||||
let result = new SymbolInformation(item.text,
|
||||
outlineTypeTable[item.kind] || SymbolKind.Variable,
|
||||
outlineTypeTable[item.kind as string] || SymbolKind.Variable,
|
||||
containerLabel ? containerLabel : '',
|
||||
new Location(resource, textSpan2Range(item.spans[0])));
|
||||
foldingMap[key] = result;
|
||||
|
@ -86,7 +86,7 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
|
|||
|
||||
private static convertNavTree(resource: Uri, bucket: SymbolInformation[], item: Proto.NavigationTree, containerLabel?: string): void {
|
||||
const result = new SymbolInformation(item.text,
|
||||
outlineTypeTable[item.kind] || SymbolKind.Variable,
|
||||
outlineTypeTable[item.kind as string] || SymbolKind.Variable,
|
||||
containerLabel ? containerLabel : '',
|
||||
new Location(resource, textSpan2Range(item.spans[0]))
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@ import { HoverProvider, Hover, TextDocument, Position, Range, CancellationToken
|
|||
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypescriptServiceClient } from '../typescriptService';
|
||||
import { tagsMarkdownPreview } from "./previewer";
|
||||
import { tagsMarkdownPreview } from './previewer';
|
||||
|
||||
export default class TypeScriptHoverProvider implements HoverProvider {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { CodeActionProvider, TextDocument, Range, CancellationToken, CodeActionContext, Command, commands, workspace, WorkspaceEdit, window, QuickPickItem } from 'vscode';
|
||||
import { CodeActionProvider, TextDocument, Range, CancellationToken, CodeActionContext, Command, commands, workspace, WorkspaceEdit, window, QuickPickItem, Selection, Position } from 'vscode';
|
||||
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypescriptServiceClient } from '../typescriptService';
|
||||
|
@ -123,6 +123,18 @@ export default class TypeScriptRefactorProvider implements CodeActionProvider {
|
|||
}
|
||||
|
||||
const edit = this.toWorkspaceEdit(response.body.edits);
|
||||
return workspace.applyEdit(edit);
|
||||
if (!(await workspace.applyEdit(edit))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const renameLocation = response.body.renameLocation;
|
||||
if (renameLocation) {
|
||||
if (window.activeTextEditor && window.activeTextEditor.document.uri.fsPath === file) {
|
||||
const pos = new Position(renameLocation.line - 1, renameLocation.offset - 1);
|
||||
window.activeTextEditor.selection = new Selection(pos, pos);
|
||||
await commands.executeCommand('editor.action.rename');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -78,10 +78,10 @@ class TscTaskProvider implements vscode.TaskProvider {
|
|||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor) {
|
||||
if (path.basename(editor.document.fileName).match(/^tsconfig\.(.\.)?json$/)) {
|
||||
const path = editor.document.uri;
|
||||
const uri = editor.document.uri;
|
||||
return [{
|
||||
path: path.fsPath,
|
||||
workspaceFolder: vscode.workspace.getWorkspaceFolder(path)
|
||||
path: uri.fsPath,
|
||||
workspaceFolder: vscode.workspace.getWorkspaceFolder(uri)
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
@ -103,10 +103,11 @@ class TscTaskProvider implements vscode.TaskProvider {
|
|||
|
||||
const { configFileName } = res.body;
|
||||
if (configFileName && !isImplicitProjectConfigFile(configFileName)) {
|
||||
const path = vscode.Uri.file(configFileName);
|
||||
const folder = vscode.workspace.getWorkspaceFolder(path);
|
||||
const normalizedConfigPath = path.normalize(configFileName);
|
||||
const uri = vscode.Uri.file(normalizedConfigPath);
|
||||
const folder = vscode.workspace.getWorkspaceFolder(uri);
|
||||
return [{
|
||||
path: configFileName,
|
||||
path: normalizedConfigPath,
|
||||
workspaceFolder: folder
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -300,8 +300,7 @@ class LanguageProvider {
|
|||
// ^(.*\*/)?\s*\}.*$
|
||||
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]\)].*$/,
|
||||
// ^.*\{[^}"']*$
|
||||
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/,
|
||||
indentNextLinePattern: /^\s*(for|while|if|else)\b(?!.*[;{}]\s*(\/\/.*|\/[*].*[*]\/\s*)?$)/
|
||||
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
|
||||
},
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||
onEnterRules: [
|
||||
|
@ -327,12 +326,6 @@ class LanguageProvider {
|
|||
// e.g. *-----*/|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
|
||||
action: { indentAction: IndentAction.None, removeText: 1 }
|
||||
},
|
||||
{
|
||||
// e.g. if (...) | {}
|
||||
beforeText: /^\s*(for|while|if|else)\s*/,
|
||||
afterText: /^\s*{/,
|
||||
action: { indentAction: IndentAction.None }
|
||||
}
|
||||
]
|
||||
}));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import { CancellationToken, Uri, Event } from 'vscode';
|
||||
import * as Proto from './protocol';
|
||||
import API from './utils/api';
|
||||
import { TypeScriptServerPlugin } from './utils/plugins';
|
||||
|
||||
export interface ITypescriptServiceClientHost {
|
||||
syntaxDiagnosticsReceived(event: Proto.DiagnosticEvent): void;
|
||||
|
@ -34,6 +35,8 @@ export interface ITypescriptServiceClient {
|
|||
|
||||
apiVersion: API;
|
||||
|
||||
plugins: TypeScriptServerPlugin[];
|
||||
|
||||
execute(command: 'configure', args: Proto.ConfigureRequestArguments, token?: CancellationToken): Promise<Proto.ConfigureResponse>;
|
||||
execute(command: 'open', args: Proto.OpenRequestArgs, expectedResult: boolean, token?: CancellationToken): Promise<any>;
|
||||
execute(command: 'close', args: Proto.FileRequestArgs, expectedResult: boolean, token?: CancellationToken): Promise<any>;
|
||||
|
|
|
@ -21,12 +21,12 @@ import VersionStatus from './utils/versionStatus';
|
|||
import * as is from './utils/is';
|
||||
import TelemetryReporter from './utils/telemetry';
|
||||
import Tracer from './utils/tracer';
|
||||
import API from "./utils/api";
|
||||
import API from './utils/api';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import { TypeScriptServiceConfiguration, TsServerLogLevel } from "./utils/configuration";
|
||||
import { TypeScriptVersionProvider } from "./utils/versionProvider";
|
||||
import { TypeScriptVersionPicker } from "./utils/versionPicker";
|
||||
import { TypeScriptServiceConfiguration, TsServerLogLevel } from './utils/configuration';
|
||||
import { TypeScriptVersionProvider } from './utils/versionProvider';
|
||||
import { TypeScriptVersionPicker } from './utils/versionPicker';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
interface CallbackItem {
|
||||
|
@ -159,7 +159,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
private readonly host: ITypescriptServiceClientHost,
|
||||
private readonly workspaceState: Memento,
|
||||
private readonly versionStatus: VersionStatus,
|
||||
private readonly plugins: TypeScriptServerPlugin[]
|
||||
public readonly plugins: TypeScriptServerPlugin[]
|
||||
) {
|
||||
this.pathSeparator = path.sep;
|
||||
this.lastStart = Date.now();
|
||||
|
@ -332,7 +332,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
const args: string[] = [];
|
||||
if (this.apiVersion.has206Features()) {
|
||||
args.push('--useSingleInferredProject');
|
||||
if (workspace.getConfiguration().get<boolean>('typescript.disableAutomaticTypeAcquisition', false)) {
|
||||
if (this.configuration.disableAutomaticTypeAcquisition) {
|
||||
args.push('--disableAutomaticTypingAcquisition');
|
||||
}
|
||||
}
|
||||
|
@ -501,12 +501,12 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
}
|
||||
|
||||
const compilerOptions: Proto.ExternalProjectCompilerOptions = {
|
||||
module: 'CommonJS',
|
||||
target: 'ES6',
|
||||
module: Proto.ModuleKind.CommonJS,
|
||||
target: Proto.ScriptTarget.ES6,
|
||||
allowSyntheticDefaultImports: true,
|
||||
allowNonTsExtensions: true,
|
||||
allowJs: true,
|
||||
jsx: 'Preserve'
|
||||
jsx: Proto.JsxEmit.Preserve
|
||||
};
|
||||
|
||||
if (this.apiVersion.has230Features()) {
|
||||
|
|
|
@ -4,64 +4,65 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as semver from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class API {
|
||||
public static readonly defaultVersion = new API('1.0.0');
|
||||
public static readonly defaultVersion = new API('1.0.0', '1.0.0');
|
||||
|
||||
private readonly _version: string;
|
||||
|
||||
constructor(
|
||||
private readonly _versionString: string
|
||||
) {
|
||||
this._version = semver.valid(_versionString);
|
||||
if (!this._version) {
|
||||
this._version = '1.0.0';
|
||||
} else {
|
||||
// Cut of any prerelease tag since we sometimes consume those
|
||||
// on purpose.
|
||||
let index = _versionString.indexOf('-');
|
||||
if (index >= 0) {
|
||||
this._version = this._version.substr(0, index);
|
||||
}
|
||||
public static fromVersionString(versionString: string): API {
|
||||
let version = semver.valid(versionString);
|
||||
if (!version) {
|
||||
return new API(localize('invalidVersion', 'invalid version'), '1.0.0');
|
||||
}
|
||||
|
||||
// Cut of any prerelease tag since we sometimes consume those on purpose.
|
||||
const index = versionString.indexOf('-');
|
||||
if (index >= 0) {
|
||||
version = version.substr(0, index);
|
||||
}
|
||||
return new API(versionString, version);
|
||||
}
|
||||
|
||||
public get versionString(): string {
|
||||
return this._versionString;
|
||||
}
|
||||
private constructor(
|
||||
public readonly versionString: string,
|
||||
private readonly version: string
|
||||
) { }
|
||||
|
||||
|
||||
public has203Features(): boolean {
|
||||
return semver.gte(this._version, '2.0.3');
|
||||
return semver.gte(this.version, '2.0.3');
|
||||
}
|
||||
|
||||
public has206Features(): boolean {
|
||||
return semver.gte(this._version, '2.0.6');
|
||||
return semver.gte(this.version, '2.0.6');
|
||||
}
|
||||
|
||||
public has208Features(): boolean {
|
||||
return semver.gte(this._version, '2.0.8');
|
||||
return semver.gte(this.version, '2.0.8');
|
||||
}
|
||||
|
||||
public has213Features(): boolean {
|
||||
return semver.gte(this._version, '2.1.3');
|
||||
return semver.gte(this.version, '2.1.3');
|
||||
}
|
||||
|
||||
public has220Features(): boolean {
|
||||
return semver.gte(this._version, '2.2.0');
|
||||
return semver.gte(this.version, '2.2.0');
|
||||
}
|
||||
|
||||
public has222Features(): boolean {
|
||||
return semver.gte(this._version, '2.2.2');
|
||||
return semver.gte(this.version, '2.2.2');
|
||||
}
|
||||
|
||||
public has230Features(): boolean {
|
||||
return semver.gte(this._version, '2.3.0');
|
||||
return semver.gte(this.version, '2.3.0');
|
||||
}
|
||||
|
||||
public has234Features(): boolean {
|
||||
return semver.gte(this._version, '2.3.4');
|
||||
return semver.gte(this.version, '2.3.4');
|
||||
}
|
||||
|
||||
public has240Features(): boolean {
|
||||
return semver.gte(this._version, '2.4.0');
|
||||
return semver.gte(this.version, '2.4.0');
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { WorkspaceConfiguration, workspace } from "vscode";
|
||||
import { WorkspaceConfiguration, workspace } from 'vscode';
|
||||
|
||||
export enum TsServerLogLevel {
|
||||
Off,
|
||||
|
@ -47,6 +47,7 @@ export class TypeScriptServiceConfiguration {
|
|||
public readonly npmLocation: string | null;
|
||||
public readonly tsServerLogLevel: TsServerLogLevel = TsServerLogLevel.Off;
|
||||
public readonly checkJs: boolean;
|
||||
public readonly disableAutomaticTypeAcquisition: boolean;
|
||||
|
||||
public static loadFromWorkspace(): TypeScriptServiceConfiguration {
|
||||
return new TypeScriptServiceConfiguration();
|
||||
|
@ -60,6 +61,7 @@ export class TypeScriptServiceConfiguration {
|
|||
this.npmLocation = TypeScriptServiceConfiguration.readNpmLocation(configuration);
|
||||
this.tsServerLogLevel = TypeScriptServiceConfiguration.readTsServerLogLevel(configuration);
|
||||
this.checkJs = TypeScriptServiceConfiguration.readCheckJs(configuration);
|
||||
this.disableAutomaticTypeAcquisition = TypeScriptServiceConfiguration.readDisableAutomaticTypeAcquisition(configuration);
|
||||
}
|
||||
|
||||
public isEqualTo(other: TypeScriptServiceConfiguration): boolean {
|
||||
|
@ -67,7 +69,8 @@ export class TypeScriptServiceConfiguration {
|
|||
&& this.localTsdk === other.localTsdk
|
||||
&& this.npmLocation === other.npmLocation
|
||||
&& this.tsServerLogLevel === other.tsServerLogLevel
|
||||
&& this.checkJs === other.checkJs;
|
||||
&& this.checkJs === other.checkJs
|
||||
&& this.disableAutomaticTypeAcquisition === other.disableAutomaticTypeAcquisition;
|
||||
}
|
||||
|
||||
private static extractGlobalTsdk(configuration: WorkspaceConfiguration): string | null {
|
||||
|
@ -98,4 +101,8 @@ export class TypeScriptServiceConfiguration {
|
|||
private static readNpmLocation(configuration: WorkspaceConfiguration): string | null {
|
||||
return configuration.get<string | null>('typescript.npm', null);
|
||||
}
|
||||
}
|
||||
|
||||
private static readDisableAutomaticTypeAcquisition(configuration: WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.disableAutomaticTypeAcquisition', false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import { TypeScriptVersionProvider, TypeScriptVersion } from "./versionProvider";
|
||||
import { Memento, commands, Uri, window, QuickPickItem, workspace } from "vscode";
|
||||
import { TypeScriptVersionProvider, TypeScriptVersion } from './versionProvider';
|
||||
import { Memento, commands, Uri, window, QuickPickItem, workspace } from 'vscode';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ const localize = nls.loadMessageBundle();
|
|||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { workspace, window } from "vscode";
|
||||
import { workspace, window } from 'vscode';
|
||||
|
||||
import { TypeScriptServiceConfiguration } from "./configuration";
|
||||
import { TypeScriptServiceConfiguration } from './configuration';
|
||||
import API from './api';
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ export class TypeScriptVersion {
|
|||
// Allow TS developers to provide custom version
|
||||
const tsdkVersion = workspace.getConfiguration().get<string | undefined>('typescript.tsdk_version', undefined);
|
||||
if (tsdkVersion) {
|
||||
return new API(tsdkVersion);
|
||||
return API.fromVersionString(tsdkVersion);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
@ -78,7 +78,7 @@ export class TypeScriptVersion {
|
|||
if (!desc || !desc.version) {
|
||||
return undefined;
|
||||
}
|
||||
return desc.version ? new API(desc.version) : undefined;
|
||||
return desc.version ? API.fromVersionString(desc.version) : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -355,11 +355,11 @@
|
|||
"c": "${",
|
||||
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -368,8 +368,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -377,11 +377,11 @@
|
|||
"c": "}",
|
||||
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -399,11 +399,11 @@
|
|||
"c": "${",
|
||||
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -412,8 +412,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -421,11 +421,11 @@
|
|||
"c": "}",
|
||||
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -91,11 +91,11 @@
|
|||
"c": "${",
|
||||
"t": "source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -104,8 +104,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -113,11 +113,11 @@
|
|||
"c": "}",
|
||||
"t": "source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -344,22 +344,22 @@
|
|||
"c": "${",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -368,8 +368,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -377,11 +377,11 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -399,11 +399,11 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -412,8 +412,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -421,22 +421,22 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "}",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -454,22 +454,22 @@
|
|||
"c": "${",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.begin: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.begin: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.begin: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -478,8 +478,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -487,11 +487,11 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -509,11 +509,11 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -522,8 +522,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -531,22 +531,22 @@
|
|||
"c": " ",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts",
|
||||
"r": {
|
||||
"dark_plus": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_plus": "meta.template.expression.ts: #000000",
|
||||
"dark_vs": "meta.template.expression.ts: #D4D4D4",
|
||||
"light_vs": "meta.template.expression.ts: #000000",
|
||||
"hc_black": "meta.template.expression.ts: #FFFFFF"
|
||||
"dark_plus": "meta.template.expression: #D4D4D4",
|
||||
"light_plus": "meta.template.expression: #000000",
|
||||
"dark_vs": "meta.template.expression: #D4D4D4",
|
||||
"light_vs": "meta.template.expression: #000000",
|
||||
"hc_black": "meta.template.expression: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "}",
|
||||
"t": "source.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts",
|
||||
"r": {
|
||||
"dark_plus": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end.ts: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end.ts: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end.ts: #569CD6"
|
||||
"dark_plus": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_plus": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"dark_vs": "punctuation.definition.template-expression.end: #569CD6",
|
||||
"light_vs": "punctuation.definition.template-expression.end: #0000FF",
|
||||
"hc_black": "punctuation.definition.template-expression.end: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
".proj",
|
||||
".props",
|
||||
".pt",
|
||||
".publishsettings",
|
||||
".pubxml",
|
||||
".pubxml.user",
|
||||
".rdf",
|
||||
|
|
18
npm-shrinkwrap.json
generated
18
npm-shrinkwrap.json
generated
|
@ -296,14 +296,14 @@
|
|||
"resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-1.2.4.tgz"
|
||||
},
|
||||
"native-watchdog": {
|
||||
"version": "0.1.0",
|
||||
"from": "native-watchdog@0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/native-watchdog/-/native-watchdog-0.1.0.tgz"
|
||||
"version": "0.2.0",
|
||||
"from": "native-watchdog@0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/native-watchdog/-/native-watchdog-0.2.0.tgz"
|
||||
},
|
||||
"node-pty": {
|
||||
"version": "0.6.9",
|
||||
"from": "node-pty@0.6.9",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.6.9.tgz",
|
||||
"version": "0.7.0",
|
||||
"from": "node-pty@0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.7.0.tgz",
|
||||
"dependencies": {
|
||||
"nan": {
|
||||
"version": "2.5.0",
|
||||
|
@ -572,9 +572,9 @@
|
|||
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.0.tgz"
|
||||
},
|
||||
"xterm": {
|
||||
"version": "2.8.1",
|
||||
"from": "Tyriar/xterm.js#vscode-release/1.15",
|
||||
"resolved": "git+https://github.com/Tyriar/xterm.js.git#75ffea5ebd5510ad0478b017c3946cb8d504855f"
|
||||
"version": "2.9.1",
|
||||
"from": "Tyriar/xterm.js#vscode-release/1.16",
|
||||
"resolved": "git+https://github.com/Tyriar/xterm.js.git#cdf3177fd735ab64403a34778d69daa833e539a5"
|
||||
},
|
||||
"yauzl": {
|
||||
"version": "2.8.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.16.0",
|
||||
"electronVersion": "1.7.4",
|
||||
"electronVersion": "1.7.5",
|
||||
"distro": "724097db097bfde7796fcca70aaac83ba80a95f8",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
|
@ -35,8 +35,8 @@
|
|||
"keytar": "^4.0.3",
|
||||
"minimist": "1.2.0",
|
||||
"native-keymap": "1.2.4",
|
||||
"native-watchdog": "0.1.0",
|
||||
"node-pty": "0.6.9",
|
||||
"native-watchdog": "0.2.0",
|
||||
"node-pty": "0.7.0",
|
||||
"nsfw": "1.0.16",
|
||||
"semver": "4.3.6",
|
||||
"v8-profiler": "jrieken/v8-profiler#vscode",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"vscode-textmate": "^3.1.5",
|
||||
"windows-process-tree": "0.1.1",
|
||||
"winreg": "1.2.0",
|
||||
"xterm": "Tyriar/xterm.js#vscode-release/1.15",
|
||||
"xterm": "Tyriar/xterm.js#vscode-release/1.16",
|
||||
"yauzl": "2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
18
src/bootstrap.js
vendored
18
src/bootstrap.js
vendored
|
@ -103,13 +103,15 @@ if (!process.env['VSCODE_ALLOW_IO']) {
|
|||
process.__defineGetter__('stdin', function () { return writable; });
|
||||
}
|
||||
|
||||
// Handle uncaught exceptions
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error('Uncaught Exception: ', err.toString());
|
||||
if (err.stack) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
});
|
||||
if (!process.env['VSCODE_HANDLES_UNCAUGHT_ERRORS']) {
|
||||
// Handle uncaught exceptions
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error('Uncaught Exception: ', err.toString());
|
||||
if (err.stack) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Kill oneself if one's parent dies. Much drama.
|
||||
if (process.env['VSCODE_PARENT_PID']) {
|
||||
|
@ -138,4 +140,4 @@ if (typeof crashReporterOptionsRaw === 'string') {
|
|||
}
|
||||
}
|
||||
|
||||
require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']);
|
||||
require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']);
|
||||
|
|
|
@ -12,15 +12,6 @@ if (process.argv.indexOf('--prof-startup') >= 0) {
|
|||
profiler.startProfiling('main', true);
|
||||
}
|
||||
|
||||
// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
|
||||
// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
|
||||
// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
|
||||
// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories). TODO@Ben temporary.
|
||||
if (process.env.LC_ALL) {
|
||||
process.env.LC_ALL = 'C';
|
||||
}
|
||||
process.env.LC_NUMERIC = 'C';
|
||||
|
||||
// Perf measurements
|
||||
global.perfStartTime = Date.now();
|
||||
|
||||
|
|
592
src/typings/xterm.d.ts
vendored
592
src/typings/xterm.d.ts
vendored
|
@ -1,197 +1,455 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @license MIT
|
||||
*
|
||||
* This contains the type declarations for the xterm.js library. Note that
|
||||
* some interfaces differ between this file and the actual implementation in
|
||||
* src/, that's because this file declares the *public* API which is intended
|
||||
* to be stable and consumed by external programs.
|
||||
*/
|
||||
|
||||
declare module 'xterm' {
|
||||
type LinkMatcherHandler = (event: MouseEvent, uri: string) => boolean | void;
|
||||
/**
|
||||
* An object containing start up options for the terminal.
|
||||
*/
|
||||
interface ITerminalOptions {
|
||||
/**
|
||||
* A data uri of the sound to use for the bell (needs bellStyle = 'sound').
|
||||
*/
|
||||
bellSound?: string;
|
||||
|
||||
class Terminal {
|
||||
cols: number;
|
||||
rows: number;
|
||||
ydisp: number;
|
||||
element: HTMLElement;
|
||||
textarea: HTMLTextAreaElement;
|
||||
/**
|
||||
* The type of the bell notification the terminal will use.
|
||||
*/
|
||||
bellStyle?: 'none' | 'visual' | 'sound' | 'both';
|
||||
|
||||
/**
|
||||
* Creates a new `Terminal` object.
|
||||
*
|
||||
* @param {object} options An object containing a set of options.
|
||||
*/
|
||||
constructor(options?: any);
|
||||
/**
|
||||
* The number of columns in the terminal.
|
||||
*/
|
||||
cols?: number;
|
||||
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param eventName The name of the event.
|
||||
* @param callback The callback.
|
||||
*/
|
||||
on(eventName: string, callback: (data: any) => void): void;
|
||||
/**
|
||||
* Whether the cursor blinks.
|
||||
*/
|
||||
cursorBlink?: boolean;
|
||||
|
||||
/**
|
||||
* Resizes the terminal.
|
||||
*
|
||||
* @param x The number of columns to resize to.
|
||||
* @param y The number of rows to resize to.
|
||||
*/
|
||||
resize(columns: number, rows: number): void;
|
||||
/**
|
||||
* The style of the cursor.
|
||||
*/
|
||||
cursorStyle?: 'block' | 'underline' | 'bar';
|
||||
|
||||
/**
|
||||
* Emits an event.
|
||||
* @param eventName The name of the event.
|
||||
* @param data The data attached to the event.
|
||||
*/
|
||||
emit(eventName: string, data: any): void;
|
||||
/**
|
||||
* Whether input should be disabled.
|
||||
*/
|
||||
disableStdin?: boolean;
|
||||
|
||||
/**
|
||||
* Writes text to the terminal, followed by a break line character (\n).
|
||||
* @param data The text to write to the terminal.
|
||||
*/
|
||||
writeln(data: string): void;
|
||||
/**
|
||||
* The number of rows in the terminal.
|
||||
*/
|
||||
rows?: number;
|
||||
|
||||
/**
|
||||
* Opens the terminal within an element.
|
||||
* @param parent The element to create the terminal within.
|
||||
* @param focus Focus the terminal, after it gets instantiated in the
|
||||
* DOM.
|
||||
*/
|
||||
open(parent: HTMLElement, focus: boolean): void;
|
||||
/**
|
||||
* The amount of scrollback in the terminal. Scrollback is the amount of rows
|
||||
* that are retained when lines are scrolled beyond the initial viewport.
|
||||
*/
|
||||
scrollback?: number;
|
||||
|
||||
/**
|
||||
* Attaches a custom key event handler which is run before keys are
|
||||
* processed, giving consumers of xterm.js ultimate control as to what
|
||||
* keys should be processed by the terminal and what keys should not.
|
||||
* @param customKeyEventHandler The custom KeyboardEvent handler to
|
||||
* attach. This is a function that takes a KeyboardEvent, allowing
|
||||
* consumers to stop propogation and/or prevent the default action. The
|
||||
* function returns whether the event should be processed by xterm.js.
|
||||
*/
|
||||
attachCustomKeyEventHandler(customKeyEventHandler: (...any) => boolean);
|
||||
/**
|
||||
* The size of tab stops in the terminal.
|
||||
*/
|
||||
tabStopWidth?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: string): any;
|
||||
/**
|
||||
* An object containing options for a link matcher.
|
||||
*/
|
||||
interface ILinkMatcherOptions {
|
||||
/**
|
||||
* The index of the link from the regex.match(text) call. This defaults to 0
|
||||
* (for regular expressions without capture groups).
|
||||
*/
|
||||
matchIndex?: number;
|
||||
|
||||
/**
|
||||
* Registers a link matcher, allowing custom link patterns to be matched and
|
||||
* handled.
|
||||
* @param {RegExp} regex The regular expression to search for, specifically
|
||||
* this searches the textContent of the rows. You will want to use \s to match
|
||||
* a space ' ' character for example.
|
||||
* @param {LinkMatcherHandler} handler The callback when the link is called.
|
||||
* @param {LinkMatcherOptions} [options] Options for the link matcher.
|
||||
* @return {number} The ID of the new matcher, this can be used to deregister.
|
||||
*/
|
||||
registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler , options?: any);
|
||||
/**
|
||||
* A callback that validates an individual link, returning true if valid and
|
||||
* false if invalid.
|
||||
*/
|
||||
validationCallback?: (uri: string, element: HTMLElement, callback: (isValid: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* Deregisters a link matcher if it has been registered.
|
||||
* @param matcherId The link matcher's ID (returned after register)
|
||||
*/
|
||||
deregisterLinkMatcher(matcherId: number): void;
|
||||
/**
|
||||
* The priority of the link matcher, this defines the order in which the link
|
||||
* matcher is evaluated relative to others, from highest to lowest. The
|
||||
* default value is 0.
|
||||
*/
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the terminal has an active selection.
|
||||
*/
|
||||
hasSelection(): boolean;
|
||||
declare module 'xterm' {
|
||||
/**
|
||||
* The class that represents an xterm.js terminal.
|
||||
*/
|
||||
export class Terminal {
|
||||
/**
|
||||
* The element containing the terminal.
|
||||
*/
|
||||
element: HTMLElement;
|
||||
|
||||
/**
|
||||
* Gets the terminal's current selection, this is useful for implementing copy
|
||||
* behavior outside of xterm.js.
|
||||
*/
|
||||
getSelection(): string;
|
||||
/**
|
||||
* The textarea that accepts input for the terminal.
|
||||
*/
|
||||
textarea: HTMLTextAreaElement;
|
||||
|
||||
/**
|
||||
* Clears the current terminal selection.
|
||||
*/
|
||||
clearSelection(): void;
|
||||
/**
|
||||
* The number of rows in the terminal's viewport.
|
||||
*/
|
||||
rows: number;
|
||||
|
||||
/**
|
||||
* Selects all text within the terminal.
|
||||
*/
|
||||
selectAll(): void;
|
||||
/**
|
||||
* The number of columns in the terminal's viewport.
|
||||
*/
|
||||
cols: number;
|
||||
|
||||
/**
|
||||
* Focus the terminal. Delegates focus handling to the terminal's DOM element.
|
||||
*/
|
||||
focus(): void;
|
||||
/**
|
||||
* Creates a new `Terminal` object.
|
||||
*
|
||||
* @param options An object containing a set of options.
|
||||
*/
|
||||
constructor(options?: ITerminalOptions);
|
||||
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
findNext(term: string): boolean;
|
||||
/**
|
||||
* Unfocus the terminal.
|
||||
*/
|
||||
blur(): void;
|
||||
|
||||
/**
|
||||
* Find the previous instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
findPrevious(term: string): boolean;
|
||||
/**
|
||||
* Focus the terminal.
|
||||
*/
|
||||
focus(): void;
|
||||
|
||||
/**
|
||||
* Destroys the terminal.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'blur' | 'focus' | 'lineFeed', listener: () => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'data', listener: (data?: string) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'key', listener: (key?: string, event?: KeyboardEvent) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'keypress' | 'keydown', listener: (event?: KeyboardEvent) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'refresh', listener: (data?: {start: number, end: number}) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'resize', listener: (data?: {cols: number, rows: number}) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'scroll', listener: (ydisp?: number) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'title', listener: (title?: string) => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: string, listener: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Scroll the display of the terminal
|
||||
* @param disp The number of lines to scroll down (negatives scroll up).
|
||||
*/
|
||||
scrollDisp(disp: number): void;
|
||||
/**
|
||||
* Deregisters an event listener.
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
off(type: 'blur' | 'focus' | 'lineFeed' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Scroll the display of the terminal by a number of pages.
|
||||
* @param {number} pageCount The number of pages to scroll (negative scrolls up).
|
||||
*/
|
||||
scrollPages(pageCount: number): void;
|
||||
/**
|
||||
* Resizes the terminal.
|
||||
* @param x The number of columns to resize to.
|
||||
* @param y The number of rows to resize to.
|
||||
*/
|
||||
resize(columns: number, rows: number): void;
|
||||
|
||||
/**
|
||||
* Scrolls the display of the terminal to the top.
|
||||
*/
|
||||
scrollToTop(): void;
|
||||
/**
|
||||
* Writes text to the terminal, followed by a break line character (\n).
|
||||
* @param data The text to write to the terminal.
|
||||
*/
|
||||
writeln(data: string): void;
|
||||
|
||||
/**
|
||||
* Scrolls the display of the terminal to the bottom.
|
||||
*/
|
||||
scrollToBottom(): void;
|
||||
/**
|
||||
* Opens the terminal within an element.
|
||||
* @param parent The element to create the terminal within.
|
||||
*/
|
||||
open(parent: HTMLElement): void;
|
||||
|
||||
/**
|
||||
* Clears the entire buffer, making the prompt line the new first line.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Attaches a custom key event handler which is run before keys are
|
||||
* processed, giving consumers of xterm.js ultimate control as to what keys
|
||||
* should be processed by the terminal and what keys should not.
|
||||
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
|
||||
* This is a function that takes a KeyboardEvent, allowing consumers to stop
|
||||
* propogation and/or prevent the default action. The function returns
|
||||
* whether the event should be processed by xterm.js.
|
||||
*/
|
||||
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
|
||||
|
||||
/**
|
||||
* Writes text to the terminal.
|
||||
* @param data The text to write to the terminal.
|
||||
*/
|
||||
write(data: string): void;
|
||||
/**
|
||||
* (EXPERIMENTAL) Registers a link matcher, allowing custom link patterns to
|
||||
* be matched and handled.
|
||||
* @param regex The regular expression to search for, specifically this
|
||||
* searches the textContent of the rows. You will want to use \s to match a
|
||||
* space ' ' character for example.
|
||||
* @param handler The callback when the link is called.
|
||||
* @param options Options for the link matcher.
|
||||
* @return The ID of the new matcher, this can be used to deregister.
|
||||
*/
|
||||
registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => boolean | void , options?: ILinkMatcherOptions): number;
|
||||
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: string, value: any): void;
|
||||
/**
|
||||
* (EXPERIMENTAL) Deregisters a link matcher if it has been registered.
|
||||
* @param matcherId The link matcher's ID (returned after register)
|
||||
*/
|
||||
deregisterLinkMatcher(matcherId: number): void;
|
||||
|
||||
/**
|
||||
* Tells the renderer to refresh terminal content between two rows (inclusive) at the next
|
||||
* opportunity.
|
||||
* @param start The row to start from (between 0 and this.rows - 1).
|
||||
* @param end The row to end at (between start and this.rows - 1).
|
||||
*/
|
||||
refresh(start: number, end: number): void;
|
||||
/**
|
||||
* Gets whether the terminal has an active selection.
|
||||
*/
|
||||
hasSelection(): boolean;
|
||||
|
||||
/**
|
||||
* Loads an addon, attaching it to the Terminal prototype.
|
||||
* @param addon The addon to load.
|
||||
*/
|
||||
static loadAddon(addon: string): void;
|
||||
/**
|
||||
* Gets the terminal's current selection, this is useful for implementing
|
||||
* copy behavior outside of xterm.js.
|
||||
*/
|
||||
getSelection(): string;
|
||||
|
||||
/**
|
||||
* Clears the current terminal selection.
|
||||
*/
|
||||
clearSelection(): void;
|
||||
|
||||
/**
|
||||
* Selects all text within the terminal.
|
||||
*/
|
||||
selectAll(): void;
|
||||
|
||||
// /**
|
||||
// * Find the next instance of the term, then scroll to and select it. If it
|
||||
// * doesn't exist, do nothing.
|
||||
// * @param term Tne search term.
|
||||
// * @return Whether a result was found.
|
||||
// */
|
||||
// findNext(term: string): boolean;
|
||||
|
||||
// /**
|
||||
// * Find the previous instance of the term, then scroll to and select it. If it
|
||||
// * doesn't exist, do nothing.
|
||||
// * @param term Tne search term.
|
||||
// * @return Whether a result was found.
|
||||
// */
|
||||
// findPrevious(term: string): boolean;
|
||||
|
||||
/**
|
||||
* Destroys the terminal and detaches it from the DOM.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Scroll the display of the terminal
|
||||
* @param amount The number of lines to scroll down (negative scroll up).
|
||||
*/
|
||||
scrollDisp(amount: number): void;
|
||||
|
||||
/**
|
||||
* Scroll the display of the terminal by a number of pages.
|
||||
* @param pageCount The number of pages to scroll (negative scrolls up).
|
||||
*/
|
||||
scrollPages(pageCount: number): void;
|
||||
|
||||
/**
|
||||
* Scrolls the display of the terminal to the top.
|
||||
*/
|
||||
scrollToTop(): void;
|
||||
|
||||
/**
|
||||
* Scrolls the display of the terminal to the bottom.
|
||||
*/
|
||||
scrollToBottom(): void;
|
||||
|
||||
/**
|
||||
* Clear the entire buffer, making the prompt line the new first line.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Writes text to the terminal.
|
||||
* @param data The text to write to the terminal.
|
||||
*/
|
||||
write(data: string): void;
|
||||
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'termName'): string;
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell'): boolean;
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'colors'): string[];
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'cols' | 'rows' | 'tabStopWidth' | 'scrollback'): number;
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'geometry'): [number, number];
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'handler'): (data: string) => void;
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: string): any;
|
||||
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'termName' | 'bellSound', value: string): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'bellStyle', value: null | 'none' | 'visual' | 'sound' | 'both'): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'cursorStyle', value: null | 'block' | 'underline' | 'bar'): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell', value: boolean): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'colors', value: string[]): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'cols' | 'rows' | 'tabStopWidth' | 'scrollback', value: number): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'geometry', value: [number, number]): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: 'handler', value: (data: string) => void): void;
|
||||
/**
|
||||
* Sets an option on the terminal.
|
||||
* @param key The option key.
|
||||
* @param value The option value.
|
||||
*/
|
||||
setOption(key: string, value: any): void;
|
||||
|
||||
/**
|
||||
* Tells the renderer to refresh terminal content between two rows
|
||||
* (inclusive) at the next opportunity.
|
||||
* @param start The row to start from (between 0 and this.rows - 1).
|
||||
* @param end The row to end at (between start and this.rows - 1).
|
||||
*/
|
||||
refresh(start: number, end: number): void;
|
||||
|
||||
/**
|
||||
* Perform a full reset (RIS, aka '\x1bc').
|
||||
*/
|
||||
reset(): void
|
||||
|
||||
/**
|
||||
* Loads an addon, attaching it to the Terminal prototype and making it
|
||||
* available to all newly created Terminals.
|
||||
* @param addon The addon to load.
|
||||
*/
|
||||
static loadAddon(addon: 'attach' | 'fit' | 'fullscreen' | 'search' | 'terminado'): void;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Moficiations to official .d.ts below
|
||||
|
||||
/**
|
||||
* The viewport position.
|
||||
*/
|
||||
ydisp: number;
|
||||
|
||||
/**
|
||||
* Emit an event on the terminal.
|
||||
*/
|
||||
emit(type: string, data: any): void;
|
||||
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
findNext(term: string): boolean;
|
||||
|
||||
/**
|
||||
* Find the previous instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
findPrevious(term: string): boolean;
|
||||
}
|
||||
|
||||
export = Terminal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ export class RGBA {
|
|||
readonly b: number;
|
||||
|
||||
/**
|
||||
* Alpha: integer in [0-255]
|
||||
* Alpha: float in [0-1]
|
||||
*/
|
||||
readonly a: number;
|
||||
|
||||
constructor(r: number, g: number, b: number, a: number = 255) {
|
||||
constructor(r: number, g: number, b: number, a: number = 1) {
|
||||
this.r = Math.min(255, Math.max(0, r)) | 0;
|
||||
this.g = Math.min(255, Math.max(0, g)) | 0;
|
||||
this.b = Math.min(255, Math.max(0, b)) | 0;
|
||||
this.a = Math.min(255, Math.max(0, a)) | 0;
|
||||
this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);
|
||||
}
|
||||
|
||||
static equals(a: RGBA, b: RGBA): boolean {
|
||||
|
@ -90,7 +90,7 @@ export class HSLA {
|
|||
const r = rgba.r / 255;
|
||||
const g = rgba.g / 255;
|
||||
const b = rgba.b / 255;
|
||||
const a = rgba.a / 255;
|
||||
const a = rgba.a;
|
||||
|
||||
const max = Math.max(r, g, b);
|
||||
const min = Math.min(r, g, b);
|
||||
|
@ -154,7 +154,7 @@ export class HSLA {
|
|||
b = HSLA._hue2rgb(p, q, h - 1 / 3);
|
||||
}
|
||||
|
||||
return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), Math.round(a * 255));
|
||||
return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ export class HSVA {
|
|||
m = ((r - g) / delta) + 4;
|
||||
}
|
||||
|
||||
return new HSVA(m * 60, s, cmax, rgba.a / 255);
|
||||
return new HSVA(m * 60, s, cmax, rgba.a);
|
||||
}
|
||||
|
||||
// from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm
|
||||
|
@ -249,7 +249,7 @@ export class HSVA {
|
|||
g = Math.round((g + m) * 255);
|
||||
b = Math.round((b + m) * 255);
|
||||
|
||||
return new RGBA(r, g, b, Math.round(a * 255));
|
||||
return new RGBA(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ export class Color {
|
|||
|
||||
transparent(factor: number): Color {
|
||||
const { r, g, b, a } = this.rgba;
|
||||
return new Color(new RGBA(r, g, b, Math.round(a * factor)));
|
||||
return new Color(new RGBA(r, g, b, a * factor));
|
||||
}
|
||||
|
||||
isTransparent(): boolean {
|
||||
|
@ -357,7 +357,7 @@ export class Color {
|
|||
}
|
||||
|
||||
isOpaque(): boolean {
|
||||
return this.rgba.a === 255;
|
||||
return this.rgba.a === 1;
|
||||
}
|
||||
|
||||
opposite(): Color {
|
||||
|
@ -368,8 +368,8 @@ export class Color {
|
|||
const rgba = c.rgba;
|
||||
|
||||
// Convert to 0..1 opacity
|
||||
const thisA = this.rgba.a / 255;
|
||||
const colorA = rgba.a / 255;
|
||||
const thisA = this.rgba.a;
|
||||
const colorA = rgba.a;
|
||||
|
||||
let a = thisA + colorA * (1 - thisA);
|
||||
if (a < 1.0e-6) {
|
||||
|
@ -379,7 +379,6 @@ export class Color {
|
|||
const r = this.rgba.r * thisA / a + rgba.r * colorA * (1 - thisA) / a;
|
||||
const g = this.rgba.g * thisA / a + rgba.g * colorA * (1 - thisA) / a;
|
||||
const b = this.rgba.b * thisA / a + rgba.b * colorA * (1 - thisA) / a;
|
||||
a *= 255;
|
||||
|
||||
return new Color(new RGBA(r, g, b, a));
|
||||
}
|
||||
|
@ -410,13 +409,13 @@ export class Color {
|
|||
return of.darken(factor);
|
||||
}
|
||||
|
||||
static readonly white = new Color(new RGBA(255, 255, 255, 255));
|
||||
static readonly black = new Color(new RGBA(0, 0, 0, 255));
|
||||
static readonly red = new Color(new RGBA(255, 0, 0, 255));
|
||||
static readonly blue = new Color(new RGBA(0, 0, 255, 255));
|
||||
static readonly green = new Color(new RGBA(0, 255, 0, 255));
|
||||
static readonly cyan = new Color(new RGBA(0, 255, 255, 255));
|
||||
static readonly lightgrey = new Color(new RGBA(211, 211, 211, 255));
|
||||
static readonly white = new Color(new RGBA(255, 255, 255, 1));
|
||||
static readonly black = new Color(new RGBA(0, 0, 0, 1));
|
||||
static readonly red = new Color(new RGBA(255, 0, 0, 1));
|
||||
static readonly blue = new Color(new RGBA(0, 0, 255, 1));
|
||||
static readonly green = new Color(new RGBA(0, 255, 0, 1));
|
||||
static readonly cyan = new Color(new RGBA(0, 255, 255, 1));
|
||||
static readonly lightgrey = new Color(new RGBA(211, 211, 211, 1));
|
||||
static readonly transparent = new Color(new RGBA(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
|
@ -425,7 +424,7 @@ export namespace Color {
|
|||
export namespace CSS {
|
||||
|
||||
export function formatRGB(color: Color): string {
|
||||
if (color.rgba.a === 255) {
|
||||
if (color.rgba.a === 1) {
|
||||
return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`;
|
||||
}
|
||||
|
||||
|
@ -433,7 +432,7 @@ export namespace Color {
|
|||
}
|
||||
|
||||
export function formatRGBA(color: Color): string {
|
||||
return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a / 255).toFixed(2)})`;
|
||||
return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a).toFixed(2)})`;
|
||||
}
|
||||
|
||||
export function formatHSL(color: Color): string {
|
||||
|
@ -465,11 +464,11 @@ export namespace Color {
|
|||
* If 'compact' is set, colors without transparancy will be printed as #RRGGBB
|
||||
*/
|
||||
export function formatHexA(color: Color, compact = false): string {
|
||||
if (compact && color.rgba.a === 0xFF) {
|
||||
if (compact && color.rgba.a === 1) {
|
||||
return Color.Format.CSS.formatHex(color);
|
||||
}
|
||||
|
||||
return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(color.rgba.a)}`;
|
||||
return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -515,7 +514,7 @@ export namespace Color {
|
|||
const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));
|
||||
const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
|
||||
const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
|
||||
return new Color(new RGBA(r, g, b, 255));
|
||||
return new Color(new RGBA(r, g, b, 1));
|
||||
}
|
||||
|
||||
if (length === 9) {
|
||||
|
@ -524,7 +523,7 @@ export namespace Color {
|
|||
const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
|
||||
const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
|
||||
const a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));
|
||||
return new Color(new RGBA(r, g, b, a));
|
||||
return new Color(new RGBA(r, g, b, a / 255));
|
||||
}
|
||||
|
||||
if (length === 4) {
|
||||
|
@ -541,7 +540,7 @@ export namespace Color {
|
|||
const g = _parseHexDigit(hex.charCodeAt(2));
|
||||
const b = _parseHexDigit(hex.charCodeAt(3));
|
||||
const a = _parseHexDigit(hex.charCodeAt(4));
|
||||
return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, 16 * a + a));
|
||||
return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));
|
||||
}
|
||||
|
||||
// Invalid color
|
||||
|
|
|
@ -132,26 +132,35 @@ export function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) =>
|
|||
errorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);
|
||||
}
|
||||
|
||||
export function onUnexpectedError(e: any): void {
|
||||
|
||||
export function onUnexpectedError(e: any): undefined {
|
||||
// ignore errors from cancelled promises
|
||||
if (!isPromiseCanceledError(e)) {
|
||||
errorHandler.onUnexpectedError(e);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function onUnexpectedExternalError(e: any): void {
|
||||
|
||||
export function onUnexpectedExternalError(e: any): undefined {
|
||||
// ignore errors from cancelled promises
|
||||
if (!isPromiseCanceledError(e)) {
|
||||
errorHandler.onUnexpectedExternalError(e);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function onUnexpectedPromiseError<T>(promise: TPromise<T>): TPromise<T> {
|
||||
return promise.then<T>(null, onUnexpectedError);
|
||||
export function onUnexpectedPromiseError<T>(promise: TPromise<T>): TPromise<T | void> {
|
||||
return promise.then(null, onUnexpectedError);
|
||||
}
|
||||
|
||||
export interface SerializedError {
|
||||
readonly $isError: true;
|
||||
readonly name: string;
|
||||
readonly message: string;
|
||||
readonly stack: string;
|
||||
}
|
||||
|
||||
export function transformErrorForSerialization(error: Error): SerializedError;
|
||||
export function transformErrorForSerialization(error: any): any;
|
||||
export function transformErrorForSerialization(error: any): any {
|
||||
if (error instanceof Error) {
|
||||
let { name, message } = error;
|
||||
|
@ -168,6 +177,24 @@ export function transformErrorForSerialization(error: any): any {
|
|||
return error;
|
||||
}
|
||||
|
||||
// see https://github.com/v8/v8/wiki/Stack%20Trace%20API#basic-stack-traces
|
||||
export interface V8CallSite {
|
||||
getThis(): any;
|
||||
getTypeName(): string;
|
||||
getFunction(): string;
|
||||
getFunctionName(): string;
|
||||
getMethodName(): string;
|
||||
getFileName(): string;
|
||||
getLineNumber(): number;
|
||||
getColumnNumber(): number;
|
||||
getEvalOrigin(): string;
|
||||
isToplevel(): boolean;
|
||||
isEval(): boolean;
|
||||
isNative(): boolean;
|
||||
isConstructor(): boolean;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
const canceledName = 'Canceled';
|
||||
|
||||
/**
|
||||
|
@ -215,6 +242,12 @@ export function readonly(name?: string): Error {
|
|||
: new Error('readonly property cannot be changed');
|
||||
}
|
||||
|
||||
export function disposed(what: string): Error {
|
||||
const result = new Error(`${what} has been disposed`);
|
||||
result.name = 'DISPOSED';
|
||||
return result;
|
||||
}
|
||||
|
||||
export interface IErrorOptions {
|
||||
severity?: Severity;
|
||||
actions?: IAction[];
|
||||
|
@ -248,4 +281,4 @@ export function getErrorMessage(err: any): string {
|
|||
}
|
||||
|
||||
return String(err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ export function tildify(path: string, userHome: string): string {
|
|||
*/
|
||||
const ellipsis = '\u2026';
|
||||
const unc = '\\\\';
|
||||
const home = '~';
|
||||
export function shorten(paths: string[]): string[] {
|
||||
const shortenedPaths: string[] = new Array(paths.length);
|
||||
|
||||
|
@ -130,7 +131,7 @@ export function shorten(paths: string[]): string[] {
|
|||
|
||||
match = true;
|
||||
|
||||
// trim for now and concatenate unc path (e.g. \\network) or root path (/etc) later
|
||||
// trim for now and concatenate unc path (e.g. \\network) or root path (/etc, ~/etc) later
|
||||
let prefix = '';
|
||||
if (path.indexOf(unc) === 0) {
|
||||
prefix = path.substr(0, path.indexOf(unc) + unc.length);
|
||||
|
@ -138,6 +139,9 @@ export function shorten(paths: string[]): string[] {
|
|||
} else if (path.indexOf(nativeSep) === 0) {
|
||||
prefix = path.substr(0, path.indexOf(nativeSep) + nativeSep.length);
|
||||
path = path.substr(path.indexOf(nativeSep) + nativeSep.length);
|
||||
} else if (path.indexOf(home) === 0) {
|
||||
prefix = path.substr(0, path.indexOf(home) + home.length);
|
||||
path = path.substr(path.indexOf(home) + home.length);
|
||||
}
|
||||
|
||||
// pick the first shortest subpath found
|
||||
|
|
|
@ -238,7 +238,7 @@ export class TrieMap<E> {
|
|||
private readonly _splitter: (s: string) => string[];
|
||||
private _root = new Node<E>();
|
||||
|
||||
constructor(splitter: (s: string) => string[]) {
|
||||
constructor(splitter: (s: string) => string[] = TrieMap.PathSplitter) {
|
||||
this._splitter = s => splitter(s).filter(s => Boolean(s));
|
||||
}
|
||||
|
||||
|
|
|
@ -182,18 +182,6 @@ export function endsWith(haystack: string, needle: string): boolean {
|
|||
}
|
||||
}
|
||||
|
||||
export function indexOfIgnoreCase(haystack: string, needle: string, position: number = 0): number {
|
||||
let index = haystack.indexOf(needle, position);
|
||||
if (index < 0) {
|
||||
if (position > 0) {
|
||||
haystack = haystack.substr(position);
|
||||
}
|
||||
needle = escapeRegExpCharacters(needle);
|
||||
index = haystack.search(new RegExp(needle, 'i'));
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
export interface RegExpOptions {
|
||||
matchCase?: boolean;
|
||||
wholeWord?: boolean;
|
||||
|
|
163
src/vs/base/common/winjs.base.d.ts
vendored
163
src/vs/base/common/winjs.base.d.ts
vendored
|
@ -4,110 +4,47 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
/// Interfaces for WinJS
|
||||
|
||||
export interface ValueCallback {
|
||||
(value: any): any;
|
||||
}
|
||||
export type ErrorCallback = (error: any) => void;
|
||||
export type ProgressCallback<TProgress = any> = (progress: TProgress) => void;
|
||||
|
||||
export interface EventCallback {
|
||||
(value: any): void;
|
||||
}
|
||||
export declare class Promise<T = any, TProgress = any> {
|
||||
constructor(
|
||||
executor: (
|
||||
resolve: (value: T | PromiseLike<T>) => void,
|
||||
reject: (reason: any) => void,
|
||||
progress: (progress: TProgress) => void) => void,
|
||||
oncancel?: () => void);
|
||||
|
||||
export interface ErrorCallback {
|
||||
(error: any): any;
|
||||
}
|
||||
public then<TResult1 = T, TResult2 = never>(
|
||||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
|
||||
onprogress?: (progress: TProgress) => void): Promise<TResult1 | TResult2, TProgress>;
|
||||
|
||||
export interface ProgressCallback {
|
||||
(progress: any): any;
|
||||
}
|
||||
public done(
|
||||
onfulfilled?: (value: T) => void,
|
||||
onrejected?: (reason: any) => void,
|
||||
onprogress?: (progress: TProgress) => void): void;
|
||||
|
||||
export declare class Promise {
|
||||
// commented out because this conflicts with the native promise
|
||||
// constructor(init: (complete: ValueCallback, error: ErrorCallback, progress: ProgressCallback) => void, oncancel?: any);
|
||||
|
||||
// commented out to speed up adoption of TPromise
|
||||
// static as(value:any):Promise;
|
||||
|
||||
// static join(promises: { [name: string]: Promise; }): Promise;
|
||||
static join(promises: Promise[]): Promise;
|
||||
// static any(promises: Promise[]): Promise;
|
||||
|
||||
// commented out to speed up adoption of TPromise
|
||||
// static timeout(delay:number):Promise;
|
||||
|
||||
// static wrapError(error: Error): Promise;
|
||||
// static is(value: any): value is Thenable<any>;
|
||||
// static addEventListener(type: string, fn: EventCallback): void;
|
||||
|
||||
public then(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): Promise;
|
||||
// public then<U>(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): TPromise<U>;
|
||||
public done(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): void;
|
||||
public cancel(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The value callback to complete a promise
|
||||
*/
|
||||
export interface TValueCallback<T> {
|
||||
(value: T | Thenable<T>): void;
|
||||
}
|
||||
|
||||
|
||||
export interface TProgressCallback<T> {
|
||||
(progress: T): void;
|
||||
}
|
||||
|
||||
interface IPromiseErrorDetail {
|
||||
parent: TPromise<any>;
|
||||
error: any;
|
||||
id: number;
|
||||
handler: Function;
|
||||
exception: Error;
|
||||
}
|
||||
|
||||
interface IPromiseError {
|
||||
detail: IPromiseErrorDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Promise implementation that supports progress and cancelation.
|
||||
*/
|
||||
export declare class TPromise<V> {
|
||||
|
||||
constructor(init: (complete: TValueCallback<V>, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any);
|
||||
|
||||
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U> | U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => void, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U> | U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U> | U, error?: (err: any) => TPromise<U> | U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U> | U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => TPromise<U> | U, error?: (err: any) => void, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => U, error?: (err: any) => TPromise<U> | U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>;
|
||||
public then<U>(success?: (value: V) => U, error?: (err: any) => void, progress?: ProgressCallback): TPromise<U>;
|
||||
|
||||
public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void;
|
||||
public cancel(): void;
|
||||
|
||||
public static as(value: null): TPromise<null>;
|
||||
public static as(value: undefined): TPromise<undefined>;
|
||||
public static as<ValueType>(value: TPromise<ValueType>): TPromise<ValueType>;
|
||||
public static as<ValueType>(value: Thenable<ValueType>): Thenable<ValueType>;
|
||||
public static as<ValueType>(value: ValueType): TPromise<ValueType>;
|
||||
public static as(value: null): Promise<null>;
|
||||
public static as(value: undefined): Promise<undefined>;
|
||||
public static as<T, TPromise extends PromiseLike<T>>(value: TPromise): TPromise;
|
||||
public static as<T>(value: T): Promise<T>;
|
||||
|
||||
public static is(value: any): value is Thenable<any>;
|
||||
public static timeout(delay: number): TPromise<void>;
|
||||
public static join<ValueType>(promises: TPromise<ValueType>[]): TPromise<ValueType[]>;
|
||||
public static join<ValueType>(promises: Thenable<ValueType>[]): Thenable<ValueType[]>;
|
||||
public static join<ValueType>(promises: { [n: string]: TPromise<ValueType> }): TPromise<{ [n: string]: ValueType }>;
|
||||
public static any<ValueType>(promises: TPromise<ValueType>[]): TPromise<{ key: string; value: TPromise<ValueType>; }>;
|
||||
public static is(value: any): value is PromiseLike<any>;
|
||||
|
||||
public static wrap<ValueType>(value: Thenable<ValueType>): TPromise<ValueType>;
|
||||
public static wrap<ValueType>(value: ValueType): TPromise<ValueType>;
|
||||
public static timeout(delay: number): Promise<void>;
|
||||
|
||||
public static wrapError<ValueType>(error: Error): TPromise<ValueType>;
|
||||
public static join<T1, T2>(promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
public static join<T>(promises: (T | PromiseLike<T>)[]): Promise<T[]>;
|
||||
public static join<T>(promises: { [n: string]: T | PromiseLike<T> }): Promise<{ [n: string]: T }>;
|
||||
|
||||
public static any<T>(promises: (T | PromiseLike<T>)[]): Promise<{ key: string; value: Promise<T>; }>;
|
||||
|
||||
public static wrap<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
public static wrapError<T = never>(error: Error): Promise<T>;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -115,25 +52,23 @@ export declare class TPromise<V> {
|
|||
public static addEventListener(event: 'error', promiseErrorHandler: (e: IPromiseError) => void);
|
||||
}
|
||||
|
||||
// --- Generic promise with generic progress value
|
||||
export declare class PPromise<C, P> extends TPromise<C> {
|
||||
export type TValueCallback<T = any> = (value: T | PromiseLike<T>) => void;
|
||||
|
||||
constructor(init: (complete: TValueCallback<C>, error: (err: any) => void, progress: TProgressCallback<P>) => void, oncancel?: any);
|
||||
export {
|
||||
Promise as TPromise,
|
||||
Promise as PPromise,
|
||||
TValueCallback as ValueCallback,
|
||||
ProgressCallback as TProgressCallback
|
||||
};
|
||||
|
||||
public then<U>(success?: (value: C) => PPromise<U, P>, error?: (err: any) => PPromise<U, P>, progress?: (value: P) => void): PPromise<U, P>;
|
||||
public then<U>(success?: (value: C) => PPromise<U, P>, error?: (err: any) => U, progress?: (value: P) => void): PPromise<U, P>;
|
||||
public then<U>(success?: (value: C) => PPromise<U, P>, error?: (err: any) => void, progress?: (value: P) => void): PPromise<U, P>;
|
||||
public then<U>(success?: (value: C) => U, error?: (err: any) => PPromise<C, P>, progress?: (value: P) => void): PPromise<U, P>;
|
||||
public then<U>(success?: (value: C) => U, error?: (err: any) => U, progress?: (value: P) => void): PPromise<U, P>;
|
||||
public then<U>(success?: (value: C) => U, error?: (err: any) => void, progress?: (value: P) => void): PPromise<U, P>;
|
||||
|
||||
public done(success?: (value: C) => void, error?: (err: any) => any, progress?: (value: P) => void): void;
|
||||
public cancel(): void;
|
||||
|
||||
public static as<V>(value: V): TPromise<V>;
|
||||
public static timeout(delay: number): PPromise<void, void>;
|
||||
public static join<C, P>(promises: PPromise<C, P>[]): PPromise<C, P[]>;
|
||||
public static join<C, P>(promises: { [n: string]: PPromise<C, P> }): PPromise<{ [n: string]: C }, P>;
|
||||
public static any<C, P>(promises: PPromise<C, P>[]): PPromise<{ key: string; value: PPromise<C, P>; }, P>;
|
||||
public static wrapError<V>(error: Error): TPromise<V>;
|
||||
export interface IPromiseErrorDetail {
|
||||
parent: Promise;
|
||||
error: any;
|
||||
id: number;
|
||||
handler: Function;
|
||||
exception: Error;
|
||||
}
|
||||
|
||||
export interface IPromiseError {
|
||||
detail: IPromiseErrorDetail;
|
||||
}
|
||||
|
|
|
@ -58,59 +58,61 @@ async function getNodeRequest(options: IRequestOptions): TPromise<IRawRequestFun
|
|||
export function request(options: IRequestOptions): TPromise<IRequestContext> {
|
||||
let req: http.ClientRequest;
|
||||
|
||||
return new TPromise<IRequestContext>(async (c, e) => {
|
||||
const endpoint = parseUrl(options.url);
|
||||
const rawRequest = options.getRawRequest
|
||||
? options.getRawRequest(options)
|
||||
: await getNodeRequest(options);
|
||||
const rawRequestPromise = options.getRawRequest
|
||||
? TPromise.as(options.getRawRequest(options))
|
||||
: getNodeRequest(options);
|
||||
|
||||
const opts: https.RequestOptions = {
|
||||
hostname: endpoint.hostname,
|
||||
port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80),
|
||||
protocol: endpoint.protocol,
|
||||
path: endpoint.path,
|
||||
method: options.type || 'GET',
|
||||
headers: options.headers,
|
||||
agent: options.agent,
|
||||
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true
|
||||
};
|
||||
return rawRequestPromise.then(rawRequest => {
|
||||
return new TPromise<IRequestContext>((c, e) => {
|
||||
const endpoint = parseUrl(options.url);
|
||||
|
||||
if (options.user && options.password) {
|
||||
opts.auth = options.user + ':' + options.password;
|
||||
}
|
||||
const opts: https.RequestOptions = {
|
||||
hostname: endpoint.hostname,
|
||||
port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80),
|
||||
protocol: endpoint.protocol,
|
||||
path: endpoint.path,
|
||||
method: options.type || 'GET',
|
||||
headers: options.headers,
|
||||
agent: options.agent,
|
||||
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true
|
||||
};
|
||||
|
||||
req = rawRequest(opts, (res: http.ClientResponse) => {
|
||||
const followRedirects = isNumber(options.followRedirects) ? options.followRedirects : 3;
|
||||
|
||||
if (res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {
|
||||
request(assign({}, options, {
|
||||
url: res.headers['location'],
|
||||
followRedirects: followRedirects - 1
|
||||
})).done(c, e);
|
||||
} else {
|
||||
let stream: Stream = res;
|
||||
|
||||
if (res.headers['content-encoding'] === 'gzip') {
|
||||
stream = stream.pipe(createGunzip());
|
||||
}
|
||||
|
||||
c({ res, stream });
|
||||
if (options.user && options.password) {
|
||||
opts.auth = options.user + ':' + options.password;
|
||||
}
|
||||
});
|
||||
|
||||
req.on('error', e);
|
||||
req = rawRequest(opts, (res: http.ClientResponse) => {
|
||||
const followRedirects = isNumber(options.followRedirects) ? options.followRedirects : 3;
|
||||
|
||||
if (options.timeout) {
|
||||
req.setTimeout(options.timeout);
|
||||
}
|
||||
if (res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {
|
||||
request(assign({}, options, {
|
||||
url: res.headers['location'],
|
||||
followRedirects: followRedirects - 1
|
||||
})).done(c, e);
|
||||
} else {
|
||||
let stream: Stream = res;
|
||||
|
||||
if (options.data) {
|
||||
req.write(options.data);
|
||||
}
|
||||
if (res.headers['content-encoding'] === 'gzip') {
|
||||
stream = stream.pipe(createGunzip());
|
||||
}
|
||||
|
||||
req.end();
|
||||
},
|
||||
() => req && req.abort());
|
||||
c({ res, stream });
|
||||
}
|
||||
});
|
||||
|
||||
req.on('error', e);
|
||||
|
||||
if (options.timeout) {
|
||||
req.setTimeout(options.timeout);
|
||||
}
|
||||
|
||||
if (options.data) {
|
||||
req.write(options.data);
|
||||
}
|
||||
|
||||
req.end();
|
||||
}, () => req && req.abort());
|
||||
});
|
||||
}
|
||||
|
||||
function isSuccess(context: IRequestContext): boolean {
|
||||
|
|
|
@ -340,6 +340,10 @@ export class QuickOpenWidget implements IModelProvider {
|
|||
// Allows focus to switch to next/previous entry after tab into an actionbar item
|
||||
DOM.addDisposableListener(this.treeContainer.getHTMLElement(), DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
|
||||
// Only handle when not in quick navigation mode
|
||||
if (this.quickNavigateConfiguration) {
|
||||
return;
|
||||
}
|
||||
if (keyboardEvent.keyCode === KeyCode.DownArrow || keyboardEvent.keyCode === KeyCode.UpArrow || keyboardEvent.keyCode === KeyCode.PageDown || keyboardEvent.keyCode === KeyCode.PageUp) {
|
||||
DOM.EventHelper.stop(e, true);
|
||||
this.navigateInTree(keyboardEvent.keyCode, keyboardEvent.shiftKey);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue