diff --git a/README.md b/README.md
index 3a10b463101..df87a4eea0b 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index 20531bdc4b1..68caf689ded 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -43,8 +43,8 @@ const nodeModules = ['electron', 'original-fs']
// Build
const builtInExtensions = [
- { name: 'ms-vscode.node-debug', version: '1.16.4' },
- { 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 = [
diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe
index 096f516afcf..9c2970d508b 100644
--- a/build/monaco/monaco.d.ts.recipe
+++ b/build/monaco/monaco.d.ts.recipe
@@ -5,16 +5,7 @@
declare module monaco {
- interface Thenable {
- /**
- * 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(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable;
- then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable;
- }
+ type Thenable = PromiseLike;
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
diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js
index 7b156212bec..95205aa1fe1 100644
--- a/build/npm/postinstall.js
+++ b/build/npm/postinstall.js
@@ -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',
diff --git a/extensions/azure-account/.vscodeignore b/extensions/azure-account/.vscodeignore
new file mode 100644
index 00000000000..24428a6f758
--- /dev/null
+++ b/extensions/azure-account/.vscodeignore
@@ -0,0 +1,4 @@
+test/**
+src/**
+tsconfig.json
+npm-shrinkwrap.json
\ No newline at end of file
diff --git a/extensions/azure-account/npm-shrinkwrap.json b/extensions/azure-account/npm-shrinkwrap.json
new file mode 100644
index 00000000000..18206b8124a
--- /dev/null
+++ b/extensions/azure-account/npm-shrinkwrap.json
@@ -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"
+ }
+ }
+}
diff --git a/extensions/azure-account/package.json b/extensions/azure-account/package.json
new file mode 100644
index 00000000000..d98aa059e74
--- /dev/null
+++ b/extensions/azure-account/package.json
@@ -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"
+ }
+}
\ No newline at end of file
diff --git a/extensions/azure-account/package.nls.json b/extensions/azure-account/package.nls.json
new file mode 100644
index 00000000000..4857a376665
--- /dev/null
+++ b/extensions/azure-account/package.nls.json
@@ -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"
+}
\ No newline at end of file
diff --git a/extensions/azure-account/src/azure-account.ts b/extensions/azure-account/src/azure-account.ts
new file mode 100644
index 00000000000..d5b4b3d9ed1
--- /dev/null
+++ b/extensions/azure-account/src/azure-account.ts
@@ -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 = (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();
+ private onSessionsChanged = new EventEmitter();
+ private onFiltersChanged = new EventEmitter();
+ 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') {
+ (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) {
+ (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(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('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('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('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;
+ }, []) : [];
+ 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('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('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 | 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 => (>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 {
+ return new Promise((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((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((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((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((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 extends Array {
+ nextLink?: string;
+}
+
+export async function listAll(client: { listNext(nextPageLink: string): Promise>; }, first: Promise>): Promise {
+ 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;
+}
\ No newline at end of file
diff --git a/extensions/azure-account/src/extension.ts b/extensions/azure-account/src/extension.ts
new file mode 100644
index 00000000000..df46a761df1
--- /dev/null
+++ b/extensions/azure-account/src/extension.ts
@@ -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() {
+}
\ No newline at end of file
diff --git a/extensions/azure-account/src/typings/azure-account.api.d.ts b/extensions/azure-account/src/typings/azure-account.api.d.ts
new file mode 100644
index 00000000000..089511dda45
--- /dev/null
+++ b/extensions/azure-account/src/typings/azure-account.api.d.ts
@@ -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;
+ readonly sessions: AzureSession[];
+ readonly onSessionsChanged: Event;
+ readonly filters: AzureResourceFilter[];
+ readonly onFiltersChanged: Event;
+ 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;
+ writeSecret(service: string, account: string, secret: string): Thenable;
+ deleteSecret(service: string, account: string): Thenable;
+}
diff --git a/extensions/azure-account/src/typings/ref.d.ts b/extensions/azure-account/src/typings/ref.d.ts
new file mode 100644
index 00000000000..216911a680e
--- /dev/null
+++ b/extensions/azure-account/src/typings/ref.d.ts
@@ -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.
+ *--------------------------------------------------------------------------------------------*/
+
+///
diff --git a/extensions/azure-account/src/typings/vscode.rejected.d.ts b/extensions/azure-account/src/typings/vscode.rejected.d.ts
new file mode 100644
index 00000000000..7f6f64df560
--- /dev/null
+++ b/extensions/azure-account/src/typings/vscode.rejected.d.ts
@@ -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;
+
+ /**
+ * 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;
+
+ /**
+ * 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;
+ }
+}
diff --git a/extensions/azure-account/tsconfig.json b/extensions/azure-account/tsconfig.json
new file mode 100644
index 00000000000..61265d449a4
--- /dev/null
+++ b/extensions/azure-account/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "strict": true,
+ "noUnusedLocals": true,
+ "outDir": "./out",
+ "lib": [
+ "es6"
+ ],
+ "sourceMap": true
+ },
+ "exclude": [
+ "node_modules"
+ ],
+ "include": [
+ "src/**/*"
+ ]
+}
\ No newline at end of file
diff --git a/extensions/css/client/src/cssMain.ts b/extensions/css/client/src/cssMain.ts
index 1080628cad4..a13dabac0b9 100644
--- a/extensions/css/client/src/cssMain.ts
+++ b/extensions/css/client/src/cssMain.ts
@@ -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
diff --git a/extensions/css/npm-shrinkwrap.json b/extensions/css/npm-shrinkwrap.json
index 89c99f09cf0..6a497e0b691 100644
--- a/extensions/css/npm-shrinkwrap.json
+++ b/extensions/css/npm-shrinkwrap.json
@@ -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",
diff --git a/extensions/css/package.json b/extensions/css/package.json
index ff0bf9ac994..49b8f98ba2f 100644
--- a/extensions/css/package.json
+++ b/extensions/css/package.json
@@ -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"
}
-}
\ No newline at end of file
+}
diff --git a/extensions/css/server/npm-shrinkwrap.json b/extensions/css/server/npm-shrinkwrap.json
index 21329db6203..63bed9e999b 100644
--- a/extensions/css/server/npm-shrinkwrap.json
+++ b/extensions/css/server/npm-shrinkwrap.json
@@ -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"
}
}
}
diff --git a/extensions/css/server/package.json b/extensions/css/server/package.json
index c7b93d1573f..d8112cc044a 100644
--- a/extensions/css/server/package.json
+++ b/extensions/css/server/package.json
@@ -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"
diff --git a/extensions/css/server/src/cssServerMain.ts b/extensions/css/server/src/cssServerMain.ts
index 573b4b61c5f..4b5c4e4ad2c 100644
--- a/extensions/css/server/src/cssServerMain.ts
+++ b/extensions/css/server/src/cssServerMain.ts
@@ -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 } = {};
+function getDocumentSettings(textDocument: TextDocument): Thenable {
+ 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(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 => {
diff --git a/extensions/emmet/npm-shrinkwrap.json b/extensions/emmet/npm-shrinkwrap.json
index 68b2886e6d4..d4dd5915a17 100644
--- a/extensions/emmet/npm-shrinkwrap.json
+++ b/extensions/emmet/npm-shrinkwrap.json
@@ -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",
diff --git a/extensions/emmet/package.json b/extensions/emmet/package.json
index f9266ef067a..7bf1a1213b9 100644
--- a/extensions/emmet/package.json
+++ b/extensions/emmet/package.json
@@ -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"
diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts
index 399d3807833..624a486729c 100644
--- a/extensions/emmet/src/abbreviationActions.ts
+++ b/extensions/emmet/src/abbreviationActions.ts
@@ -95,10 +95,7 @@ export function expandEmmetAbbreviation(args): Thenable {
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)) {
diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts
index 28adbadfb7a..cadfd8ef380 100644
--- a/extensions/emmet/src/defaultCompletionProvider.ts
+++ b/extensions/emmet/src/defaultCompletionProvider.ts
@@ -72,9 +72,13 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
const currentHtmlNode = 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;
+ }
}
}
diff --git a/extensions/emmet/src/util.ts b/extensions/emmet/src/util.ts
index 3eee4a0dba9..1f6d03e2458 100644
--- a/extensions/emmet/src/util.ts
+++ b/extensions/emmet/src/util.ts
@@ -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;
diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts
index c0526029e91..ccba5abd79b 100644
--- a/extensions/git/src/commands.ts
+++ b/extensions/git/src/commands.ts
@@ -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';
@@ -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");
diff --git a/extensions/html/client/src/htmlMain.ts b/extensions/html/client/src/htmlMain.ts
index 7f4c9fe3440..82a1d0ffc59 100644
--- a/extensions/html/client/src/htmlMain.ts
+++ b/extensions/html/client/src/htmlMain.ts
@@ -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(() => {
diff --git a/extensions/html/npm-shrinkwrap.json b/extensions/html/npm-shrinkwrap.json
index 7fee667332b..9dc0cf34176 100644
--- a/extensions/html/npm-shrinkwrap.json
+++ b/extensions/html/npm-shrinkwrap.json
@@ -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"
}
}
-}
\ No newline at end of file
+}
diff --git a/extensions/html/package.json b/extensions/html/package.json
index f79ac361538..a06789f08a2 100644
--- a/extensions/html/package.json
+++ b/extensions/html/package.json
@@ -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"
}
-}
\ No newline at end of file
+}
diff --git a/extensions/html/server/npm-shrinkwrap.json b/extensions/html/server/npm-shrinkwrap.json
index ee83f51e71e..8853dfc48b4 100644
--- a/extensions/html/server/npm-shrinkwrap.json
+++ b/extensions/html/server/npm-shrinkwrap.json
@@ -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"
}
}
}
diff --git a/extensions/html/server/package.json b/extensions/html/server/package.json
index 5284d547143..3fe6263139d 100644
--- a/extensions/html/server/package.json
+++ b/extensions/html/server/package.json
@@ -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"
}
}
diff --git a/extensions/html/server/src/htmlServerMain.ts b/extensions/html/server/src/htmlServerMain.ts
index 0ea5b627424..c29012bd8b1 100644
--- a/extensions/html/server/src/htmlServerMain.ts
+++ b/extensions/html/server/src/htmlServerMain.ts
@@ -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 } = {};
+
+function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings: () => boolean): Thenable {
+ 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 = 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 => {
diff --git a/extensions/html/server/src/modes/cssMode.ts b/extensions/html/server/src/modes/cssMode.ts
index b813c59f572..bcaa48391d9 100644
--- a/extensions/html/server/src/modes/cssMode.ts
+++ b/extensions/html/server/src/modes/cssMode.ts
@@ -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): LanguageMode {
@@ -22,9 +22,9 @@ export function getCSSMode(documentRegions: LanguageModelCache(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 {
diff --git a/extensions/html/server/src/modes/javascriptMode.ts b/extensions/html/server/src/modes/javascriptMode.ts
index b9cd9075b20..128969d0140 100644
--- a/extensions/html/server/src/modes/javascriptMode.ts
+++ b/extensions/html/server/src/modes/javascriptMode.ts
@@ -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;
+}
+
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;
diff --git a/extensions/html/server/src/test/formatting.test.ts b/extensions/html/server/src/test/formatting.test.ts
index ea4ecf33153..713d2943ed4 100644
--- a/extensions/html/server/src/test/formatting.test.ts
+++ b/extensions/html/server/src/test/formatting.test.ts
@@ -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);
diff --git a/extensions/html/server/src/test/javascriptMode.test.ts b/extensions/html/server/src/test/javascriptMode.test.ts
index 8b231644ee5..c5d44e88cae 100644
--- a/extensions/html/server/src/test/javascriptMode.test.ts
+++ b/extensions/html/server/src/test/javascriptMode.test.ts
@@ -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';
diff --git a/extensions/markdown/syntaxes/gulpfile.js b/extensions/markdown/syntaxes/gulpfile.js
index 6bd6851cb01..e04c73fe1d1 100644
--- a/extensions/markdown/syntaxes/gulpfile.js
+++ b/extensions/markdown/syntaxes/gulpfile.js
@@ -68,7 +68,7 @@ const fencedCodeBlockDefinition = (name, identifiers, sourceScope) => {
return `fenced_code_block_${name}
begin
- (^|\\G)(\\s*)(\`{3,}|~{3,})\\s*((${identifiers.join('|')})(\\s+[^\`~]*)?$)
+ (^|\\G)(\\s*)(\`{3,}|~{3,})\\s*(?i:(${identifiers.join('|')})(\\s+[^\`~]*)?$)
name
markup.fenced_code.block.markdown
end
diff --git a/extensions/markdown/syntaxes/markdown.tmLanguage b/extensions/markdown/syntaxes/markdown.tmLanguage
index ede4f2a2d18..552aec21007 100644
--- a/extensions/markdown/syntaxes/markdown.tmLanguage
+++ b/extensions/markdown/syntaxes/markdown.tmLanguage
@@ -588,7 +588,7 @@
fenced_code_block_css
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((css|css.erb)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(css|css.erb)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -639,7 +639,7 @@
fenced_code_block_basic
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -690,7 +690,7 @@
fenced_code_block_ini
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((ini|conf)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(ini|conf)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -741,7 +741,7 @@
fenced_code_block_java
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((java|bsh)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(java|bsh)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -792,7 +792,7 @@
fenced_code_block_lua
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((lua)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(lua)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -843,7 +843,7 @@
fenced_code_block_makefile
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -894,7 +894,7 @@
fenced_code_block_perl
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((perl|pl|pm|pod|t|PL|psgi|vcl)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(perl|pl|pm|pod|t|PL|psgi|vcl)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -945,7 +945,7 @@
fenced_code_block_r
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((R|r|s|S|Rprofile)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(R|r|s|S|Rprofile)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -996,7 +996,7 @@
fenced_code_block_ruby
begin
- (^|\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+[^`~]*)?$)
+ (^|\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+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1047,7 +1047,7 @@
fenced_code_block_php
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1102,7 +1102,7 @@
fenced_code_block_sql
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((sql|ddl|dml)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(sql|ddl|dml)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1153,7 +1153,7 @@
fenced_code_block_vs_net
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((vb)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(vb)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1204,7 +1204,7 @@
fenced_code_block_xml
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1255,7 +1255,7 @@
fenced_code_block_xsl
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((xsl|xslt)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(xsl|xslt)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1306,7 +1306,7 @@
fenced_code_block_yaml
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((yaml|yml)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(yaml|yml)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1357,7 +1357,7 @@
fenced_code_block_dosbatch
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((bat|batch)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(bat|batch)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1408,7 +1408,7 @@
fenced_code_block_clojure
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((clj|cljs|clojure)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(clj|cljs|clojure)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1459,7 +1459,7 @@
fenced_code_block_coffee
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((coffee|Cakefile|coffee.erb)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(coffee|Cakefile|coffee.erb)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1510,7 +1510,7 @@
fenced_code_block_c
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((c|h)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(c|h)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1561,7 +1561,7 @@
fenced_code_block_cpp
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((cpp|c\+\+|cxx)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(cpp|c\+\+|cxx)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1612,7 +1612,7 @@
fenced_code_block_diff
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((patch|diff|rej)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(patch|diff|rej)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1663,7 +1663,7 @@
fenced_code_block_dockerfile
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((dockerfile|Dockerfile)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(dockerfile|Dockerfile)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1714,7 +1714,7 @@
fenced_code_block_git_commit
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((COMMIT_EDITMSG|MERGE_MSG)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(COMMIT_EDITMSG|MERGE_MSG)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1765,7 +1765,7 @@
fenced_code_block_git_rebase
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((git-rebase-todo)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(git-rebase-todo)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1816,7 +1816,7 @@
fenced_code_block_go
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((go|golang)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(go|golang)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1867,7 +1867,7 @@
fenced_code_block_groovy
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((groovy|gvy)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(groovy|gvy)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1918,7 +1918,7 @@
fenced_code_block_jade
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((jade|pug)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(jade|pug)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -1969,7 +1969,7 @@
fenced_code_block_js
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((js|jsx|javascript|es6|mjs)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(js|jsx|javascript|es6|mjs)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2020,7 +2020,7 @@
fenced_code_block_js_regexp
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((regexp)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(regexp)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2071,7 +2071,7 @@
fenced_code_block_json
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2122,7 +2122,7 @@
fenced_code_block_less
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((less)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(less)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2173,7 +2173,7 @@
fenced_code_block_objc
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((objectivec|objective-c|mm|objc|obj-c|m|h)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(objectivec|objective-c|mm|objc|obj-c|m|h)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2224,7 +2224,7 @@
fenced_code_block_scss
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((scss)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(scss)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2275,7 +2275,7 @@
fenced_code_block_perl6
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((perl6|p6|pl6|pm6|nqp)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(perl6|p6|pl6|pm6|nqp)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2326,7 +2326,7 @@
fenced_code_block_powershell
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((powershell|ps1|psm1|psd1)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(powershell|ps1|psm1|psd1)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2377,7 +2377,7 @@
fenced_code_block_python
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2428,7 +2428,7 @@
fenced_code_block_regexp_python
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((re)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(re)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2479,7 +2479,7 @@
fenced_code_block_rust
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((rust|rs)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(rust|rs)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2530,7 +2530,7 @@
fenced_code_block_scala
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((scala|sbt)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(scala|sbt)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2581,7 +2581,7 @@
fenced_code_block_shell
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2632,7 +2632,7 @@
fenced_code_block_ts
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((typescript|ts)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(typescript|ts)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2683,7 +2683,7 @@
fenced_code_block_tsx
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((tsx)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(tsx)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2734,7 +2734,7 @@
fenced_code_block_csharp
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((cs|csharp|c#)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(cs|csharp|c#)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
@@ -2785,7 +2785,7 @@
fenced_code_block_fsharp
begin
- (^|\G)(\s*)(`{3,}|~{3,})\s*((fs|fsharp|f#)(\s+[^`~]*)?$)
+ (^|\G)(\s*)(`{3,}|~{3,})\s*(?i:(fs|fsharp|f#)(\s+[^`~]*)?$)
name
markup.fenced_code.block.markdown
end
diff --git a/extensions/npm-shrinkwrap.json b/extensions/npm-shrinkwrap.json
index 4ffcfc354c6..149c711b4e7 100644
--- a/extensions/npm-shrinkwrap.json
+++ b/extensions/npm-shrinkwrap.json
@@ -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"
}
}
}
diff --git a/extensions/package.json b/extensions/package.json
index 834e7ca2131..102d1ef27d5 100644
--- a/extensions/package.json
+++ b/extensions/package.json
@@ -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"
diff --git a/extensions/python/syntaxes/MagicPython.tmLanguage.json b/extensions/python/syntaxes/MagicPython.tmLanguage.json
index 3a9f24cc41e..812ddf97357 100644
--- a/extensions/python/syntaxes/MagicPython.tmLanguage.json
+++ b/extensions/python/syntaxes/MagicPython.tmLanguage.json
@@ -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": "(\\#)",
diff --git a/extensions/python/syntaxes/MagicRegExp.tmLanguage.json b/extensions/python/syntaxes/MagicRegExp.tmLanguage.json
index c6c74610836..0de066f3677 100644
--- a/extensions/python/syntaxes/MagicRegExp.tmLanguage.json
+++ b/extensions/python/syntaxes/MagicRegExp.tmLanguage.json
@@ -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": [
{
diff --git a/extensions/python/test/colorize-results/test_py.json b/extensions/python/test/colorize-results/test_py.json
index 5d58f2c7297..b456114b1ed 100644
--- a/extensions/python/test/colorize-results/test_py.json
+++ b/extensions/python/test/colorize-results/test_py.json
@@ -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",
diff --git a/extensions/theme-defaults/themes/dark_vs.json b/extensions/theme-defaults/themes/dark_vs.json
index 02e12514b26..4dd90c71801 100644
--- a/extensions/theme-defaults/themes/dark_vs.json
+++ b/extensions/theme-defaults/themes/dark_vs.json
@@ -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"
diff --git a/extensions/theme-defaults/themes/hc_black_defaults.json b/extensions/theme-defaults/themes/hc_black_defaults.json
index fe0b672d312..986fa7cf615 100644
--- a/extensions/theme-defaults/themes/hc_black_defaults.json
+++ b/extensions/theme-defaults/themes/hc_black_defaults.json
@@ -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"
diff --git a/extensions/theme-defaults/themes/light_vs.json b/extensions/theme-defaults/themes/light_vs.json
index a1d9f797f64..162c32f6218 100644
--- a/extensions/theme-defaults/themes/light_vs.json
+++ b/extensions/theme-defaults/themes/light_vs.json
@@ -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"
diff --git a/extensions/typescript/package.nls.json b/extensions/typescript/package.nls.json
index 49d28876e2e..b25953666f6 100644
--- a/extensions/typescript/package.nls.json
+++ b/extensions/typescript/package.nls.json
@@ -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.",
diff --git a/extensions/typescript/src/features/bufferSyncSupport.ts b/extensions/typescript/src/features/bufferSyncSupport.ts
index e76816e5b8f..975d4e9f529 100644
--- a/extensions/typescript/src/features/bufferSyncSupport.ts
+++ b/extensions/typescript/src/features/bufferSyncSupport.ts
@@ -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);
}
diff --git a/extensions/typescript/src/features/completionItemProvider.ts b/extensions/typescript/src/features/completionItemProvider.ts
index 90a3f56b30e..db06b46cbc2 100644
--- a/extensions/typescript/src/features/completionItemProvider.ts
+++ b/extensions/typescript/src/features/completionItemProvider.ts
@@ -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':
diff --git a/extensions/typescript/src/features/documentSymbolProvider.ts b/extensions/typescript/src/features/documentSymbolProvider.ts
index 9fbaf64fc80..456776cf3a6 100644
--- a/extensions/typescript/src/features/documentSymbolProvider.ts
+++ b/extensions/typescript/src/features/documentSymbolProvider.ts
@@ -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]))
);
diff --git a/extensions/typescript/src/features/refactorProvider.ts b/extensions/typescript/src/features/refactorProvider.ts
index 4e930e09d80..1b9062998b5 100644
--- a/extensions/typescript/src/features/refactorProvider.ts
+++ b/extensions/typescript/src/features/refactorProvider.ts
@@ -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;
}
}
\ No newline at end of file
diff --git a/extensions/typescript/src/features/taskProvider.ts b/extensions/typescript/src/features/taskProvider.ts
index 9ece0fc2119..4eb9a3e4e43 100644
--- a/extensions/typescript/src/features/taskProvider.ts
+++ b/extensions/typescript/src/features/taskProvider.ts
@@ -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
}];
}
diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts
index 5d4a89d93ba..036b130adab 100644
--- a/extensions/typescript/src/typescriptMain.ts
+++ b/extensions/typescript/src/typescriptMain.ts
@@ -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 }
}
]
}));
diff --git a/extensions/typescript/src/typescriptService.ts b/extensions/typescript/src/typescriptService.ts
index f0d5f5e2501..1a4d1340507 100644
--- a/extensions/typescript/src/typescriptService.ts
+++ b/extensions/typescript/src/typescriptService.ts
@@ -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;
execute(command: 'open', args: Proto.OpenRequestArgs, expectedResult: boolean, token?: CancellationToken): Promise;
execute(command: 'close', args: Proto.FileRequestArgs, expectedResult: boolean, token?: CancellationToken): Promise;
diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts
index bf68bc742f9..091abda60d1 100644
--- a/extensions/typescript/src/typescriptServiceClient.ts
+++ b/extensions/typescript/src/typescriptServiceClient.ts
@@ -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('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()) {
diff --git a/extensions/typescript/src/utils/api.ts b/extensions/typescript/src/utils/api.ts
index 87749afc8e8..4fa9f1d5cb5 100644
--- a/extensions/typescript/src/utils/api.ts
+++ b/extensions/typescript/src/utils/api.ts
@@ -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');
}
}
\ No newline at end of file
diff --git a/extensions/typescript/src/utils/configuration.ts b/extensions/typescript/src/utils/configuration.ts
index df3a8943643..3ff9ad9cc63 100644
--- a/extensions/typescript/src/utils/configuration.ts
+++ b/extensions/typescript/src/utils/configuration.ts
@@ -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('typescript.npm', null);
}
-}
\ No newline at end of file
+
+ private static readDisableAutomaticTypeAcquisition(configuration: WorkspaceConfiguration): boolean {
+ return configuration.get('typescript.disableAutomaticTypeAcquisition', false);
+ }
+}
diff --git a/extensions/typescript/src/utils/versionProvider.ts b/extensions/typescript/src/utils/versionProvider.ts
index 57edf0d5116..a0a61db3872 100644
--- a/extensions/typescript/src/utils/versionProvider.ts
+++ b/extensions/typescript/src/utils/versionProvider.ts
@@ -41,7 +41,7 @@ export class TypeScriptVersion {
// Allow TS developers to provide custom version
const tsdkVersion = workspace.getConfiguration().get('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;
}
}
diff --git a/extensions/typescript/test/colorize-results/test-issue5431_ts.json b/extensions/typescript/test/colorize-results/test-issue5431_ts.json
index f249e06fe47..53b90902a23 100644
--- a/extensions/typescript/test/colorize-results/test-issue5431_ts.json
+++ b/extensions/typescript/test/colorize-results/test-issue5431_ts.json
@@ -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"
}
},
{
diff --git a/extensions/typescript/test/colorize-results/test-strings_ts.json b/extensions/typescript/test/colorize-results/test-strings_ts.json
index cbf4e9dfb66..136549cfeba 100644
--- a/extensions/typescript/test/colorize-results/test-strings_ts.json
+++ b/extensions/typescript/test/colorize-results/test-strings_ts.json
@@ -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"
}
},
{
diff --git a/extensions/xml/package.json b/extensions/xml/package.json
index 9ae56b31dc5..c9210274b25 100644
--- a/extensions/xml/package.json
+++ b/extensions/xml/package.json
@@ -36,6 +36,7 @@
".proj",
".props",
".pt",
+ ".publishsettings",
".pubxml",
".pubxml.user",
".rdf",
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index 1112f9fcfdb..32ae19faf07 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -296,9 +296,9 @@
"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",
@@ -567,9 +567,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",
diff --git a/package.json b/package.json
index 7b42390564c..60932fa6fc4 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"keytar": "^4.0.3",
"minimist": "1.2.0",
"native-keymap": "1.2.4",
- "native-watchdog": "0.1.0",
+ "native-watchdog": "0.2.0",
"node-pty": "0.6.9",
"nsfw": "1.0.16",
"semver": "4.3.6",
@@ -44,7 +44,7 @@
"vscode-ripgrep": "0.0.25",
"vscode-textmate": "^3.1.5",
"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": {
diff --git a/src/bootstrap.js b/src/bootstrap.js
index 3f94abadd31..dad68bf5c80 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -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']);
\ No newline at end of file
+require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']);
diff --git a/src/typings/xterm.d.ts b/src/typings/xterm.d.ts
index 08c24dcd70c..f182fce6bdb 100644
--- a/src/typings/xterm.d.ts
+++ b/src/typings/xterm.d.ts
@@ -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;
-}
\ No newline at end of file
+ }
diff --git a/src/vs/base/common/color.ts b/src/vs/base/common/color.ts
index 37b6cc08681..217dc4b426e 100644
--- a/src/vs/base/common/color.ts
+++ b/src/vs/base/common/color.ts
@@ -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
diff --git a/src/vs/base/common/errors.ts b/src/vs/base/common/errors.ts
index 743e88c5946..18d8cad519c 100644
--- a/src/vs/base/common/errors.ts
+++ b/src/vs/base/common/errors.ts
@@ -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(promise: TPromise): TPromise {
- return promise.then(null, onUnexpectedError);
+export function onUnexpectedPromiseError(promise: TPromise): TPromise {
+ 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';
/**
diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts
index ca5661ad764..6687e3b9e2f 100644
--- a/src/vs/base/common/labels.ts
+++ b/src/vs/base/common/labels.ts
@@ -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
diff --git a/src/vs/base/common/map.ts b/src/vs/base/common/map.ts
index 560103a08c6..003e893e7f8 100644
--- a/src/vs/base/common/map.ts
+++ b/src/vs/base/common/map.ts
@@ -238,7 +238,7 @@ export class TrieMap {
private readonly _splitter: (s: string) => string[];
private _root = new Node();
- constructor(splitter: (s: string) => string[]) {
+ constructor(splitter: (s: string) => string[] = TrieMap.PathSplitter) {
this._splitter = s => splitter(s).filter(s => Boolean(s));
}
diff --git a/src/vs/base/common/strings.ts b/src/vs/base/common/strings.ts
index cd2254d3950..7af18aadcb6 100644
--- a/src/vs/base/common/strings.ts
+++ b/src/vs/base/common/strings.ts
@@ -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;
diff --git a/src/vs/base/common/winjs.base.d.ts b/src/vs/base/common/winjs.base.d.ts
index bb8ebf440d5..434db0a5fa8 100644
--- a/src/vs/base/common/winjs.base.d.ts
+++ b/src/vs/base/common/winjs.base.d.ts
@@ -4,110 +4,47 @@
*--------------------------------------------------------------------------------------------*/
/// Interfaces for WinJS
-export interface ValueCallback {
- (value: any): any;
-}
+export type ErrorCallback = (error: any) => void;
+export type ProgressCallback = (progress: TProgress) => void;
-export interface EventCallback {
- (value: any): void;
-}
+export declare class Promise {
+ constructor(
+ executor: (
+ resolve: (value: T | PromiseLike) => void,
+ reject: (reason: any) => void,
+ progress: (progress: TProgress) => void) => void,
+ oncancel?: () => void);
-export interface ErrorCallback {
- (error: any): any;
-}
+ public then(
+ onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null,
+ onrejected?: ((reason: any) => TResult2 | PromiseLike) | null,
+ onprogress?: (progress: TProgress) => void): Promise;
-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;
- // static addEventListener(type: string, fn: EventCallback): void;
-
- public then(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): Promise;
- // public then(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): TPromise;
- public done(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): void;
- public cancel(): void;
-}
-
-/**
- * The value callback to complete a promise
- */
-export interface TValueCallback {
- (value: T | Thenable): void;
-}
-
-
-export interface TProgressCallback {
- (progress: T): void;
-}
-
-interface IPromiseErrorDetail {
- parent: TPromise;
- error: any;
- id: number;
- handler: Function;
- exception: Error;
-}
-
-interface IPromiseError {
- detail: IPromiseErrorDetail;
-}
-
-/**
- * A Promise implementation that supports progress and cancelation.
- */
-export declare class TPromise {
-
- constructor(init: (complete: TValueCallback, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any);
-
- public then(success?: (value: V) => TPromise, error?: (err: any) => TPromise, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise, error?: (err: any) => TPromise | U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise, error?: (err: any) => U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise, error?: (err: any) => void, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise | U, error?: (err: any) => TPromise, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise | U, error?: (err: any) => TPromise | U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise | U, error?: (err: any) => U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => TPromise | U, error?: (err: any) => void, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => U, error?: (err: any) => TPromise, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => U, error?: (err: any) => TPromise | U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise;
- public then(success?: (value: V) => U, error?: (err: any) => void, progress?: ProgressCallback): TPromise;
-
- public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void;
public cancel(): void;
- public static as(value: null): TPromise;
- public static as(value: undefined): TPromise;
- public static as(value: TPromise): TPromise;
- public static as(value: Thenable): Thenable;
- public static as(value: ValueType): TPromise;
+ public static as(value: null): Promise;
+ public static as(value: undefined): Promise;
+ public static as>(value: TPromise): TPromise;
+ public static as(value: T): Promise;
- public static is(value: any): value is Thenable;
- public static timeout(delay: number): TPromise;
- public static join(promises: TPromise[]): TPromise;
- public static join(promises: Thenable[]): Thenable;
- public static join(promises: { [n: string]: TPromise }): TPromise<{ [n: string]: ValueType }>;
- public static any(promises: TPromise[]): TPromise<{ key: string; value: TPromise; }>;
+ public static is(value: any): value is PromiseLike;
- public static wrap(value: Thenable): TPromise;
- public static wrap(value: ValueType): TPromise;
+ public static timeout(delay: number): Promise;
- public static wrapError(error: Error): TPromise;
+ public static join(promises: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>;
+ public static join(promises: (T | PromiseLike)[]): Promise;
+ public static join(promises: { [n: string]: T | PromiseLike }): Promise<{ [n: string]: T }>;
+
+ public static any(promises: (T | PromiseLike)[]): Promise<{ key: string; value: Promise; }>;
+
+ public static wrap(value: T | PromiseLike): Promise;
+
+ public static wrapError(error: Error): Promise;
/**
* @internal
@@ -115,25 +52,23 @@ export declare class TPromise {
public static addEventListener(event: 'error', promiseErrorHandler: (e: IPromiseError) => void);
}
-// --- Generic promise with generic progress value
-export declare class PPromise extends TPromise {
+export type TValueCallback = (value: T | PromiseLike) => void;
- constructor(init: (complete: TValueCallback, error: (err: any) => void, progress: TProgressCallback) => void, oncancel?: any);
+export {
+ Promise as TPromise,
+ Promise as PPromise,
+ TValueCallback as ValueCallback,
+ ProgressCallback as TProgressCallback
+};
- public then(success?: (value: C) => PPromise, error?: (err: any) => PPromise, progress?: (value: P) => void): PPromise;
- public then(success?: (value: C) => PPromise, error?: (err: any) => U, progress?: (value: P) => void): PPromise;
- public then(success?: (value: C) => PPromise, error?: (err: any) => void, progress?: (value: P) => void): PPromise;
- public then(success?: (value: C) => U, error?: (err: any) => PPromise, progress?: (value: P) => void): PPromise;
- public then(success?: (value: C) => U, error?: (err: any) => U, progress?: (value: P) => void): PPromise;
- public then(success?: (value: C) => U, error?: (err: any) => void, progress?: (value: P) => void): PPromise;
-
- public done(success?: (value: C) => void, error?: (err: any) => any, progress?: (value: P) => void): void;
- public cancel(): void;
-
- public static as(value: V): TPromise;
- public static timeout(delay: number): PPromise;
- public static join