From 4c252bc80e85c15973f317113f5ed2fff6d085b5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 16 Sep 2018 12:54:24 +0300 Subject: [PATCH 001/819] rename all things --- rust-analyzer/editors/code/.gitignore | 4 + .../editors/code/.vscode/launch.json | 36 + .../editors/code/.vscode/settings.json | 11 + rust-analyzer/editors/code/.vscode/tasks.json | 20 + rust-analyzer/editors/code/.vscodeignore | 9 + rust-analyzer/editors/code/package-lock.json | 2419 +++++++++++++++++ rust-analyzer/editors/code/package.json | 149 + rust-analyzer/editors/code/src/extension.ts | 400 +++ rust-analyzer/editors/code/tsconfig.json | 17 + 9 files changed, 3065 insertions(+) create mode 100644 rust-analyzer/editors/code/.gitignore create mode 100644 rust-analyzer/editors/code/.vscode/launch.json create mode 100644 rust-analyzer/editors/code/.vscode/settings.json create mode 100644 rust-analyzer/editors/code/.vscode/tasks.json create mode 100644 rust-analyzer/editors/code/.vscodeignore create mode 100644 rust-analyzer/editors/code/package-lock.json create mode 100644 rust-analyzer/editors/code/package.json create mode 100644 rust-analyzer/editors/code/src/extension.ts create mode 100644 rust-analyzer/editors/code/tsconfig.json diff --git a/rust-analyzer/editors/code/.gitignore b/rust-analyzer/editors/code/.gitignore new file mode 100644 index 00000000..5fe00fea --- /dev/null +++ b/rust-analyzer/editors/code/.gitignore @@ -0,0 +1,4 @@ +out +node_modules +.vscode-test/ +*.vsix diff --git a/rust-analyzer/editors/code/.vscode/launch.json b/rust-analyzer/editors/code/.vscode/launch.json new file mode 100644 index 00000000..c174db30 --- /dev/null +++ b/rust-analyzer/editors/code/.vscode/launch.json @@ -0,0 +1,36 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ], + "preLaunchTask": "npm: watch" + }, + { + "name": "Extension Tests", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionTestsPath=${workspaceFolder}/out/test" + ], + "outFiles": [ + "${workspaceFolder}/out/test/**/*.js" + ], + "preLaunchTask": "npm: watch" + } + ] +} diff --git a/rust-analyzer/editors/code/.vscode/settings.json b/rust-analyzer/editors/code/.vscode/settings.json new file mode 100644 index 00000000..30bf8c2d --- /dev/null +++ b/rust-analyzer/editors/code/.vscode/settings.json @@ -0,0 +1,11 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "files.exclude": { + "out": false // set this to true to hide the "out" folder with the compiled JS files + }, + "search.exclude": { + "out": true // set this to false to include "out" folder in search results + }, + // Turn off tsc task auto detection since we have the necessary tasks as npm scripts + "typescript.tsc.autoDetect": "off" +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/.vscode/tasks.json b/rust-analyzer/editors/code/.vscode/tasks.json new file mode 100644 index 00000000..604e38f5 --- /dev/null +++ b/rust-analyzer/editors/code/.vscode/tasks.json @@ -0,0 +1,20 @@ +// See https://go.microsoft.com/fwlink/?LinkId=733558 +// for the documentation about the tasks.json format +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore new file mode 100644 index 00000000..85571789 --- /dev/null +++ b/rust-analyzer/editors/code/.vscodeignore @@ -0,0 +1,9 @@ +.vscode/** +.vscode-test/** +out/test/** +out/**/*.map +src/** +.gitignore +tsconfig.json +vsc-extension-quickstart.md +tslint.json \ No newline at end of file diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json new file mode 100644 index 00000000..594a10b5 --- /dev/null +++ b/rust-analyzer/editors/code/package-lock.json @@ -0,0 +1,2419 @@ +{ + "name": "ra-lsp", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/mocha": { + "version": "2.2.48", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz", + "integrity": "sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw==", + "dev": true + }, + "@types/node": { + "version": "8.10.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.29.tgz", + "integrity": "sha512-zbteaWZ2mdduacm0byELwtRyhYE40aK+pAanQk415gr1eRuu67x7QGOLmn8jz5zI8LDK7d0WI/oT6r5Trz4rzQ==", + "dev": true + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.3" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "cheerio": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz", + "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", + "dev": true, + "requires": { + "css-select": "1.2.0", + "dom-serializer": "0.1.0", + "entities": "1.1.1", + "htmlparser2": "3.9.2", + "lodash": "4.17.11", + "parse5": "3.0.3" + } + }, + "clone": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", + "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "process-nextick-args": "2.0.0", + "readable-stream": "2.3.6" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", + "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "1.0.0", + "css-what": "2.1.0", + "domutils": "1.5.1", + "nth-check": "1.0.1" + } + }, + "css-what": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", + "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-assign": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "denodeify": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", + "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", + "dev": true + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "1.1.3", + "entities": "1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "requires": { + "domelementtype": "1.3.0" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" + } + }, + "duplexer": { + "version": "0.1.1", + "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "duplexify": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1", + "safer-buffer": "2.1.2" + } + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "event-stream": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz", + "integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "flatmap-stream": "0.1.0", + "from": "0.1.7", + "map-stream": "0.0.7", + "pause-stream": "0.0.11", + "split": "1.0.1", + "stream-combiner": "0.2.2", + "through": "2.3.8" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.4" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "1.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "1.2.0" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "3.1.0", + "repeat-element": "1.1.3", + "repeat-string": "1.6.1" + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", + "dev": true + }, + "flatmap-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.0.tgz", + "integrity": "sha512-Nlic4ZRYxikqnK5rj3YoxDVKGGtUjcNDUtvQ7XsdGLZmMwdUYnXf10o1zcXtzEZTBgc6GxeRpQxV/Wu3WPIIHA==", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.20" + } + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + }, + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + } + }, + "glob-stream": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-5.3.5.tgz", + "integrity": "sha1-pVZlqajM3EGRWofHAeMtTgFvrSI=", + "dev": true, + "requires": { + "extend": "3.0.2", + "glob": "5.0.15", + "glob-parent": "3.1.0", + "micromatch": "2.3.11", + "ordered-read-streams": "0.3.0", + "through2": "0.6.5", + "to-absolute-glob": "0.1.1", + "unique-stream": "2.2.1" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "gulp-chmod": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/gulp-chmod/-/gulp-chmod-2.0.0.tgz", + "integrity": "sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw=", + "dev": true, + "requires": { + "deep-assign": "1.0.0", + "stat-mode": "0.2.2", + "through2": "2.0.3" + } + }, + "gulp-filter": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/gulp-filter/-/gulp-filter-5.1.0.tgz", + "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", + "dev": true, + "requires": { + "multimatch": "2.1.0", + "plugin-error": "0.1.2", + "streamfilter": "1.0.7" + } + }, + "gulp-gunzip": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulp-gunzip/-/gulp-gunzip-1.0.0.tgz", + "integrity": "sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak=", + "dev": true, + "requires": { + "through2": "0.6.5", + "vinyl": "0.4.6" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + } + } + }, + "gulp-remote-src-vscode": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/gulp-remote-src-vscode/-/gulp-remote-src-vscode-0.5.0.tgz", + "integrity": "sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ==", + "dev": true, + "requires": { + "event-stream": "3.3.6", + "node.extend": "1.1.6", + "request": "2.88.0", + "through2": "2.0.3", + "vinyl": "2.2.0" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" + } + } + } + }, + "gulp-sourcemaps": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz", + "integrity": "sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw=", + "dev": true, + "requires": { + "convert-source-map": "1.6.0", + "graceful-fs": "4.1.11", + "strip-bom": "2.0.0", + "through2": "2.0.3", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "gulp-symdest": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/gulp-symdest/-/gulp-symdest-1.1.0.tgz", + "integrity": "sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA=", + "dev": true, + "requires": { + "event-stream": "3.3.6", + "mkdirp": "0.5.1", + "queue": "3.1.0", + "vinyl-fs": "2.4.4" + } + }, + "gulp-untar": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/gulp-untar/-/gulp-untar-0.0.7.tgz", + "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", + "dev": true, + "requires": { + "event-stream": "3.3.6", + "streamifier": "0.1.1", + "tar": "2.2.1", + "through2": "2.0.3", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "gulp-vinyl-zip": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.0.tgz", + "integrity": "sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0=", + "dev": true, + "requires": { + "event-stream": "3.3.6", + "queue": "4.5.0", + "through2": "2.0.3", + "vinyl": "2.2.0", + "vinyl-fs": "2.4.4", + "yauzl": "2.10.0", + "yazl": "2.4.3" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "queue": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.0.tgz", + "integrity": "sha512-DwxpAnqJuoQa+wyDgQuwkSshkhlqIlWEvwvdAY27fDPunZ2cVJzXU4JyjY+5l7zs7oGLaYAQm4MbLOVFAHFBzA==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true, + "requires": { + "domelementtype": "1.3.0", + "domhandler": "2.4.2", + "domutils": "1.5.1", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.2" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", + "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-valid-glob": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-0.3.0.tgz", + "integrity": "sha1-1LVcafUYhvm2XHDWwmItN+KfSP4=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + }, + "lazystream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", + "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "dev": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "linkify-it": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.0.3.tgz", + "integrity": "sha1-2UpGSPmxwXnWT6lykSaL22zpQ08=", + "dev": true, + "requires": { + "uc.micro": "1.0.5" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "dev": true + }, + "map-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", + "dev": true + }, + "markdown-it": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", + "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", + "dev": true, + "requires": { + "argparse": "1.0.10", + "entities": "1.1.1", + "linkify-it": "2.0.3", + "mdurl": "1.0.1", + "uc.micro": "1.0.5" + } + }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "dev": true + }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "dev": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "1.36.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", + "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multimatch": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", + "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "dev": true, + "requires": { + "array-differ": "1.0.0", + "array-union": "1.0.2", + "arrify": "1.0.1", + "minimatch": "3.0.4" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "node.extend": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.6.tgz", + "integrity": "sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y=", + "dev": true, + "requires": { + "is": "3.2.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "nth-check": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", + "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "dev": true, + "requires": { + "boolbase": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "ordered-read-streams": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz", + "integrity": "sha1-cTfmmzKYuzQiR6G77jiByA4v14s=", + "dev": true, + "requires": { + "is-stream": "1.1.0", + "readable-stream": "2.3.6" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + } + } + }, + "parse-semver": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", + "dev": true, + "requires": { + "semver": "5.5.1" + } + }, + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "dev": true, + "requires": { + "@types/node": "8.10.29" + } + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pause-stream": { + "version": "0.0.11", + "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" + } + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "querystringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", + "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", + "dev": true + }, + "queue": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/queue/-/queue-3.1.0.tgz", + "integrity": "sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "randomatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", + "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", + "dev": true, + "requires": { + "is-number": "4.0.0", + "kind-of": "6.0.2", + "math-random": "1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", + "dev": true, + "requires": { + "mute-stream": "0.0.7" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.8.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.2", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.1.0", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.20", + "oauth-sign": "0.9.0", + "performance-now": "2.1.0", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.4.3", + "tunnel-agent": "0.6.0", + "uuid": "3.3.2" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "1.1.1", + "source-map": "0.6.1" + } + }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, + "requires": { + "asn1": "0.2.4", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.2", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.2", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "safer-buffer": "2.1.2", + "tweetnacl": "0.14.5" + } + }, + "stat-mode": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz", + "integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI=", + "dev": true + }, + "stream-combiner": { + "version": "0.2.2", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "through": "2.3.8" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "streamfilter": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/streamfilter/-/streamfilter-1.0.7.tgz", + "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", + "dev": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "streamifier": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", + "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-bom-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz", + "integrity": "sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4=", + "dev": true, + "requires": { + "first-chunk-stream": "1.0.0", + "strip-bom": "2.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "dev": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "through": { + "version": "2.3.8", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.3.6", + "xtend": "4.0.1" + } + }, + "through2-filter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", + "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", + "dev": true, + "requires": { + "through2": "2.0.3", + "xtend": "4.0.1" + } + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "to-absolute-glob": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz", + "integrity": "sha1-HN+kcqnvUMI57maZm2YsoOs5k38=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "1.1.29", + "punycode": "1.4.1" + } + }, + "tunnel": { + "version": "0.0.4", + "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "typed-rest-client": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-0.9.0.tgz", + "integrity": "sha1-92jMDcP06VDwbgSCXDaz54NKofI=", + "dev": true, + "requires": { + "tunnel": "0.0.4", + "underscore": "1.8.3" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + } + } + }, + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + }, + "uc.micro": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.5.tgz", + "integrity": "sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg==", + "dev": true + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", + "dev": true + }, + "unique-stream": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", + "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", + "dev": true, + "requires": { + "json-stable-stringify": "1.0.1", + "through2-filter": "2.0.0" + } + }, + "url-join": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", + "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", + "dev": true + }, + "url-parse": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", + "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", + "dev": true, + "requires": { + "querystringify": "2.0.0", + "requires-port": "1.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "vali-date": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz", + "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "vinyl": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "dev": true, + "requires": { + "clone": "0.2.0", + "clone-stats": "0.0.1" + } + }, + "vinyl-fs": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-2.4.4.tgz", + "integrity": "sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=", + "dev": true, + "requires": { + "duplexify": "3.6.0", + "glob-stream": "5.3.5", + "graceful-fs": "4.1.11", + "gulp-sourcemaps": "1.6.0", + "is-valid-glob": "0.3.0", + "lazystream": "1.0.0", + "lodash.isequal": "4.5.0", + "merge-stream": "1.0.1", + "mkdirp": "0.5.1", + "object-assign": "4.1.1", + "readable-stream": "2.3.6", + "strip-bom": "2.0.0", + "strip-bom-stream": "1.0.0", + "through2": "2.0.3", + "through2-filter": "2.0.0", + "vali-date": "1.0.0", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "vinyl-source-stream": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-1.1.2.tgz", + "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", + "dev": true, + "requires": { + "through2": "2.0.3", + "vinyl": "0.4.6" + } + }, + "vsce": { + "version": "1.48.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.48.0.tgz", + "integrity": "sha512-1qJn6QLRTu26FIvvMbK/gzHLLdxJVTg9CUTSnCjJHObCCF5CQ0F3FUv7t+5cT7i0J5v5YljrsRY09u7dPBcEnA==", + "dev": true, + "requires": { + "cheerio": "1.0.0-rc.2", + "commander": "2.18.0", + "denodeify": "1.2.1", + "glob": "7.1.3", + "lodash": "4.17.11", + "markdown-it": "8.4.2", + "mime": "1.6.0", + "minimatch": "3.0.4", + "osenv": "0.1.5", + "parse-semver": "1.1.1", + "read": "1.0.7", + "semver": "5.5.1", + "tmp": "0.0.29", + "url-join": "1.1.0", + "vso-node-api": "6.1.2-preview", + "yauzl": "2.10.0", + "yazl": "2.4.3" + } + }, + "vscode": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.21.tgz", + "integrity": "sha512-tJl9eL15ZMm6vzCYYeQ26sSYRuXGMGPsaeIAmG2rOOYRn01jdaDg6I4b9G5Ed6FISdmn6egpKThk4o4om8Ax/A==", + "dev": true, + "requires": { + "glob": "7.1.3", + "gulp-chmod": "2.0.0", + "gulp-filter": "5.1.0", + "gulp-gunzip": "1.0.0", + "gulp-remote-src-vscode": "0.5.0", + "gulp-symdest": "1.1.0", + "gulp-untar": "0.0.7", + "gulp-vinyl-zip": "2.1.0", + "mocha": "4.1.0", + "request": "2.88.0", + "semver": "5.5.1", + "source-map-support": "0.5.9", + "url-parse": "1.4.3", + "vinyl-source-stream": "1.1.2" + } + }, + "vscode-jsonrpc": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", + "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" + }, + "vscode-languageclient": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz", + "integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==", + "requires": { + "vscode-languageserver-protocol": "3.13.0" + } + }, + "vscode-languageserver-protocol": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.13.0.tgz", + "integrity": "sha512-2ZGKwI+P2ovQll2PGAp+2UfJH+FK9eait86VBUdkPd9HRlm8e58aYT9pV/NYanHOcp3pL6x2yTLVCFMcTer0mg==", + "requires": { + "vscode-jsonrpc": "4.0.0", + "vscode-languageserver-types": "3.13.0" + } + }, + "vscode-languageserver-types": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.13.0.tgz", + "integrity": "sha512-BnJIxS+5+8UWiNKCP7W3g9FlE7fErFw0ofP5BXJe7c2tl0VeWh+nNHFbwAS2vmVC4a5kYxHBjRy0UeOtziemVA==" + }, + "vso-node-api": { + "version": "6.1.2-preview", + "resolved": "https://registry.npmjs.org/vso-node-api/-/vso-node-api-6.1.2-preview.tgz", + "integrity": "sha1-qrNUbfJFHs2JTgcbuZtd8Zxfp48=", + "dev": true, + "requires": { + "q": "1.5.1", + "tunnel": "0.0.4", + "typed-rest-client": "0.9.0", + "underscore": "1.9.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "0.2.13", + "fd-slicer": "1.1.0" + } + }, + "yazl": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.4.3.tgz", + "integrity": "sha1-7CblzIfVYBud+EMtvdPNLlFzoHE=", + "dev": true, + "requires": { + "buffer-crc32": "0.2.13" + } + } + } +} diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json new file mode 100644 index 00000000..cc8fb93f --- /dev/null +++ b/rust-analyzer/editors/code/package.json @@ -0,0 +1,149 @@ +{ + "name": "ra-lsp", + "displayName": "ra-lsp", + "description": "", + "version": "0.0.1", + "publisher": "matklad", + "repository": { + "url": "https://github.com/matklad/rust-analyzer/" + }, + "categories": [ + "Other" + ], + "engines": { + "vscode": "^1.26.0" + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./", + "postinstall": "node ./node_modules/vscode/bin/install" + }, + "dependencies": { + "vscode-languageclient": "^4.4.0" + }, + "devDependencies": { + "typescript": "^2.6.1", + "vscode": "^1.1.21", + "vsce": "^1.42.0", + "@types/node": "^8.10.25", + "@types/mocha": "^2.2.42" + }, + "activationEvents": [ + "onLanguage:rust" + ], + "main": "./out/extension", + "contributes": { + "taskDefinitions": [ + { + "type": "cargo", + "required": [ + "command" + ], + "properties": { + "label": { + "type": "string" + }, + "command": { + "type": "string" + }, + "args": { + "type": "array" + }, + "env": { + "type": "object" + } + } + } + ], + "commands": [ + { + "command": "ra-lsp.createFile", + "title": "Show Rust syntax tree" + }, + { + "command": "ra-lsp.syntaxTree", + "title": "Show Rust syntax tree" + }, + { + "command": "ra-lsp.extendSelection", + "title": "Rust Extend Selection" + }, + { + "command": "ra-lsp.matchingBrace", + "title": "Rust Matching Brace" + }, + { + "command": "ra-lsp.parentModule", + "title": "Rust Parent Module" + }, + { + "command": "ra-lsp.joinLines", + "title": "Rust Join Lines" + }, + { + "command": "ra-lsp.run", + "title": "Rust Run" + } + ], + "keybindings": [ + { + "command": "ra-lsp.parentModule", + "key": "ctrl+u", + "when": "editorTextFocus && editorLangId == rust" + }, + { + "command": "ra-lsp.matchingBrace", + "key": "ctrl+shift+m", + "when": "editorTextFocus && editorLangId == rust" + }, + { + "command": "ra-lsp.extendSelection", + "key": "ctrl+w", + "when": "editorTextFocus && editorLangId == rust" + }, + { + "command": "ra-lsp.joinLines", + "key": "ctrl+shift+j", + "when": "editorTextFocus && editorLangId == rust" + }, + { + "command": "ra-lsp.run", + "key": "ctrl+r", + "when": "editorTextFocus && editorLangId == rust" + } + ], + "problemMatchers": [ + { + "name": "rustc", + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "pattern": [ + { + "regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$", + "severity": 1, + "message": 4, + "code": 3 + }, + { + "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", + "file": 2, + "line": 3, + "column": 4 + }, + { + "regexp": "^.*$" + }, + { + "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", + "file": 2, + "line": 3, + "column": 4 + } + ] + } + ] + } +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts new file mode 100644 index 00000000..2c42c07f --- /dev/null +++ b/rust-analyzer/editors/code/src/extension.ts @@ -0,0 +1,400 @@ +'use strict'; +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient' +import { DH_UNABLE_TO_CHECK_GENERATOR } from 'constants'; + + +let client: lc.LanguageClient; + +let uris = { + syntaxTree: vscode.Uri.parse('ra-lsp://syntaxtree') +} + + +export function activate(context: vscode.ExtensionContext) { + let textDocumentContentProvider = new TextDocumentContentProvider() + let dispose = (disposable: vscode.Disposable) => { + context.subscriptions.push(disposable); + } + let registerCommand = (name: string, f: any) => { + dispose(vscode.commands.registerCommand(name, f)) + } + + registerCommand('ra-lsp.syntaxTree', () => openDoc(uris.syntaxTree)) + registerCommand('ra-lsp.extendSelection', async () => { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: ExtendSelectionParams = { + textDocument: { uri: editor.document.uri.toString() }, + selections: editor.selections.map((s) => { + return client.code2ProtocolConverter.asRange(s) + }) + } + let response = await client.sendRequest("m/extendSelection", request) + editor.selections = response.selections.map((range) => { + let r = client.protocol2CodeConverter.asRange(range) + return new vscode.Selection(r.start, r.end) + }) + }) + registerCommand('ra-lsp.matchingBrace', async () => { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: FindMatchingBraceParams = { + textDocument: { uri: editor.document.uri.toString() }, + offsets: editor.selections.map((s) => { + return client.code2ProtocolConverter.asPosition(s.active) + }) + } + let response = await client.sendRequest("m/findMatchingBrace", request) + editor.selections = editor.selections.map((sel, idx) => { + let active = client.protocol2CodeConverter.asPosition(response[idx]) + let anchor = sel.isEmpty ? active : sel.anchor + return new vscode.Selection(anchor, active) + }) + editor.revealRange(editor.selection) + }) + registerCommand('ra-lsp.joinLines', async () => { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: JoinLinesParams = { + textDocument: { uri: editor.document.uri.toString() }, + range: client.code2ProtocolConverter.asRange(editor.selection), + } + let change = await client.sendRequest("m/joinLines", request) + await applySourceChange(change) + }) + registerCommand('ra-lsp.parentModule', async () => { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let response = await client.sendRequest("m/parentModule", request) + let loc = response[0] + if (loc == null) return + let uri = client.protocol2CodeConverter.asUri(loc.uri) + let range = client.protocol2CodeConverter.asRange(loc.range) + + let doc = await vscode.workspace.openTextDocument(uri) + let e = await vscode.window.showTextDocument(doc) + e.revealRange(range, vscode.TextEditorRevealType.InCenter) + }) + + let prevRunnable: RunnableQuickPick | undefined = undefined + registerCommand('ra-lsp.run', async () => { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let textDocument: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let params: RunnablesParams = { + textDocument, + position: client.code2ProtocolConverter.asPosition(editor.selection.active) + } + let runnables = await client.sendRequest('m/runnables', params) + let items: RunnableQuickPick[] = [] + if (prevRunnable) { + items.push(prevRunnable) + } + for (let r of runnables) { + if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { + continue + } + items.push(new RunnableQuickPick(r)) + } + let item = await vscode.window.showQuickPick(items) + if (item) { + item.detail = "rerun" + prevRunnable = item + let task = createTask(item.runnable) + return await vscode.tasks.executeTask(task) + } + }) + registerCommand('ra-lsp.applySourceChange', applySourceChange) + + dispose(vscode.workspace.registerTextDocumentContentProvider( + 'ra-lsp', + textDocumentContentProvider + )) + startServer() + vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => { + let doc = event.document + if (doc.languageId != "rust") return + afterLs(() => { + textDocumentContentProvider.eventEmitter.fire(uris.syntaxTree) + }) + }, null, context.subscriptions) + vscode.window.onDidChangeActiveTextEditor(async (editor) => { + if (!editor || editor.document.languageId != 'rust') return + let params: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let decorations = await client.sendRequest("m/decorationsRequest", params) + setHighlights(editor, decorations) + }) +} + +// We need to order this after LS updates, but there's no API for that. +// Hence, good old setTimeout. +function afterLs(f: () => any) { + setTimeout(f, 10) +} + +export function deactivate(): Thenable { + if (!client) { + return Promise.resolve(); + } + return client.stop(); +} + +function startServer() { + let run: lc.Executable = { + command: "ra_lsp_server", + options: { cwd: "." } + } + let serverOptions: lc.ServerOptions = { + run, + debug: run + }; + + let clientOptions: lc.LanguageClientOptions = { + documentSelector: [{ scheme: 'file', language: 'rust' }], + }; + + client = new lc.LanguageClient( + 'ra-lsp', + 'rust-analyzer languge server', + serverOptions, + clientOptions, + ); + client.onReady().then(() => { + client.onNotification( + "m/publishDecorations", + (params: PublishDecorationsParams) => { + let editor = vscode.window.visibleTextEditors.find( + (editor) => editor.document.uri.toString() == params.uri + ) + if (editor == null) return; + setHighlights( + editor, + params.decorations, + ) + } + ) + }) + client.start(); +} + +async function openDoc(uri: vscode.Uri) { + let document = await vscode.workspace.openTextDocument(uri) + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true) +} + +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { + public eventEmitter = new vscode.EventEmitter() + public syntaxTree: string = "Not available" + + public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { + let editor = vscode.window.activeTextEditor; + if (editor == null) return "" + let request: SyntaxTreeParams = { + textDocument: { uri: editor.document.uri.toString() } + }; + return client.sendRequest("m/syntaxTree", request); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event + } +} + + +const decorations: { [index: string]: vscode.TextEditorDecorationType } = (() => { + const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }) + return { + background: decor("#3F3F3F"), + error: vscode.window.createTextEditorDecorationType({ + borderColor: "red", + borderStyle: "none none dashed none", + }), + comment: decor("#7F9F7F"), + string: decor("#CC9393"), + keyword: decor("#F0DFAF"), + function: decor("#93E0E3"), + parameter: decor("#94BFF3"), + builtin: decor("#DD6718"), + text: decor("#DCDCCC"), + attribute: decor("#BFEBBF"), + literal: decor("#DFAF8F"), + } +})() + +function setHighlights( + editor: vscode.TextEditor, + highlihgs: Array +) { + let byTag: Map = new Map() + for (let tag in decorations) { + byTag.set(tag, []) + } + + for (let d of highlihgs) { + if (!byTag.get(d.tag)) { + console.log(`unknown tag ${d.tag}`) + continue + } + byTag.get(d.tag)!.push( + client.protocol2CodeConverter.asRange(d.range) + ) + } + + for (let tag of byTag.keys()) { + let dec: vscode.TextEditorDecorationType = decorations[tag] + let ranges = byTag.get(tag)! + editor.setDecorations(dec, ranges) + } +} + +interface SyntaxTreeParams { + textDocument: lc.TextDocumentIdentifier; +} + +type SyntaxTreeResult = string + +interface ExtendSelectionParams { + textDocument: lc.TextDocumentIdentifier; + selections: lc.Range[]; +} + +interface ExtendSelectionResult { + selections: lc.Range[]; +} + +interface FindMatchingBraceParams { + textDocument: lc.TextDocumentIdentifier; + offsets: lc.Position[]; +} + +interface JoinLinesParams { + textDocument: lc.TextDocumentIdentifier; + range: lc.Range; +} + +interface PublishDecorationsParams { + uri: string, + decorations: Decoration[], +} + +interface RunnablesParams { + textDocument: lc.TextDocumentIdentifier, + position?: lc.Position, +} + +interface Runnable { + range: lc.Range; + label: string; + bin: string; + args: string[]; + env: { [index: string]: string }, +} + +class RunnableQuickPick implements vscode.QuickPickItem { + label: string; + description?: string | undefined; + detail?: string | undefined; + picked?: boolean | undefined; + + constructor(public runnable: Runnable) { + this.label = runnable.label + } +} + +interface Decoration { + range: lc.Range, + tag: string, +} + + +interface CargoTaskDefinition extends vscode.TaskDefinition { + type: 'cargo'; + label: string; + command: string; + args: Array; + env?: { [key: string]: string }; +} + +function createTask(spec: Runnable): vscode.Task { + const TASK_SOURCE = 'Rust'; + let definition: CargoTaskDefinition = { + type: 'cargo', + label: 'cargo', + command: spec.bin, + args: spec.args, + env: spec.env + } + + let execCmd = `${definition.command} ${definition.args.join(' ')}`; + let execOption: vscode.ShellExecutionOptions = { + cwd: '.', + env: definition.env, + }; + let exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); + + let f = vscode.workspace.workspaceFolders![0] + let t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); + return t; +} + +interface FileSystemEdit { + type: string; + uri?: string; + src?: string; + dst?: string; +} + +interface SourceChange { + label: string, + sourceFileEdits: lc.TextDocumentEdit[], + fileSystemEdits: FileSystemEdit[], + cursorPosition?: lc.TextDocumentPositionParams, +} + +async function applySourceChange(change: SourceChange) { + console.log(`applySOurceChange ${JSON.stringify(change)}`) + let wsEdit = new vscode.WorkspaceEdit() + for (let sourceEdit of change.sourceFileEdits) { + let uri = client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri) + let edits = client.protocol2CodeConverter.asTextEdits(sourceEdit.edits) + wsEdit.set(uri, edits) + } + let created; + let moved; + for (let fsEdit of change.fileSystemEdits) { + if (fsEdit.type == "createFile") { + let uri = vscode.Uri.parse(fsEdit.uri!) + wsEdit.createFile(uri) + created = uri + } else if (fsEdit.type == "moveFile") { + let src = vscode.Uri.parse(fsEdit.src!) + let dst = vscode.Uri.parse(fsEdit.dst!) + wsEdit.renameFile(src, dst) + moved = dst + } else { + console.error(`unknown op: ${JSON.stringify(fsEdit)}`) + } + } + let toOpen = created || moved + let toReveal = change.cursorPosition + await vscode.workspace.applyEdit(wsEdit) + if (toOpen) { + let doc = await vscode.workspace.openTextDocument(toOpen) + await vscode.window.showTextDocument(doc) + } else if (toReveal) { + let uri = client.protocol2CodeConverter.asUri(toReveal.textDocument.uri) + let position = client.protocol2CodeConverter.asPosition(toReveal.position) + let editor = vscode.window.activeTextEditor; + if (!editor || editor.document.uri.toString() != uri.toString()) return + if (!editor.selection.isEmpty) return + editor!.selection = new vscode.Selection(position, position) + } +} diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json new file mode 100644 index 00000000..ebec0162 --- /dev/null +++ b/rust-analyzer/editors/code/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "lib": [ + "es6" + ], + "sourceMap": true, + "rootDir": "src", + "strict": true + }, + "exclude": [ + "node_modules", + ".vscode-test" + ] +} From 62ac7e218024dbf25ae52418e1872dd7b960478e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 16 Sep 2018 16:25:24 +0300 Subject: [PATCH 002/819] goto super places cursor on mod --- rust-analyzer/editors/code/src/extension.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 2c42c07f..c464ab5b 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -77,6 +77,7 @@ export function activate(context: vscode.ExtensionContext) { let doc = await vscode.workspace.openTextDocument(uri) let e = await vscode.window.showTextDocument(doc) + e.selection = new vscode.Selection(range.start, range.start) e.revealRange(range, vscode.TextEditorRevealType.InCenter) }) From 29ae248a0fb631bfed8c29d1680246cdcc2f0f4b Mon Sep 17 00:00:00 2001 From: ekrctb Date: Fri, 21 Sep 2018 22:20:48 +0900 Subject: [PATCH 003/819] Remove undefined command --- rust-analyzer/editors/code/package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index cc8fb93f..0cfba5db 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -57,10 +57,6 @@ } ], "commands": [ - { - "command": "ra-lsp.createFile", - "title": "Show Rust syntax tree" - }, { "command": "ra-lsp.syntaxTree", "title": "Show Rust syntax tree" From 1d9139c96832f388a5acc698345d7e4d5a627ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Sat, 29 Sep 2018 21:27:41 +0200 Subject: [PATCH 004/819] Add a setting to disable custom syntax highlighting --- rust-analyzer/editors/code/package.json | 11 +++++++++++ rust-analyzer/editors/code/src/extension.ts | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 0cfba5db..305d6eaf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -109,6 +109,17 @@ "when": "editorTextFocus && editorLangId == rust" } ], + "configuration": { + "type": "object", + "title": "Rust Analyzer configuration", + "properties": { + "ra-lsp.highlightingOn": { + "type": "boolean", + "default": true, + "description": "Highlight Rust code (overrides built-in syntax highlighting)" + } + } + }, "problemMatchers": [ { "name": "rustc", diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index c464ab5b..dc1792e9 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,8 +1,6 @@ 'use strict'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient' -import { DH_UNABLE_TO_CHECK_GENERATOR } from 'constants'; - let client: lc.LanguageClient; @@ -10,8 +8,14 @@ let uris = { syntaxTree: vscode.Uri.parse('ra-lsp://syntaxtree') } +let highlightingOn = true; export function activate(context: vscode.ExtensionContext) { + let config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + highlightingOn = config.get('highlightingOn') as boolean; + } + let textDocumentContentProvider = new TextDocumentContentProvider() let dispose = (disposable: vscode.Disposable) => { context.subscriptions.push(disposable); @@ -232,14 +236,18 @@ const decorations: { [index: string]: vscode.TextEditorDecorationType } = (() => function setHighlights( editor: vscode.TextEditor, - highlihgs: Array + highlights: Array ) { + if (!highlightingOn) { + return; + } + let byTag: Map = new Map() for (let tag in decorations) { byTag.set(tag, []) } - for (let d of highlihgs) { + for (let d of highlights) { if (!byTag.get(d.tag)) { console.log(`unknown tag ${d.tag}`) continue From 9546122b2411feee8a495fbf448a4c9f91dadd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Sat, 6 Oct 2018 22:53:12 +0200 Subject: [PATCH 005/819] Dynamically apply highlightingOn config Fixes #84 --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/extension.ts | 47 ++++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 305d6eaf..9f05fe91 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -111,7 +111,7 @@ ], "configuration": { "type": "object", - "title": "Rust Analyzer configuration", + "title": "Rust Analyzer", "properties": { "ra-lsp.highlightingOn": { "type": "boolean", diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index dc1792e9..fde6a480 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -11,10 +11,22 @@ let uris = { let highlightingOn = true; export function activate(context: vscode.ExtensionContext) { - let config = vscode.workspace.getConfiguration('ra-lsp'); - if (config.has('highlightingOn')) { - highlightingOn = config.get('highlightingOn') as boolean; - } + let applyHighlightingOn = () => { + let config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + highlightingOn = config.get('highlightingOn') as boolean; + }; + + if (!highlightingOn) { + removeHighlights(); + } + }; + + // Apply the highlightingOn config now and whenever the config changes + applyHighlightingOn(); + vscode.workspace.onDidChangeConfiguration(_ => { + applyHighlightingOn(); + }); let textDocumentContentProvider = new TextDocumentContentProvider() let dispose = (disposable: vscode.Disposable) => { @@ -130,7 +142,7 @@ export function activate(context: vscode.ExtensionContext) { }) }, null, context.subscriptions) vscode.window.onDidChangeActiveTextEditor(async (editor) => { - if (!editor || editor.document.languageId != 'rust') return + if (!highlightingOn || !editor || editor.document.languageId != 'rust') return let params: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString() } @@ -179,7 +191,7 @@ function startServer() { let editor = vscode.window.visibleTextEditors.find( (editor) => editor.document.uri.toString() == params.uri ) - if (editor == null) return; + if (!highlightingOn || !editor) return; setHighlights( editor, params.decorations, @@ -213,10 +225,11 @@ class TextDocumentContentProvider implements vscode.TextDocumentContentProvider } } +let decorations: { [index: string]: vscode.TextEditorDecorationType } = {}; -const decorations: { [index: string]: vscode.TextEditorDecorationType } = (() => { +function initDecorations() { const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }) - return { + decorations = { background: decor("#3F3F3F"), error: vscode.window.createTextEditorDecorationType({ borderColor: "red", @@ -232,14 +245,26 @@ const decorations: { [index: string]: vscode.TextEditorDecorationType } = (() => attribute: decor("#BFEBBF"), literal: decor("#DFAF8F"), } -})() +} + +function removeHighlights() { + for (let tag in decorations) { + decorations[tag].dispose(); + } + + decorations = {}; +} function setHighlights( editor: vscode.TextEditor, highlights: Array ) { - if (!highlightingOn) { - return; + // Initialize decorations if necessary + // + // Note: decoration objects need to be kept around so we can dispose them + // if the user disables syntax highlighting + if (Object.keys(decorations).length === 0) { + initDecorations(); } let byTag: Map = new Map() From 58415db33639d171df063f5813abfead14971133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Sun, 7 Oct 2018 22:44:25 +0200 Subject: [PATCH 006/819] Refactor vscode extension --- rust-analyzer/editors/code/src/commands.ts | 17 + .../code/src/commands/apply_source_change.ts | 58 +++ .../code/src/commands/extend_selection.ts | 29 ++ .../editors/code/src/commands/join_lines.ts | 21 + .../code/src/commands/matching_brace.ts | 27 ++ .../code/src/commands/parent_module.ts | 22 + .../editors/code/src/commands/runnables.ts | 88 ++++ .../editors/code/src/commands/syntaxTree.ts | 38 ++ rust-analyzer/editors/code/src/events.ts | 7 + .../src/events/change_active_text_editor.ts | 14 + .../code/src/events/change_text_document.ts | 19 + rust-analyzer/editors/code/src/extension.ts | 441 ++---------------- .../editors/code/src/highlighting.ts | 78 ++++ rust-analyzer/editors/code/src/server.ts | 74 +++ 14 files changed, 518 insertions(+), 415 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands.ts create mode 100644 rust-analyzer/editors/code/src/commands/apply_source_change.ts create mode 100644 rust-analyzer/editors/code/src/commands/extend_selection.ts create mode 100644 rust-analyzer/editors/code/src/commands/join_lines.ts create mode 100644 rust-analyzer/editors/code/src/commands/matching_brace.ts create mode 100644 rust-analyzer/editors/code/src/commands/parent_module.ts create mode 100644 rust-analyzer/editors/code/src/commands/runnables.ts create mode 100644 rust-analyzer/editors/code/src/commands/syntaxTree.ts create mode 100644 rust-analyzer/editors/code/src/events.ts create mode 100644 rust-analyzer/editors/code/src/events/change_active_text_editor.ts create mode 100644 rust-analyzer/editors/code/src/events/change_text_document.ts create mode 100644 rust-analyzer/editors/code/src/highlighting.ts create mode 100644 rust-analyzer/editors/code/src/server.ts diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts new file mode 100644 index 00000000..99cac337 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands.ts @@ -0,0 +1,17 @@ +import * as applySourceChange from './commands/apply_source_change'; +import * as extendSelection from './commands/extend_selection'; +import * as joinLines from './commands/join_lines'; +import * as matchingBrace from './commands/matching_brace'; +import * as parentModule from './commands/parent_module'; +import * as runnables from './commands/runnables'; +import * as syntaxTree from './commands/syntaxTree'; + +export { + applySourceChange, + extendSelection, + joinLines, + matchingBrace, + parentModule, + runnables, + syntaxTree +} diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts new file mode 100644 index 00000000..dcbbb2b0 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -0,0 +1,58 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient' + +import { Server } from '../server'; + +interface FileSystemEdit { + type: string; + uri?: string; + src?: string; + dst?: string; +} + +export interface SourceChange { + label: string, + sourceFileEdits: lc.TextDocumentEdit[], + fileSystemEdits: FileSystemEdit[], + cursorPosition?: lc.TextDocumentPositionParams, +} + +export async function handle(change: SourceChange) { + console.log(`applySOurceChange ${JSON.stringify(change)}`) + let wsEdit = new vscode.WorkspaceEdit() + for (let sourceEdit of change.sourceFileEdits) { + let uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri) + let edits = Server.client.protocol2CodeConverter.asTextEdits(sourceEdit.edits) + wsEdit.set(uri, edits) + } + let created; + let moved; + for (let fsEdit of change.fileSystemEdits) { + if (fsEdit.type == "createFile") { + let uri = vscode.Uri.parse(fsEdit.uri!) + wsEdit.createFile(uri) + created = uri + } else if (fsEdit.type == "moveFile") { + let src = vscode.Uri.parse(fsEdit.src!) + let dst = vscode.Uri.parse(fsEdit.dst!) + wsEdit.renameFile(src, dst) + moved = dst + } else { + console.error(`unknown op: ${JSON.stringify(fsEdit)}`) + } + } + let toOpen = created || moved + let toReveal = change.cursorPosition + await vscode.workspace.applyEdit(wsEdit) + if (toOpen) { + let doc = await vscode.workspace.openTextDocument(toOpen) + await vscode.window.showTextDocument(doc) + } else if (toReveal) { + let uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri) + let position = Server.client.protocol2CodeConverter.asPosition(toReveal.position) + let editor = vscode.window.activeTextEditor; + if (!editor || editor.document.uri.toString() != uri.toString()) return + if (!editor.selection.isEmpty) return + editor!.selection = new vscode.Selection(position, position) + } +} diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts new file mode 100644 index 00000000..b90828ba --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -0,0 +1,29 @@ +import * as vscode from 'vscode'; + +import { TextDocumentIdentifier, Range } from "vscode-languageclient"; +import { Server } from '../server'; + +interface ExtendSelectionParams { + textDocument: TextDocumentIdentifier; + selections: Range[]; +} + +interface ExtendSelectionResult { + selections: Range[]; +} + +export async function handle() { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: ExtendSelectionParams = { + textDocument: { uri: editor.document.uri.toString() }, + selections: editor.selections.map((s) => { + return Server.client.code2ProtocolConverter.asRange(s) + }) + } + let response = await Server.client.sendRequest("m/extendSelection", request) + editor.selections = response.selections.map((range: Range) => { + let r = Server.client.protocol2CodeConverter.asRange(range) + return new vscode.Selection(r.start, r.end) + }) +} diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts new file mode 100644 index 00000000..7ae7b9d7 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -0,0 +1,21 @@ +import * as vscode from 'vscode'; + +import { TextDocumentIdentifier, Range } from "vscode-languageclient"; +import { Server } from '../server'; +import { handle as applySourceChange, SourceChange } from './apply_source_change'; + +interface JoinLinesParams { + textDocument: TextDocumentIdentifier; + range: Range; +} + +export async function handle() { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: JoinLinesParams = { + textDocument: { uri: editor.document.uri.toString() }, + range: Server.client.code2ProtocolConverter.asRange(editor.selection), + } + let change = await Server.client.sendRequest("m/joinLines", request) + await applySourceChange(change) +} diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts new file mode 100644 index 00000000..572c15ce --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -0,0 +1,27 @@ +import * as vscode from 'vscode'; + +import { TextDocumentIdentifier, Position } from "vscode-languageclient"; +import { Server } from '../server'; + +interface FindMatchingBraceParams { + textDocument: TextDocumentIdentifier; + offsets: Position[]; +} + +export async function handle() { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: FindMatchingBraceParams = { + textDocument: { uri: editor.document.uri.toString() }, + offsets: editor.selections.map((s) => { + return Server.client.code2ProtocolConverter.asPosition(s.active) + }) + } + let response = await Server.client.sendRequest("m/findMatchingBrace", request) + editor.selections = editor.selections.map((sel, idx) => { + let active = Server.client.protocol2CodeConverter.asPosition(response[idx]) + let anchor = sel.isEmpty ? active : sel.anchor + return new vscode.Selection(anchor, active) + }) + editor.revealRange(editor.selection) +}; diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts new file mode 100644 index 00000000..dae60bfb --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -0,0 +1,22 @@ +import * as vscode from 'vscode'; + +import { TextDocumentIdentifier, Location } from "vscode-languageclient"; +import { Server } from '../server'; + +export async function handle() { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let request: TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let response = await Server.client.sendRequest("m/parentModule", request) + let loc = response[0] + if (loc == null) return + let uri = Server.client.protocol2CodeConverter.asUri(loc.uri) + let range = Server.client.protocol2CodeConverter.asRange(loc.range) + + let doc = await vscode.workspace.openTextDocument(uri) + let e = await vscode.window.showTextDocument(doc) + e.selection = new vscode.Selection(range.start, range.start) + e.revealRange(range, vscode.TextEditorRevealType.InCenter) +} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts new file mode 100644 index 00000000..45c16497 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -0,0 +1,88 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient' +import { Server } from '../server'; + +interface RunnablesParams { + textDocument: lc.TextDocumentIdentifier, + position?: lc.Position, +} + +interface Runnable { + range: lc.Range; + label: string; + bin: string; + args: string[]; + env: { [index: string]: string }, +} + +class RunnableQuickPick implements vscode.QuickPickItem { + label: string; + description?: string | undefined; + detail?: string | undefined; + picked?: boolean | undefined; + + constructor(public runnable: Runnable) { + this.label = runnable.label + } +} + +interface CargoTaskDefinition extends vscode.TaskDefinition { + type: 'cargo'; + label: string; + command: string; + args: Array; + env?: { [key: string]: string }; +} + +function createTask(spec: Runnable): vscode.Task { + const TASK_SOURCE = 'Rust'; + let definition: CargoTaskDefinition = { + type: 'cargo', + label: 'cargo', + command: spec.bin, + args: spec.args, + env: spec.env + } + + let execCmd = `${definition.command} ${definition.args.join(' ')}`; + let execOption: vscode.ShellExecutionOptions = { + cwd: '.', + env: definition.env, + }; + let exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); + + let f = vscode.workspace.workspaceFolders![0] + let t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); + return t; +} + +let prevRunnable: RunnableQuickPick | undefined = undefined +export async function handle() { + let editor = vscode.window.activeTextEditor + if (editor == null || editor.document.languageId != "rust") return + let textDocument: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let params: RunnablesParams = { + textDocument, + position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active) + } + let runnables = await Server.client.sendRequest('m/runnables', params) + let items: RunnableQuickPick[] = [] + if (prevRunnable) { + items.push(prevRunnable) + } + for (let r of runnables) { + if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { + continue + } + items.push(new RunnableQuickPick(r)) + } + let item = await vscode.window.showQuickPick(items) + if (item) { + item.detail = "rerun" + prevRunnable = item + let task = createTask(item.runnable) + return await vscode.tasks.executeTask(task) + } +} diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts new file mode 100644 index 00000000..d5daa930 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -0,0 +1,38 @@ +import * as vscode from 'vscode'; +import { TextDocumentIdentifier } from 'vscode-languageclient'; + +import { Server } from '../server'; + +export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); + +export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { + public eventEmitter = new vscode.EventEmitter() + public syntaxTree: string = "Not available" + + public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { + let editor = vscode.window.activeTextEditor; + if (editor == null) return "" + let request: SyntaxTreeParams = { + textDocument: { uri: editor.document.uri.toString() } + }; + return Server.client.sendRequest("m/syntaxTree", request); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event + } +} + +interface SyntaxTreeParams { + textDocument: TextDocumentIdentifier; +} + +type SyntaxTreeResult = string; + +// Opens the virtual file that will show the syntax tree +// +// The contents of the file come from the `TextDocumentContentProvider` +export async function handle() { + let document = await vscode.workspace.openTextDocument(syntaxTreeUri) + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true) +} diff --git a/rust-analyzer/editors/code/src/events.ts b/rust-analyzer/editors/code/src/events.ts new file mode 100644 index 00000000..b143bb25 --- /dev/null +++ b/rust-analyzer/editors/code/src/events.ts @@ -0,0 +1,7 @@ +import * as changeActiveTextEditor from './events/change_active_text_editor' +import * as changeTextDocument from './events/change_text_document'; + +export { + changeActiveTextEditor, + changeTextDocument +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts new file mode 100644 index 00000000..bbdd5309 --- /dev/null +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -0,0 +1,14 @@ +import { TextEditor } from "vscode"; +import { TextDocumentIdentifier } from "vscode-languageclient"; + +import { Server } from "../server"; +import { Decoration } from "../highlighting"; + +export async function handle(editor: TextEditor | undefined) { + if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') return + let params: TextDocumentIdentifier = { + uri: editor.document.uri.toString() + } + let decorations = await Server.client.sendRequest("m/decorationsRequest", params) + Server.highlighter.setHighlights(editor, decorations) +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts new file mode 100644 index 00000000..83ee6c9e --- /dev/null +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -0,0 +1,19 @@ +import * as vscode from 'vscode'; + +import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTree'; + +export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) { + return (event: vscode.TextDocumentChangeEvent) => { + let doc = event.document + if (doc.languageId != "rust") return + afterLs(() => { + textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); + }) + } +} + +// We need to order this after LS updates, but there's no API for that. +// Hence, good old setTimeout. +function afterLs(f: () => any) { + setTimeout(f, 10) +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index fde6a480..595fb98f 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,434 +1,45 @@ -'use strict'; import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient' -let client: lc.LanguageClient; - -let uris = { - syntaxTree: vscode.Uri.parse('ra-lsp://syntaxtree') -} - -let highlightingOn = true; +import * as commands from './commands' +import * as events from './events' +import { Server } from './server'; +import { TextDocumentContentProvider } from './commands/syntaxTree'; export function activate(context: vscode.ExtensionContext) { - let applyHighlightingOn = () => { - let config = vscode.workspace.getConfiguration('ra-lsp'); - if (config.has('highlightingOn')) { - highlightingOn = config.get('highlightingOn') as boolean; - }; - - if (!highlightingOn) { - removeHighlights(); - } - }; - - // Apply the highlightingOn config now and whenever the config changes - applyHighlightingOn(); - vscode.workspace.onDidChangeConfiguration(_ => { - applyHighlightingOn(); - }); - - let textDocumentContentProvider = new TextDocumentContentProvider() - let dispose = (disposable: vscode.Disposable) => { + function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); } - let registerCommand = (name: string, f: any) => { - dispose(vscode.commands.registerCommand(name, f)) - } - - registerCommand('ra-lsp.syntaxTree', () => openDoc(uris.syntaxTree)) - registerCommand('ra-lsp.extendSelection', async () => { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: ExtendSelectionParams = { - textDocument: { uri: editor.document.uri.toString() }, - selections: editor.selections.map((s) => { - return client.code2ProtocolConverter.asRange(s) - }) - } - let response = await client.sendRequest("m/extendSelection", request) - editor.selections = response.selections.map((range) => { - let r = client.protocol2CodeConverter.asRange(range) - return new vscode.Selection(r.start, r.end) - }) - }) - registerCommand('ra-lsp.matchingBrace', async () => { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: FindMatchingBraceParams = { - textDocument: { uri: editor.document.uri.toString() }, - offsets: editor.selections.map((s) => { - return client.code2ProtocolConverter.asPosition(s.active) - }) - } - let response = await client.sendRequest("m/findMatchingBrace", request) - editor.selections = editor.selections.map((sel, idx) => { - let active = client.protocol2CodeConverter.asPosition(response[idx]) - let anchor = sel.isEmpty ? active : sel.anchor - return new vscode.Selection(anchor, active) - }) - editor.revealRange(editor.selection) - }) - registerCommand('ra-lsp.joinLines', async () => { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: JoinLinesParams = { - textDocument: { uri: editor.document.uri.toString() }, - range: client.code2ProtocolConverter.asRange(editor.selection), - } - let change = await client.sendRequest("m/joinLines", request) - await applySourceChange(change) - }) - registerCommand('ra-lsp.parentModule', async () => { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let response = await client.sendRequest("m/parentModule", request) - let loc = response[0] - if (loc == null) return - let uri = client.protocol2CodeConverter.asUri(loc.uri) - let range = client.protocol2CodeConverter.asRange(loc.range) - let doc = await vscode.workspace.openTextDocument(uri) - let e = await vscode.window.showTextDocument(doc) - e.selection = new vscode.Selection(range.start, range.start) - e.revealRange(range, vscode.TextEditorRevealType.InCenter) - }) + function registerCommand(name: string, f: any) { + disposeOnDeactivation(vscode.commands.registerCommand(name, f)) + } - let prevRunnable: RunnableQuickPick | undefined = undefined - registerCommand('ra-lsp.run', async () => { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let params: RunnablesParams = { - textDocument, - position: client.code2ProtocolConverter.asPosition(editor.selection.active) - } - let runnables = await client.sendRequest('m/runnables', params) - let items: RunnableQuickPick[] = [] - if (prevRunnable) { - items.push(prevRunnable) - } - for (let r of runnables) { - if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { - continue - } - items.push(new RunnableQuickPick(r)) - } - let item = await vscode.window.showQuickPick(items) - if (item) { - item.detail = "rerun" - prevRunnable = item - let task = createTask(item.runnable) - return await vscode.tasks.executeTask(task) - } - }) - registerCommand('ra-lsp.applySourceChange', applySourceChange) + registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle) + registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); + registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); + registerCommand('ra-lsp.joinLines', commands.joinLines.handle); + registerCommand('ra-lsp.parentModule', commands.parentModule.handle); + registerCommand('ra-lsp.run', commands.runnables.handle); + registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle); - dispose(vscode.workspace.registerTextDocumentContentProvider( + let textDocumentContentProvider = new TextDocumentContentProvider() + disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider( 'ra-lsp', textDocumentContentProvider )) - startServer() - vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => { - let doc = event.document - if (doc.languageId != "rust") return - afterLs(() => { - textDocumentContentProvider.eventEmitter.fire(uris.syntaxTree) - }) - }, null, context.subscriptions) - vscode.window.onDidChangeActiveTextEditor(async (editor) => { - if (!highlightingOn || !editor || editor.document.languageId != 'rust') return - let params: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let decorations = await client.sendRequest("m/decorationsRequest", params) - setHighlights(editor, decorations) - }) -} -// We need to order this after LS updates, but there's no API for that. -// Hence, good old setTimeout. -function afterLs(f: () => any) { - setTimeout(f, 10) + Server.start() + + vscode.workspace.onDidChangeTextDocument( + events.changeTextDocument.createHandler(textDocumentContentProvider), + null, + context.subscriptions) + vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle) } export function deactivate(): Thenable { - if (!client) { + if (!Server.client) { return Promise.resolve(); } - return client.stop(); -} - -function startServer() { - let run: lc.Executable = { - command: "ra_lsp_server", - options: { cwd: "." } - } - let serverOptions: lc.ServerOptions = { - run, - debug: run - }; - - let clientOptions: lc.LanguageClientOptions = { - documentSelector: [{ scheme: 'file', language: 'rust' }], - }; - - client = new lc.LanguageClient( - 'ra-lsp', - 'rust-analyzer languge server', - serverOptions, - clientOptions, - ); - client.onReady().then(() => { - client.onNotification( - "m/publishDecorations", - (params: PublishDecorationsParams) => { - let editor = vscode.window.visibleTextEditors.find( - (editor) => editor.document.uri.toString() == params.uri - ) - if (!highlightingOn || !editor) return; - setHighlights( - editor, - params.decorations, - ) - } - ) - }) - client.start(); -} - -async function openDoc(uri: vscode.Uri) { - let document = await vscode.workspace.openTextDocument(uri) - return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true) -} - -class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - public eventEmitter = new vscode.EventEmitter() - public syntaxTree: string = "Not available" - - public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { - let editor = vscode.window.activeTextEditor; - if (editor == null) return "" - let request: SyntaxTreeParams = { - textDocument: { uri: editor.document.uri.toString() } - }; - return client.sendRequest("m/syntaxTree", request); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event - } -} - -let decorations: { [index: string]: vscode.TextEditorDecorationType } = {}; - -function initDecorations() { - const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }) - decorations = { - background: decor("#3F3F3F"), - error: vscode.window.createTextEditorDecorationType({ - borderColor: "red", - borderStyle: "none none dashed none", - }), - comment: decor("#7F9F7F"), - string: decor("#CC9393"), - keyword: decor("#F0DFAF"), - function: decor("#93E0E3"), - parameter: decor("#94BFF3"), - builtin: decor("#DD6718"), - text: decor("#DCDCCC"), - attribute: decor("#BFEBBF"), - literal: decor("#DFAF8F"), - } -} - -function removeHighlights() { - for (let tag in decorations) { - decorations[tag].dispose(); - } - - decorations = {}; -} - -function setHighlights( - editor: vscode.TextEditor, - highlights: Array -) { - // Initialize decorations if necessary - // - // Note: decoration objects need to be kept around so we can dispose them - // if the user disables syntax highlighting - if (Object.keys(decorations).length === 0) { - initDecorations(); - } - - let byTag: Map = new Map() - for (let tag in decorations) { - byTag.set(tag, []) - } - - for (let d of highlights) { - if (!byTag.get(d.tag)) { - console.log(`unknown tag ${d.tag}`) - continue - } - byTag.get(d.tag)!.push( - client.protocol2CodeConverter.asRange(d.range) - ) - } - - for (let tag of byTag.keys()) { - let dec: vscode.TextEditorDecorationType = decorations[tag] - let ranges = byTag.get(tag)! - editor.setDecorations(dec, ranges) - } -} - -interface SyntaxTreeParams { - textDocument: lc.TextDocumentIdentifier; -} - -type SyntaxTreeResult = string - -interface ExtendSelectionParams { - textDocument: lc.TextDocumentIdentifier; - selections: lc.Range[]; -} - -interface ExtendSelectionResult { - selections: lc.Range[]; -} - -interface FindMatchingBraceParams { - textDocument: lc.TextDocumentIdentifier; - offsets: lc.Position[]; -} - -interface JoinLinesParams { - textDocument: lc.TextDocumentIdentifier; - range: lc.Range; -} - -interface PublishDecorationsParams { - uri: string, - decorations: Decoration[], -} - -interface RunnablesParams { - textDocument: lc.TextDocumentIdentifier, - position?: lc.Position, -} - -interface Runnable { - range: lc.Range; - label: string; - bin: string; - args: string[]; - env: { [index: string]: string }, -} - -class RunnableQuickPick implements vscode.QuickPickItem { - label: string; - description?: string | undefined; - detail?: string | undefined; - picked?: boolean | undefined; - - constructor(public runnable: Runnable) { - this.label = runnable.label - } -} - -interface Decoration { - range: lc.Range, - tag: string, -} - - -interface CargoTaskDefinition extends vscode.TaskDefinition { - type: 'cargo'; - label: string; - command: string; - args: Array; - env?: { [key: string]: string }; -} - -function createTask(spec: Runnable): vscode.Task { - const TASK_SOURCE = 'Rust'; - let definition: CargoTaskDefinition = { - type: 'cargo', - label: 'cargo', - command: spec.bin, - args: spec.args, - env: spec.env - } - - let execCmd = `${definition.command} ${definition.args.join(' ')}`; - let execOption: vscode.ShellExecutionOptions = { - cwd: '.', - env: definition.env, - }; - let exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); - - let f = vscode.workspace.workspaceFolders![0] - let t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); - return t; -} - -interface FileSystemEdit { - type: string; - uri?: string; - src?: string; - dst?: string; -} - -interface SourceChange { - label: string, - sourceFileEdits: lc.TextDocumentEdit[], - fileSystemEdits: FileSystemEdit[], - cursorPosition?: lc.TextDocumentPositionParams, -} - -async function applySourceChange(change: SourceChange) { - console.log(`applySOurceChange ${JSON.stringify(change)}`) - let wsEdit = new vscode.WorkspaceEdit() - for (let sourceEdit of change.sourceFileEdits) { - let uri = client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri) - let edits = client.protocol2CodeConverter.asTextEdits(sourceEdit.edits) - wsEdit.set(uri, edits) - } - let created; - let moved; - for (let fsEdit of change.fileSystemEdits) { - if (fsEdit.type == "createFile") { - let uri = vscode.Uri.parse(fsEdit.uri!) - wsEdit.createFile(uri) - created = uri - } else if (fsEdit.type == "moveFile") { - let src = vscode.Uri.parse(fsEdit.src!) - let dst = vscode.Uri.parse(fsEdit.dst!) - wsEdit.renameFile(src, dst) - moved = dst - } else { - console.error(`unknown op: ${JSON.stringify(fsEdit)}`) - } - } - let toOpen = created || moved - let toReveal = change.cursorPosition - await vscode.workspace.applyEdit(wsEdit) - if (toOpen) { - let doc = await vscode.workspace.openTextDocument(toOpen) - await vscode.window.showTextDocument(doc) - } else if (toReveal) { - let uri = client.protocol2CodeConverter.asUri(toReveal.textDocument.uri) - let position = client.protocol2CodeConverter.asPosition(toReveal.position) - let editor = vscode.window.activeTextEditor; - if (!editor || editor.document.uri.toString() != uri.toString()) return - if (!editor.selection.isEmpty) return - editor!.selection = new vscode.Selection(position, position) - } + return Server.client.stop(); } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts new file mode 100644 index 00000000..169ddb0d --- /dev/null +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -0,0 +1,78 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient' + +import { Server } from './server'; + +export interface Decoration { + range: lc.Range, + tag: string, +} + +export class Highlighter { + private decorations: { [index: string]: vscode.TextEditorDecorationType }; + constructor() { + this.decorations = {}; + } + + removeHighlights() { + for (let tag in this.decorations) { + this.decorations[tag].dispose(); + } + + this.decorations = {}; + } + + setHighlights( + editor: vscode.TextEditor, + highlights: Array + ) { + // Initialize decorations if necessary + // + // Note: decoration objects need to be kept around so we can dispose them + // if the user disables syntax highlighting + if (Object.keys(this.decorations).length === 0) { + this.initDecorations(); + } + + let byTag: Map = new Map() + for (let tag in this.decorations) { + byTag.set(tag, []) + } + + for (let d of highlights) { + if (!byTag.get(d.tag)) { + console.log(`unknown tag ${d.tag}`) + continue + } + byTag.get(d.tag)!.push( + Server.client.protocol2CodeConverter.asRange(d.range) + ) + } + + for (let tag of byTag.keys()) { + let dec: vscode.TextEditorDecorationType = this.decorations[tag] + let ranges = byTag.get(tag)! + editor.setDecorations(dec, ranges) + } + } + + private initDecorations() { + const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }) + this.decorations = { + background: decor("#3F3F3F"), + error: vscode.window.createTextEditorDecorationType({ + borderColor: "red", + borderStyle: "none none dashed none", + }), + comment: decor("#7F9F7F"), + string: decor("#CC9393"), + keyword: decor("#F0DFAF"), + function: decor("#93E0E3"), + parameter: decor("#94BFF3"), + builtin: decor("#DD6718"), + text: decor("#DCDCCC"), + attribute: decor("#BFEBBF"), + literal: decor("#DFAF8F"), + } + } +} diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts new file mode 100644 index 00000000..c1c95e00 --- /dev/null +++ b/rust-analyzer/editors/code/src/server.ts @@ -0,0 +1,74 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient' + +import { Highlighter, Decoration } from './highlighting'; + +export class Config { + highlightingOn = true; + + constructor() { + vscode.workspace.onDidChangeConfiguration(_ => this.userConfigChanged()); + this.userConfigChanged(); + } + + userConfigChanged() { + let config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + this.highlightingOn = config.get('highlightingOn') as boolean; + }; + + if (!this.highlightingOn) { + Server.highlighter.removeHighlights(); + } + } +} + +export class Server { + static highlighter = new Highlighter(); + static config = new Config(); + static client: lc.LanguageClient; + + + static start() { + let run: lc.Executable = { + command: "ra_lsp_server", + options: { cwd: "." } + } + let serverOptions: lc.ServerOptions = { + run, + debug: run + }; + + let clientOptions: lc.LanguageClientOptions = { + documentSelector: [{ scheme: 'file', language: 'rust' }], + }; + + Server.client = new lc.LanguageClient( + 'ra-lsp', + 'rust-analyzer languge server', + serverOptions, + clientOptions, + ); + Server.client.onReady().then(() => { + Server.client.onNotification( + "m/publishDecorations", + (params: PublishDecorationsParams) => { + let editor = vscode.window.visibleTextEditors.find( + (editor) => editor.document.uri.toString() == params.uri + ) + if (!Server.config.highlightingOn || !editor) return; + Server.highlighter.setHighlights( + editor, + params.decorations, + ) + } + ) + }) + Server.client.start(); + } +} + +interface PublishDecorationsParams { + uri: string, + decorations: Decoration[], +} From 867676c376366b31335c921dfe94ec478095ee3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Sun, 7 Oct 2018 22:59:02 +0200 Subject: [PATCH 007/819] Apply tslint suggestions, round one --- rust-analyzer/editors/code/src/commands.ts | 4 +- .../code/src/commands/apply_source_change.ts | 66 ++++++++-------- .../code/src/commands/extend_selection.ts | 24 +++--- .../editors/code/src/commands/join_lines.ts | 16 ++-- .../code/src/commands/matching_brace.ts | 28 +++---- .../code/src/commands/parent_module.ts | 30 ++++---- .../editors/code/src/commands/runnables.ts | 76 +++++++++---------- .../editors/code/src/commands/syntaxTree.ts | 20 ++--- rust-analyzer/editors/code/src/config.ts | 23 ++++++ rust-analyzer/editors/code/src/events.ts | 6 +- .../src/events/change_active_text_editor.ts | 22 +++--- .../code/src/events/change_text_document.ts | 10 +-- rust-analyzer/editors/code/src/extension.ts | 22 +++--- .../editors/code/src/highlighting.ts | 66 ++++++++-------- rust-analyzer/editors/code/src/server.ts | 74 +++++++----------- rust-analyzer/editors/code/tslint.json | 13 ++++ 16 files changed, 258 insertions(+), 242 deletions(-) create mode 100644 rust-analyzer/editors/code/src/config.ts create mode 100644 rust-analyzer/editors/code/tslint.json diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 99cac337..c7e27781 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -13,5 +13,5 @@ export { matchingBrace, parentModule, runnables, - syntaxTree -} + syntaxTree, +}; diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index dcbbb2b0..f011cbe1 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient' +import * as lc from 'vscode-languageclient'; import { Server } from '../server'; @@ -11,48 +11,48 @@ interface FileSystemEdit { } export interface SourceChange { - label: string, - sourceFileEdits: lc.TextDocumentEdit[], - fileSystemEdits: FileSystemEdit[], - cursorPosition?: lc.TextDocumentPositionParams, + label: string; + sourceFileEdits: lc.TextDocumentEdit[]; + fileSystemEdits: FileSystemEdit[]; + cursorPosition?: lc.TextDocumentPositionParams; } export async function handle(change: SourceChange) { - console.log(`applySOurceChange ${JSON.stringify(change)}`) - let wsEdit = new vscode.WorkspaceEdit() - for (let sourceEdit of change.sourceFileEdits) { - let uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri) - let edits = Server.client.protocol2CodeConverter.asTextEdits(sourceEdit.edits) - wsEdit.set(uri, edits) + console.log(`applySOurceChange ${JSON.stringify(change)}`); + const wsEdit = new vscode.WorkspaceEdit(); + for (const sourceEdit of change.sourceFileEdits) { + const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); + const edits = Server.client.protocol2CodeConverter.asTextEdits(sourceEdit.edits); + wsEdit.set(uri, edits); } let created; let moved; - for (let fsEdit of change.fileSystemEdits) { - if (fsEdit.type == "createFile") { - let uri = vscode.Uri.parse(fsEdit.uri!) - wsEdit.createFile(uri) - created = uri - } else if (fsEdit.type == "moveFile") { - let src = vscode.Uri.parse(fsEdit.src!) - let dst = vscode.Uri.parse(fsEdit.dst!) - wsEdit.renameFile(src, dst) - moved = dst + for (const fsEdit of change.fileSystemEdits) { + if (fsEdit.type == 'createFile') { + const uri = vscode.Uri.parse(fsEdit.uri!); + wsEdit.createFile(uri); + created = uri; + } else if (fsEdit.type == 'moveFile') { + const src = vscode.Uri.parse(fsEdit.src!); + const dst = vscode.Uri.parse(fsEdit.dst!); + wsEdit.renameFile(src, dst); + moved = dst; } else { - console.error(`unknown op: ${JSON.stringify(fsEdit)}`) + console.error(`unknown op: ${JSON.stringify(fsEdit)}`); } } - let toOpen = created || moved - let toReveal = change.cursorPosition - await vscode.workspace.applyEdit(wsEdit) + const toOpen = created || moved; + const toReveal = change.cursorPosition; + await vscode.workspace.applyEdit(wsEdit); if (toOpen) { - let doc = await vscode.workspace.openTextDocument(toOpen) - await vscode.window.showTextDocument(doc) + const doc = await vscode.workspace.openTextDocument(toOpen); + await vscode.window.showTextDocument(doc); } else if (toReveal) { - let uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri) - let position = Server.client.protocol2CodeConverter.asPosition(toReveal.position) - let editor = vscode.window.activeTextEditor; - if (!editor || editor.document.uri.toString() != uri.toString()) return - if (!editor.selection.isEmpty) return - editor!.selection = new vscode.Selection(position, position) + const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); + const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); + const editor = vscode.window.activeTextEditor; + if (!editor || editor.document.uri.toString() != uri.toString()) { return; } + if (!editor.selection.isEmpty) { return; } + editor!.selection = new vscode.Selection(position, position); } } diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts index b90828ba..b722ac17 100644 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { TextDocumentIdentifier, Range } from "vscode-languageclient"; +import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; interface ExtendSelectionParams { @@ -13,17 +13,17 @@ interface ExtendSelectionResult { } export async function handle() { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: ExtendSelectionParams = { - textDocument: { uri: editor.document.uri.toString() }, + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId != 'rust') { return; } + const request: ExtendSelectionParams = { selections: editor.selections.map((s) => { - return Server.client.code2ProtocolConverter.asRange(s) - }) - } - let response = await Server.client.sendRequest("m/extendSelection", request) + return Server.client.code2ProtocolConverter.asRange(s); + }), + textDocument: { uri: editor.document.uri.toString() }, + }; + const response = await Server.client.sendRequest('m/extendSelection', request); editor.selections = response.selections.map((range: Range) => { - let r = Server.client.protocol2CodeConverter.asRange(range) - return new vscode.Selection(r.start, r.end) - }) + const r = Server.client.protocol2CodeConverter.asRange(range); + return new vscode.Selection(r.start, r.end); + }); } diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 7ae7b9d7..80ad4460 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { TextDocumentIdentifier, Range } from "vscode-languageclient"; +import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; import { handle as applySourceChange, SourceChange } from './apply_source_change'; @@ -10,12 +10,12 @@ interface JoinLinesParams { } export async function handle() { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: JoinLinesParams = { - textDocument: { uri: editor.document.uri.toString() }, + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId != 'rust') { return; } + const request: JoinLinesParams = { range: Server.client.code2ProtocolConverter.asRange(editor.selection), - } - let change = await Server.client.sendRequest("m/joinLines", request) - await applySourceChange(change) + textDocument: { uri: editor.document.uri.toString() }, + }; + const change = await Server.client.sendRequest('m/joinLines', request); + await applySourceChange(change); } diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 572c15ce..cf7f6bf8 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { TextDocumentIdentifier, Position } from "vscode-languageclient"; +import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; interface FindMatchingBraceParams { @@ -9,19 +9,19 @@ interface FindMatchingBraceParams { } export async function handle() { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: FindMatchingBraceParams = { + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId != 'rust') { return; } + const request: FindMatchingBraceParams = { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map((s) => { - return Server.client.code2ProtocolConverter.asPosition(s.active) - }) - } - let response = await Server.client.sendRequest("m/findMatchingBrace", request) + return Server.client.code2ProtocolConverter.asPosition(s.active); + }), + }; + const response = await Server.client.sendRequest('m/findMatchingBrace', request); editor.selections = editor.selections.map((sel, idx) => { - let active = Server.client.protocol2CodeConverter.asPosition(response[idx]) - let anchor = sel.isEmpty ? active : sel.anchor - return new vscode.Selection(anchor, active) - }) - editor.revealRange(editor.selection) -}; + const active = Server.client.protocol2CodeConverter.asPosition(response[idx]); + const anchor = sel.isEmpty ? active : sel.anchor; + return new vscode.Selection(anchor, active); + }); + editor.revealRange(editor.selection); +} diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index dae60bfb..7d413c27 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -1,22 +1,22 @@ import * as vscode from 'vscode'; -import { TextDocumentIdentifier, Location } from "vscode-languageclient"; +import { Location, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; export async function handle() { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let request: TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let response = await Server.client.sendRequest("m/parentModule", request) - let loc = response[0] - if (loc == null) return - let uri = Server.client.protocol2CodeConverter.asUri(loc.uri) - let range = Server.client.protocol2CodeConverter.asRange(loc.range) + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId != 'rust') { return; } + const request: TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + const response = await Server.client.sendRequest('m/parentModule', request); + const loc = response[0]; + if (loc == null) { return; } + const uri = Server.client.protocol2CodeConverter.asUri(loc.uri); + const range = Server.client.protocol2CodeConverter.asRange(loc.range); - let doc = await vscode.workspace.openTextDocument(uri) - let e = await vscode.window.showTextDocument(doc) - e.selection = new vscode.Selection(range.start, range.start) - e.revealRange(range, vscode.TextEditorRevealType.InCenter) + const doc = await vscode.workspace.openTextDocument(uri); + const e = await vscode.window.showTextDocument(doc); + e.selection = new vscode.Selection(range.start, range.start); + e.revealRange(range, vscode.TextEditorRevealType.InCenter); } diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 45c16497..37db6ea1 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient' +import * as lc from 'vscode-languageclient'; import { Server } from '../server'; interface RunnablesParams { - textDocument: lc.TextDocumentIdentifier, - position?: lc.Position, + textDocument: lc.TextDocumentIdentifier; + position?: lc.Position; } interface Runnable { @@ -12,17 +12,17 @@ interface Runnable { label: string; bin: string; args: string[]; - env: { [index: string]: string }, + env: { [index: string]: string }; } class RunnableQuickPick implements vscode.QuickPickItem { - label: string; - description?: string | undefined; - detail?: string | undefined; - picked?: boolean | undefined; + public label: string; + public description?: string | undefined; + public detail?: string | undefined; + public picked?: boolean | undefined; constructor(public runnable: Runnable) { - this.label = runnable.label + this.label = runnable.label; } } @@ -30,59 +30,59 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { type: 'cargo'; label: string; command: string; - args: Array; + args: string[]; env?: { [key: string]: string }; } function createTask(spec: Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; - let definition: CargoTaskDefinition = { + const definition: CargoTaskDefinition = { type: 'cargo', label: 'cargo', command: spec.bin, args: spec.args, - env: spec.env - } + env: spec.env, + }; - let execCmd = `${definition.command} ${definition.args.join(' ')}`; - let execOption: vscode.ShellExecutionOptions = { + const execCmd = `${definition.command} ${definition.args.join(' ')}`; + const execOption: vscode.ShellExecutionOptions = { cwd: '.', env: definition.env, }; - let exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); + const exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); - let f = vscode.workspace.workspaceFolders![0] - let t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); + const f = vscode.workspace.workspaceFolders![0]; + const t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); return t; } -let prevRunnable: RunnableQuickPick | undefined = undefined +let prevRunnable: RunnableQuickPick | undefined; export async function handle() { - let editor = vscode.window.activeTextEditor - if (editor == null || editor.document.languageId != "rust") return - let textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let params: RunnablesParams = { + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId != 'rust') { return; } + const textDocument: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + const params: RunnablesParams = { textDocument, - position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active) - } - let runnables = await Server.client.sendRequest('m/runnables', params) - let items: RunnableQuickPick[] = [] + position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active), + }; + const runnables = await Server.client.sendRequest('m/runnables', params); + const items: RunnableQuickPick[] = []; if (prevRunnable) { - items.push(prevRunnable) + items.push(prevRunnable); } - for (let r of runnables) { + for (const r of runnables) { if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { - continue + continue; } - items.push(new RunnableQuickPick(r)) + items.push(new RunnableQuickPick(r)); } - let item = await vscode.window.showQuickPick(items) + const item = await vscode.window.showQuickPick(items); if (item) { - item.detail = "rerun" - prevRunnable = item - let task = createTask(item.runnable) - return await vscode.tasks.executeTask(task) + item.detail = 'rerun'; + prevRunnable = item; + const task = createTask(item.runnable); + return await vscode.tasks.executeTask(task); } } diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index d5daa930..dcb721ee 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -6,20 +6,20 @@ import { Server } from '../server'; export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - public eventEmitter = new vscode.EventEmitter() - public syntaxTree: string = "Not available" + public eventEmitter = new vscode.EventEmitter(); + public syntaxTree: string = 'Not available'; public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { - let editor = vscode.window.activeTextEditor; - if (editor == null) return "" - let request: SyntaxTreeParams = { - textDocument: { uri: editor.document.uri.toString() } + const editor = vscode.window.activeTextEditor; + if (editor == null) { return ''; } + const request: SyntaxTreeParams = { + textDocument: { uri: editor.document.uri.toString() }, }; - return Server.client.sendRequest("m/syntaxTree", request); + return Server.client.sendRequest('m/syntaxTree', request); } get onDidChange(): vscode.Event { - return this.eventEmitter.event + return this.eventEmitter.event; } } @@ -33,6 +33,6 @@ type SyntaxTreeResult = string; // // The contents of the file come from the `TextDocumentContentProvider` export async function handle() { - let document = await vscode.workspace.openTextDocument(syntaxTreeUri) - return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true) + const document = await vscode.workspace.openTextDocument(syntaxTreeUri); + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts new file mode 100644 index 00000000..740b5be2 --- /dev/null +++ b/rust-analyzer/editors/code/src/config.ts @@ -0,0 +1,23 @@ +import * as vscode from 'vscode'; + +import { Server } from './server'; + +export class Config { + public highlightingOn = true; + + constructor() { + vscode.workspace.onDidChangeConfiguration((_) => this.userConfigChanged()); + this.userConfigChanged(); + } + + public userConfigChanged() { + const config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + this.highlightingOn = config.get('highlightingOn') as boolean; + } + + if (!this.highlightingOn && Server) { + Server.highlighter.removeHighlights(); + } + } +} diff --git a/rust-analyzer/editors/code/src/events.ts b/rust-analyzer/editors/code/src/events.ts index b143bb25..8e2ac4a4 100644 --- a/rust-analyzer/editors/code/src/events.ts +++ b/rust-analyzer/editors/code/src/events.ts @@ -1,7 +1,7 @@ -import * as changeActiveTextEditor from './events/change_active_text_editor' +import * as changeActiveTextEditor from './events/change_active_text_editor'; import * as changeTextDocument from './events/change_text_document'; export { changeActiveTextEditor, - changeTextDocument -} \ No newline at end of file + changeTextDocument, +}; diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index bbdd5309..96d61126 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -1,14 +1,14 @@ -import { TextEditor } from "vscode"; -import { TextDocumentIdentifier } from "vscode-languageclient"; +import { TextEditor } from 'vscode'; +import { TextDocumentIdentifier } from 'vscode-languageclient'; -import { Server } from "../server"; -import { Decoration } from "../highlighting"; +import { Decoration } from '../highlighting'; +import { Server } from '../server'; export async function handle(editor: TextEditor | undefined) { - if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') return - let params: TextDocumentIdentifier = { - uri: editor.document.uri.toString() - } - let decorations = await Server.client.sendRequest("m/decorationsRequest", params) - Server.highlighter.setHighlights(editor, decorations) -} \ No newline at end of file + if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') { return; } + const params: TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + const decorations = await Server.client.sendRequest('m/decorationsRequest', params); + Server.highlighter.setHighlights(editor, decorations); +} diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts index 83ee6c9e..192fb1e8 100644 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -4,16 +4,16 @@ import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTr export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) { return (event: vscode.TextDocumentChangeEvent) => { - let doc = event.document - if (doc.languageId != "rust") return + const doc = event.document; + if (doc.languageId != 'rust') { return; } afterLs(() => { textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); - }) - } + }); + }; } // We need to order this after LS updates, but there's no API for that. // Hence, good old setTimeout. function afterLs(f: () => any) { - setTimeout(f, 10) + setTimeout(f, 10); } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 595fb98f..f1bc0b45 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,9 +1,9 @@ import * as vscode from 'vscode'; -import * as commands from './commands' -import * as events from './events' -import { Server } from './server'; +import * as commands from './commands'; import { TextDocumentContentProvider } from './commands/syntaxTree'; +import * as events from './events'; +import { Server } from './server'; export function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { @@ -11,10 +11,10 @@ export function activate(context: vscode.ExtensionContext) { } function registerCommand(name: string, f: any) { - disposeOnDeactivation(vscode.commands.registerCommand(name, f)) + disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } - registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle) + registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); registerCommand('ra-lsp.joinLines', commands.joinLines.handle); @@ -22,19 +22,19 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('ra-lsp.run', commands.runnables.handle); registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle); - let textDocumentContentProvider = new TextDocumentContentProvider() + const textDocumentContentProvider = new TextDocumentContentProvider(); disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider( 'ra-lsp', - textDocumentContentProvider - )) + textDocumentContentProvider, + )); - Server.start() + Server.start(); vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(textDocumentContentProvider), null, - context.subscriptions) - vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle) + context.subscriptions); + vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle); } export function deactivate(): Thenable { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 169ddb0d..71f8e5ba 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,11 +1,11 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient' +import * as lc from 'vscode-languageclient'; import { Server } from './server'; export interface Decoration { - range: lc.Range, - tag: string, + range: lc.Range; + tag: string; } export class Highlighter { @@ -14,17 +14,17 @@ export class Highlighter { this.decorations = {}; } - removeHighlights() { - for (let tag in this.decorations) { + public removeHighlights() { + for (const tag in this.decorations) { this.decorations[tag].dispose(); } this.decorations = {}; } - setHighlights( + public setHighlights( editor: vscode.TextEditor, - highlights: Array + highlights: Decoration[], ) { // Initialize decorations if necessary // @@ -34,45 +34,45 @@ export class Highlighter { this.initDecorations(); } - let byTag: Map = new Map() - for (let tag in this.decorations) { - byTag.set(tag, []) + const byTag: Map = new Map(); + for (const tag in this.decorations) { + byTag.set(tag, []); } - for (let d of highlights) { + for (const d of highlights) { if (!byTag.get(d.tag)) { - console.log(`unknown tag ${d.tag}`) - continue + console.log(`unknown tag ${d.tag}`); + continue; } byTag.get(d.tag)!.push( - Server.client.protocol2CodeConverter.asRange(d.range) - ) + Server.client.protocol2CodeConverter.asRange(d.range), + ); } - for (let tag of byTag.keys()) { - let dec: vscode.TextEditorDecorationType = this.decorations[tag] - let ranges = byTag.get(tag)! - editor.setDecorations(dec, ranges) + for (const tag of byTag.keys()) { + const dec: vscode.TextEditorDecorationType = this.decorations[tag]; + const ranges = byTag.get(tag)!; + editor.setDecorations(dec, ranges); } } private initDecorations() { - const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }) + const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }); this.decorations = { - background: decor("#3F3F3F"), + background: decor('#3F3F3F'), error: vscode.window.createTextEditorDecorationType({ - borderColor: "red", - borderStyle: "none none dashed none", + borderColor: 'red', + borderStyle: 'none none dashed none', }), - comment: decor("#7F9F7F"), - string: decor("#CC9393"), - keyword: decor("#F0DFAF"), - function: decor("#93E0E3"), - parameter: decor("#94BFF3"), - builtin: decor("#DD6718"), - text: decor("#DCDCCC"), - attribute: decor("#BFEBBF"), - literal: decor("#DFAF8F"), - } + comment: decor('#7F9F7F'), + string: decor('#CC9393'), + keyword: decor('#F0DFAF'), + function: decor('#93E0E3'), + parameter: decor('#94BFF3'), + builtin: decor('#DD6718'), + text: decor('#DCDCCC'), + attribute: decor('#BFEBBF'), + literal: decor('#DFAF8F'), + }; } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index c1c95e00..3857b00a 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,45 +1,25 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient' +import * as lc from 'vscode-languageclient'; -import { Highlighter, Decoration } from './highlighting'; - -export class Config { - highlightingOn = true; - - constructor() { - vscode.workspace.onDidChangeConfiguration(_ => this.userConfigChanged()); - this.userConfigChanged(); - } - - userConfigChanged() { - let config = vscode.workspace.getConfiguration('ra-lsp'); - if (config.has('highlightingOn')) { - this.highlightingOn = config.get('highlightingOn') as boolean; - }; - - if (!this.highlightingOn) { - Server.highlighter.removeHighlights(); - } - } -} +import { Config } from './config'; +import { Decoration, Highlighter } from './highlighting'; export class Server { - static highlighter = new Highlighter(); - static config = new Config(); - static client: lc.LanguageClient; - - - static start() { - let run: lc.Executable = { - command: "ra_lsp_server", - options: { cwd: "." } - } - let serverOptions: lc.ServerOptions = { + public static highlighter = new Highlighter(); + public static config = new Config(); + public static client: lc.LanguageClient; + + public static start() { + const run: lc.Executable = { + command: 'ra_lsp_server', + options: { cwd: '.' }, + }; + const serverOptions: lc.ServerOptions = { run, - debug: run + debug: run, }; - let clientOptions: lc.LanguageClientOptions = { + const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], }; @@ -51,24 +31,24 @@ export class Server { ); Server.client.onReady().then(() => { Server.client.onNotification( - "m/publishDecorations", + 'm/publishDecorations', (params: PublishDecorationsParams) => { - let editor = vscode.window.visibleTextEditors.find( - (editor) => editor.document.uri.toString() == params.uri - ) - if (!Server.config.highlightingOn || !editor) return; + const targetEditor = vscode.window.visibleTextEditors.find( + (editor) => editor.document.uri.toString() == params.uri, + ); + if (!Server.config.highlightingOn || !targetEditor) { return; } Server.highlighter.setHighlights( - editor, + targetEditor, params.decorations, - ) - } - ) - }) + ); + }, + ); + }); Server.client.start(); } } interface PublishDecorationsParams { - uri: string, - decorations: Decoration[], + uri: string; + decorations: Decoration[]; } diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json new file mode 100644 index 00000000..466e1fa2 --- /dev/null +++ b/rust-analyzer/editors/code/tslint.json @@ -0,0 +1,13 @@ +{ + "defaultSeverity": "warning", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "quotemark": [true, "single"], + "interface-name": false, + "object-literal-sort-keys": false + }, + "rulesDirectory": [] +} From b29a06c0004f107e08638d0dce9b983b89fe5200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Mon, 8 Oct 2018 20:18:55 +0200 Subject: [PATCH 008/819] Fix remaining tslint suggestions --- rust-analyzer/editors/code/src/commands.ts | 17 ----- .../code/src/commands/apply_source_change.ts | 26 ++++---- .../code/src/commands/extend_selection.ts | 2 +- .../editors/code/src/commands/index.ts | 17 +++++ .../editors/code/src/commands/join_lines.ts | 2 +- .../code/src/commands/matching_brace.ts | 2 +- .../code/src/commands/parent_module.ts | 2 +- .../editors/code/src/commands/runnables.ts | 4 +- rust-analyzer/editors/code/src/events.ts | 7 -- .../src/events/change_active_text_editor.ts | 2 +- .../code/src/events/change_text_document.ts | 2 +- .../editors/code/src/events/index.ts | 7 ++ .../editors/code/src/highlighting.ts | 66 ++++++++++--------- rust-analyzer/editors/code/src/server.ts | 2 +- rust-analyzer/editors/code/tslint.json | 2 +- 15 files changed, 82 insertions(+), 78 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands.ts create mode 100644 rust-analyzer/editors/code/src/commands/index.ts delete mode 100644 rust-analyzer/editors/code/src/events.ts create mode 100644 rust-analyzer/editors/code/src/events/index.ts diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts deleted file mode 100644 index c7e27781..00000000 --- a/rust-analyzer/editors/code/src/commands.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as applySourceChange from './commands/apply_source_change'; -import * as extendSelection from './commands/extend_selection'; -import * as joinLines from './commands/join_lines'; -import * as matchingBrace from './commands/matching_brace'; -import * as parentModule from './commands/parent_module'; -import * as runnables from './commands/runnables'; -import * as syntaxTree from './commands/syntaxTree'; - -export { - applySourceChange, - extendSelection, - joinLines, - matchingBrace, - parentModule, - runnables, - syntaxTree, -}; diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index f011cbe1..67765e5a 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -18,7 +18,6 @@ export interface SourceChange { } export async function handle(change: SourceChange) { - console.log(`applySOurceChange ${JSON.stringify(change)}`); const wsEdit = new vscode.WorkspaceEdit(); for (const sourceEdit of change.sourceFileEdits) { const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); @@ -28,17 +27,18 @@ export async function handle(change: SourceChange) { let created; let moved; for (const fsEdit of change.fileSystemEdits) { - if (fsEdit.type == 'createFile') { - const uri = vscode.Uri.parse(fsEdit.uri!); - wsEdit.createFile(uri); - created = uri; - } else if (fsEdit.type == 'moveFile') { - const src = vscode.Uri.parse(fsEdit.src!); - const dst = vscode.Uri.parse(fsEdit.dst!); - wsEdit.renameFile(src, dst); - moved = dst; - } else { - console.error(`unknown op: ${JSON.stringify(fsEdit)}`); + switch (fsEdit.type) { + case 'createFile': + const uri = vscode.Uri.parse(fsEdit.uri!); + wsEdit.createFile(uri); + created = uri; + break; + case 'moveFile': + const src = vscode.Uri.parse(fsEdit.src!); + const dst = vscode.Uri.parse(fsEdit.dst!); + wsEdit.renameFile(src, dst); + moved = dst; + break; } } const toOpen = created || moved; @@ -51,7 +51,7 @@ export async function handle(change: SourceChange) { const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); const editor = vscode.window.activeTextEditor; - if (!editor || editor.document.uri.toString() != uri.toString()) { return; } + if (!editor || editor.document.uri.toString() !== uri.toString()) { return; } if (!editor.selection.isEmpty) { return; } editor!.selection = new vscode.Selection(position, position); } diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts index b722ac17..cdc3d10f 100644 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -14,7 +14,7 @@ interface ExtendSelectionResult { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId != 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { return; } const request: ExtendSelectionParams = { selections: editor.selections.map((s) => { return Server.client.code2ProtocolConverter.asRange(s); diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts new file mode 100644 index 00000000..dfdcd645 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -0,0 +1,17 @@ +import * as applySourceChange from './apply_source_change'; +import * as extendSelection from './extend_selection'; +import * as joinLines from './join_lines'; +import * as matchingBrace from './matching_brace'; +import * as parentModule from './parent_module'; +import * as runnables from './runnables'; +import * as syntaxTree from './syntaxTree'; + +export { + applySourceChange, + extendSelection, + joinLines, + matchingBrace, + parentModule, + runnables, + syntaxTree, +}; diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 80ad4460..526b698c 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -11,7 +11,7 @@ interface JoinLinesParams { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId != 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { return; } const request: JoinLinesParams = { range: Server.client.code2ProtocolConverter.asRange(editor.selection), textDocument: { uri: editor.document.uri.toString() }, diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index cf7f6bf8..a80446a8 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -10,7 +10,7 @@ interface FindMatchingBraceParams { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId != 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { return; } const request: FindMatchingBraceParams = { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map((s) => { diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 7d413c27..d66fb302 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -5,7 +5,7 @@ import { Server } from '../server'; export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId != 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { return; } const request: TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 37db6ea1..40f590dc 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -59,7 +59,7 @@ function createTask(spec: Runnable): vscode.Task { let prevRunnable: RunnableQuickPick | undefined; export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId != 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { return; } const textDocument: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; @@ -73,7 +73,7 @@ export async function handle() { items.push(prevRunnable); } for (const r of runnables) { - if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { + if (prevRunnable && JSON.stringify(prevRunnable.runnable) === JSON.stringify(r)) { continue; } items.push(new RunnableQuickPick(r)); diff --git a/rust-analyzer/editors/code/src/events.ts b/rust-analyzer/editors/code/src/events.ts deleted file mode 100644 index 8e2ac4a4..00000000 --- a/rust-analyzer/editors/code/src/events.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as changeActiveTextEditor from './events/change_active_text_editor'; -import * as changeTextDocument from './events/change_text_document'; - -export { - changeActiveTextEditor, - changeTextDocument, -}; diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index 96d61126..3440aa0c 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -5,7 +5,7 @@ import { Decoration } from '../highlighting'; import { Server } from '../server'; export async function handle(editor: TextEditor | undefined) { - if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') { return; } + if (!Server.config.highlightingOn || !editor || editor.document.languageId !== 'rust') { return; } const params: TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts index 192fb1e8..b3000e02 100644 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -5,7 +5,7 @@ import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTr export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) { return (event: vscode.TextDocumentChangeEvent) => { const doc = event.document; - if (doc.languageId != 'rust') { return; } + if (doc.languageId !== 'rust') { return; } afterLs(() => { textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); }); diff --git a/rust-analyzer/editors/code/src/events/index.ts b/rust-analyzer/editors/code/src/events/index.ts new file mode 100644 index 00000000..b570a7a9 --- /dev/null +++ b/rust-analyzer/editors/code/src/events/index.ts @@ -0,0 +1,7 @@ +import * as changeActiveTextEditor from './change_active_text_editor'; +import * as changeTextDocument from './change_text_document'; + +export { + changeActiveTextEditor, + changeTextDocument, +}; diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 71f8e5ba..e2ac4d62 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -9,17 +9,42 @@ export interface Decoration { } export class Highlighter { - private decorations: { [index: string]: vscode.TextEditorDecorationType }; - constructor() { - this.decorations = {}; + private static initDecorations(): Map { + const decor = (color: string) => vscode.window.createTextEditorDecorationType({ color }); + + const decorations: Iterable<[string, vscode.TextEditorDecorationType]> = [ + ['background', decor('#3F3F3F')], + ['error', vscode.window.createTextEditorDecorationType({ + borderColor: 'red', + borderStyle: 'none none dashed none', + })], + ['comment', decor('#7F9F7F')], + ['string', decor('#CC9393')], + ['keyword', decor('#F0DFAF')], + ['function', decor('#93E0E3')], + ['parameter', decor('#94BFF3')], + ['builtin', decor('#DD6718')], + ['text', decor('#DCDCCC')], + ['attribute', decor('#BFEBBF')], + ['literal', decor('#DFAF8F')], + ]; + + return new Map(decorations); } + private decorations: (Map | null) = null; + public removeHighlights() { - for (const tag in this.decorations) { - this.decorations[tag].dispose(); + if (this.decorations == null) { + return; } - this.decorations = {}; + // Decorations are removed when the object is disposed + for (const decoration of this.decorations.values()) { + decoration.dispose(); + } + + this.decorations = null; } public setHighlights( @@ -30,18 +55,17 @@ export class Highlighter { // // Note: decoration objects need to be kept around so we can dispose them // if the user disables syntax highlighting - if (Object.keys(this.decorations).length === 0) { - this.initDecorations(); + if (this.decorations == null) { + this.decorations = Highlighter.initDecorations(); } const byTag: Map = new Map(); - for (const tag in this.decorations) { + for (const tag of this.decorations.keys()) { byTag.set(tag, []); } for (const d of highlights) { if (!byTag.get(d.tag)) { - console.log(`unknown tag ${d.tag}`); continue; } byTag.get(d.tag)!.push( @@ -50,29 +74,9 @@ export class Highlighter { } for (const tag of byTag.keys()) { - const dec: vscode.TextEditorDecorationType = this.decorations[tag]; + const dec = this.decorations.get(tag) as vscode.TextEditorDecorationType; const ranges = byTag.get(tag)!; editor.setDecorations(dec, ranges); } } - - private initDecorations() { - const decor = (obj: any) => vscode.window.createTextEditorDecorationType({ color: obj }); - this.decorations = { - background: decor('#3F3F3F'), - error: vscode.window.createTextEditorDecorationType({ - borderColor: 'red', - borderStyle: 'none none dashed none', - }), - comment: decor('#7F9F7F'), - string: decor('#CC9393'), - keyword: decor('#F0DFAF'), - function: decor('#93E0E3'), - parameter: decor('#94BFF3'), - builtin: decor('#DD6718'), - text: decor('#DCDCCC'), - attribute: decor('#BFEBBF'), - literal: decor('#DFAF8F'), - }; - } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 3857b00a..325023e3 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -34,7 +34,7 @@ export class Server { 'm/publishDecorations', (params: PublishDecorationsParams) => { const targetEditor = vscode.window.visibleTextEditors.find( - (editor) => editor.document.uri.toString() == params.uri, + (editor) => editor.document.uri.toString() === params.uri, ); if (!Server.config.highlightingOn || !targetEditor) { return; } Server.highlighter.setHighlights( diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index 466e1fa2..ce48dfc9 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -1,5 +1,5 @@ { - "defaultSeverity": "warning", + "defaultSeverity": "error", "extends": [ "tslint:recommended" ], From 3d565fa96e282a6f8ab2b7e13ffd9efbbca01162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Mon, 8 Oct 2018 20:55:22 +0200 Subject: [PATCH 009/819] Add some comments --- rust-analyzer/editors/code/src/extension.ts | 17 +++++++++--- .../editors/code/src/notifications/index.ts | 5 ++++ .../src/notifications/publish_decorations.ts | 20 ++++++++++++++ rust-analyzer/editors/code/src/server.ts | 27 ++++--------------- 4 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 rust-analyzer/editors/code/src/notifications/index.ts create mode 100644 rust-analyzer/editors/code/src/notifications/publish_decorations.ts diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index f1bc0b45..44e74f4c 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,8 +1,10 @@ import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { TextDocumentContentProvider } from './commands/syntaxTree'; import * as events from './events'; +import * as notifications from './notifications'; import { Server } from './server'; export function activate(context: vscode.ExtensionContext) { @@ -14,6 +16,7 @@ export function activate(context: vscode.ExtensionContext) { disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } + // Commands are requests from vscode to the language server registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); @@ -22,19 +25,27 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('ra-lsp.run', commands.runnables.handle); registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle); + // Notifications are events triggered by the language server + const allNotifications: Iterable<[string, lc.GenericNotificationHandler]> = [ + ['m/publishDecorations', notifications.publishDecorations.handle], + ]; + + // The events below are plain old javascript events, triggered and handled by vscode + vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle); + const textDocumentContentProvider = new TextDocumentContentProvider(); disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider( 'ra-lsp', textDocumentContentProvider, )); - Server.start(); - vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(textDocumentContentProvider), null, context.subscriptions); - vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle); + + // Start the language server, finally! + Server.start(allNotifications); } export function deactivate(): Thenable { diff --git a/rust-analyzer/editors/code/src/notifications/index.ts b/rust-analyzer/editors/code/src/notifications/index.ts new file mode 100644 index 00000000..c5657686 --- /dev/null +++ b/rust-analyzer/editors/code/src/notifications/index.ts @@ -0,0 +1,5 @@ +import * as publishDecorations from './publish_decorations'; + +export { + publishDecorations, +}; diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts new file mode 100644 index 00000000..d8790386 --- /dev/null +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -0,0 +1,20 @@ +import * as vscode from 'vscode'; + +import { Decoration } from '../highlighting'; +import { Server } from '../server'; + +export interface PublishDecorationsParams { + uri: string; + decorations: Decoration[]; +} + +export function handle(params: PublishDecorationsParams) { + const targetEditor = vscode.window.visibleTextEditors.find( + (editor) => editor.document.uri.toString() === params.uri, + ); + if (!Server.config.highlightingOn || !targetEditor) { return; } + Server.highlighter.setHighlights( + targetEditor, + params.decorations, + ); +} diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 325023e3..01fd8075 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,15 +1,14 @@ -import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { Decoration, Highlighter } from './highlighting'; +import { Highlighter } from './highlighting'; export class Server { public static highlighter = new Highlighter(); public static config = new Config(); public static client: lc.LanguageClient; - public static start() { + public static start(notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>) { const run: lc.Executable = { command: 'ra_lsp_server', options: { cwd: '.' }, @@ -18,7 +17,6 @@ export class Server { run, debug: run, }; - const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], }; @@ -30,25 +28,10 @@ export class Server { clientOptions, ); Server.client.onReady().then(() => { - Server.client.onNotification( - 'm/publishDecorations', - (params: PublishDecorationsParams) => { - const targetEditor = vscode.window.visibleTextEditors.find( - (editor) => editor.document.uri.toString() === params.uri, - ); - if (!Server.config.highlightingOn || !targetEditor) { return; } - Server.highlighter.setHighlights( - targetEditor, - params.decorations, - ); - }, - ); + for (const [type, handler] of notificationHandlers) { + Server.client.onNotification(type, handler); + } }); Server.client.start(); } } - -interface PublishDecorationsParams { - uri: string; - decorations: Decoration[]; -} From d7103eca9d48f22a6016cc3759166ae3fa0aac7e Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 8 Oct 2018 22:36:47 +0100 Subject: [PATCH 010/819] Add tslint and prettier to ci --- rust-analyzer/editors/code/package-lock.json | 950 +++++++++++-------- rust-analyzer/editors/code/package.json | 19 +- rust-analyzer/editors/code/src/config.ts | 26 +- rust-analyzer/editors/code/tslint.json | 18 +- 4 files changed, 614 insertions(+), 399 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 594a10b5..eb5990a8 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -11,9 +11,9 @@ "dev": true }, "@types/node": { - "version": "8.10.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.29.tgz", - "integrity": "sha512-zbteaWZ2mdduacm0byELwtRyhYE40aK+pAanQk415gr1eRuu67x7QGOLmn8jz5zI8LDK7d0WI/oT6r5Trz4rzQ==", + "version": "8.10.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.34.tgz", + "integrity": "sha512-alypNiaAEd0RBGXoWehJ2gchPYCITmw4CYBoB5nDlji8l8on7FsklfdfIs4DDmgpKLSX3OF3ha6SV+0W7cTzUA==", "dev": true }, "ajv": { @@ -22,10 +22,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.1.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ansi-cyan": { @@ -46,6 +46,18 @@ "ansi-wrap": "0.1.0" } }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, "ansi-wrap": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", @@ -58,7 +70,7 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" } }, "arr-diff": { @@ -67,8 +79,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-flatten": { @@ -101,7 +113,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -128,7 +140,7 @@ "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "~2.1.0" } }, "assert-plus": { @@ -155,6 +167,38 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -168,7 +212,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "block-stream": { @@ -177,7 +221,7 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "boolbase": { @@ -192,7 +236,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -202,9 +246,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.3" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "browser-stdout": { @@ -225,24 +269,67 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "cheerio": { "version": "1.0.0-rc.2", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz", "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", "dev": true, "requires": { - "css-select": "1.2.0", - "dom-serializer": "0.1.0", - "entities": "1.1.1", - "htmlparser2": "3.9.2", - "lodash": "4.17.11", - "parse5": "3.0.3" + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" } }, "clone": { @@ -269,9 +356,9 @@ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", "dev": true, "requires": { - "inherits": "2.0.3", - "process-nextick-args": "2.0.0", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" } }, "co": { @@ -280,13 +367,28 @@ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": true }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -307,7 +409,7 @@ "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.1" } }, "core-util-is": { @@ -322,10 +424,10 @@ "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { - "boolbase": "1.0.0", - "css-what": "2.1.0", + "boolbase": "~1.0.0", + "css-what": "2.1", "domutils": "1.5.1", - "nth-check": "1.0.1" + "nth-check": "~1.0.1" } }, "css-what": { @@ -340,7 +442,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "debug": { @@ -358,7 +460,7 @@ "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { - "is-obj": "1.0.1" + "is-obj": "^1.0.0" } }, "delayed-stream": { @@ -385,8 +487,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "domelementtype": "~1.1.1", + "entities": "~1.1.1" }, "dependencies": { "domelementtype": { @@ -409,7 +511,7 @@ "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", "dev": true, "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1" } }, "domutils": { @@ -418,8 +520,8 @@ "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "dom-serializer": "0", + "domelementtype": "1" } }, "duplexer": { @@ -434,10 +536,10 @@ "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", "dev": true, "requires": { - "end-of-stream": "1.4.1", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "stream-shift": "1.0.0" + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" } }, "ecc-jsbn": { @@ -447,8 +549,8 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1", - "safer-buffer": "2.1.2" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "end-of-stream": { @@ -457,7 +559,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.4.0" } }, "entities": { @@ -472,20 +574,32 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, "event-stream": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz", "integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==", "dev": true, "requires": { - "duplexer": "0.1.1", - "flatmap-stream": "0.1.0", - "from": "0.1.7", + "duplexer": "^0.1.1", + "flatmap-stream": "^0.1.0", + "from": "^0.1.7", "map-stream": "0.0.7", - "pause-stream": "0.0.11", - "split": "1.0.1", - "stream-combiner": "0.2.2", - "through": "2.3.8" + "pause-stream": "^0.0.11", + "split": "^1.0.1", + "stream-combiner": "^0.2.2", + "through": "^2.3.8" } }, "expand-brackets": { @@ -494,7 +608,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" } }, "expand-range": { @@ -503,7 +617,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "2.2.4" + "fill-range": "^2.1.0" } }, "extend": { @@ -518,7 +632,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "extglob": { @@ -527,7 +641,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" }, "dependencies": { "is-extglob": { @@ -562,7 +676,7 @@ "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "dev": true, "requires": { - "pend": "1.2.0" + "pend": "~1.2.0" } }, "filename-regex": { @@ -577,11 +691,11 @@ "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "3.1.0", - "repeat-element": "1.1.3", - "repeat-string": "1.6.1" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, "first-chunk-stream": { @@ -608,7 +722,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } }, "forever-agent": { @@ -623,9 +737,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "0.4.0", + "asynckit": "^0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.20" + "mime-types": "^2.1.12" } }, "from": { @@ -646,10 +760,10 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.2" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "getpass": { @@ -658,7 +772,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "glob": { @@ -667,12 +781,12 @@ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "glob-base": { @@ -681,8 +795,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "glob-parent": { @@ -691,7 +805,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" } }, "is-extglob": { @@ -706,7 +820,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -717,8 +831,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" } }, "glob-stream": { @@ -727,14 +841,14 @@ "integrity": "sha1-pVZlqajM3EGRWofHAeMtTgFvrSI=", "dev": true, "requires": { - "extend": "3.0.2", - "glob": "5.0.15", - "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", - "unique-stream": "2.2.1" + "extend": "^3.0.0", + "glob": "^5.0.3", + "glob-parent": "^3.0.0", + "micromatch": "^2.3.7", + "ordered-read-streams": "^0.3.0", + "through2": "^0.6.0", + "to-absolute-glob": "^0.1.1", + "unique-stream": "^2.0.2" }, "dependencies": { "glob": { @@ -743,11 +857,11 @@ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "isarray": { @@ -762,10 +876,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -780,8 +894,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } } } @@ -804,9 +918,9 @@ "integrity": "sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw=", "dev": true, "requires": { - "deep-assign": "1.0.0", - "stat-mode": "0.2.2", - "through2": "2.0.3" + "deep-assign": "^1.0.0", + "stat-mode": "^0.2.0", + "through2": "^2.0.0" } }, "gulp-filter": { @@ -815,9 +929,9 @@ "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", "dev": true, "requires": { - "multimatch": "2.1.0", - "plugin-error": "0.1.2", - "streamfilter": "1.0.7" + "multimatch": "^2.0.0", + "plugin-error": "^0.1.2", + "streamfilter": "^1.0.5" } }, "gulp-gunzip": { @@ -826,8 +940,8 @@ "integrity": "sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak=", "dev": true, "requires": { - "through2": "0.6.5", - "vinyl": "0.4.6" + "through2": "~0.6.5", + "vinyl": "~0.4.6" }, "dependencies": { "isarray": { @@ -842,10 +956,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -860,8 +974,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } } } @@ -872,11 +986,11 @@ "integrity": "sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ==", "dev": true, "requires": { - "event-stream": "3.3.6", - "node.extend": "1.1.6", - "request": "2.88.0", - "through2": "2.0.3", - "vinyl": "2.2.0" + "event-stream": "^3.3.4", + "node.extend": "^1.1.2", + "request": "^2.79.0", + "through2": "^2.0.3", + "vinyl": "^2.0.1" }, "dependencies": { "clone": { @@ -897,12 +1011,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -913,11 +1027,11 @@ "integrity": "sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw=", "dev": true, "requires": { - "convert-source-map": "1.6.0", - "graceful-fs": "4.1.11", - "strip-bom": "2.0.0", - "through2": "2.0.3", - "vinyl": "1.2.0" + "convert-source-map": "^1.1.1", + "graceful-fs": "^4.1.2", + "strip-bom": "^2.0.0", + "through2": "^2.0.0", + "vinyl": "^1.0.0" }, "dependencies": { "clone": { @@ -938,8 +1052,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", + "clone": "^1.0.0", + "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } @@ -951,10 +1065,10 @@ "integrity": "sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA=", "dev": true, "requires": { - "event-stream": "3.3.6", - "mkdirp": "0.5.1", - "queue": "3.1.0", - "vinyl-fs": "2.4.4" + "event-stream": "^3.3.1", + "mkdirp": "^0.5.1", + "queue": "^3.1.0", + "vinyl-fs": "^2.4.3" } }, "gulp-untar": { @@ -963,11 +1077,11 @@ "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "3.3.6", - "streamifier": "0.1.1", - "tar": "2.2.1", - "through2": "2.0.3", - "vinyl": "1.2.0" + "event-stream": "~3.3.4", + "streamifier": "~0.1.1", + "tar": "^2.2.1", + "through2": "~2.0.3", + "vinyl": "^1.2.0" }, "dependencies": { "clone": { @@ -988,8 +1102,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", + "clone": "^1.0.0", + "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } @@ -1001,13 +1115,13 @@ "integrity": "sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0=", "dev": true, "requires": { - "event-stream": "3.3.6", - "queue": "4.5.0", - "through2": "2.0.3", - "vinyl": "2.2.0", - "vinyl-fs": "2.4.4", - "yauzl": "2.10.0", - "yazl": "2.4.3" + "event-stream": "^3.3.1", + "queue": "^4.2.1", + "through2": "^2.0.3", + "vinyl": "^2.0.2", + "vinyl-fs": "^2.0.0", + "yauzl": "^2.2.1", + "yazl": "^2.2.1" }, "dependencies": { "clone": { @@ -1028,7 +1142,7 @@ "integrity": "sha512-DwxpAnqJuoQa+wyDgQuwkSshkhlqIlWEvwvdAY27fDPunZ2cVJzXU4JyjY+5l7zs7oGLaYAQm4MbLOVFAHFBzA==", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "vinyl": { @@ -1037,12 +1151,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -1059,8 +1173,17 @@ "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "dev": true, "requires": { - "ajv": "5.5.2", - "har-schema": "2.0.0" + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" } }, "has-flag": { @@ -1081,12 +1204,12 @@ "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "dev": true, "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.2", - "domutils": "1.5.1", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.6" + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" } }, "http-signature": { @@ -1095,9 +1218,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.14.2" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { @@ -1106,8 +1229,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -1140,7 +1263,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "2.0.0" + "is-primitive": "^2.0.0" } }, "is-extendable": { @@ -1161,7 +1284,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.0" } }, "is-number": { @@ -1170,7 +1293,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -1179,7 +1302,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -1247,6 +1370,22 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -1272,7 +1411,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -1311,7 +1450,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.5" } }, "linkify-it": { @@ -1320,7 +1459,7 @@ "integrity": "sha1-2UpGSPmxwXnWT6lykSaL22zpQ08=", "dev": true, "requires": { - "uc.micro": "1.0.5" + "uc.micro": "^1.0.1" } }, "lodash": { @@ -1347,11 +1486,11 @@ "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", "dev": true, "requires": { - "argparse": "1.0.10", - "entities": "1.1.1", - "linkify-it": "2.0.3", - "mdurl": "1.0.1", - "uc.micro": "1.0.5" + "argparse": "^1.0.7", + "entities": "~1.1.1", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" } }, "math-random": { @@ -1372,7 +1511,7 @@ "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.1" } }, "micromatch": { @@ -1381,19 +1520,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" }, "dependencies": { "arr-diff": { @@ -1402,7 +1541,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.1.0" + "arr-flatten": "^1.0.1" } }, "is-extglob": { @@ -1417,7 +1556,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "kind-of": { @@ -1426,7 +1565,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -1449,7 +1588,7 @@ "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", "dev": true, "requires": { - "mime-db": "1.36.0" + "mime-db": "~1.36.0" } }, "minimatch": { @@ -1458,7 +1597,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -1506,12 +1645,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -1528,10 +1667,10 @@ "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", "dev": true, "requires": { - "array-differ": "1.0.0", - "array-union": "1.0.2", - "arrify": "1.0.1", - "minimatch": "3.0.4" + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" } }, "mute-stream": { @@ -1546,7 +1685,7 @@ "integrity": "sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y=", "dev": true, "requires": { - "is": "3.2.1" + "is": "^3.1.0" } }, "normalize-path": { @@ -1555,7 +1694,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "remove-trailing-separator": "^1.0.1" } }, "nth-check": { @@ -1564,7 +1703,7 @@ "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", "dev": true, "requires": { - "boolbase": "1.0.0" + "boolbase": "~1.0.0" } }, "oauth-sign": { @@ -1585,8 +1724,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" } }, "once": { @@ -1595,7 +1734,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "ordered-read-streams": { @@ -1604,8 +1743,8 @@ "integrity": "sha1-cTfmmzKYuzQiR6G77jiByA4v14s=", "dev": true, "requires": { - "is-stream": "1.1.0", - "readable-stream": "2.3.6" + "is-stream": "^1.0.1", + "readable-stream": "^2.0.1" } }, "os-homedir": { @@ -1626,8 +1765,8 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "parse-glob": { @@ -1636,10 +1775,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "is-extglob": { @@ -1654,7 +1793,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } } } @@ -1665,7 +1804,7 @@ "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { - "semver": "5.5.1" + "semver": "^5.1.0" } }, "parse5": { @@ -1674,7 +1813,7 @@ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", "dev": true, "requires": { - "@types/node": "8.10.29" + "@types/node": "*" } }, "path-dirname": { @@ -1689,13 +1828,19 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "pause-stream": { "version": "0.0.11", "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { - "through": "2.3.8" + "through": "~2.3" } }, "pend": { @@ -1716,11 +1861,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" } }, "preserve": { @@ -1729,6 +1874,12 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, + "prettier": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", + "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", + "dev": true + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", @@ -1771,7 +1922,7 @@ "integrity": "sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "randomatic": { @@ -1780,9 +1931,9 @@ "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", "dev": true, "requires": { - "is-number": "4.0.0", - "kind-of": "6.0.2", - "math-random": "1.0.1" + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" }, "dependencies": { "is-number": { @@ -1805,7 +1956,7 @@ "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { - "mute-stream": "0.0.7" + "mute-stream": "~0.0.4" } }, "readable-stream": { @@ -1814,13 +1965,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "regex-cache": { @@ -1829,7 +1980,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "is-equal-shallow": "^0.1.3" } }, "remove-trailing-separator": { @@ -1862,26 +2013,26 @@ "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.8.0", - "caseless": "0.12.0", - "combined-stream": "1.0.6", - "extend": "3.0.2", - "forever-agent": "0.6.1", - "form-data": "2.3.2", - "har-validator": "5.1.0", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.20", - "oauth-sign": "0.9.0", - "performance-now": "2.1.0", - "qs": "6.5.2", - "safe-buffer": "5.1.2", - "tough-cookie": "2.4.3", - "tunnel-agent": "0.6.0", - "uuid": "3.3.2" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "requires-port": { @@ -1890,13 +2041,22 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.3" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -1929,8 +2089,8 @@ "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", "dev": true, "requires": { - "buffer-from": "1.1.1", - "source-map": "0.6.1" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, "split": { @@ -1939,7 +2099,7 @@ "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "dev": true, "requires": { - "through": "2.3.8" + "through": "2" } }, "sprintf-js": { @@ -1954,15 +2114,15 @@ "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "dev": true, "requires": { - "asn1": "0.2.4", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.2", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.2", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "safer-buffer": "2.1.2", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, "stat-mode": { @@ -1977,8 +2137,8 @@ "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", "dev": true, "requires": { - "duplexer": "0.1.1", - "through": "2.3.8" + "duplexer": "~0.1.1", + "through": "~2.3.4" } }, "stream-shift": { @@ -1993,7 +2153,7 @@ "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.2" } }, "streamifier": { @@ -2008,7 +2168,16 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -2017,7 +2186,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "strip-bom-stream": { @@ -2026,8 +2195,8 @@ "integrity": "sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4=", "dev": true, "requires": { - "first-chunk-stream": "1.0.0", - "strip-bom": "2.0.0" + "first-chunk-stream": "^1.0.0", + "strip-bom": "^2.0.0" } }, "supports-color": { @@ -2036,7 +2205,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } }, "tar": { @@ -2045,9 +2214,9 @@ "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "through": { @@ -2062,8 +2231,8 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "2.3.6", - "xtend": "4.0.1" + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" } }, "through2-filter": { @@ -2072,8 +2241,8 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "2.0.3", - "xtend": "4.0.1" + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "tmp": { @@ -2082,7 +2251,7 @@ "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.1" } }, "to-absolute-glob": { @@ -2091,7 +2260,7 @@ "integrity": "sha1-HN+kcqnvUMI57maZm2YsoOs5k38=", "dev": true, "requires": { - "extend-shallow": "2.0.1" + "extend-shallow": "^2.0.1" }, "dependencies": { "extend-shallow": { @@ -2100,7 +2269,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -2111,8 +2280,49 @@ "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { - "psl": "1.1.29", - "punycode": "1.4.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tslint": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" + } + }, + "tslint-config-prettier": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.15.0.tgz", + "integrity": "sha512-06CgrHJxJmNYVgsmeMoa1KXzQRoOdvfkqnJth6XUkNeOz707qxN0WfxfhYwhL5kXHHbYJRby2bqAPKwThlZPhw==", + "dev": true + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" } }, "tunnel": { @@ -2127,7 +2337,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -2179,8 +2389,8 @@ "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", "dev": true, "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" + "json-stable-stringify": "^1.0.0", + "through2-filter": "^2.0.0" } }, "url-join": { @@ -2195,8 +2405,8 @@ "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", "dev": true, "requires": { - "querystringify": "2.0.0", - "requires-port": "1.0.0" + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" } }, "util-deprecate": { @@ -2223,9 +2433,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "vinyl": { @@ -2234,8 +2444,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "0.2.0", - "clone-stats": "0.0.1" + "clone": "^0.2.0", + "clone-stats": "^0.0.1" } }, "vinyl-fs": { @@ -2244,23 +2454,23 @@ "integrity": "sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=", "dev": true, "requires": { - "duplexify": "3.6.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", + "duplexify": "^3.2.0", + "glob-stream": "^5.3.2", + "graceful-fs": "^4.0.0", "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", - "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "readable-stream": "2.3.6", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" + "is-valid-glob": "^0.3.0", + "lazystream": "^1.0.0", + "lodash.isequal": "^4.0.0", + "merge-stream": "^1.0.0", + "mkdirp": "^0.5.0", + "object-assign": "^4.0.0", + "readable-stream": "^2.0.4", + "strip-bom": "^2.0.0", + "strip-bom-stream": "^1.0.0", + "through2": "^2.0.0", + "through2-filter": "^2.0.0", + "vali-date": "^1.0.0", + "vinyl": "^1.0.0" }, "dependencies": { "clone": { @@ -2281,8 +2491,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", + "clone": "^1.0.0", + "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } @@ -2294,33 +2504,33 @@ "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", "dev": true, "requires": { - "through2": "2.0.3", - "vinyl": "0.4.6" + "through2": "^2.0.3", + "vinyl": "^0.4.3" } }, "vsce": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.48.0.tgz", - "integrity": "sha512-1qJn6QLRTu26FIvvMbK/gzHLLdxJVTg9CUTSnCjJHObCCF5CQ0F3FUv7t+5cT7i0J5v5YljrsRY09u7dPBcEnA==", - "dev": true, - "requires": { - "cheerio": "1.0.0-rc.2", - "commander": "2.18.0", - "denodeify": "1.2.1", - "glob": "7.1.3", - "lodash": "4.17.11", - "markdown-it": "8.4.2", - "mime": "1.6.0", - "minimatch": "3.0.4", - "osenv": "0.1.5", - "parse-semver": "1.1.1", - "read": "1.0.7", - "semver": "5.5.1", + "version": "1.51.1", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.51.1.tgz", + "integrity": "sha512-Hf2HE9O/MRQHxUUgWHAm7mOkz0K5swuF2smaE/sP7+OWp/5DdIPFwmLEYCCZHxG25l3GBRoO0dAL8S5w//et+g==", + "dev": true, + "requires": { + "cheerio": "^1.0.0-rc.1", + "commander": "^2.8.1", + "denodeify": "^1.2.1", + "glob": "^7.0.6", + "lodash": "^4.17.10", + "markdown-it": "^8.3.1", + "mime": "^1.3.4", + "minimatch": "^3.0.3", + "osenv": "^0.1.3", + "parse-semver": "^1.1.1", + "read": "^1.0.7", + "semver": "^5.1.0", "tmp": "0.0.29", - "url-join": "1.1.0", + "url-join": "^1.1.0", "vso-node-api": "6.1.2-preview", - "yauzl": "2.10.0", - "yazl": "2.4.3" + "yauzl": "^2.3.1", + "yazl": "^2.2.2" } }, "vscode": { @@ -2329,20 +2539,20 @@ "integrity": "sha512-tJl9eL15ZMm6vzCYYeQ26sSYRuXGMGPsaeIAmG2rOOYRn01jdaDg6I4b9G5Ed6FISdmn6egpKThk4o4om8Ax/A==", "dev": true, "requires": { - "glob": "7.1.3", - "gulp-chmod": "2.0.0", - "gulp-filter": "5.1.0", + "glob": "^7.1.2", + "gulp-chmod": "^2.0.0", + "gulp-filter": "^5.0.1", "gulp-gunzip": "1.0.0", - "gulp-remote-src-vscode": "0.5.0", - "gulp-symdest": "1.1.0", - "gulp-untar": "0.0.7", - "gulp-vinyl-zip": "2.1.0", - "mocha": "4.1.0", - "request": "2.88.0", - "semver": "5.5.1", - "source-map-support": "0.5.9", - "url-parse": "1.4.3", - "vinyl-source-stream": "1.1.2" + "gulp-remote-src-vscode": "^0.5.0", + "gulp-symdest": "^1.1.0", + "gulp-untar": "^0.0.7", + "gulp-vinyl-zip": "^2.1.0", + "mocha": "^4.0.1", + "request": "^2.83.0", + "semver": "^5.4.1", + "source-map-support": "^0.5.0", + "url-parse": "^1.4.3", + "vinyl-source-stream": "^1.1.0" } }, "vscode-jsonrpc": { @@ -2355,7 +2565,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz", "integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==", "requires": { - "vscode-languageserver-protocol": "3.13.0" + "vscode-languageserver-protocol": "^3.10.3" } }, "vscode-languageserver-protocol": { @@ -2363,7 +2573,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.13.0.tgz", "integrity": "sha512-2ZGKwI+P2ovQll2PGAp+2UfJH+FK9eait86VBUdkPd9HRlm8e58aYT9pV/NYanHOcp3pL6x2yTLVCFMcTer0mg==", "requires": { - "vscode-jsonrpc": "4.0.0", + "vscode-jsonrpc": "^4.0.0", "vscode-languageserver-types": "3.13.0" } }, @@ -2378,10 +2588,10 @@ "integrity": "sha1-qrNUbfJFHs2JTgcbuZtd8Zxfp48=", "dev": true, "requires": { - "q": "1.5.1", + "q": "^1.0.1", "tunnel": "0.0.4", - "typed-rest-client": "0.9.0", - "underscore": "1.9.1" + "typed-rest-client": "^0.9.0", + "underscore": "^1.8.3" } }, "wrappy": { @@ -2402,8 +2612,8 @@ "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "dev": true, "requires": { - "buffer-crc32": "0.2.13", - "fd-slicer": "1.1.0" + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" } }, "yazl": { @@ -2412,7 +2622,7 @@ "integrity": "sha1-7CblzIfVYBud+EMtvdPNLlFzoHE=", "dev": true, "requires": { - "buffer-crc32": "0.2.13" + "buffer-crc32": "~0.2.3" } } } diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9f05fe91..8328a46c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -17,17 +17,26 @@ "vscode:prepublish": "npm run compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install" + "postinstall": "node ./node_modules/vscode/bin/install", + "lint": "tslint --project .", + "prettier": "prettier **/*.{json,ts}", + "travis": "npm run compile && npm run lint && npm run prettier --list-different" + }, + "prettier": { + "tabWidth": 4 }, "dependencies": { "vscode-languageclient": "^4.4.0" }, "devDependencies": { + "@types/mocha": "^2.2.42", + "@types/node": "^8.10.34", + "prettier": "^1.14.3", + "tslint": "^5.11.0", + "tslint-config-prettier": "^1.15.0", "typescript": "^2.6.1", - "vscode": "^1.1.21", - "vsce": "^1.42.0", - "@types/node": "^8.10.25", - "@types/mocha": "^2.2.42" + "vsce": "^1.51.1", + "vscode": "^1.1.21" }, "activationEvents": [ "onLanguage:rust" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 740b5be2..b9ff3b81 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -3,21 +3,21 @@ import * as vscode from 'vscode'; import { Server } from './server'; export class Config { - public highlightingOn = true; + public highlightingOn = true; - constructor() { - vscode.workspace.onDidChangeConfiguration((_) => this.userConfigChanged()); - this.userConfigChanged(); - } + constructor() { + vscode.workspace.onDidChangeConfiguration((_) => this.userConfigChanged()); + this.userConfigChanged(); + } - public userConfigChanged() { - const config = vscode.workspace.getConfiguration('ra-lsp'); - if (config.has('highlightingOn')) { - this.highlightingOn = config.get('highlightingOn') as boolean; - } + public userConfigChanged() { + const config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + this.highlightingOn = config.get('highlightingOn') as boolean; + } - if (!this.highlightingOn && Server) { - Server.highlighter.removeHighlights(); - } + if (!this.highlightingOn && Server) { + Server.highlighter.removeHighlights(); } + } } diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index ce48dfc9..c2525a9d 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -1,13 +1,9 @@ { - "defaultSeverity": "error", - "extends": [ - "tslint:recommended" - ], - "jsRules": {}, - "rules": { - "quotemark": [true, "single"], - "interface-name": false, - "object-literal-sort-keys": false - }, - "rulesDirectory": [] + "defaultSeverity": "error", + "extends": ["tslint:recommended", "tslint-config-prettier"], + "rules": { + "quotemark": [true, "single"], + "interface-name": false, + "object-literal-sort-keys": false + } } From f38c0ab91ba70dcb71188a1562b6bb09793e4f20 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 8 Oct 2018 22:38:33 +0100 Subject: [PATCH 011/819] Run prettier on all files --- .../editors/code/.vscode/launch.json | 14 ++---- .../editors/code/.vscode/settings.json | 2 +- rust-analyzer/editors/code/.vscode/tasks.json | 2 +- rust-analyzer/editors/code/package.json | 3 +- .../code/src/commands/apply_source_change.ts | 24 +++++++--- .../code/src/commands/extend_selection.ts | 13 ++++-- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/join_lines.ts | 16 +++++-- .../code/src/commands/matching_brace.ts | 17 ++++--- .../code/src/commands/parent_module.ts | 15 +++++-- .../editors/code/src/commands/runnables.ts | 33 ++++++++++---- .../editors/code/src/commands/syntaxTree.ts | 24 +++++++--- rust-analyzer/editors/code/src/config.ts | 28 ++++++------ .../src/events/change_active_text_editor.ts | 15 +++++-- .../code/src/events/change_text_document.ts | 13 ++++-- .../editors/code/src/events/index.ts | 5 +-- rust-analyzer/editors/code/src/extension.ts | 28 +++++++----- .../editors/code/src/highlighting.ts | 45 ++++++++++++------- .../editors/code/src/notifications/index.ts | 4 +- .../src/notifications/publish_decorations.ts | 11 +++-- rust-analyzer/editors/code/src/server.ts | 12 ++--- rust-analyzer/editors/code/tsconfig.json | 9 +--- rust-analyzer/editors/code/tslint.json | 14 +++--- 23 files changed, 220 insertions(+), 129 deletions(-) diff --git a/rust-analyzer/editors/code/.vscode/launch.json b/rust-analyzer/editors/code/.vscode/launch.json index c174db30..b9d14ddd 100644 --- a/rust-analyzer/editors/code/.vscode/launch.json +++ b/rust-analyzer/editors/code/.vscode/launch.json @@ -3,19 +3,15 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", + "version": "0.2.0", "configurations": [ { "name": "Extension", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ], - "outFiles": [ - "${workspaceFolder}/out/**/*.js" - ], + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"], "preLaunchTask": "npm: watch" }, { @@ -27,9 +23,7 @@ "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test" ], - "outFiles": [ - "${workspaceFolder}/out/test/**/*.js" - ], + "outFiles": ["${workspaceFolder}/out/test/**/*.js"], "preLaunchTask": "npm: watch" } ] diff --git a/rust-analyzer/editors/code/.vscode/settings.json b/rust-analyzer/editors/code/.vscode/settings.json index 30bf8c2d..fa0a1048 100644 --- a/rust-analyzer/editors/code/.vscode/settings.json +++ b/rust-analyzer/editors/code/.vscode/settings.json @@ -8,4 +8,4 @@ }, // Turn off tsc task auto detection since we have the necessary tasks as npm scripts "typescript.tsc.autoDetect": "off" -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/.vscode/tasks.json b/rust-analyzer/editors/code/.vscode/tasks.json index 604e38f5..5deb2bcc 100644 --- a/rust-analyzer/editors/code/.vscode/tasks.json +++ b/rust-analyzer/editors/code/.vscode/tasks.json @@ -17,4 +17,4 @@ } } ] -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8328a46c..cd07e3be 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -23,7 +23,8 @@ "travis": "npm run compile && npm run lint && npm run prettier --list-different" }, "prettier": { - "tabWidth": 4 + "tabWidth": 4, + "singleQuote": true }, "dependencies": { "vscode-languageclient": "^4.4.0" diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index 67765e5a..cf921e3a 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -20,8 +20,12 @@ export interface SourceChange { export async function handle(change: SourceChange) { const wsEdit = new vscode.WorkspaceEdit(); for (const sourceEdit of change.sourceFileEdits) { - const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); - const edits = Server.client.protocol2CodeConverter.asTextEdits(sourceEdit.edits); + const uri = Server.client.protocol2CodeConverter.asUri( + sourceEdit.textDocument.uri + ); + const edits = Server.client.protocol2CodeConverter.asTextEdits( + sourceEdit.edits + ); wsEdit.set(uri, edits); } let created; @@ -48,11 +52,19 @@ export async function handle(change: SourceChange) { const doc = await vscode.workspace.openTextDocument(toOpen); await vscode.window.showTextDocument(doc); } else if (toReveal) { - const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); - const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); + const uri = Server.client.protocol2CodeConverter.asUri( + toReveal.textDocument.uri + ); + const position = Server.client.protocol2CodeConverter.asPosition( + toReveal.position + ); const editor = vscode.window.activeTextEditor; - if (!editor || editor.document.uri.toString() !== uri.toString()) { return; } - if (!editor.selection.isEmpty) { return; } + if (!editor || editor.document.uri.toString() !== uri.toString()) { + return; + } + if (!editor.selection.isEmpty) { + return; + } editor!.selection = new vscode.Selection(position, position); } } diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts index cdc3d10f..0ee6bd11 100644 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -14,14 +14,19 @@ interface ExtendSelectionResult { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { + return; + } const request: ExtendSelectionParams = { - selections: editor.selections.map((s) => { + selections: editor.selections.map(s => { return Server.client.code2ProtocolConverter.asRange(s); }), - textDocument: { uri: editor.document.uri.toString() }, + textDocument: { uri: editor.document.uri.toString() } }; - const response = await Server.client.sendRequest('m/extendSelection', request); + const response = await Server.client.sendRequest( + 'm/extendSelection', + request + ); editor.selections = response.selections.map((range: Range) => { const r = Server.client.protocol2CodeConverter.asRange(range); return new vscode.Selection(r.start, r.end); diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index dfdcd645..2496c7ff 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -13,5 +13,5 @@ export { matchingBrace, parentModule, runnables, - syntaxTree, + syntaxTree }; diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 526b698c..27d263b8 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -2,7 +2,10 @@ import * as vscode from 'vscode'; import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -import { handle as applySourceChange, SourceChange } from './apply_source_change'; +import { + handle as applySourceChange, + SourceChange +} from './apply_source_change'; interface JoinLinesParams { textDocument: TextDocumentIdentifier; @@ -11,11 +14,16 @@ interface JoinLinesParams { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { + return; + } const request: JoinLinesParams = { range: Server.client.code2ProtocolConverter.asRange(editor.selection), - textDocument: { uri: editor.document.uri.toString() }, + textDocument: { uri: editor.document.uri.toString() } }; - const change = await Server.client.sendRequest('m/joinLines', request); + const change = await Server.client.sendRequest( + 'm/joinLines', + request + ); await applySourceChange(change); } diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index a80446a8..5e6638e8 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -10,16 +10,23 @@ interface FindMatchingBraceParams { export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { + return; + } const request: FindMatchingBraceParams = { textDocument: { uri: editor.document.uri.toString() }, - offsets: editor.selections.map((s) => { + offsets: editor.selections.map(s => { return Server.client.code2ProtocolConverter.asPosition(s.active); - }), + }) }; - const response = await Server.client.sendRequest('m/findMatchingBrace', request); + const response = await Server.client.sendRequest( + 'm/findMatchingBrace', + request + ); editor.selections = editor.selections.map((sel, idx) => { - const active = Server.client.protocol2CodeConverter.asPosition(response[idx]); + const active = Server.client.protocol2CodeConverter.asPosition( + response[idx] + ); const anchor = sel.isEmpty ? active : sel.anchor; return new vscode.Selection(anchor, active); }); diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index d66fb302..4bb92eb9 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -5,13 +5,20 @@ import { Server } from '../server'; export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { + return; + } const request: TextDocumentIdentifier = { - uri: editor.document.uri.toString(), + uri: editor.document.uri.toString() }; - const response = await Server.client.sendRequest('m/parentModule', request); + const response = await Server.client.sendRequest( + 'm/parentModule', + request + ); const loc = response[0]; - if (loc == null) { return; } + if (loc == null) { + return; + } const uri = Server.client.protocol2CodeConverter.asUri(loc.uri); const range = Server.client.protocol2CodeConverter.asRange(loc.range); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 40f590dc..c234bfae 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -41,39 +41,56 @@ function createTask(spec: Runnable): vscode.Task { label: 'cargo', command: spec.bin, args: spec.args, - env: spec.env, + env: spec.env }; const execCmd = `${definition.command} ${definition.args.join(' ')}`; const execOption: vscode.ShellExecutionOptions = { cwd: '.', - env: definition.env, + env: definition.env }; const exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); const f = vscode.workspace.workspaceFolders![0]; - const t = new vscode.Task(definition, f, definition.label, TASK_SOURCE, exec, ['$rustc']); + const t = new vscode.Task( + definition, + f, + definition.label, + TASK_SOURCE, + exec, + ['$rustc'] + ); return t; } let prevRunnable: RunnableQuickPick | undefined; export async function handle() { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { return; } + if (editor == null || editor.document.languageId !== 'rust') { + return; + } const textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString(), + uri: editor.document.uri.toString() }; const params: RunnablesParams = { textDocument, - position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active), + position: Server.client.code2ProtocolConverter.asPosition( + editor.selection.active + ) }; - const runnables = await Server.client.sendRequest('m/runnables', params); + const runnables = await Server.client.sendRequest( + 'm/runnables', + params + ); const items: RunnableQuickPick[] = []; if (prevRunnable) { items.push(prevRunnable); } for (const r of runnables) { - if (prevRunnable && JSON.stringify(prevRunnable.runnable) === JSON.stringify(r)) { + if ( + prevRunnable && + JSON.stringify(prevRunnable.runnable) === JSON.stringify(r) + ) { continue; } items.push(new RunnableQuickPick(r)); diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index dcb721ee..5d5cdd7a 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -5,17 +5,25 @@ import { Server } from '../server'; export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); -export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { +export class TextDocumentContentProvider + implements vscode.TextDocumentContentProvider { public eventEmitter = new vscode.EventEmitter(); public syntaxTree: string = 'Not available'; - public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { + public provideTextDocumentContent( + uri: vscode.Uri + ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - if (editor == null) { return ''; } + if (editor == null) { + return ''; + } const request: SyntaxTreeParams = { - textDocument: { uri: editor.document.uri.toString() }, + textDocument: { uri: editor.document.uri.toString() } }; - return Server.client.sendRequest('m/syntaxTree', request); + return Server.client.sendRequest( + 'm/syntaxTree', + request + ); } get onDidChange(): vscode.Event { @@ -34,5 +42,9 @@ type SyntaxTreeResult = string; // The contents of the file come from the `TextDocumentContentProvider` export async function handle() { const document = await vscode.workspace.openTextDocument(syntaxTreeUri); - return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true + ); } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b9ff3b81..7d05ea07 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -3,21 +3,23 @@ import * as vscode from 'vscode'; import { Server } from './server'; export class Config { - public highlightingOn = true; + public highlightingOn = true; - constructor() { - vscode.workspace.onDidChangeConfiguration((_) => this.userConfigChanged()); - this.userConfigChanged(); - } - - public userConfigChanged() { - const config = vscode.workspace.getConfiguration('ra-lsp'); - if (config.has('highlightingOn')) { - this.highlightingOn = config.get('highlightingOn') as boolean; + constructor() { + vscode.workspace.onDidChangeConfiguration(_ => + this.userConfigChanged() + ); + this.userConfigChanged(); } - if (!this.highlightingOn && Server) { - Server.highlighter.removeHighlights(); + public userConfigChanged() { + const config = vscode.workspace.getConfiguration('ra-lsp'); + if (config.has('highlightingOn')) { + this.highlightingOn = config.get('highlightingOn') as boolean; + } + + if (!this.highlightingOn && Server) { + Server.highlighter.removeHighlights(); + } } - } } diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index 3440aa0c..0b7ceb65 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -5,10 +5,19 @@ import { Decoration } from '../highlighting'; import { Server } from '../server'; export async function handle(editor: TextEditor | undefined) { - if (!Server.config.highlightingOn || !editor || editor.document.languageId !== 'rust') { return; } + if ( + !Server.config.highlightingOn || + !editor || + editor.document.languageId !== 'rust' + ) { + return; + } const params: TextDocumentIdentifier = { - uri: editor.document.uri.toString(), + uri: editor.document.uri.toString() }; - const decorations = await Server.client.sendRequest('m/decorationsRequest', params); + const decorations = await Server.client.sendRequest( + 'm/decorationsRequest', + params + ); Server.highlighter.setHighlights(editor, decorations); } diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts index b3000e02..6be05724 100644 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -1,11 +1,18 @@ import * as vscode from 'vscode'; -import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTree'; +import { + syntaxTreeUri, + TextDocumentContentProvider +} from '../commands/syntaxTree'; -export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) { +export function createHandler( + textDocumentContentProvider: TextDocumentContentProvider +) { return (event: vscode.TextDocumentChangeEvent) => { const doc = event.document; - if (doc.languageId !== 'rust') { return; } + if (doc.languageId !== 'rust') { + return; + } afterLs(() => { textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); }); diff --git a/rust-analyzer/editors/code/src/events/index.ts b/rust-analyzer/editors/code/src/events/index.ts index b570a7a9..4c154563 100644 --- a/rust-analyzer/editors/code/src/events/index.ts +++ b/rust-analyzer/editors/code/src/events/index.ts @@ -1,7 +1,4 @@ import * as changeActiveTextEditor from './change_active_text_editor'; import * as changeTextDocument from './change_text_document'; -export { - changeActiveTextEditor, - changeTextDocument, -}; +export { changeActiveTextEditor, changeTextDocument }; diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 44e74f4c..81e1107a 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -23,26 +23,34 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('ra-lsp.joinLines', commands.joinLines.handle); registerCommand('ra-lsp.parentModule', commands.parentModule.handle); registerCommand('ra-lsp.run', commands.runnables.handle); - registerCommand('ra-lsp.applySourceChange', commands.applySourceChange.handle); + registerCommand( + 'ra-lsp.applySourceChange', + commands.applySourceChange.handle + ); // Notifications are events triggered by the language server - const allNotifications: Iterable<[string, lc.GenericNotificationHandler]> = [ - ['m/publishDecorations', notifications.publishDecorations.handle], - ]; + const allNotifications: Iterable< + [string, lc.GenericNotificationHandler] + > = [['m/publishDecorations', notifications.publishDecorations.handle]]; // The events below are plain old javascript events, triggered and handled by vscode - vscode.window.onDidChangeActiveTextEditor(events.changeActiveTextEditor.handle); + vscode.window.onDidChangeActiveTextEditor( + events.changeActiveTextEditor.handle + ); const textDocumentContentProvider = new TextDocumentContentProvider(); - disposeOnDeactivation(vscode.workspace.registerTextDocumentContentProvider( - 'ra-lsp', - textDocumentContentProvider, - )); + disposeOnDeactivation( + vscode.workspace.registerTextDocumentContentProvider( + 'ra-lsp', + textDocumentContentProvider + ) + ); vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(textDocumentContentProvider), null, - context.subscriptions); + context.subscriptions + ); // Start the language server, finally! Server.start(allNotifications); diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index e2ac4d62..ceddffe0 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -9,15 +9,24 @@ export interface Decoration { } export class Highlighter { - private static initDecorations(): Map { - const decor = (color: string) => vscode.window.createTextEditorDecorationType({ color }); + private static initDecorations(): Map< + string, + vscode.TextEditorDecorationType + > { + const decor = (color: string) => + vscode.window.createTextEditorDecorationType({ color }); - const decorations: Iterable<[string, vscode.TextEditorDecorationType]> = [ + const decorations: Iterable< + [string, vscode.TextEditorDecorationType] + > = [ ['background', decor('#3F3F3F')], - ['error', vscode.window.createTextEditorDecorationType({ - borderColor: 'red', - borderStyle: 'none none dashed none', - })], + [ + 'error', + vscode.window.createTextEditorDecorationType({ + borderColor: 'red', + borderStyle: 'none none dashed none' + }) + ], ['comment', decor('#7F9F7F')], ['string', decor('#CC9393')], ['keyword', decor('#F0DFAF')], @@ -26,13 +35,16 @@ export class Highlighter { ['builtin', decor('#DD6718')], ['text', decor('#DCDCCC')], ['attribute', decor('#BFEBBF')], - ['literal', decor('#DFAF8F')], + ['literal', decor('#DFAF8F')] ]; return new Map(decorations); } - private decorations: (Map | null) = null; + private decorations: Map< + string, + vscode.TextEditorDecorationType + > | null = null; public removeHighlights() { if (this.decorations == null) { @@ -47,10 +59,7 @@ export class Highlighter { this.decorations = null; } - public setHighlights( - editor: vscode.TextEditor, - highlights: Decoration[], - ) { + public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) { // Initialize decorations if necessary // // Note: decoration objects need to be kept around so we can dispose them @@ -68,13 +77,15 @@ export class Highlighter { if (!byTag.get(d.tag)) { continue; } - byTag.get(d.tag)!.push( - Server.client.protocol2CodeConverter.asRange(d.range), - ); + byTag + .get(d.tag)! + .push(Server.client.protocol2CodeConverter.asRange(d.range)); } for (const tag of byTag.keys()) { - const dec = this.decorations.get(tag) as vscode.TextEditorDecorationType; + const dec = this.decorations.get( + tag + ) as vscode.TextEditorDecorationType; const ranges = byTag.get(tag)!; editor.setDecorations(dec, ranges); } diff --git a/rust-analyzer/editors/code/src/notifications/index.ts b/rust-analyzer/editors/code/src/notifications/index.ts index c5657686..74c4c356 100644 --- a/rust-analyzer/editors/code/src/notifications/index.ts +++ b/rust-analyzer/editors/code/src/notifications/index.ts @@ -1,5 +1,3 @@ import * as publishDecorations from './publish_decorations'; -export { - publishDecorations, -}; +export { publishDecorations }; diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index d8790386..3180019b 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -10,11 +10,10 @@ export interface PublishDecorationsParams { export function handle(params: PublishDecorationsParams) { const targetEditor = vscode.window.visibleTextEditors.find( - (editor) => editor.document.uri.toString() === params.uri, - ); - if (!Server.config.highlightingOn || !targetEditor) { return; } - Server.highlighter.setHighlights( - targetEditor, - params.decorations, + editor => editor.document.uri.toString() === params.uri ); + if (!Server.config.highlightingOn || !targetEditor) { + return; + } + Server.highlighter.setHighlights(targetEditor, params.decorations); } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 01fd8075..196fc3eb 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -8,24 +8,26 @@ export class Server { public static config = new Config(); public static client: lc.LanguageClient; - public static start(notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>) { + public static start( + notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> + ) { const run: lc.Executable = { command: 'ra_lsp_server', - options: { cwd: '.' }, + options: { cwd: '.' } }; const serverOptions: lc.ServerOptions = { run, - debug: run, + debug: run }; const clientOptions: lc.LanguageClientOptions = { - documentSelector: [{ scheme: 'file', language: 'rust' }], + documentSelector: [{ scheme: 'file', language: 'rust' }] }; Server.client = new lc.LanguageClient( 'ra-lsp', 'rust-analyzer languge server', serverOptions, - clientOptions, + clientOptions ); Server.client.onReady().then(() => { for (const [type, handler] of notificationHandlers) { diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index ebec0162..ef93c52b 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -3,15 +3,10 @@ "module": "commonjs", "target": "es6", "outDir": "out", - "lib": [ - "es6" - ], + "lib": ["es6"], "sourceMap": true, "rootDir": "src", "strict": true }, - "exclude": [ - "node_modules", - ".vscode-test" - ] + "exclude": ["node_modules", ".vscode-test"] } diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index c2525a9d..bdeb4895 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -1,9 +1,9 @@ { - "defaultSeverity": "error", - "extends": ["tslint:recommended", "tslint-config-prettier"], - "rules": { - "quotemark": [true, "single"], - "interface-name": false, - "object-literal-sort-keys": false - } + "defaultSeverity": "error", + "extends": ["tslint:recommended", "tslint-config-prettier"], + "rules": { + "quotemark": [true, "single"], + "interface-name": false, + "object-literal-sort-keys": false + } } From 4d9246262aeafc4202f924c945802e5b718a4d68 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Oct 2018 16:00:20 +0300 Subject: [PATCH 012/819] Add on-enter handler Now, typing doc comments is much more pleasant --- rust-analyzer/editors/code/package-lock.json | 786 +++++++++--------- .../editors/code/src/commands/index.ts | 4 +- .../editors/code/src/commands/on_enter.ts | 29 + rust-analyzer/editors/code/src/extension.ts | 20 +- 4 files changed, 444 insertions(+), 395 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands/on_enter.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index eb5990a8..33c5203b 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -22,10 +22,10 @@ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ansi-cyan": { @@ -70,7 +70,7 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "sprintf-js": "1.0.3" } }, "arr-diff": { @@ -79,8 +79,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" } }, "arr-flatten": { @@ -113,7 +113,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "^1.0.1" + "array-uniq": "1.0.3" } }, "array-uniq": { @@ -140,7 +140,7 @@ "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, "requires": { - "safer-buffer": "~2.1.0" + "safer-buffer": "2.1.2" } }, "assert-plus": { @@ -173,9 +173,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" }, "dependencies": { "chalk": { @@ -184,11 +184,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -212,7 +212,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "^0.14.3" + "tweetnacl": "0.14.5" } }, "block-stream": { @@ -221,7 +221,7 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "~2.0.0" + "inherits": "2.0.3" } }, "boolbase": { @@ -236,7 +236,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -246,9 +246,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.3" } }, "browser-stdout": { @@ -287,9 +287,9 @@ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" }, "dependencies": { "ansi-styles": { @@ -298,7 +298,7 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "color-convert": "1.9.3" } }, "has-flag": { @@ -313,7 +313,7 @@ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } } } @@ -324,12 +324,12 @@ "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", "dev": true, "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash": "^4.15.0", - "parse5": "^3.0.1" + "css-select": "1.2.0", + "dom-serializer": "0.1.0", + "entities": "1.1.1", + "htmlparser2": "3.9.2", + "lodash": "4.17.11", + "parse5": "3.0.3" } }, "clone": { @@ -356,9 +356,9 @@ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", "dev": true, "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" + "inherits": "2.0.3", + "process-nextick-args": "2.0.0", + "readable-stream": "2.3.6" } }, "co": { @@ -388,7 +388,7 @@ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "delayed-stream": "~1.0.0" + "delayed-stream": "1.0.0" } }, "commander": { @@ -409,7 +409,7 @@ "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", "dev": true, "requires": { - "safe-buffer": "~5.1.1" + "safe-buffer": "5.1.2" } }, "core-util-is": { @@ -424,10 +424,10 @@ "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", + "boolbase": "1.0.0", + "css-what": "2.1.0", "domutils": "1.5.1", - "nth-check": "~1.0.1" + "nth-check": "1.0.1" } }, "css-what": { @@ -442,7 +442,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "^1.0.0" + "assert-plus": "1.0.0" } }, "debug": { @@ -460,7 +460,7 @@ "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { - "is-obj": "^1.0.0" + "is-obj": "1.0.1" } }, "delayed-stream": { @@ -487,8 +487,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" + "domelementtype": "1.1.3", + "entities": "1.1.1" }, "dependencies": { "domelementtype": { @@ -511,7 +511,7 @@ "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", "dev": true, "requires": { - "domelementtype": "1" + "domelementtype": "1.3.0" } }, "domutils": { @@ -520,8 +520,8 @@ "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "dev": true, "requires": { - "dom-serializer": "0", - "domelementtype": "1" + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" } }, "duplexer": { @@ -536,10 +536,10 @@ "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", "dev": true, "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" } }, "ecc-jsbn": { @@ -549,8 +549,8 @@ "dev": true, "optional": true, "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" + "jsbn": "0.1.1", + "safer-buffer": "2.1.2" } }, "end-of-stream": { @@ -559,7 +559,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "^1.4.0" + "once": "1.4.0" } }, "entities": { @@ -592,14 +592,14 @@ "integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==", "dev": true, "requires": { - "duplexer": "^0.1.1", - "flatmap-stream": "^0.1.0", - "from": "^0.1.7", + "duplexer": "0.1.1", + "flatmap-stream": "0.1.0", + "from": "0.1.7", "map-stream": "0.0.7", - "pause-stream": "^0.0.11", - "split": "^1.0.1", - "stream-combiner": "^0.2.2", - "through": "^2.3.8" + "pause-stream": "0.0.11", + "split": "1.0.1", + "stream-combiner": "0.2.2", + "through": "2.3.8" } }, "expand-brackets": { @@ -608,7 +608,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "^0.1.0" + "is-posix-bracket": "0.1.1" } }, "expand-range": { @@ -617,7 +617,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "^2.1.0" + "fill-range": "2.2.4" } }, "extend": { @@ -632,7 +632,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "^1.1.0" + "kind-of": "1.1.0" } }, "extglob": { @@ -641,7 +641,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" }, "dependencies": { "is-extglob": { @@ -676,7 +676,7 @@ "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "dev": true, "requires": { - "pend": "~1.2.0" + "pend": "1.2.0" } }, "filename-regex": { @@ -691,11 +691,11 @@ "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "3.1.0", + "repeat-element": "1.1.3", + "repeat-string": "1.6.1" } }, "first-chunk-stream": { @@ -722,7 +722,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "^1.0.1" + "for-in": "1.0.2" } }, "forever-agent": { @@ -737,9 +737,9 @@ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "asynckit": "^0.4.0", + "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "^2.1.12" + "mime-types": "2.1.20" } }, "from": { @@ -760,10 +760,10 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" } }, "getpass": { @@ -772,7 +772,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "^1.0.0" + "assert-plus": "1.0.0" } }, "glob": { @@ -781,12 +781,12 @@ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "glob-base": { @@ -795,8 +795,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" + "glob-parent": "2.0.0", + "is-glob": "2.0.1" }, "dependencies": { "glob-parent": { @@ -805,7 +805,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "^2.0.0" + "is-glob": "2.0.1" } }, "is-extglob": { @@ -820,7 +820,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -831,8 +831,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" + "is-glob": "3.1.0", + "path-dirname": "1.0.2" } }, "glob-stream": { @@ -841,14 +841,14 @@ "integrity": "sha1-pVZlqajM3EGRWofHAeMtTgFvrSI=", "dev": true, "requires": { - "extend": "^3.0.0", - "glob": "^5.0.3", - "glob-parent": "^3.0.0", - "micromatch": "^2.3.7", - "ordered-read-streams": "^0.3.0", - "through2": "^0.6.0", - "to-absolute-glob": "^0.1.1", - "unique-stream": "^2.0.2" + "extend": "3.0.2", + "glob": "5.0.15", + "glob-parent": "3.1.0", + "micromatch": "2.3.11", + "ordered-read-streams": "0.3.0", + "through2": "0.6.5", + "to-absolute-glob": "0.1.1", + "unique-stream": "2.2.1" }, "dependencies": { "glob": { @@ -857,11 +857,11 @@ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "isarray": { @@ -876,10 +876,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -894,8 +894,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } } } @@ -918,9 +918,9 @@ "integrity": "sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw=", "dev": true, "requires": { - "deep-assign": "^1.0.0", - "stat-mode": "^0.2.0", - "through2": "^2.0.0" + "deep-assign": "1.0.0", + "stat-mode": "0.2.2", + "through2": "2.0.3" } }, "gulp-filter": { @@ -929,9 +929,9 @@ "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", "dev": true, "requires": { - "multimatch": "^2.0.0", - "plugin-error": "^0.1.2", - "streamfilter": "^1.0.5" + "multimatch": "2.1.0", + "plugin-error": "0.1.2", + "streamfilter": "1.0.7" } }, "gulp-gunzip": { @@ -940,8 +940,8 @@ "integrity": "sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak=", "dev": true, "requires": { - "through2": "~0.6.5", - "vinyl": "~0.4.6" + "through2": "0.6.5", + "vinyl": "0.4.6" }, "dependencies": { "isarray": { @@ -956,10 +956,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -974,8 +974,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } } } @@ -986,11 +986,11 @@ "integrity": "sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ==", "dev": true, "requires": { - "event-stream": "^3.3.4", - "node.extend": "^1.1.2", - "request": "^2.79.0", - "through2": "^2.0.3", - "vinyl": "^2.0.1" + "event-stream": "3.3.6", + "node.extend": "1.1.6", + "request": "2.88.0", + "through2": "2.0.3", + "vinyl": "2.2.0" }, "dependencies": { "clone": { @@ -1011,12 +1011,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" } } } @@ -1027,11 +1027,11 @@ "integrity": "sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw=", "dev": true, "requires": { - "convert-source-map": "^1.1.1", - "graceful-fs": "^4.1.2", - "strip-bom": "^2.0.0", - "through2": "^2.0.0", - "vinyl": "^1.0.0" + "convert-source-map": "1.6.0", + "graceful-fs": "4.1.11", + "strip-bom": "2.0.0", + "through2": "2.0.3", + "vinyl": "1.2.0" }, "dependencies": { "clone": { @@ -1052,8 +1052,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", + "clone": "1.0.4", + "clone-stats": "0.0.1", "replace-ext": "0.0.1" } } @@ -1065,10 +1065,10 @@ "integrity": "sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA=", "dev": true, "requires": { - "event-stream": "^3.3.1", - "mkdirp": "^0.5.1", - "queue": "^3.1.0", - "vinyl-fs": "^2.4.3" + "event-stream": "3.3.6", + "mkdirp": "0.5.1", + "queue": "3.1.0", + "vinyl-fs": "2.4.4" } }, "gulp-untar": { @@ -1077,11 +1077,11 @@ "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "~3.3.4", - "streamifier": "~0.1.1", - "tar": "^2.2.1", - "through2": "~2.0.3", - "vinyl": "^1.2.0" + "event-stream": "3.3.6", + "streamifier": "0.1.1", + "tar": "2.2.1", + "through2": "2.0.3", + "vinyl": "1.2.0" }, "dependencies": { "clone": { @@ -1102,8 +1102,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", + "clone": "1.0.4", + "clone-stats": "0.0.1", "replace-ext": "0.0.1" } } @@ -1115,13 +1115,13 @@ "integrity": "sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0=", "dev": true, "requires": { - "event-stream": "^3.3.1", - "queue": "^4.2.1", - "through2": "^2.0.3", - "vinyl": "^2.0.2", - "vinyl-fs": "^2.0.0", - "yauzl": "^2.2.1", - "yazl": "^2.2.1" + "event-stream": "3.3.6", + "queue": "4.5.0", + "through2": "2.0.3", + "vinyl": "2.2.0", + "vinyl-fs": "2.4.4", + "yauzl": "2.10.0", + "yazl": "2.4.3" }, "dependencies": { "clone": { @@ -1142,7 +1142,7 @@ "integrity": "sha512-DwxpAnqJuoQa+wyDgQuwkSshkhlqIlWEvwvdAY27fDPunZ2cVJzXU4JyjY+5l7zs7oGLaYAQm4MbLOVFAHFBzA==", "dev": true, "requires": { - "inherits": "~2.0.0" + "inherits": "2.0.3" } }, "vinyl": { @@ -1151,12 +1151,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" } } } @@ -1173,8 +1173,8 @@ "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "dev": true, "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" + "ajv": "5.5.2", + "har-schema": "2.0.0" } }, "has-ansi": { @@ -1183,7 +1183,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "has-flag": { @@ -1204,12 +1204,12 @@ "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "dev": true, "requires": { - "domelementtype": "^1.3.0", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" + "domelementtype": "1.3.0", + "domhandler": "2.4.2", + "domutils": "1.5.1", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6" } }, "http-signature": { @@ -1218,9 +1218,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.2" } }, "inflight": { @@ -1229,8 +1229,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -1263,7 +1263,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "^2.0.0" + "is-primitive": "2.0.0" } }, "is-extendable": { @@ -1284,7 +1284,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "is-extglob": "2.1.1" } }, "is-number": { @@ -1293,7 +1293,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -1302,7 +1302,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -1382,8 +1382,8 @@ "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "1.0.10", + "esprima": "4.0.1" } }, "jsbn": { @@ -1411,7 +1411,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "~0.0.0" + "jsonify": "0.0.0" } }, "json-stringify-safe": { @@ -1450,7 +1450,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "^2.0.5" + "readable-stream": "2.3.6" } }, "linkify-it": { @@ -1459,7 +1459,7 @@ "integrity": "sha1-2UpGSPmxwXnWT6lykSaL22zpQ08=", "dev": true, "requires": { - "uc.micro": "^1.0.1" + "uc.micro": "1.0.5" } }, "lodash": { @@ -1486,11 +1486,11 @@ "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", "dev": true, "requires": { - "argparse": "^1.0.7", - "entities": "~1.1.1", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" + "argparse": "1.0.10", + "entities": "1.1.1", + "linkify-it": "2.0.3", + "mdurl": "1.0.1", + "uc.micro": "1.0.5" } }, "math-random": { @@ -1511,7 +1511,7 @@ "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", "dev": true, "requires": { - "readable-stream": "^2.0.1" + "readable-stream": "2.3.6" } }, "micromatch": { @@ -1520,19 +1520,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" }, "dependencies": { "arr-diff": { @@ -1541,7 +1541,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "^1.0.1" + "arr-flatten": "1.1.0" } }, "is-extglob": { @@ -1556,7 +1556,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } }, "kind-of": { @@ -1565,7 +1565,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -1588,7 +1588,7 @@ "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", "dev": true, "requires": { - "mime-db": "~1.36.0" + "mime-db": "1.36.0" } }, "minimatch": { @@ -1597,7 +1597,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -1645,12 +1645,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } } } @@ -1667,10 +1667,10 @@ "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", "dev": true, "requires": { - "array-differ": "^1.0.0", - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "minimatch": "^3.0.0" + "array-differ": "1.0.0", + "array-union": "1.0.2", + "arrify": "1.0.1", + "minimatch": "3.0.4" } }, "mute-stream": { @@ -1685,7 +1685,7 @@ "integrity": "sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y=", "dev": true, "requires": { - "is": "^3.1.0" + "is": "3.2.1" } }, "normalize-path": { @@ -1694,7 +1694,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "^1.0.1" + "remove-trailing-separator": "1.1.0" } }, "nth-check": { @@ -1703,7 +1703,7 @@ "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", "dev": true, "requires": { - "boolbase": "~1.0.0" + "boolbase": "1.0.0" } }, "oauth-sign": { @@ -1724,8 +1724,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" + "for-own": "0.1.5", + "is-extendable": "0.1.1" } }, "once": { @@ -1734,7 +1734,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "ordered-read-streams": { @@ -1743,8 +1743,8 @@ "integrity": "sha1-cTfmmzKYuzQiR6G77jiByA4v14s=", "dev": true, "requires": { - "is-stream": "^1.0.1", - "readable-stream": "^2.0.1" + "is-stream": "1.1.0", + "readable-stream": "2.3.6" } }, "os-homedir": { @@ -1765,8 +1765,8 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" } }, "parse-glob": { @@ -1775,10 +1775,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" }, "dependencies": { "is-extglob": { @@ -1793,7 +1793,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^1.0.0" + "is-extglob": "1.0.0" } } } @@ -1804,7 +1804,7 @@ "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { - "semver": "^5.1.0" + "semver": "5.5.1" } }, "parse5": { @@ -1813,7 +1813,7 @@ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.10.34" } }, "path-dirname": { @@ -1840,7 +1840,7 @@ "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { - "through": "~2.3" + "through": "2.3.8" } }, "pend": { @@ -1861,11 +1861,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" } }, "preserve": { @@ -1922,7 +1922,7 @@ "integrity": "sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU=", "dev": true, "requires": { - "inherits": "~2.0.0" + "inherits": "2.0.3" } }, "randomatic": { @@ -1931,9 +1931,9 @@ "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", "dev": true, "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" + "is-number": "4.0.0", + "kind-of": "6.0.2", + "math-random": "1.0.1" }, "dependencies": { "is-number": { @@ -1956,7 +1956,7 @@ "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { - "mute-stream": "~0.0.4" + "mute-stream": "0.0.7" } }, "readable-stream": { @@ -1965,13 +1965,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "regex-cache": { @@ -1980,7 +1980,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "^0.1.3" + "is-equal-shallow": "0.1.3" } }, "remove-trailing-separator": { @@ -2013,26 +2013,26 @@ "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" + "aws-sign2": "0.7.0", + "aws4": "1.8.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.2", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.1.0", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.20", + "oauth-sign": "0.9.0", + "performance-now": "2.1.0", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.4.3", + "tunnel-agent": "0.6.0", + "uuid": "3.3.2" } }, "requires-port": { @@ -2047,7 +2047,7 @@ "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.6" } }, "rimraf": { @@ -2056,7 +2056,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.3" } }, "safe-buffer": { @@ -2089,8 +2089,8 @@ "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", "dev": true, "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "buffer-from": "1.1.1", + "source-map": "0.6.1" } }, "split": { @@ -2099,7 +2099,7 @@ "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "dev": true, "requires": { - "through": "2" + "through": "2.3.8" } }, "sprintf-js": { @@ -2114,15 +2114,15 @@ "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "dev": true, "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" + "asn1": "0.2.4", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.2", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.2", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "safer-buffer": "2.1.2", + "tweetnacl": "0.14.5" } }, "stat-mode": { @@ -2137,8 +2137,8 @@ "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", "dev": true, "requires": { - "duplexer": "~0.1.1", - "through": "~2.3.4" + "duplexer": "0.1.1", + "through": "2.3.8" } }, "stream-shift": { @@ -2153,7 +2153,7 @@ "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", "dev": true, "requires": { - "readable-stream": "^2.0.2" + "readable-stream": "2.3.6" } }, "streamifier": { @@ -2168,7 +2168,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.2" } }, "strip-ansi": { @@ -2177,7 +2177,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-bom": { @@ -2186,7 +2186,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "^0.2.0" + "is-utf8": "0.2.1" } }, "strip-bom-stream": { @@ -2195,8 +2195,8 @@ "integrity": "sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4=", "dev": true, "requires": { - "first-chunk-stream": "^1.0.0", - "strip-bom": "^2.0.0" + "first-chunk-stream": "1.0.0", + "strip-bom": "2.0.0" } }, "supports-color": { @@ -2205,7 +2205,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "2.0.0" } }, "tar": { @@ -2214,9 +2214,9 @@ "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" } }, "through": { @@ -2231,8 +2231,8 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" + "readable-stream": "2.3.6", + "xtend": "4.0.1" } }, "through2-filter": { @@ -2241,8 +2241,8 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" + "through2": "2.0.3", + "xtend": "4.0.1" } }, "tmp": { @@ -2251,7 +2251,7 @@ "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", "dev": true, "requires": { - "os-tmpdir": "~1.0.1" + "os-tmpdir": "1.0.2" } }, "to-absolute-glob": { @@ -2260,7 +2260,7 @@ "integrity": "sha1-HN+kcqnvUMI57maZm2YsoOs5k38=", "dev": true, "requires": { - "extend-shallow": "^2.0.1" + "extend-shallow": "2.0.1" }, "dependencies": { "extend-shallow": { @@ -2269,7 +2269,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -2280,8 +2280,8 @@ "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" + "psl": "1.1.29", + "punycode": "1.4.1" } }, "tslib": { @@ -2296,18 +2296,18 @@ "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.7.0", - "minimatch": "^3.0.4", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.27.2" + "babel-code-frame": "6.26.0", + "builtin-modules": "1.1.1", + "chalk": "2.4.1", + "commander": "2.18.0", + "diff": "3.3.1", + "glob": "7.1.3", + "js-yaml": "3.12.0", + "minimatch": "3.0.4", + "resolve": "1.8.1", + "semver": "5.5.1", + "tslib": "1.9.3", + "tsutils": "2.29.0" } }, "tslint-config-prettier": { @@ -2322,7 +2322,7 @@ "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { - "tslib": "^1.8.1" + "tslib": "1.9.3" } }, "tunnel": { @@ -2337,7 +2337,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "^5.0.1" + "safe-buffer": "5.1.2" } }, "tweetnacl": { @@ -2389,8 +2389,8 @@ "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", "dev": true, "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" + "json-stable-stringify": "1.0.1", + "through2-filter": "2.0.0" } }, "url-join": { @@ -2405,8 +2405,8 @@ "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", "dev": true, "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" + "querystringify": "2.0.0", + "requires-port": "1.0.0" } }, "util-deprecate": { @@ -2433,9 +2433,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "^1.0.0", + "assert-plus": "1.0.0", "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" + "extsprintf": "1.3.0" } }, "vinyl": { @@ -2444,8 +2444,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" + "clone": "0.2.0", + "clone-stats": "0.0.1" } }, "vinyl-fs": { @@ -2454,23 +2454,23 @@ "integrity": "sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=", "dev": true, "requires": { - "duplexify": "^3.2.0", - "glob-stream": "^5.3.2", - "graceful-fs": "^4.0.0", + "duplexify": "3.6.0", + "glob-stream": "5.3.5", + "graceful-fs": "4.1.11", "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "^0.3.0", - "lazystream": "^1.0.0", - "lodash.isequal": "^4.0.0", - "merge-stream": "^1.0.0", - "mkdirp": "^0.5.0", - "object-assign": "^4.0.0", - "readable-stream": "^2.0.4", - "strip-bom": "^2.0.0", - "strip-bom-stream": "^1.0.0", - "through2": "^2.0.0", - "through2-filter": "^2.0.0", - "vali-date": "^1.0.0", - "vinyl": "^1.0.0" + "is-valid-glob": "0.3.0", + "lazystream": "1.0.0", + "lodash.isequal": "4.5.0", + "merge-stream": "1.0.1", + "mkdirp": "0.5.1", + "object-assign": "4.1.1", + "readable-stream": "2.3.6", + "strip-bom": "2.0.0", + "strip-bom-stream": "1.0.0", + "through2": "2.0.3", + "through2-filter": "2.0.0", + "vali-date": "1.0.0", + "vinyl": "1.2.0" }, "dependencies": { "clone": { @@ -2491,8 +2491,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", + "clone": "1.0.4", + "clone-stats": "0.0.1", "replace-ext": "0.0.1" } } @@ -2504,8 +2504,8 @@ "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", "dev": true, "requires": { - "through2": "^2.0.3", - "vinyl": "^0.4.3" + "through2": "2.0.3", + "vinyl": "0.4.6" } }, "vsce": { @@ -2514,23 +2514,23 @@ "integrity": "sha512-Hf2HE9O/MRQHxUUgWHAm7mOkz0K5swuF2smaE/sP7+OWp/5DdIPFwmLEYCCZHxG25l3GBRoO0dAL8S5w//et+g==", "dev": true, "requires": { - "cheerio": "^1.0.0-rc.1", - "commander": "^2.8.1", - "denodeify": "^1.2.1", - "glob": "^7.0.6", - "lodash": "^4.17.10", - "markdown-it": "^8.3.1", - "mime": "^1.3.4", - "minimatch": "^3.0.3", - "osenv": "^0.1.3", - "parse-semver": "^1.1.1", - "read": "^1.0.7", - "semver": "^5.1.0", + "cheerio": "1.0.0-rc.2", + "commander": "2.18.0", + "denodeify": "1.2.1", + "glob": "7.1.3", + "lodash": "4.17.11", + "markdown-it": "8.4.2", + "mime": "1.6.0", + "minimatch": "3.0.4", + "osenv": "0.1.5", + "parse-semver": "1.1.1", + "read": "1.0.7", + "semver": "5.5.1", "tmp": "0.0.29", - "url-join": "^1.1.0", + "url-join": "1.1.0", "vso-node-api": "6.1.2-preview", - "yauzl": "^2.3.1", - "yazl": "^2.2.2" + "yauzl": "2.10.0", + "yazl": "2.4.3" } }, "vscode": { @@ -2539,20 +2539,20 @@ "integrity": "sha512-tJl9eL15ZMm6vzCYYeQ26sSYRuXGMGPsaeIAmG2rOOYRn01jdaDg6I4b9G5Ed6FISdmn6egpKThk4o4om8Ax/A==", "dev": true, "requires": { - "glob": "^7.1.2", - "gulp-chmod": "^2.0.0", - "gulp-filter": "^5.0.1", + "glob": "7.1.3", + "gulp-chmod": "2.0.0", + "gulp-filter": "5.1.0", "gulp-gunzip": "1.0.0", - "gulp-remote-src-vscode": "^0.5.0", - "gulp-symdest": "^1.1.0", - "gulp-untar": "^0.0.7", - "gulp-vinyl-zip": "^2.1.0", - "mocha": "^4.0.1", - "request": "^2.83.0", - "semver": "^5.4.1", - "source-map-support": "^0.5.0", - "url-parse": "^1.4.3", - "vinyl-source-stream": "^1.1.0" + "gulp-remote-src-vscode": "0.5.0", + "gulp-symdest": "1.1.0", + "gulp-untar": "0.0.7", + "gulp-vinyl-zip": "2.1.0", + "mocha": "4.1.0", + "request": "2.88.0", + "semver": "5.5.1", + "source-map-support": "0.5.9", + "url-parse": "1.4.3", + "vinyl-source-stream": "1.1.2" } }, "vscode-jsonrpc": { @@ -2565,7 +2565,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz", "integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==", "requires": { - "vscode-languageserver-protocol": "^3.10.3" + "vscode-languageserver-protocol": "3.13.0" } }, "vscode-languageserver-protocol": { @@ -2573,7 +2573,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.13.0.tgz", "integrity": "sha512-2ZGKwI+P2ovQll2PGAp+2UfJH+FK9eait86VBUdkPd9HRlm8e58aYT9pV/NYanHOcp3pL6x2yTLVCFMcTer0mg==", "requires": { - "vscode-jsonrpc": "^4.0.0", + "vscode-jsonrpc": "4.0.0", "vscode-languageserver-types": "3.13.0" } }, @@ -2588,10 +2588,10 @@ "integrity": "sha1-qrNUbfJFHs2JTgcbuZtd8Zxfp48=", "dev": true, "requires": { - "q": "^1.0.1", + "q": "1.5.1", "tunnel": "0.0.4", - "typed-rest-client": "^0.9.0", - "underscore": "^1.8.3" + "typed-rest-client": "0.9.0", + "underscore": "1.9.1" } }, "wrappy": { @@ -2612,8 +2612,8 @@ "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "dev": true, "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "buffer-crc32": "0.2.13", + "fd-slicer": "1.1.0" } }, "yazl": { @@ -2622,7 +2622,7 @@ "integrity": "sha1-7CblzIfVYBud+EMtvdPNLlFzoHE=", "dev": true, "requires": { - "buffer-crc32": "~0.2.3" + "buffer-crc32": "0.2.13" } } } diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 2496c7ff..d78a64c3 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -2,6 +2,7 @@ import * as applySourceChange from './apply_source_change'; import * as extendSelection from './extend_selection'; import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; +import * as on_enter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; @@ -13,5 +14,6 @@ export { matchingBrace, parentModule, runnables, - syntaxTree + syntaxTree, + on_enter, }; diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts new file mode 100644 index 00000000..2666797f --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -0,0 +1,29 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; +import { Server } from '../server'; +import { handle as applySourceChange, SourceChange } from './apply_source_change'; + +interface OnEnterParams { + textDocument: lc.TextDocumentIdentifier; + position: lc.Position; +} + +export async function handle(event: { text: string }): Promise { + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId !== 'rust' || event.text !== '\n') { + return false; + } + const request: OnEnterParams = { + textDocument: { uri: editor.document.uri.toString() }, + position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active), + }; + const change = await Server.client.sendRequest( + 'm/onEnter', + request + ); + if (!change) { + return false; + } + await applySourceChange(change); + return true +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 81e1107a..3e576753 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -15,6 +15,23 @@ export function activate(context: vscode.ExtensionContext) { function registerCommand(name: string, f: any) { disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } + function overrideCommand( + + name: string, + f: (...args: any[]) => Promise, + ) { + const defaultCmd = `default:${name}`; + const original = async (...args: any[]) => await vscode.commands.executeCommand(defaultCmd, ...args); + registerCommand(name, async (...args: any[]) => { + const editor = vscode.window.activeTextEditor; + if (!editor || !editor.document || editor.document.languageId !== 'rust') { + return await original(...args); + } + if (!await f(...args)) { + return await original(...args); + } + }) + } // Commands are requests from vscode to the language server registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); @@ -27,11 +44,12 @@ export function activate(context: vscode.ExtensionContext) { 'ra-lsp.applySourceChange', commands.applySourceChange.handle ); + overrideCommand('type', commands.on_enter.handle) // Notifications are events triggered by the language server const allNotifications: Iterable< [string, lc.GenericNotificationHandler] - > = [['m/publishDecorations', notifications.publishDecorations.handle]]; + > = [['m/publishDecorations', notifications.publishDecorations.handle]]; // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( From 73494aece0e540dc33abb00f00b0373d7c5e1ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Tue, 9 Oct 2018 22:56:15 +0200 Subject: [PATCH 013/819] Format vscode extension and add npm run fix --- rust-analyzer/editors/code/package.json | 1 + .../editors/code/src/commands/index.ts | 4 ++-- .../editors/code/src/commands/on_enter.ts | 17 +++++++++++---- rust-analyzer/editors/code/src/extension.ts | 21 ++++++++++++------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index cd07e3be..eeb6dd81 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,6 +18,7 @@ "compile": "tsc -p ./", "watch": "tsc -watch -p ./", "postinstall": "node ./node_modules/vscode/bin/install", + "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", "prettier": "prettier **/*.{json,ts}", "travis": "npm run compile && npm run lint && npm run prettier --list-different" diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index d78a64c3..33e2b34a 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -2,7 +2,7 @@ import * as applySourceChange from './apply_source_change'; import * as extendSelection from './extend_selection'; import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; -import * as on_enter from './on_enter'; +import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; @@ -15,5 +15,5 @@ export { parentModule, runnables, syntaxTree, - on_enter, + onEnter }; diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 2666797f..fe6aca63 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,7 +1,10 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from '../server'; -import { handle as applySourceChange, SourceChange } from './apply_source_change'; +import { + handle as applySourceChange, + SourceChange +} from './apply_source_change'; interface OnEnterParams { textDocument: lc.TextDocumentIdentifier; @@ -10,12 +13,18 @@ interface OnEnterParams { export async function handle(event: { text: string }): Promise { const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust' || event.text !== '\n') { + if ( + editor == null || + editor.document.languageId !== 'rust' || + event.text !== '\n' + ) { return false; } const request: OnEnterParams = { textDocument: { uri: editor.document.uri.toString() }, - position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active), + position: Server.client.code2ProtocolConverter.asPosition( + editor.selection.active + ) }; const change = await Server.client.sendRequest( 'm/onEnter', @@ -25,5 +34,5 @@ export async function handle(event: { text: string }): Promise { return false; } await applySourceChange(change); - return true + return true; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 3e576753..ff8f23c7 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -16,21 +16,26 @@ export function activate(context: vscode.ExtensionContext) { disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } function overrideCommand( - name: string, - f: (...args: any[]) => Promise, + f: (...args: any[]) => Promise ) { const defaultCmd = `default:${name}`; - const original = async (...args: any[]) => await vscode.commands.executeCommand(defaultCmd, ...args); + const original = async (...args: any[]) => + await vscode.commands.executeCommand(defaultCmd, ...args); + registerCommand(name, async (...args: any[]) => { const editor = vscode.window.activeTextEditor; - if (!editor || !editor.document || editor.document.languageId !== 'rust') { + if ( + !editor || + !editor.document || + editor.document.languageId !== 'rust' + ) { return await original(...args); } - if (!await f(...args)) { + if (!(await f(...args))) { return await original(...args); } - }) + }); } // Commands are requests from vscode to the language server @@ -44,12 +49,12 @@ export function activate(context: vscode.ExtensionContext) { 'ra-lsp.applySourceChange', commands.applySourceChange.handle ); - overrideCommand('type', commands.on_enter.handle) + overrideCommand('type', commands.onEnter.handle); // Notifications are events triggered by the language server const allNotifications: Iterable< [string, lc.GenericNotificationHandler] - > = [['m/publishDecorations', notifications.publishDecorations.handle]]; + > = [['m/publishDecorations', notifications.publishDecorations.handle]]; // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( From e22597ca6109600bd6c11ccdbca9efd813a15ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Wed, 10 Oct 2018 16:49:32 +0200 Subject: [PATCH 014/819] Remove error publishing through publishDecorations --- rust-analyzer/editors/code/src/highlighting.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index ceddffe0..d440e77c 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -20,13 +20,6 @@ export class Highlighter { [string, vscode.TextEditorDecorationType] > = [ ['background', decor('#3F3F3F')], - [ - 'error', - vscode.window.createTextEditorDecorationType({ - borderColor: 'red', - borderStyle: 'none none dashed none' - }) - ], ['comment', decor('#7F9F7F')], ['string', decor('#CC9393')], ['keyword', decor('#F0DFAF')], From 1cabf5a65495bf4d6bbb7bf8d4fd0987f9ed3b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Fri, 12 Oct 2018 08:59:12 +0200 Subject: [PATCH 015/819] Fold multiline comments --- rust-analyzer/editors/code/src/extension.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index ff8f23c7..d1c525f6 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -20,8 +20,8 @@ export function activate(context: vscode.ExtensionContext) { f: (...args: any[]) => Promise ) { const defaultCmd = `default:${name}`; - const original = async (...args: any[]) => - await vscode.commands.executeCommand(defaultCmd, ...args); + const original = (...args: any[]) => + vscode.commands.executeCommand(defaultCmd, ...args); registerCommand(name, async (...args: any[]) => { const editor = vscode.window.activeTextEditor; From 52f4e1ff2cf04ccf28f85620daa457d7521315c1 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Fri, 19 Oct 2018 15:25:43 -0400 Subject: [PATCH 016/819] Update vscode-languageclient package to support RenameOptions --- rust-analyzer/editors/code/package-lock.json | 16 ++++++++-------- rust-analyzer/editors/code/package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 33c5203b..fe304623 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -2074,8 +2074,7 @@ "semver": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", - "dev": true + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==" }, "source-map": { "version": "0.6.1", @@ -2509,9 +2508,9 @@ } }, "vsce": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.51.1.tgz", - "integrity": "sha512-Hf2HE9O/MRQHxUUgWHAm7mOkz0K5swuF2smaE/sP7+OWp/5DdIPFwmLEYCCZHxG25l3GBRoO0dAL8S5w//et+g==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.52.0.tgz", + "integrity": "sha512-k+KYoTx1sacpYf2BHTA7GN82MNSlf2N4EuppFWwtTN/Sh6fWzIJafxxCNBCDK0H+5NDWfRGZheBY8C3/HOE2ZA==", "dev": true, "requires": { "cheerio": "1.0.0-rc.2", @@ -2561,10 +2560,11 @@ "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" }, "vscode-languageclient": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz", - "integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.1.1.tgz", + "integrity": "sha512-jMxshi+BPRQFNG8GB00dJv7ldqMda0be26laYYll/udtJuHbog6RqK10GSxHWDN0PgY0b0m5fePyTk3bq8a0TA==", "requires": { + "semver": "5.5.1", "vscode-languageserver-protocol": "3.13.0" } }, diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index eeb6dd81..ea84a1cc 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -28,7 +28,7 @@ "singleQuote": true }, "dependencies": { - "vscode-languageclient": "^4.4.0" + "vscode-languageclient": "^5.1.1" }, "devDependencies": { "@types/mocha": "^2.2.42", @@ -37,7 +37,7 @@ "tslint": "^5.11.0", "tslint-config-prettier": "^1.15.0", "typescript": "^2.6.1", - "vsce": "^1.51.1", + "vsce": "^1.52.0", "vscode": "^1.1.21" }, "activationEvents": [ From 18d4cb26fcce299a041c49faa5a56a5e9efe4cbf Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 21 Oct 2018 21:39:50 +0200 Subject: [PATCH 017/819] Fix typo Truly an A+, errrr, +a commit --- rust-analyzer/editors/code/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 196fc3eb..a7a22fa6 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -25,7 +25,7 @@ export class Server { Server.client = new lc.LanguageClient( 'ra-lsp', - 'rust-analyzer languge server', + 'rust-analyzer language server', serverOptions, clientOptions ); From fd5c8c6f1b5e54a30ead00a80436f6ce7bb9b68d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 5 Nov 2018 14:10:20 +0300 Subject: [PATCH 018/819] Fully add inline modules to module tree --- rust-analyzer/editors/code/src/commands/on_enter.ts | 6 +----- .../editors/code/src/commands/parent_module.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index fe6aca63..64401b68 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -6,10 +6,6 @@ import { SourceChange } from './apply_source_change'; -interface OnEnterParams { - textDocument: lc.TextDocumentIdentifier; - position: lc.Position; -} export async function handle(event: { text: string }): Promise { const editor = vscode.window.activeTextEditor; @@ -20,7 +16,7 @@ export async function handle(event: { text: string }): Promise { ) { return false; } - const request: OnEnterParams = { + const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, position: Server.client.code2ProtocolConverter.asPosition( editor.selection.active diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 4bb92eb9..806c3d34 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { Location, TextDocumentIdentifier } from 'vscode-languageclient'; +import * as lc from 'vscode-languageclient'; import { Server } from '../server'; export async function handle() { @@ -8,10 +8,13 @@ export async function handle() { if (editor == null || editor.document.languageId !== 'rust') { return; } - const request: TextDocumentIdentifier = { - uri: editor.document.uri.toString() + const request: lc.TextDocumentPositionParams = { + textDocument: { uri: editor.document.uri.toString() }, + position: Server.client.code2ProtocolConverter.asPosition( + editor.selection.active + ) }; - const response = await Server.client.sendRequest( + const response = await Server.client.sendRequest( 'm/parentModule', request ); From 13ca5d9041e41036f3c1b1aa1f7c363afe80ce87 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 7 Nov 2018 18:32:33 +0300 Subject: [PATCH 019/819] Rename File -> SourceFileNode --- .../editors/code/src/commands/apply_source_change.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index cf921e3a..ec420d1a 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -12,14 +12,14 @@ interface FileSystemEdit { export interface SourceChange { label: string; - sourceFileEdits: lc.TextDocumentEdit[]; + SourceFileNodeEdits: lc.TextDocumentEdit[]; fileSystemEdits: FileSystemEdit[]; cursorPosition?: lc.TextDocumentPositionParams; } export async function handle(change: SourceChange) { const wsEdit = new vscode.WorkspaceEdit(); - for (const sourceEdit of change.sourceFileEdits) { + for (const sourceEdit of change.SourceFileNodeEdits) { const uri = Server.client.protocol2CodeConverter.asUri( sourceEdit.textDocument.uri ); From ed41fff6bedc4b947db27c7aa83a18a5fee03dad Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 8 Nov 2018 18:43:02 +0300 Subject: [PATCH 020/819] workspace-symbols function for Emacs --- rust-analyzer/editors/code/src/server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index a7a22fa6..75e273f3 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -20,7 +20,10 @@ export class Server { debug: run }; const clientOptions: lc.LanguageClientOptions = { - documentSelector: [{ scheme: 'file', language: 'rust' }] + documentSelector: [{ scheme: 'file', language: 'rust' }], + initializationOptions: { + publishDecorations: true, + } }; Server.client = new lc.LanguageClient( From 713872cce83d7cfb584724d872f83c635e87fcc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Fri, 9 Nov 2018 13:10:53 +0100 Subject: [PATCH 021/819] Fix on enter --- .../editors/code/src/commands/apply_source_change.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index ec420d1a..cf921e3a 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -12,14 +12,14 @@ interface FileSystemEdit { export interface SourceChange { label: string; - SourceFileNodeEdits: lc.TextDocumentEdit[]; + sourceFileEdits: lc.TextDocumentEdit[]; fileSystemEdits: FileSystemEdit[]; cursorPosition?: lc.TextDocumentPositionParams; } export async function handle(change: SourceChange) { const wsEdit = new vscode.WorkspaceEdit(); - for (const sourceEdit of change.SourceFileNodeEdits) { + for (const sourceEdit of change.sourceFileEdits) { const uri = Server.client.protocol2CodeConverter.asUri( sourceEdit.textDocument.uri ); From 02da7b5b42311460c779af6da9aa03a39778beae Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 27 Nov 2018 12:29:09 +0300 Subject: [PATCH 022/819] fix npm problems --- rust-analyzer/editors/code/package-lock.json | 62 ++++++++------------ rust-analyzer/editors/code/package.json | 1 + 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index fe304623..530a6f77 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -527,8 +527,7 @@ "duplexer": { "version": "0.1.1", "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", - "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", - "dev": true + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, "duplexify": { "version": "3.6.0", @@ -587,18 +586,16 @@ "dev": true }, "event-stream": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz", - "integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==", - "dev": true, + "version": "3.3.4", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "requires": { "duplexer": "0.1.1", - "flatmap-stream": "0.1.0", "from": "0.1.7", - "map-stream": "0.0.7", + "map-stream": "0.1.0", "pause-stream": "0.0.11", - "split": "1.0.1", - "stream-combiner": "0.2.2", + "split": "0.3.3", + "stream-combiner": "0.0.4", "through": "2.3.8" } }, @@ -704,12 +701,6 @@ "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", "dev": true }, - "flatmap-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.0.tgz", - "integrity": "sha512-Nlic4ZRYxikqnK5rj3YoxDVKGGtUjcNDUtvQ7XsdGLZmMwdUYnXf10o1zcXtzEZTBgc6GxeRpQxV/Wu3WPIIHA==", - "dev": true - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -745,8 +736,7 @@ "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", - "dev": true + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" }, "fs.realpath": { "version": "1.0.0", @@ -986,7 +976,7 @@ "integrity": "sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ==", "dev": true, "requires": { - "event-stream": "3.3.6", + "event-stream": "3.3.4", "node.extend": "1.1.6", "request": "2.88.0", "through2": "2.0.3", @@ -1065,7 +1055,7 @@ "integrity": "sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA=", "dev": true, "requires": { - "event-stream": "3.3.6", + "event-stream": "3.3.4", "mkdirp": "0.5.1", "queue": "3.1.0", "vinyl-fs": "2.4.4" @@ -1077,7 +1067,7 @@ "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "3.3.6", + "event-stream": "3.3.4", "streamifier": "0.1.1", "tar": "2.2.1", "through2": "2.0.3", @@ -1115,7 +1105,7 @@ "integrity": "sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0=", "dev": true, "requires": { - "event-stream": "3.3.6", + "event-stream": "3.3.4", "queue": "4.5.0", "through2": "2.0.3", "vinyl": "2.2.0", @@ -1475,10 +1465,9 @@ "dev": true }, "map-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", - "dev": true + "version": "0.1.0", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=" }, "markdown-it": { "version": "8.4.2", @@ -1838,7 +1827,6 @@ "version": "0.0.11", "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", - "dev": true, "requires": { "through": "2.3.8" } @@ -2093,10 +2081,9 @@ } }, "split": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "dev": true, + "version": "0.3.3", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "requires": { "through": "2.3.8" } @@ -2131,13 +2118,11 @@ "dev": true }, "stream-combiner": { - "version": "0.2.2", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", - "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", - "dev": true, + "version": "0.0.4", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "requires": { - "duplexer": "0.1.1", - "through": "2.3.8" + "duplexer": "0.1.1" } }, "stream-shift": { @@ -2221,8 +2206,7 @@ "through": { "version": "2.3.8", "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { "version": "2.0.3", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ea84a1cc..f3b049e4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -28,6 +28,7 @@ "singleQuote": true }, "dependencies": { + "event-stream": "^3.3.4", "vscode-languageclient": "^5.1.1" }, "devDependencies": { From 12557a63d043150b07dd8fb9bd8e07320924481b Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 8 Dec 2018 20:48:50 +0000 Subject: [PATCH 023/819] Improve the extend keybinding to not conflict --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f3b049e4..de956697 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -107,7 +107,7 @@ }, { "command": "ra-lsp.extendSelection", - "key": "ctrl+w", + "key": "shift+alt+right", "when": "editorTextFocus && editorLangId == rust" }, { From d3dbc45c77f650dd8a927374d92a2db96eb9e414 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 8 Dec 2018 20:52:30 +0000 Subject: [PATCH 024/819] Remove uneeded characters --- rust-analyzer/editors/code/src/commands/extend_selection.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts index 0ee6bd11..7b96bbc3 100644 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -18,9 +18,9 @@ export async function handle() { return; } const request: ExtendSelectionParams = { - selections: editor.selections.map(s => { - return Server.client.code2ProtocolConverter.asRange(s); - }), + selections: editor.selections.map(s => + Server.client.code2ProtocolConverter.asRange(s) + ), textDocument: { uri: editor.document.uri.toString() } }; const response = await Server.client.sendRequest( From 51aad39aa3dd75cc034e4ee10172c5f85199cf9e Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 8 Dec 2018 20:56:31 +0000 Subject: [PATCH 025/819] Run npm update and add private and preview flags Private stops npm publish working, which would be nonsensical anyway In case it gets added to the vscode extension repository, preview marks it as such Private may also prevent publishing to the vscode extension repository --- rust-analyzer/editors/code/package-lock.json | 1498 +++++++++--------- rust-analyzer/editors/code/package.json | 16 +- 2 files changed, 789 insertions(+), 725 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 530a6f77..d4777448 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -11,21 +11,21 @@ "dev": true }, "@types/node": { - "version": "8.10.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.34.tgz", - "integrity": "sha512-alypNiaAEd0RBGXoWehJ2gchPYCITmw4CYBoB5nDlji8l8on7FsklfdfIs4DDmgpKLSX3OF3ha6SV+0W7cTzUA==", + "version": "8.10.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.38.tgz", + "integrity": "sha512-EibsnbJerd0hBFaDjJStFrVbVBAtOy4dgL8zZFw0uOvPqzBAX59Ci8cgjg3+RgJIWhsB5A4c+pi+D4P9tQQh/A==", "dev": true }, "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz", + "integrity": "sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==", "dev": true, "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.1.0", + "fast-deep-equal": "2.0.1", "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" } }, "ansi-cyan": { @@ -64,6 +64,15 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, + "append-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", + "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", + "dev": true, + "requires": { + "buffer-equal": "1.0.0" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -122,12 +131,6 @@ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", "dev": true }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -210,7 +213,6 @@ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "optional": true, "requires": { "tweetnacl": "0.14.5" } @@ -240,17 +242,6 @@ "concat-map": "0.0.1" } }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.3" - } - }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", @@ -263,6 +254,12 @@ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", "dev": true }, + "buffer-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", + "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -326,8 +323,8 @@ "requires": { "css-select": "1.2.0", "dom-serializer": "0.1.0", - "entities": "1.1.1", - "htmlparser2": "3.9.2", + "entities": "1.1.2", + "htmlparser2": "3.10.0", "lodash": "4.17.11", "parse5": "3.0.3" } @@ -359,14 +356,34 @@ "inherits": "2.0.3", "process-nextick-args": "2.0.0", "readable-stream": "2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -383,9 +400,9 @@ "dev": true }, "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "dev": true, "requires": { "delayed-stream": "1.0.0" @@ -420,20 +437,20 @@ }, "css-select": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { "boolbase": "1.0.0", - "css-what": "2.1.0", + "css-what": "2.1.2", "domutils": "1.5.1", - "nth-check": "1.0.1" + "nth-check": "1.0.2" } }, "css-what": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", - "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.2.tgz", + "integrity": "sha512-wan8dMWQ0GUeF7DGEPVjhHemVW/vy6xUYmFzRY8RYqgA0JtXC9rJmbScBjqSu6dg9q0lwPQy6ZAmJVr3PPTvqQ==", "dev": true }, "dashdash": { @@ -456,13 +473,22 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { "is-obj": "1.0.1" } }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "1.0.12" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -488,21 +514,21 @@ "dev": true, "requires": { "domelementtype": "1.1.3", - "entities": "1.1.1" + "entities": "1.1.2" }, "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } } }, "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", "dev": true }, "domhandler": { @@ -511,7 +537,7 @@ "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", "dev": true, "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1.3.1" } }, "domutils": { @@ -521,7 +547,7 @@ "dev": true, "requires": { "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "domelementtype": "1.3.1" } }, "duplexer": { @@ -530,15 +556,41 @@ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, "duplexify": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", - "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", + "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", "dev": true, "requires": { "end-of-stream": "1.4.1", "inherits": "2.0.3", "readable-stream": "2.3.6", "stream-shift": "1.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, "ecc-jsbn": { @@ -546,7 +598,6 @@ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "optional": true, "requires": { "jsbn": "0.1.1", "safer-buffer": "2.1.2" @@ -562,9 +613,9 @@ } }, "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, "escape-string-regexp": { @@ -586,37 +637,19 @@ "dev": true }, "event-stream": { - "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz", + "integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==", "requires": { "duplexer": "0.1.1", "from": "0.1.7", - "map-stream": "0.1.0", + "map-stream": "0.0.7", "pause-stream": "0.0.11", - "split": "0.3.3", - "stream-combiner": "0.0.4", + "split": "1.0.1", + "stream-combiner": "0.2.2", "through": "2.3.8" } }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "2.2.4" - } - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -632,23 +665,6 @@ "kind-of": "1.1.0" } }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - } - } - }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -656,9 +672,9 @@ "dev": true }, "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, "fast-json-stable-stringify": { @@ -676,44 +692,40 @@ "pend": "1.2.0" } }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "3.1.0", - "repeat-element": "1.1.3", - "repeat-string": "1.6.1" - } - }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", "dev": true, "requires": { - "for-in": "1.0.2" + "inherits": "2.0.3", + "readable-stream": "2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, "forever-agent": { @@ -723,14 +735,14 @@ "dev": true }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { "asynckit": "0.4.0", - "combined-stream": "1.0.6", - "mime-types": "2.1.20" + "combined-stream": "1.0.7", + "mime-types": "2.1.21" } }, "from": { @@ -738,6 +750,16 @@ "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" }, + "fs-mkdirp-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", + "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", + "dev": true, + "requires": { + "graceful-fs": "4.1.15", + "through2": "2.0.5" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -750,12 +772,18 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", + "graceful-fs": "4.1.15", "inherits": "2.0.3", "mkdirp": "0.5.1", "rimraf": "2.6.2" } }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -779,42 +807,6 @@ "path-is-absolute": "1.0.1" } }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - }, - "dependencies": { - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - } - } - }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -826,74 +818,53 @@ } }, "glob-stream": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-5.3.5.tgz", - "integrity": "sha1-pVZlqajM3EGRWofHAeMtTgFvrSI=", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", + "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { "extend": "3.0.2", - "glob": "5.0.15", + "glob": "7.1.3", "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", + "is-negated-glob": "1.0.0", + "ordered-read-streams": "1.0.1", + "pumpify": "1.5.1", + "readable-stream": "2.3.6", + "remove-trailing-separator": "1.1.0", + "to-absolute-glob": "2.0.2", "unique-stream": "2.2.1" }, "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, "readable-stream": { - "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "safe-buffer": "5.1.2" } } } }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, "growl": { @@ -910,7 +881,7 @@ "requires": { "deep-assign": "1.0.0", "stat-mode": "0.2.2", - "through2": "2.0.3" + "through2": "2.0.5" } }, "gulp-filter": { @@ -954,13 +925,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -971,15 +942,15 @@ } }, "gulp-remote-src-vscode": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/gulp-remote-src-vscode/-/gulp-remote-src-vscode-0.5.0.tgz", - "integrity": "sha512-/9vtSk9eI9DEWCqzGieglPqmx0WUQ9pwPHyHFpKmfxqdgqGJC2l0vFMdYs54hLdDsMDEZFLDL2J4ikjc4hQ5HQ==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/gulp-remote-src-vscode/-/gulp-remote-src-vscode-0.5.1.tgz", + "integrity": "sha512-mw4OGjtC/jlCWJFhbcAlel4YPvccChlpsl3JceNiB/DLJi24/UPxXt53/N26lgI3dknEqd4ErfdHrO8sJ5bATQ==", "dev": true, "requires": { "event-stream": "3.3.4", - "node.extend": "1.1.6", + "node.extend": "1.1.8", "request": "2.88.0", - "through2": "2.0.3", + "through2": "2.0.5", "vinyl": "2.2.0" }, "dependencies": { @@ -995,6 +966,45 @@ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, + "event-stream": { + "version": "3.3.4", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "from": "0.1.7", + "map-stream": "0.1.0", + "pause-stream": "0.0.11", + "split": "0.3.3", + "stream-combiner": "0.0.4", + "through": "2.3.8" + } + }, + "map-stream": { + "version": "0.1.0", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true + }, + "split": { + "version": "0.3.3", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, + "requires": { + "duplexer": "0.1.1" + } + }, "vinyl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", @@ -1011,66 +1021,16 @@ } } }, - "gulp-sourcemaps": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz", - "integrity": "sha1-uG/zSdgBzrVuHZ59x7vLS33uYAw=", - "dev": true, - "requires": { - "convert-source-map": "1.6.0", - "graceful-fs": "4.1.11", - "strip-bom": "2.0.0", - "through2": "2.0.3", - "vinyl": "1.2.0" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", - "dev": true - }, - "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", - "dev": true, - "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulp-symdest": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/gulp-symdest/-/gulp-symdest-1.1.0.tgz", - "integrity": "sha1-wWUyBzLRks5W/ZQnH/oSMjS/KuA=", - "dev": true, - "requires": { - "event-stream": "3.3.4", - "mkdirp": "0.5.1", - "queue": "3.1.0", - "vinyl-fs": "2.4.4" - } - }, "gulp-untar": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/gulp-untar/-/gulp-untar-0.0.7.tgz", "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "3.3.4", + "event-stream": "3.3.5", "streamifier": "0.1.1", "tar": "2.2.1", - "through2": "2.0.3", + "through2": "2.0.5", "vinyl": "1.2.0" }, "dependencies": { @@ -1100,18 +1060,18 @@ } }, "gulp-vinyl-zip": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.0.tgz", - "integrity": "sha1-JOQGhdwFtxSZlSRQmeBZAmO+ja0=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.2.tgz", + "integrity": "sha512-wJn09jsb8PyvUeyFF7y7ImEJqJwYy40BqL9GKfJs6UGpaGW9A+N68Q+ajsIpb9AeR6lAdjMbIdDPclIGo1/b7Q==", "dev": true, "requires": { "event-stream": "3.3.4", - "queue": "4.5.0", - "through2": "2.0.3", + "queue": "4.5.1", + "through2": "2.0.5", "vinyl": "2.2.0", - "vinyl-fs": "2.4.4", + "vinyl-fs": "3.0.3", "yauzl": "2.10.0", - "yazl": "2.4.3" + "yazl": "2.5.1" }, "dependencies": { "clone": { @@ -1126,13 +1086,43 @@ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, - "queue": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.0.tgz", - "integrity": "sha512-DwxpAnqJuoQa+wyDgQuwkSshkhlqIlWEvwvdAY27fDPunZ2cVJzXU4JyjY+5l7zs7oGLaYAQm4MbLOVFAHFBzA==", + "event-stream": { + "version": "3.3.4", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { - "inherits": "2.0.3" + "duplexer": "0.1.1", + "from": "0.1.7", + "map-stream": "0.1.0", + "pause-stream": "0.0.11", + "split": "0.3.3", + "stream-combiner": "0.0.4", + "through": "2.3.8" + } + }, + "map-stream": { + "version": "0.1.0", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true + }, + "split": { + "version": "0.3.3", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, + "requires": { + "duplexer": "0.1.1" } }, "vinyl": { @@ -1158,15 +1148,24 @@ "dev": true }, "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, "requires": { - "ajv": "5.5.2", + "ajv": "6.6.1", "har-schema": "2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "1.1.1" + } + }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -1182,6 +1181,12 @@ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -1189,17 +1194,17 @@ "dev": true }, "htmlparser2": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", - "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.0.tgz", + "integrity": "sha512-J1nEUGv+MkXS0weHNWVKJJ+UrLfePxRWpN3C9bEi9fLxL2+ggW94DQvgYVXsaT30PGwYRIZKNZXuyMhp3Di4bQ==", "dev": true, "requires": { - "domelementtype": "1.3.0", + "domelementtype": "1.3.1", "domhandler": "2.4.2", "domutils": "1.5.1", - "entities": "1.1.1", + "entities": "1.1.2", "inherits": "2.0.3", - "readable-stream": "2.3.6" + "readable-stream": "3.0.6" } }, "http-signature": { @@ -1210,7 +1215,7 @@ "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", - "sshpk": "1.14.2" + "sshpk": "1.15.2" } }, "inflight": { @@ -1235,37 +1240,26 @@ "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=", "dev": true }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "requires": { + "is-relative": "1.0.0", + "is-windows": "1.0.2" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, "is-glob": { @@ -1277,25 +1271,11 @@ "is-extglob": "2.1.1" } }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true }, "is-obj": { "version": "1.0.1", @@ -1303,23 +1283,14 @@ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "requires": { + "is-unc-path": "1.0.0" + } }, "is-typedarray": { "version": "1.0.0", @@ -1327,6 +1298,15 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "requires": { + "unc-path-regex": "0.1.2" + } + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -1334,9 +1314,15 @@ "dev": true }, "is-valid-glob": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-0.3.0.tgz", - "integrity": "sha1-1LVcafUYhvm2XHDWwmItN+KfSP4=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", + "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, "isarray": { @@ -1345,15 +1331,6 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -1380,8 +1357,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true + "dev": true }, "json-schema": { "version": "0.2.3", @@ -1390,9 +1366,9 @@ "dev": true }, "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "json-stable-stringify": { @@ -1430,7 +1406,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1441,12 +1417,47 @@ "dev": true, "requires": { "readable-stream": "2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } + } + }, + "lead": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", + "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", + "dev": true, + "requires": { + "flush-write-stream": "1.0.3" } }, "linkify-it": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.0.3.tgz", - "integrity": "sha1-2UpGSPmxwXnWT6lykSaL22zpQ08=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.1.0.tgz", + "integrity": "sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==", "dev": true, "requires": { "uc.micro": "1.0.5" @@ -1458,16 +1469,10 @@ "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", - "dev": true - }, "map-stream": { - "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=" + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=" }, "markdown-it": { "version": "8.4.2", @@ -1476,89 +1481,18 @@ "dev": true, "requires": { "argparse": "1.0.10", - "entities": "1.1.1", - "linkify-it": "2.0.3", + "entities": "1.1.2", + "linkify-it": "2.1.0", "mdurl": "1.0.1", "uc.micro": "1.0.5" } }, - "math-random": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", - "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", - "dev": true - }, "mdurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, - "merge-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", - "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", - "dev": true, - "requires": { - "readable-stream": "2.3.6" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "1.1.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -1566,18 +1500,18 @@ "dev": true }, "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==", "dev": true }, "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "dev": true, "requires": { - "mime-db": "1.36.0" + "mime-db": "1.37.0" } }, "minimatch": { @@ -1669,11 +1603,12 @@ "dev": true }, "node.extend": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.6.tgz", - "integrity": "sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y=", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz", + "integrity": "sha512-L/dvEBwyg3UowwqOUTyDsGBU6kjBQOpOhshio9V3i3BMPv5YUb9+mWNN8MK0IbWqT0AqaTSONZf0aTuMMahWgA==", "dev": true, "requires": { + "has": "1.0.3", "is": "3.2.1" } }, @@ -1686,10 +1621,19 @@ "remove-trailing-separator": "1.1.0" } }, + "now-and-later": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", + "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, "nth-check": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", - "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", "dev": true, "requires": { "boolbase": "1.0.0" @@ -1701,20 +1645,22 @@ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "define-properties": "1.1.3", + "function-bind": "1.1.1", + "has-symbols": "1.0.0", + "object-keys": "1.0.12" } }, "once": { @@ -1727,24 +1673,49 @@ } }, "ordered-read-streams": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz", - "integrity": "sha1-cTfmmzKYuzQiR6G77jiByA4v14s=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", + "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "is-stream": "1.1.0", "readable-stream": "2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1758,38 +1729,9 @@ "os-tmpdir": "1.0.2" } }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - } - } - }, "parse-semver": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1802,7 +1744,7 @@ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", "dev": true, "requires": { - "@types/node": "8.10.34" + "@types/node": "8.10.38" } }, "path-dirname": { @@ -1856,16 +1798,10 @@ "extend-shallow": "1.1.4" } }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, "prettier": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", - "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz", + "integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==", "dev": true }, "process-nextick-args": { @@ -1880,10 +1816,31 @@ "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", "dev": true }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "once": "1.4.0" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "3.6.1", + "inherits": "2.0.3", + "pump": "2.0.1" + } + }, "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, "q": { @@ -1899,45 +1856,20 @@ "dev": true }, "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", + "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==", "dev": true }, "queue": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/queue/-/queue-3.1.0.tgz", - "integrity": "sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU=", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.1.tgz", + "integrity": "sha512-AMD7w5hRXcFSb8s9u38acBZ+309u6GsiibP4/0YacJeaurRshogB7v/ZcVPxP5gD5+zIw6ixRHdutiYUJfwKHw==", "dev": true, "requires": { "inherits": "2.0.3" } }, - "randomatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", - "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", - "dev": true, - "requires": { - "is-number": "4.0.0", - "kind-of": "6.0.2", - "math-random": "1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -1948,27 +1880,35 @@ } }, "readable-stream": { - "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.0.6.tgz", + "integrity": "sha512-9E1oLoOWfhSXHGv6QlwXJim7uNzd9EVlWK+21tCU9Ju/kR0/p2AZYPz4qSchgO8PlLIH4FpZYfzwS+rEksZjIg==", "dev": true, "requires": { - "core-util-is": "1.0.2", "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", + "string_decoder": "1.2.0", "util-deprecate": "1.0.2" } }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "remove-bom-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", + "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", + "dev": true, + "requires": { + "is-buffer": "1.1.6", + "is-utf8": "0.2.1" + } + }, + "remove-bom-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", + "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "remove-bom-buffer": "3.0.0", + "safe-buffer": "5.1.2", + "through2": "2.0.5" } }, "remove-trailing-separator": { @@ -1977,18 +1917,6 @@ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "dev": true }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, "replace-ext": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", @@ -2004,16 +1932,16 @@ "aws-sign2": "0.7.0", "aws4": "1.8.0", "caseless": "0.12.0", - "combined-stream": "1.0.6", + "combined-stream": "1.0.7", "extend": "3.0.2", "forever-agent": "0.6.1", - "form-data": "2.3.2", - "har-validator": "5.1.0", + "form-data": "2.3.3", + "har-validator": "5.1.3", "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.20", + "mime-types": "2.1.21", "oauth-sign": "0.9.0", "performance-now": "2.1.0", "qs": "6.5.2", @@ -2038,6 +1966,15 @@ "path-parse": "1.0.6" } }, + "resolve-options": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", + "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", + "dev": true, + "requires": { + "value-or-function": "3.0.0" + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -2081,9 +2018,9 @@ } }, "split": { - "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", "requires": { "through": "2.3.8" } @@ -2095,9 +2032,9 @@ "dev": true }, "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz", + "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", "dev": true, "requires": { "asn1": "0.2.4", @@ -2118,11 +2055,12 @@ "dev": true }, "stream-combiner": { - "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "version": "0.2.2", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", "requires": { - "duplexer": "0.1.1" + "duplexer": "0.1.1", + "through": "2.3.8" } }, "stream-shift": { @@ -2138,6 +2076,32 @@ "dev": true, "requires": { "readable-stream": "2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, "streamifier": { @@ -2147,9 +2111,9 @@ "dev": true }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", + "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", "dev": true, "requires": { "safe-buffer": "5.1.2" @@ -2164,25 +2128,6 @@ "ansi-regex": "2.1.1" } }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "strip-bom-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz", - "integrity": "sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4=", - "dev": true, - "requires": { - "first-chunk-stream": "1.0.0", - "strip-bom": "2.0.0" - } - }, "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", @@ -2194,7 +2139,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2209,13 +2154,39 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, "requires": { "readable-stream": "2.3.6", "xtend": "4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + } } }, "through2-filter": { @@ -2224,7 +2195,7 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "2.0.3", + "through2": "2.0.5", "xtend": "4.0.1" } }, @@ -2238,23 +2209,22 @@ } }, "to-absolute-glob": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz", - "integrity": "sha1-HN+kcqnvUMI57maZm2YsoOs5k38=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", "dev": true, "requires": { - "extend-shallow": "2.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "0.1.1" - } - } + "is-absolute": "1.0.0", + "is-negated-glob": "1.0.0" + } + }, + "to-through": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", + "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", + "dev": true, + "requires": { + "through2": "2.0.5" } }, "tough-cookie": { @@ -2265,6 +2235,14 @@ "requires": { "psl": "1.1.29", "punycode": "1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } } }, "tslib": { @@ -2294,9 +2272,9 @@ } }, "tslint-config-prettier": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.15.0.tgz", - "integrity": "sha512-06CgrHJxJmNYVgsmeMoa1KXzQRoOdvfkqnJth6XUkNeOz707qxN0WfxfhYwhL5kXHHbYJRby2bqAPKwThlZPhw==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.17.0.tgz", + "integrity": "sha512-NKWNkThwqE4Snn4Cm6SZB7lV5RMDDFsBwz6fWUkTxOKGjMx8ycOHnjIbhn7dZd5XmssW3CwqUjlANR6EhP9YQw==", "dev": true }, "tsutils": { @@ -2327,8 +2305,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true + "dev": true }, "typed-rest-client": { "version": "0.9.0", @@ -2342,7 +2319,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2360,6 +2337,12 @@ "integrity": "sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg==", "dev": true }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, "underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", @@ -2376,6 +2359,15 @@ "through2-filter": "2.0.0" } }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", @@ -2383,12 +2375,12 @@ "dev": true }, "url-parse": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", "dev": true, "requires": { - "querystringify": "2.0.0", + "querystringify": "2.1.0", "requires-port": "1.0.0" } }, @@ -2404,10 +2396,10 @@ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, - "vali-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz", - "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=", + "value-or-function": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", + "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", "dev": true }, "verror": { @@ -2432,51 +2424,78 @@ } }, "vinyl-fs": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-2.4.4.tgz", - "integrity": "sha1-vm/zJwy1Xf19MGNkDegfJddTIjk=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", + "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", "dev": true, "requires": { - "duplexify": "3.6.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", + "fs-mkdirp-stream": "1.0.0", + "glob-stream": "6.1.0", + "graceful-fs": "4.1.15", + "is-valid-glob": "1.0.0", "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", + "lead": "1.0.0", + "object.assign": "4.1.0", + "pumpify": "1.5.1", "readable-stream": "2.3.6", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" + "remove-bom-buffer": "3.0.0", + "remove-bom-stream": "1.2.0", + "resolve-options": "1.1.0", + "through2": "2.0.5", + "to-through": "2.0.0", + "value-or-function": "3.0.0", + "vinyl": "2.2.0", + "vinyl-sourcemap": "1.1.0" }, "dependencies": { "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", "dev": true }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" } } } @@ -2487,14 +2506,57 @@ "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", "dev": true, "requires": { - "through2": "2.0.3", + "through2": "2.0.5", "vinyl": "0.4.6" } }, + "vinyl-sourcemap": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", + "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", + "dev": true, + "requires": { + "append-buffer": "1.0.2", + "convert-source-map": "1.6.0", + "graceful-fs": "4.1.15", + "normalize-path": "2.1.1", + "now-and-later": "2.0.0", + "remove-bom-buffer": "3.0.0", + "vinyl": "2.2.0" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "2.1.2", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" + } + } + } + }, "vsce": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.52.0.tgz", - "integrity": "sha512-k+KYoTx1sacpYf2BHTA7GN82MNSlf2N4EuppFWwtTN/Sh6fWzIJafxxCNBCDK0H+5NDWfRGZheBY8C3/HOE2ZA==", + "version": "1.53.2", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.53.2.tgz", + "integrity": "sha512-yo7ctgQPK7hKnez/be3Tj7RG3eZzgkFhx/27y9guwzhMxHfjlU1pusAsFT8wBEZKZlYA5HNJAx8oClw4WDWi+A==", "dev": true, "requires": { "cheerio": "1.0.0-rc.2", @@ -2513,28 +2575,28 @@ "url-join": "1.1.0", "vso-node-api": "6.1.2-preview", "yauzl": "2.10.0", - "yazl": "2.4.3" + "yazl": "2.5.1" } }, "vscode": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.21.tgz", - "integrity": "sha512-tJl9eL15ZMm6vzCYYeQ26sSYRuXGMGPsaeIAmG2rOOYRn01jdaDg6I4b9G5Ed6FISdmn6egpKThk4o4om8Ax/A==", + "version": "1.1.26", + "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.26.tgz", + "integrity": "sha512-z1Nf5J38gjUFbuDCbJHPN6OJ//5EG+e/yHlh6ERxj/U9B2Qc3aiHaFr38/fee/GGnxvRw/XegLMOG+UJwKi/Qg==", "dev": true, "requires": { "glob": "7.1.3", "gulp-chmod": "2.0.0", "gulp-filter": "5.1.0", "gulp-gunzip": "1.0.0", - "gulp-remote-src-vscode": "0.5.0", - "gulp-symdest": "1.1.0", + "gulp-remote-src-vscode": "0.5.1", "gulp-untar": "0.0.7", - "gulp-vinyl-zip": "2.1.0", + "gulp-vinyl-zip": "2.1.2", "mocha": "4.1.0", "request": "2.88.0", "semver": "5.5.1", "source-map-support": "0.5.9", - "url-parse": "1.4.3", + "url-parse": "1.4.4", + "vinyl-fs": "3.0.3", "vinyl-source-stream": "1.1.2" } }, @@ -2601,9 +2663,9 @@ } }, "yazl": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.4.3.tgz", - "integrity": "sha1-7CblzIfVYBud+EMtvdPNLlFzoHE=", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", "dev": true, "requires": { "buffer-crc32": "0.2.13" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index de956697..aa38a2ae 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -1,7 +1,9 @@ { "name": "ra-lsp", "displayName": "ra-lsp", - "description": "", + "description": "An alternative rust language server to the RLS", + "preview": true, + "private": true, "version": "0.0.1", "publisher": "matklad", "repository": { @@ -28,18 +30,18 @@ "singleQuote": true }, "dependencies": { - "event-stream": "^3.3.4", + "event-stream": "^3.3.5", "vscode-languageclient": "^5.1.1" }, "devDependencies": { "@types/mocha": "^2.2.42", - "@types/node": "^8.10.34", - "prettier": "^1.14.3", + "@types/node": "^8.10.38", + "prettier": "^1.15.3", "tslint": "^5.11.0", - "tslint-config-prettier": "^1.15.0", + "tslint-config-prettier": "^1.17.0", "typescript": "^2.6.1", - "vsce": "^1.52.0", - "vscode": "^1.1.21" + "vsce": "^1.53.2", + "vscode": "^1.1.26" }, "activationEvents": [ "onLanguage:rust" From 9458e5ec91ffbff357f6df5db920ab1ec8eaeeaa Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 8 Dec 2018 21:09:32 +0000 Subject: [PATCH 026/819] Add package command and upgrade event-stream --- rust-analyzer/editors/code/package-lock.json | 21 +++++++++++++++++--- rust-analyzer/editors/code/package.json | 3 ++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d4777448..e74fd2a6 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -637,9 +637,9 @@ "dev": true }, "event-stream": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz", - "integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz", + "integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==", "requires": { "duplexer": "0.1.1", "from": "0.1.7", @@ -1040,6 +1040,21 @@ "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, + "event-stream": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz", + "integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "from": "0.1.7", + "map-stream": "0.0.7", + "pause-stream": "0.0.11", + "split": "1.0.1", + "stream-combiner": "0.2.2", + "through": "2.3.8" + } + }, "replace-ext": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index aa38a2ae..b212e159 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -17,6 +17,7 @@ }, "scripts": { "vscode:prepublish": "npm run compile", + "package": "vsce package", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", "postinstall": "node ./node_modules/vscode/bin/install", @@ -30,7 +31,7 @@ "singleQuote": true }, "dependencies": { - "event-stream": "^3.3.5", + "event-stream": "^4.0.1", "vscode-languageclient": "^5.1.1" }, "devDependencies": { From eaa7fa31e3aee2a197fc07f97179836c84252076 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 9 Dec 2018 13:28:32 +0300 Subject: [PATCH 027/819] remove direct dep on event-stream: malisious version was unpublished --- rust-analyzer/editors/code/package-lock.json | 164 +++++-------------- rust-analyzer/editors/code/package.json | 1 - 2 files changed, 39 insertions(+), 126 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e74fd2a6..0b6d7291 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -437,7 +437,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -473,7 +473,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -519,7 +519,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -553,7 +553,8 @@ "duplexer": { "version": "0.1.1", "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", - "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true }, "duplexify": { "version": "3.6.1", @@ -637,16 +638,17 @@ "dev": true }, "event-stream": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-4.0.1.tgz", - "integrity": "sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==", + "version": "3.3.4", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "dev": true, "requires": { "duplexer": "0.1.1", "from": "0.1.7", - "map-stream": "0.0.7", + "map-stream": "0.1.0", "pause-stream": "0.0.11", - "split": "1.0.1", - "stream-combiner": "0.2.2", + "split": "0.3.3", + "stream-combiner": "0.0.4", "through": "2.3.8" } }, @@ -748,7 +750,8 @@ "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true }, "fs-mkdirp-stream": { "version": "1.0.0", @@ -925,13 +928,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -966,45 +969,6 @@ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, - "event-stream": { - "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", - "dev": true, - "requires": { - "duplexer": "0.1.1", - "from": "0.1.7", - "map-stream": "0.1.0", - "pause-stream": "0.0.11", - "split": "0.3.3", - "stream-combiner": "0.0.4", - "through": "2.3.8" - } - }, - "map-stream": { - "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", - "dev": true - }, - "split": { - "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", - "dev": true, - "requires": { - "through": "2.3.8" - } - }, - "stream-combiner": { - "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", - "dev": true, - "requires": { - "duplexer": "0.1.1" - } - }, "vinyl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", @@ -1027,7 +991,7 @@ "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "3.3.5", + "event-stream": "3.3.4", "streamifier": "0.1.1", "tar": "2.2.1", "through2": "2.0.5", @@ -1040,21 +1004,6 @@ "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, - "event-stream": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.5.tgz", - "integrity": "sha512-vyibDcu5JL20Me1fP734QBH/kenBGLZap2n0+XXM7mvuUPzJ20Ydqj1aKcIeMdri1p+PU+4yAKugjN8KCVst+g==", - "dev": true, - "requires": { - "duplexer": "0.1.1", - "from": "0.1.7", - "map-stream": "0.0.7", - "pause-stream": "0.0.11", - "split": "1.0.1", - "stream-combiner": "0.2.2", - "through": "2.3.8" - } - }, "replace-ext": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", @@ -1101,45 +1050,6 @@ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, - "event-stream": { - "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", - "dev": true, - "requires": { - "duplexer": "0.1.1", - "from": "0.1.7", - "map-stream": "0.1.0", - "pause-stream": "0.0.11", - "split": "0.3.3", - "stream-combiner": "0.0.4", - "through": "2.3.8" - } - }, - "map-stream": { - "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", - "dev": true - }, - "split": { - "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", - "dev": true, - "requires": { - "through": "2.3.8" - } - }, - "stream-combiner": { - "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", - "dev": true, - "requires": { - "duplexer": "0.1.1" - } - }, "vinyl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", @@ -1421,7 +1331,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1485,9 +1395,10 @@ "dev": true }, "map-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=" + "version": "0.1.0", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true }, "markdown-it": { "version": "8.4.2", @@ -1724,13 +1635,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1746,7 +1657,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1784,6 +1695,7 @@ "version": "0.0.11", "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, "requires": { "through": "2.3.8" } @@ -2033,9 +1945,10 @@ } }, "split": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "version": "0.3.3", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, "requires": { "through": "2.3.8" } @@ -2070,12 +1983,12 @@ "dev": true }, "stream-combiner": { - "version": "0.2.2", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", - "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", + "version": "0.0.4", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, "requires": { - "duplexer": "0.1.1", - "through": "2.3.8" + "duplexer": "0.1.1" } }, "stream-shift": { @@ -2154,7 +2067,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2166,7 +2079,8 @@ "through": { "version": "2.3.8", "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true }, "through2": { "version": "2.0.5", @@ -2334,7 +2248,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b212e159..f196ecc6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -31,7 +31,6 @@ "singleQuote": true }, "dependencies": { - "event-stream": "^4.0.1", "vscode-languageclient": "^5.1.1" }, "devDependencies": { From 2dd28067d69a1aa59686866f06ccbe5e87a5e68f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 15 Dec 2018 22:33:09 +0300 Subject: [PATCH 028/819] use new clear-terminal feature --- rust-analyzer/editors/code/package-lock.json | 22 +++++++++---------- rust-analyzer/editors/code/package.json | 4 ++-- .../editors/code/src/commands/runnables.ts | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 0b6d7291..51c72f01 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -2535,27 +2535,27 @@ "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" }, "vscode-languageclient": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.1.1.tgz", - "integrity": "sha512-jMxshi+BPRQFNG8GB00dJv7ldqMda0be26laYYll/udtJuHbog6RqK10GSxHWDN0PgY0b0m5fePyTk3bq8a0TA==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", + "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", "requires": { "semver": "5.5.1", - "vscode-languageserver-protocol": "3.13.0" + "vscode-languageserver-protocol": "3.14.1" } }, "vscode-languageserver-protocol": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.13.0.tgz", - "integrity": "sha512-2ZGKwI+P2ovQll2PGAp+2UfJH+FK9eait86VBUdkPd9HRlm8e58aYT9pV/NYanHOcp3pL6x2yTLVCFMcTer0mg==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", + "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", "requires": { "vscode-jsonrpc": "4.0.0", - "vscode-languageserver-types": "3.13.0" + "vscode-languageserver-types": "3.14.0" } }, "vscode-languageserver-types": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.13.0.tgz", - "integrity": "sha512-BnJIxS+5+8UWiNKCP7W3g9FlE7fErFw0ofP5BXJe7c2tl0VeWh+nNHFbwAS2vmVC4a5kYxHBjRy0UeOtziemVA==" + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", + "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==" }, "vso-node-api": { "version": "6.1.2-preview", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f196ecc6..d53e44b2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.26.0" + "vscode": "^1.30.0" }, "scripts": { "vscode:prepublish": "npm run compile", @@ -31,7 +31,7 @@ "singleQuote": true }, "dependencies": { - "vscode-languageclient": "^5.1.1" + "vscode-languageclient": "^5.2.1" }, "devDependencies": { "@types/mocha": "^2.2.42", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c234bfae..be17c894 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -44,12 +44,11 @@ function createTask(spec: Runnable): vscode.Task { env: spec.env }; - const execCmd = `${definition.command} ${definition.args.join(' ')}`; const execOption: vscode.ShellExecutionOptions = { cwd: '.', env: definition.env }; - const exec = new vscode.ShellExecution(`clear; ${execCmd}`, execOption); + const exec = new vscode.ShellExecution(definition.command, definition.args, execOption); const f = vscode.workspace.workspaceFolders![0]; const t = new vscode.Task( @@ -60,6 +59,7 @@ function createTask(spec: Runnable): vscode.Task { exec, ['$rustc'] ); + t.presentationOptions.clear = true return t; } From 8618ff45123a171684d055e18dd2a7d6c55aa4cc Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 17 Dec 2018 22:33:40 +0000 Subject: [PATCH 029/819] Reload package-lock.json --- rust-analyzer/editors/code/package-lock.json | 150 ++++++++++--------- 1 file changed, 78 insertions(+), 72 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 51c72f01..5e3d64ee 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -17,9 +17,9 @@ "dev": true }, "ajv": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz", - "integrity": "sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz", + "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", "dev": true, "requires": { "fast-deep-equal": "2.0.1", @@ -193,12 +193,6 @@ "strip-ansi": "3.0.1", "supports-color": "2.0.0" } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true } } }, @@ -298,12 +292,6 @@ "color-convert": "1.9.3" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -409,9 +397,9 @@ } }, "commander": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", - "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", "dev": true }, "concat-map": { @@ -437,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -473,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -502,9 +490,9 @@ "dev": true }, "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, "dom-serializer": { @@ -519,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -928,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1078,7 +1066,7 @@ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, "requires": { - "ajv": "6.6.1", + "ajv": "6.6.2", "har-schema": "2.0.0" } }, @@ -1101,9 +1089,9 @@ } }, "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, "has-symbols": { @@ -1129,7 +1117,7 @@ "domutils": "1.5.1", "entities": "1.1.2", "inherits": "2.0.3", - "readable-stream": "3.0.6" + "readable-stream": "3.1.0" } }, "http-signature": { @@ -1160,9 +1148,9 @@ "dev": true }, "is": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", - "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", + "integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==", "dev": true }, "is-absolute": { @@ -1331,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1488,6 +1476,12 @@ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -1501,6 +1495,21 @@ "once": "1.4.0", "path-is-absolute": "1.0.1" } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } } } }, @@ -1535,7 +1544,7 @@ "dev": true, "requires": { "has": "1.0.3", - "is": "3.2.1" + "is": "3.3.0" } }, "normalize-path": { @@ -1635,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1657,11 +1666,11 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { - "semver": "5.5.1" + "semver": "5.6.0" } }, "parse5": { @@ -1681,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1738,9 +1747,9 @@ "dev": true }, "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", "dev": true }, "pump": { @@ -1807,9 +1816,9 @@ } }, "readable-stream": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.0.6.tgz", - "integrity": "sha512-9E1oLoOWfhSXHGv6QlwXJim7uNzd9EVlWK+21tCU9Ju/kR0/p2AZYPz4qSchgO8PlLIH4FpZYfzwS+rEksZjIg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.0.tgz", + "integrity": "sha512-vpydAvIJvPODZNagCPuHG87O9JNPtvFEtjHHRVwNVsVVRBqemvPJkc2SYbxJsiZXawJdtZNmkmnsPuE3IgsG0A==", "dev": true, "requires": { "inherits": "2.0.3", @@ -1885,9 +1894,9 @@ "dev": true }, "resolve": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", - "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", + "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", "dev": true, "requires": { "path-parse": "1.0.6" @@ -1924,9 +1933,9 @@ "dev": true }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" }, "source-map": { "version": "0.6.1", @@ -1955,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -2057,17 +2066,14 @@ } }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2162,7 +2168,7 @@ "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { - "psl": "1.1.29", + "psl": "1.1.31", "punycode": "1.4.1" }, "dependencies": { @@ -2189,13 +2195,13 @@ "babel-code-frame": "6.26.0", "builtin-modules": "1.1.1", "chalk": "2.4.1", - "commander": "2.18.0", - "diff": "3.3.1", + "commander": "2.19.0", + "diff": "3.5.0", "glob": "7.1.3", "js-yaml": "3.12.0", "minimatch": "3.0.4", - "resolve": "1.8.1", - "semver": "5.5.1", + "resolve": "1.9.0", + "semver": "5.6.0", "tslib": "1.9.3", "tsutils": "2.29.0" } @@ -2248,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2489,7 +2495,7 @@ "dev": true, "requires": { "cheerio": "1.0.0-rc.2", - "commander": "2.18.0", + "commander": "2.19.0", "denodeify": "1.2.1", "glob": "7.1.3", "lodash": "4.17.11", @@ -2499,7 +2505,7 @@ "osenv": "0.1.5", "parse-semver": "1.1.1", "read": "1.0.7", - "semver": "5.5.1", + "semver": "5.6.0", "tmp": "0.0.29", "url-join": "1.1.0", "vso-node-api": "6.1.2-preview", @@ -2522,7 +2528,7 @@ "gulp-vinyl-zip": "2.1.2", "mocha": "4.1.0", "request": "2.88.0", - "semver": "5.5.1", + "semver": "5.6.0", "source-map-support": "0.5.9", "url-parse": "1.4.4", "vinyl-fs": "3.0.3", @@ -2539,7 +2545,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", "requires": { - "semver": "5.5.1", + "semver": "5.6.0", "vscode-languageserver-protocol": "3.14.1" } }, From 7bc3692a8beb6a03fb57a8dc50533f02a966f531 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 12:05:41 +0000 Subject: [PATCH 030/819] Support tracing lsp requests. TODO: Debug why decorations are sent even when highlightingOn is disabled This makes the log volume so high its impossible to work with anyway --- rust-analyzer/editors/code/package.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d53e44b2..2989a701 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -131,6 +131,17 @@ "type": "boolean", "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" + }, + "ra-lsp.trace.server": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "Trace requests to the ra-lsp server" } } }, From 07558d25011e6db18198ef64f8867ad59458bda6 Mon Sep 17 00:00:00 2001 From: frai Date: Sat, 22 Dec 2018 15:26:18 +0200 Subject: [PATCH 031/819] Fix analyzer extension fail when there are enabled any VIM extension. --- rust-analyzer/editors/code/src/extension.ts | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index d1c525f6..4acd54d9 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -23,19 +23,23 @@ export function activate(context: vscode.ExtensionContext) { const original = (...args: any[]) => vscode.commands.executeCommand(defaultCmd, ...args); - registerCommand(name, async (...args: any[]) => { - const editor = vscode.window.activeTextEditor; - if ( - !editor || - !editor.document || - editor.document.languageId !== 'rust' - ) { - return await original(...args); - } - if (!(await f(...args))) { - return await original(...args); - } - }); + try { + registerCommand(name, async (...args: any[]) => { + const editor = vscode.window.activeTextEditor; + if ( + !editor || + !editor.document || + editor.document.languageId !== 'rust' + ) { + return await original(...args); + } + if (!(await f(...args))) { + return await original(...args); + } + }); + } catch(_) { + vscode.window.showWarningMessage('Enhanced typing feature is disabled because of incompatibility with VIM extension'); + } } // Commands are requests from vscode to the language server From c6e2b42198f7d34e1ab0ef2ca78ece0767d121aa Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 24 Dec 2018 13:43:08 +0000 Subject: [PATCH 032/819] Add a very hacky workaround to not trace decorations requests --- rust-analyzer/editors/code/src/server.ts | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 75e273f3..75bdf320 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -22,7 +22,7 @@ export class Server { const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { - publishDecorations: true, + publishDecorations: true } }; @@ -32,6 +32,30 @@ export class Server { serverOptions, clientOptions ); + // HACK: This is an awful way of filtering out the decorations notifications + // However, pending proper support, this is the most effecitve approach + // Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages + // Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting) + // This also requires considering our settings strategy, which is work which needs doing + // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests + Server.client._tracer = { + log: (messageOrDataObject: string | any, data?: string) => { + if (typeof messageOrDataObject === 'string') { + if ( + messageOrDataObject.includes('m/publishDecorations') || + messageOrDataObject.includes('m/decorationsRequest') + ) { + // Don't log publish decorations requests + } else { + // @ts-ignore This is just a utility function + Server.client.logTrace(messageOrDataObject, data); + } + } else { + // @ts-ignore + Server.client.logObjectTrace(messageOrDataObject); + } + } + }; Server.client.onReady().then(() => { for (const [type, handler] of notificationHandlers) { Server.client.onNotification(type, handler); From 3aabf0f19a5e7ff02af00c8882d51738a2ecbb1f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 17:39:12 +0300 Subject: [PATCH 033/819] highlight macro idents --- rust-analyzer/editors/code/src/highlighting.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d440e77c..2521dff6 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -28,7 +28,8 @@ export class Highlighter { ['builtin', decor('#DD6718')], ['text', decor('#DCDCCC')], ['attribute', decor('#BFEBBF')], - ['literal', decor('#DFAF8F')] + ['literal', decor('#DFAF8F')], + ['macro', decor('#DFAF8F')] ]; return new Map(decorations); From 09334a80ae7da1ddf34c4a98d9562779f946f2f6 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sun, 30 Dec 2018 18:24:07 +0100 Subject: [PATCH 034/819] fix regex and add rustc-watch problem matcher --- rust-analyzer/editors/code/package.json | 55 ++++++++++++++----------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2989a701..93a1d6d0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -145,37 +145,46 @@ } } }, - "problemMatchers": [ + "problemPatterns": [ { "name": "rustc", - "fileLocation": [ - "relative", - "${workspaceRoot}" - ], - "pattern": [ + "patterns": [ { - "regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$", + "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", "severity": 1, - "message": 4, - "code": 3 - }, - { - "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", - "file": 2, - "line": 3, - "column": 4 + "code": 2, + "message": 3 }, { - "regexp": "^.*$" - }, - { - "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", - "file": 2, - "line": 3, - "column": 4 + "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", + "file": 1, + "line": 2, + "column": 3 } ] } + ], + "problemMatchers": [ + { + "name": "rustc", + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "pattern": "$rustc" + }, + { + "name": "rustc-watch", + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "background": { + "beginsPattern": "^\\[Running ", + "endsPattern": "^(\\[Finished running\\]|To learn more, run the command again with --verbose\\.)$" + }, + "pattern": "$rustc" + } ] } -} +} \ No newline at end of file From adb422b106a683dcd0c35c6562d8fc50bd79f514 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sun, 30 Dec 2018 18:30:14 +0100 Subject: [PATCH 035/819] named multiline problem patterns are not parsed properly in vscode at the moment --- rust-analyzer/editors/code/package.json | 31 +++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 93a1d6d0..e0db3c33 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -147,6 +147,7 @@ }, "problemPatterns": [ { + "//comment": "named multiline problem patterns are not parsed properly in vscode at the moment, when fixed in vscode replace both \"pattern\": [...] below with \"pattern\": \"$rustc\"", "name": "rustc", "patterns": [ { @@ -171,7 +172,20 @@ "relative", "${workspaceRoot}" ], - "pattern": "$rustc" + "pattern": [ + { + "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", + "severity": 1, + "code": 2, + "message": 3 + }, + { + "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", + "file": 1, + "line": 2, + "column": 3 + } + ] }, { "name": "rustc-watch", @@ -183,7 +197,20 @@ "beginsPattern": "^\\[Running ", "endsPattern": "^(\\[Finished running\\]|To learn more, run the command again with --verbose\\.)$" }, - "pattern": "$rustc" + "pattern": [ + { + "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", + "severity": 1, + "code": 2, + "message": 3 + }, + { + "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", + "file": 1, + "line": 2, + "column": 3 + } + ] } ] } From 0d2a789a66bb2d05a12a7128e7abb7f1ece39152 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Thu, 3 Jan 2019 14:14:36 +0100 Subject: [PATCH 036/819] use lsp WorkspaceEdit instead of custom source_file_edits and file_system_edits --- .../code/src/commands/apply_source_change.ts | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index cf921e3a..10dbf72c 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -3,46 +3,23 @@ import * as lc from 'vscode-languageclient'; import { Server } from '../server'; -interface FileSystemEdit { - type: string; - uri?: string; - src?: string; - dst?: string; -} - export interface SourceChange { label: string; - sourceFileEdits: lc.TextDocumentEdit[]; - fileSystemEdits: FileSystemEdit[]; + workspaceEdit: lc.WorkspaceEdit; cursorPosition?: lc.TextDocumentPositionParams; } export async function handle(change: SourceChange) { - const wsEdit = new vscode.WorkspaceEdit(); - for (const sourceEdit of change.sourceFileEdits) { - const uri = Server.client.protocol2CodeConverter.asUri( - sourceEdit.textDocument.uri - ); - const edits = Server.client.protocol2CodeConverter.asTextEdits( - sourceEdit.edits - ); - wsEdit.set(uri, edits); - } + const wsEdit = Server.client.protocol2CodeConverter.asWorkspaceEdit(change.workspaceEdit); let created; let moved; - for (const fsEdit of change.fileSystemEdits) { - switch (fsEdit.type) { - case 'createFile': - const uri = vscode.Uri.parse(fsEdit.uri!); - wsEdit.createFile(uri); - created = uri; - break; - case 'moveFile': - const src = vscode.Uri.parse(fsEdit.src!); - const dst = vscode.Uri.parse(fsEdit.dst!); - wsEdit.renameFile(src, dst); - moved = dst; - break; + if (change.workspaceEdit.documentChanges) { + for (const docChange of change.workspaceEdit.documentChanges) { + if (lc.CreateFile.is(docChange)) { + created = docChange.uri; + } else if (lc.RenameFile.is(docChange)) { + moved = docChange.newUri; + } } } const toOpen = created || moved; @@ -65,6 +42,6 @@ export async function handle(change: SourceChange) { if (!editor.selection.isEmpty) { return; } - editor!.selection = new vscode.Selection(position, position); + editor.selection = new vscode.Selection(position, position); } } From 67a1646e2bb7d44925c1ad03203a0882c58e1a73 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Jan 2019 21:28:35 +0300 Subject: [PATCH 037/819] index stuff produced by macros --- rust-analyzer/editors/code/package-lock.json | 872 +++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 437 insertions(+), 437 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5e3d64ee..0bbd85b8 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -22,10 +22,10 @@ "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", "dev": true, "requires": { - "fast-deep-equal": "2.0.1", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.4.1", - "uri-js": "4.2.2" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, "ansi-cyan": { @@ -70,7 +70,7 @@ "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", "dev": true, "requires": { - "buffer-equal": "1.0.0" + "buffer-equal": "^1.0.0" } }, "argparse": { @@ -79,7 +79,7 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" } }, "arr-diff": { @@ -88,8 +88,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-flatten": { @@ -122,7 +122,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -143,7 +143,7 @@ "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "~2.1.0" } }, "assert-plus": { @@ -176,9 +176,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" }, "dependencies": { "chalk": { @@ -187,11 +187,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } } } @@ -208,7 +208,7 @@ "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "block-stream": { @@ -217,7 +217,7 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "boolbase": { @@ -232,7 +232,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -278,9 +278,9 @@ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "3.2.1", - "escape-string-regexp": "1.0.5", - "supports-color": "5.5.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" }, "dependencies": { "ansi-styles": { @@ -289,7 +289,7 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "color-convert": "1.9.3" + "color-convert": "^1.9.0" } }, "supports-color": { @@ -298,7 +298,7 @@ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } } } @@ -309,12 +309,12 @@ "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", "dev": true, "requires": { - "css-select": "1.2.0", - "dom-serializer": "0.1.0", - "entities": "1.1.2", - "htmlparser2": "3.10.0", - "lodash": "4.17.11", - "parse5": "3.0.3" + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" } }, "clone": { @@ -341,9 +341,9 @@ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", "dev": true, "requires": { - "inherits": "2.0.3", - "process-nextick-args": "2.0.0", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" }, "dependencies": { "readable-stream": { @@ -352,13 +352,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -367,7 +367,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -393,7 +393,7 @@ "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -414,7 +414,7 @@ "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.1" } }, "core-util-is": { @@ -429,10 +429,10 @@ "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { - "boolbase": "1.0.0", - "css-what": "2.1.2", + "boolbase": "~1.0.0", + "css-what": "2.1", "domutils": "1.5.1", - "nth-check": "1.0.2" + "nth-check": "~1.0.1" } }, "css-what": { @@ -447,7 +447,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "debug": { @@ -465,7 +465,7 @@ "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { - "is-obj": "1.0.1" + "is-obj": "^1.0.0" } }, "define-properties": { @@ -474,7 +474,7 @@ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "requires": { - "object-keys": "1.0.12" + "object-keys": "^1.0.12" } }, "delayed-stream": { @@ -501,8 +501,8 @@ "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.2" + "domelementtype": "~1.1.1", + "entities": "~1.1.1" }, "dependencies": { "domelementtype": { @@ -525,7 +525,7 @@ "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", "dev": true, "requires": { - "domelementtype": "1.3.1" + "domelementtype": "1" } }, "domutils": { @@ -534,8 +534,8 @@ "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.1" + "dom-serializer": "0", + "domelementtype": "1" } }, "duplexer": { @@ -550,10 +550,10 @@ "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", "dev": true, "requires": { - "end-of-stream": "1.4.1", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "stream-shift": "1.0.0" + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" }, "dependencies": { "readable-stream": { @@ -562,13 +562,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -577,7 +577,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -588,8 +588,8 @@ "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "requires": { - "jsbn": "0.1.1", - "safer-buffer": "2.1.2" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "end-of-stream": { @@ -598,7 +598,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.4.0" } }, "entities": { @@ -631,13 +631,13 @@ "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { - "duplexer": "0.1.1", - "from": "0.1.7", - "map-stream": "0.1.0", + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", "pause-stream": "0.0.11", - "split": "0.3.3", - "stream-combiner": "0.0.4", - "through": "2.3.8" + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" } }, "extend": { @@ -652,7 +652,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "extsprintf": { @@ -679,7 +679,7 @@ "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "dev": true, "requires": { - "pend": "1.2.0" + "pend": "~1.2.0" } }, "flush-write-stream": { @@ -688,8 +688,8 @@ "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" }, "dependencies": { "readable-stream": { @@ -698,13 +698,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -713,7 +713,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -730,9 +730,9 @@ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.7", - "mime-types": "2.1.21" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, "from": { @@ -747,8 +747,8 @@ "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", "dev": true, "requires": { - "graceful-fs": "4.1.15", - "through2": "2.0.5" + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" } }, "fs.realpath": { @@ -763,10 +763,10 @@ "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { - "graceful-fs": "4.1.15", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.2" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "function-bind": { @@ -781,7 +781,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "glob": { @@ -790,12 +790,12 @@ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "glob-parent": { @@ -804,8 +804,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" } }, "glob-stream": { @@ -814,16 +814,16 @@ "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { - "extend": "3.0.2", - "glob": "7.1.3", - "glob-parent": "3.1.0", - "is-negated-glob": "1.0.0", - "ordered-read-streams": "1.0.1", - "pumpify": "1.5.1", - "readable-stream": "2.3.6", - "remove-trailing-separator": "1.1.0", - "to-absolute-glob": "2.0.2", - "unique-stream": "2.2.1" + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" }, "dependencies": { "readable-stream": { @@ -832,13 +832,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -847,7 +847,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -870,9 +870,9 @@ "integrity": "sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw=", "dev": true, "requires": { - "deep-assign": "1.0.0", - "stat-mode": "0.2.2", - "through2": "2.0.5" + "deep-assign": "^1.0.0", + "stat-mode": "^0.2.0", + "through2": "^2.0.0" } }, "gulp-filter": { @@ -881,9 +881,9 @@ "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", "dev": true, "requires": { - "multimatch": "2.1.0", - "plugin-error": "0.1.2", - "streamfilter": "1.0.7" + "multimatch": "^2.0.0", + "plugin-error": "^0.1.2", + "streamfilter": "^1.0.5" } }, "gulp-gunzip": { @@ -892,8 +892,8 @@ "integrity": "sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak=", "dev": true, "requires": { - "through2": "0.6.5", - "vinyl": "0.4.6" + "through2": "~0.6.5", + "vinyl": "~0.4.6" }, "dependencies": { "isarray": { @@ -908,10 +908,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -926,8 +926,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } } } @@ -939,10 +939,10 @@ "dev": true, "requires": { "event-stream": "3.3.4", - "node.extend": "1.1.8", - "request": "2.88.0", - "through2": "2.0.5", - "vinyl": "2.2.0" + "node.extend": "^1.1.2", + "request": "^2.79.0", + "through2": "^2.0.3", + "vinyl": "^2.0.1" }, "dependencies": { "clone": { @@ -963,12 +963,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -979,11 +979,11 @@ "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", "dev": true, "requires": { - "event-stream": "3.3.4", - "streamifier": "0.1.1", - "tar": "2.2.1", - "through2": "2.0.5", - "vinyl": "1.2.0" + "event-stream": "~3.3.4", + "streamifier": "~0.1.1", + "tar": "^2.2.1", + "through2": "~2.0.3", + "vinyl": "^1.2.0" }, "dependencies": { "clone": { @@ -1004,8 +1004,8 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", + "clone": "^1.0.0", + "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } @@ -1018,12 +1018,12 @@ "dev": true, "requires": { "event-stream": "3.3.4", - "queue": "4.5.1", - "through2": "2.0.5", - "vinyl": "2.2.0", - "vinyl-fs": "3.0.3", - "yauzl": "2.10.0", - "yazl": "2.5.1" + "queue": "^4.2.1", + "through2": "^2.0.3", + "vinyl": "^2.0.2", + "vinyl-fs": "^3.0.3", + "yauzl": "^2.2.1", + "yazl": "^2.2.1" }, "dependencies": { "clone": { @@ -1044,12 +1044,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -1066,8 +1066,8 @@ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, "requires": { - "ajv": "6.6.2", - "har-schema": "2.0.0" + "ajv": "^6.5.5", + "har-schema": "^2.0.0" } }, "has": { @@ -1076,7 +1076,7 @@ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "function-bind": "1.1.1" + "function-bind": "^1.1.1" } }, "has-ansi": { @@ -1085,7 +1085,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "has-flag": { @@ -1112,12 +1112,12 @@ "integrity": "sha512-J1nEUGv+MkXS0weHNWVKJJ+UrLfePxRWpN3C9bEi9fLxL2+ggW94DQvgYVXsaT30PGwYRIZKNZXuyMhp3Di4bQ==", "dev": true, "requires": { - "domelementtype": "1.3.1", - "domhandler": "2.4.2", - "domutils": "1.5.1", - "entities": "1.1.2", - "inherits": "2.0.3", - "readable-stream": "3.1.0" + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.0.6" } }, "http-signature": { @@ -1126,9 +1126,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.15.2" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { @@ -1137,8 +1137,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -1159,8 +1159,8 @@ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { - "is-relative": "1.0.0", - "is-windows": "1.0.2" + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" } }, "is-buffer": { @@ -1181,7 +1181,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.0" } }, "is-negated-glob": { @@ -1202,7 +1202,7 @@ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { - "is-unc-path": "1.0.0" + "is-unc-path": "^1.0.0" } }, "is-typedarray": { @@ -1217,7 +1217,7 @@ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { - "unc-path-regex": "0.1.2" + "unc-path-regex": "^0.1.2" } }, "is-utf8": { @@ -1262,8 +1262,8 @@ "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "dev": true, "requires": { - "argparse": "1.0.10", - "esprima": "4.0.1" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "jsbn": { @@ -1290,7 +1290,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -1329,7 +1329,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.5" }, "dependencies": { "readable-stream": { @@ -1338,13 +1338,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -1353,7 +1353,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -1364,7 +1364,7 @@ "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "flush-write-stream": "1.0.3" + "flush-write-stream": "^1.0.2" } }, "linkify-it": { @@ -1373,7 +1373,7 @@ "integrity": "sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==", "dev": true, "requires": { - "uc.micro": "1.0.5" + "uc.micro": "^1.0.1" } }, "lodash": { @@ -1394,11 +1394,11 @@ "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", "dev": true, "requires": { - "argparse": "1.0.10", - "entities": "1.1.2", - "linkify-it": "2.1.0", - "mdurl": "1.0.1", - "uc.micro": "1.0.5" + "argparse": "^1.0.7", + "entities": "~1.1.1", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" } }, "mdurl": { @@ -1425,7 +1425,7 @@ "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "dev": true, "requires": { - "mime-db": "1.37.0" + "mime-db": "~1.37.0" } }, "minimatch": { @@ -1434,7 +1434,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -1488,12 +1488,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "has-flag": { @@ -1508,7 +1508,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } } } @@ -1525,10 +1525,10 @@ "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", "dev": true, "requires": { - "array-differ": "1.0.0", - "array-union": "1.0.2", - "arrify": "1.0.1", - "minimatch": "3.0.4" + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" } }, "mute-stream": { @@ -1543,8 +1543,8 @@ "integrity": "sha512-L/dvEBwyg3UowwqOUTyDsGBU6kjBQOpOhshio9V3i3BMPv5YUb9+mWNN8MK0IbWqT0AqaTSONZf0aTuMMahWgA==", "dev": true, "requires": { - "has": "1.0.3", - "is": "3.3.0" + "has": "^1.0.3", + "is": "^3.2.1" } }, "normalize-path": { @@ -1553,7 +1553,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "remove-trailing-separator": "^1.0.1" } }, "now-and-later": { @@ -1562,7 +1562,7 @@ "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.3.2" } }, "nth-check": { @@ -1571,7 +1571,7 @@ "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", "dev": true, "requires": { - "boolbase": "1.0.0" + "boolbase": "~1.0.0" } }, "oauth-sign": { @@ -1592,10 +1592,10 @@ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { - "define-properties": "1.1.3", - "function-bind": "1.1.1", - "has-symbols": "1.0.0", - "object-keys": "1.0.12" + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" } }, "once": { @@ -1604,7 +1604,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "ordered-read-streams": { @@ -1613,7 +1613,7 @@ "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.1" }, "dependencies": { "readable-stream": { @@ -1622,13 +1622,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -1637,7 +1637,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -1660,8 +1660,8 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "parse-semver": { @@ -1670,7 +1670,7 @@ "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { - "semver": "5.6.0" + "semver": "^5.1.0" } }, "parse5": { @@ -1679,7 +1679,7 @@ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", "dev": true, "requires": { - "@types/node": "8.10.38" + "@types/node": "*" } }, "path-dirname": { @@ -1706,7 +1706,7 @@ "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { - "through": "2.3.8" + "through": "~2.3" } }, "pend": { @@ -1727,11 +1727,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" } }, "prettier": { @@ -1758,8 +1758,8 @@ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", "dev": true, "requires": { - "end-of-stream": "1.4.1", - "once": "1.4.0" + "end-of-stream": "^1.1.0", + "once": "^1.3.1" } }, "pumpify": { @@ -1768,9 +1768,9 @@ "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", "dev": true, "requires": { - "duplexify": "3.6.1", - "inherits": "2.0.3", - "pump": "2.0.1" + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" } }, "punycode": { @@ -1803,7 +1803,7 @@ "integrity": "sha512-AMD7w5hRXcFSb8s9u38acBZ+309u6GsiibP4/0YacJeaurRshogB7v/ZcVPxP5gD5+zIw6ixRHdutiYUJfwKHw==", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "read": { @@ -1812,7 +1812,7 @@ "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { - "mute-stream": "0.0.7" + "mute-stream": "~0.0.4" } }, "readable-stream": { @@ -1821,9 +1821,9 @@ "integrity": "sha512-vpydAvIJvPODZNagCPuHG87O9JNPtvFEtjHHRVwNVsVVRBqemvPJkc2SYbxJsiZXawJdtZNmkmnsPuE3IgsG0A==", "dev": true, "requires": { - "inherits": "2.0.3", - "string_decoder": "1.2.0", - "util-deprecate": "1.0.2" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" } }, "remove-bom-buffer": { @@ -1832,8 +1832,8 @@ "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", "dev": true, "requires": { - "is-buffer": "1.1.6", - "is-utf8": "0.2.1" + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" } }, "remove-bom-stream": { @@ -1842,9 +1842,9 @@ "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "remove-bom-buffer": "3.0.0", - "safe-buffer": "5.1.2", - "through2": "2.0.5" + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" } }, "remove-trailing-separator": { @@ -1865,26 +1865,26 @@ "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.8.0", - "caseless": "0.12.0", - "combined-stream": "1.0.7", - "extend": "3.0.2", - "forever-agent": "0.6.1", - "form-data": "2.3.3", - "har-validator": "5.1.3", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.21", - "oauth-sign": "0.9.0", - "performance-now": "2.1.0", - "qs": "6.5.2", - "safe-buffer": "5.1.2", - "tough-cookie": "2.4.3", - "tunnel-agent": "0.6.0", - "uuid": "3.3.2" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "requires-port": { @@ -1899,7 +1899,7 @@ "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", "dev": true, "requires": { - "path-parse": "1.0.6" + "path-parse": "^1.0.6" } }, "resolve-options": { @@ -1908,7 +1908,7 @@ "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", "dev": true, "requires": { - "value-or-function": "3.0.0" + "value-or-function": "^3.0.0" } }, "rimraf": { @@ -1917,7 +1917,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.3" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -1949,8 +1949,8 @@ "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", "dev": true, "requires": { - "buffer-from": "1.1.1", - "source-map": "0.6.1" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, "split": { @@ -1959,7 +1959,7 @@ "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { - "through": "2.3.8" + "through": "2" } }, "sprintf-js": { @@ -1974,15 +1974,15 @@ "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", "dev": true, "requires": { - "asn1": "0.2.4", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.2", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.2", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "safer-buffer": "2.1.2", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, "stat-mode": { @@ -1997,7 +1997,7 @@ "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { - "duplexer": "0.1.1" + "duplexer": "~0.1.1" } }, "stream-shift": { @@ -2012,7 +2012,7 @@ "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.2" }, "dependencies": { "readable-stream": { @@ -2021,13 +2021,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -2036,7 +2036,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -2053,7 +2053,7 @@ "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { @@ -2062,7 +2062,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "supports-color": { @@ -2077,9 +2077,9 @@ "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "through": { @@ -2094,8 +2094,8 @@ "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, "requires": { - "readable-stream": "2.3.6", - "xtend": "4.0.1" + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" }, "dependencies": { "readable-stream": { @@ -2104,13 +2104,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -2119,7 +2119,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -2130,8 +2130,8 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "2.0.5", - "xtend": "4.0.1" + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "tmp": { @@ -2140,7 +2140,7 @@ "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.1" } }, "to-absolute-glob": { @@ -2149,8 +2149,8 @@ "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", "dev": true, "requires": { - "is-absolute": "1.0.0", - "is-negated-glob": "1.0.0" + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" } }, "to-through": { @@ -2159,7 +2159,7 @@ "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", "dev": true, "requires": { - "through2": "2.0.5" + "through2": "^2.0.3" } }, "tough-cookie": { @@ -2168,8 +2168,8 @@ "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { - "psl": "1.1.31", - "punycode": "1.4.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" }, "dependencies": { "punycode": { @@ -2192,18 +2192,18 @@ "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "builtin-modules": "1.1.1", - "chalk": "2.4.1", - "commander": "2.19.0", - "diff": "3.5.0", - "glob": "7.1.3", - "js-yaml": "3.12.0", - "minimatch": "3.0.4", - "resolve": "1.9.0", - "semver": "5.6.0", - "tslib": "1.9.3", - "tsutils": "2.29.0" + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" } }, "tslint-config-prettier": { @@ -2218,7 +2218,7 @@ "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { - "tslib": "1.9.3" + "tslib": "^1.8.1" } }, "tunnel": { @@ -2233,7 +2233,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -2290,8 +2290,8 @@ "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", "dev": true, "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" + "json-stable-stringify": "^1.0.0", + "through2-filter": "^2.0.0" } }, "uri-js": { @@ -2300,7 +2300,7 @@ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, "requires": { - "punycode": "2.1.1" + "punycode": "^2.1.0" } }, "url-join": { @@ -2315,8 +2315,8 @@ "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", "dev": true, "requires": { - "querystringify": "2.1.0", - "requires-port": "1.0.0" + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" } }, "util-deprecate": { @@ -2343,9 +2343,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "vinyl": { @@ -2354,8 +2354,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "0.2.0", - "clone-stats": "0.0.1" + "clone": "^0.2.0", + "clone-stats": "^0.0.1" } }, "vinyl-fs": { @@ -2364,23 +2364,23 @@ "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", "dev": true, "requires": { - "fs-mkdirp-stream": "1.0.0", - "glob-stream": "6.1.0", - "graceful-fs": "4.1.15", - "is-valid-glob": "1.0.0", - "lazystream": "1.0.0", - "lead": "1.0.0", - "object.assign": "4.1.0", - "pumpify": "1.5.1", - "readable-stream": "2.3.6", - "remove-bom-buffer": "3.0.0", - "remove-bom-stream": "1.2.0", - "resolve-options": "1.1.0", - "through2": "2.0.5", - "to-through": "2.0.0", - "value-or-function": "3.0.0", - "vinyl": "2.2.0", - "vinyl-sourcemap": "1.1.0" + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" }, "dependencies": { "clone": { @@ -2401,13 +2401,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -2416,7 +2416,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } }, "vinyl": { @@ -2425,12 +2425,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -2441,8 +2441,8 @@ "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", "dev": true, "requires": { - "through2": "2.0.5", - "vinyl": "0.4.6" + "through2": "^2.0.3", + "vinyl": "^0.4.3" } }, "vinyl-sourcemap": { @@ -2451,13 +2451,13 @@ "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", "dev": true, "requires": { - "append-buffer": "1.0.2", - "convert-source-map": "1.6.0", - "graceful-fs": "4.1.15", - "normalize-path": "2.1.1", - "now-and-later": "2.0.0", - "remove-bom-buffer": "3.0.0", - "vinyl": "2.2.0" + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" }, "dependencies": { "clone": { @@ -2478,12 +2478,12 @@ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" } } } @@ -2494,23 +2494,23 @@ "integrity": "sha512-yo7ctgQPK7hKnez/be3Tj7RG3eZzgkFhx/27y9guwzhMxHfjlU1pusAsFT8wBEZKZlYA5HNJAx8oClw4WDWi+A==", "dev": true, "requires": { - "cheerio": "1.0.0-rc.2", - "commander": "2.19.0", - "denodeify": "1.2.1", - "glob": "7.1.3", - "lodash": "4.17.11", - "markdown-it": "8.4.2", - "mime": "1.6.0", - "minimatch": "3.0.4", - "osenv": "0.1.5", - "parse-semver": "1.1.1", - "read": "1.0.7", - "semver": "5.6.0", + "cheerio": "^1.0.0-rc.1", + "commander": "^2.8.1", + "denodeify": "^1.2.1", + "glob": "^7.0.6", + "lodash": "^4.17.10", + "markdown-it": "^8.3.1", + "mime": "^1.3.4", + "minimatch": "^3.0.3", + "osenv": "^0.1.3", + "parse-semver": "^1.1.1", + "read": "^1.0.7", + "semver": "^5.1.0", "tmp": "0.0.29", - "url-join": "1.1.0", + "url-join": "^1.1.0", "vso-node-api": "6.1.2-preview", - "yauzl": "2.10.0", - "yazl": "2.5.1" + "yauzl": "^2.3.1", + "yazl": "^2.2.2" } }, "vscode": { @@ -2519,20 +2519,20 @@ "integrity": "sha512-z1Nf5J38gjUFbuDCbJHPN6OJ//5EG+e/yHlh6ERxj/U9B2Qc3aiHaFr38/fee/GGnxvRw/XegLMOG+UJwKi/Qg==", "dev": true, "requires": { - "glob": "7.1.3", - "gulp-chmod": "2.0.0", - "gulp-filter": "5.1.0", + "glob": "^7.1.2", + "gulp-chmod": "^2.0.0", + "gulp-filter": "^5.0.1", "gulp-gunzip": "1.0.0", - "gulp-remote-src-vscode": "0.5.1", - "gulp-untar": "0.0.7", - "gulp-vinyl-zip": "2.1.2", - "mocha": "4.1.0", - "request": "2.88.0", - "semver": "5.6.0", - "source-map-support": "0.5.9", - "url-parse": "1.4.4", - "vinyl-fs": "3.0.3", - "vinyl-source-stream": "1.1.2" + "gulp-remote-src-vscode": "^0.5.1", + "gulp-untar": "^0.0.7", + "gulp-vinyl-zip": "^2.1.2", + "mocha": "^4.0.1", + "request": "^2.88.0", + "semver": "^5.4.1", + "source-map-support": "^0.5.0", + "url-parse": "^1.4.3", + "vinyl-fs": "^3.0.3", + "vinyl-source-stream": "^1.1.0" } }, "vscode-jsonrpc": { @@ -2545,7 +2545,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", "requires": { - "semver": "5.6.0", + "semver": "^5.5.0", "vscode-languageserver-protocol": "3.14.1" } }, @@ -2554,7 +2554,7 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", "requires": { - "vscode-jsonrpc": "4.0.0", + "vscode-jsonrpc": "^4.0.0", "vscode-languageserver-types": "3.14.0" } }, @@ -2569,10 +2569,10 @@ "integrity": "sha1-qrNUbfJFHs2JTgcbuZtd8Zxfp48=", "dev": true, "requires": { - "q": "1.5.1", + "q": "^1.0.1", "tunnel": "0.0.4", - "typed-rest-client": "0.9.0", - "underscore": "1.9.1" + "typed-rest-client": "^0.9.0", + "underscore": "^1.8.3" } }, "wrappy": { @@ -2593,8 +2593,8 @@ "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "dev": true, "requires": { - "buffer-crc32": "0.2.13", - "fd-slicer": "1.1.0" + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" } }, "yazl": { @@ -2603,7 +2603,7 @@ "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", "dev": true, "requires": { - "buffer-crc32": "0.2.13" + "buffer-crc32": "~0.2.3" } } } diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e0db3c33..9b8f6351 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -214,4 +214,4 @@ } ] } -} \ No newline at end of file +} From 8b5b6226b52e9ee624b049da56639e81ce071aac Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sat, 5 Jan 2019 12:12:39 +0100 Subject: [PATCH 038/819] fix open of created or renamed file --- rust-analyzer/editors/code/src/commands/apply_source_change.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index 10dbf72c..d96ace97 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -26,7 +26,8 @@ export async function handle(change: SourceChange) { const toReveal = change.cursorPosition; await vscode.workspace.applyEdit(wsEdit); if (toOpen) { - const doc = await vscode.workspace.openTextDocument(toOpen); + const toOpenUri = vscode.Uri.parse(toOpen); + const doc = await vscode.workspace.openTextDocument(toOpenUri); await vscode.window.showTextDocument(doc); } else if (toReveal) { const uri = Server.client.protocol2CodeConverter.asUri( From a5a0cc38af2c59be2f51e90657c29bbd3a2757da Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Sat, 5 Jan 2019 17:28:41 +0200 Subject: [PATCH 039/819] Allow user to set path to ra_lsp_server in vscode settings --- rust-analyzer/editors/code/package.json | 7 +++++++ rust-analyzer/editors/code/src/config.ts | 5 +++++ rust-analyzer/editors/code/src/server.ts | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9b8f6351..c6340e6d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -132,6 +132,13 @@ "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "ra-lsp.raLspServerPath": { + "type": [ + "string" + ], + "default": "ra_lsp_server", + "description": "Path to ra_lsp_server executable" + }, "ra-lsp.trace.server": { "type": "string", "scope": "window", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 7d05ea07..cd0c6e6e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -4,6 +4,7 @@ import { Server } from './server'; export class Config { public highlightingOn = true; + public raLspServerPath = 'ra_lsp_server'; constructor() { vscode.workspace.onDidChangeConfiguration(_ => @@ -21,5 +22,9 @@ export class Config { if (!this.highlightingOn && Server) { Server.highlighter.removeHighlights(); } + + if (config.has('raLspServerPath')) { + this.raLspServerPath = config.get('raLspServerPath') as string; + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 75bdf320..35fb7e3f 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -12,7 +12,7 @@ export class Server { notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> ) { const run: lc.Executable = { - command: 'ra_lsp_server', + command: this.config.raLspServerPath, options: { cwd: '.' } }; const serverOptions: lc.ServerOptions = { From 7eb9713a2034ee1552cc931e37a4486d14405747 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Fri, 11 Jan 2019 15:16:55 -0500 Subject: [PATCH 040/819] Code lens support for running tests --- .../editors/code/src/commands/index.ts | 2 + .../editors/code/src/commands/run_single.ts | 63 +++++++++++++++++++ rust-analyzer/editors/code/src/extension.ts | 3 + 3 files changed, 68 insertions(+) create mode 100644 rust-analyzer/editors/code/src/commands/run_single.ts diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 33e2b34a..c8bb5559 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,6 +4,7 @@ import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; +import * as runSingle from './run_single'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; @@ -13,6 +14,7 @@ export { joinLines, matchingBrace, parentModule, + runSingle, runnables, syntaxTree, onEnter diff --git a/rust-analyzer/editors/code/src/commands/run_single.ts b/rust-analyzer/editors/code/src/commands/run_single.ts new file mode 100644 index 00000000..855bcdb0 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/run_single.ts @@ -0,0 +1,63 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; + +interface Runnable { + range: lc.Range; + label: string; + bin: string; + args: string[]; + env: { [index: string]: string }; +} + +interface CargoTaskDefinition extends vscode.TaskDefinition { + type: 'cargo'; + label: string; + command: string; + args: string[]; + env?: { [key: string]: string }; +} + +function createTask(spec: Runnable): vscode.Task { + const TASK_SOURCE = 'Rust'; + const definition: CargoTaskDefinition = { + type: 'cargo', + label: 'cargo', + command: spec.bin, + args: spec.args, + env: spec.env + }; + + const execOption: vscode.ShellExecutionOptions = { + cwd: '.', + env: definition.env + }; + const exec = new vscode.ShellExecution(definition.command, definition.args, execOption); + + const f = vscode.workspace.workspaceFolders![0]; + const t = new vscode.Task( + definition, + f, + definition.label, + TASK_SOURCE, + exec, + ['$rustc'] + ); + t.presentationOptions.clear = true + return t; +} + +export async function handle(runnable: Runnable) { + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId !== 'rust') { + return; + } + + const task = createTask(runnable); + task.group = vscode.TaskGroup.Build; + task.presentationOptions = { + reveal: vscode.TaskRevealKind.Always, + panel: vscode.TaskPanelKind.Dedicated, + }; + + return vscode.tasks.executeTask(task); +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 4acd54d9..acbb1f73 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -55,6 +55,9 @@ export function activate(context: vscode.ExtensionContext) { ); overrideCommand('type', commands.onEnter.handle); + // Unlike the above this does not send requests to the language server + registerCommand('ra-lsp.run-single', commands.runSingle.handle); + // Notifications are events triggered by the language server const allNotifications: Iterable< [string, lc.GenericNotificationHandler] From a15b1e0ac750cbc6faa3fc37bf5f8bcf3e2152e7 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sat, 12 Jan 2019 13:54:08 -0500 Subject: [PATCH 041/819] Move run_single into runnables --- .../editors/code/src/commands/index.ts | 2 - .../editors/code/src/commands/run_single.ts | 63 ------------------- .../editors/code/src/commands/runnables.ts | 16 +++++ rust-analyzer/editors/code/src/extension.ts | 2 +- 4 files changed, 17 insertions(+), 66 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/run_single.ts diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index c8bb5559..33e2b34a 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,7 +4,6 @@ import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; -import * as runSingle from './run_single'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; @@ -14,7 +13,6 @@ export { joinLines, matchingBrace, parentModule, - runSingle, runnables, syntaxTree, onEnter diff --git a/rust-analyzer/editors/code/src/commands/run_single.ts b/rust-analyzer/editors/code/src/commands/run_single.ts deleted file mode 100644 index 855bcdb0..00000000 --- a/rust-analyzer/editors/code/src/commands/run_single.ts +++ /dev/null @@ -1,63 +0,0 @@ -import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; - -interface Runnable { - range: lc.Range; - label: string; - bin: string; - args: string[]; - env: { [index: string]: string }; -} - -interface CargoTaskDefinition extends vscode.TaskDefinition { - type: 'cargo'; - label: string; - command: string; - args: string[]; - env?: { [key: string]: string }; -} - -function createTask(spec: Runnable): vscode.Task { - const TASK_SOURCE = 'Rust'; - const definition: CargoTaskDefinition = { - type: 'cargo', - label: 'cargo', - command: spec.bin, - args: spec.args, - env: spec.env - }; - - const execOption: vscode.ShellExecutionOptions = { - cwd: '.', - env: definition.env - }; - const exec = new vscode.ShellExecution(definition.command, definition.args, execOption); - - const f = vscode.workspace.workspaceFolders![0]; - const t = new vscode.Task( - definition, - f, - definition.label, - TASK_SOURCE, - exec, - ['$rustc'] - ); - t.presentationOptions.clear = true - return t; -} - -export async function handle(runnable: Runnable) { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - - const task = createTask(runnable); - task.group = vscode.TaskGroup.Build; - task.presentationOptions = { - reveal: vscode.TaskRevealKind.Always, - panel: vscode.TaskPanelKind.Dedicated, - }; - - return vscode.tasks.executeTask(task); -} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index be17c894..f9a4e2fc 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -103,3 +103,19 @@ export async function handle() { return await vscode.tasks.executeTask(task); } } + +export async function handleSingle(runnable: Runnable) { + const editor = vscode.window.activeTextEditor; + if (editor == null || editor.document.languageId !== 'rust') { + return; + } + + const task = createTask(runnable); + task.group = vscode.TaskGroup.Build; + task.presentationOptions = { + reveal: vscode.TaskRevealKind.Always, + panel: vscode.TaskPanelKind.Dedicated, + }; + + return vscode.tasks.executeTask(task); +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index acbb1f73..9edfb13b 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -56,7 +56,7 @@ export function activate(context: vscode.ExtensionContext) { overrideCommand('type', commands.onEnter.handle); // Unlike the above this does not send requests to the language server - registerCommand('ra-lsp.run-single', commands.runSingle.handle); + registerCommand('ra-lsp.run-single', commands.runnables.handleSingle); // Notifications are events triggered by the language server const allNotifications: Iterable< From 205d8d8b0e4e79eb460e6b45f8682d6f2b8e4088 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sat, 12 Jan 2019 18:49:07 -0500 Subject: [PATCH 042/819] npm fix run --- .../code/src/commands/apply_source_change.ts | 4 +++- .../editors/code/src/commands/on_enter.ts | 1 - .../editors/code/src/commands/runnables.ts | 14 +++++++++----- rust-analyzer/editors/code/src/extension.ts | 6 ++++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index d96ace97..675a534c 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -10,7 +10,9 @@ export interface SourceChange { } export async function handle(change: SourceChange) { - const wsEdit = Server.client.protocol2CodeConverter.asWorkspaceEdit(change.workspaceEdit); + const wsEdit = Server.client.protocol2CodeConverter.asWorkspaceEdit( + change.workspaceEdit + ); let created; let moved; if (change.workspaceEdit.documentChanges) { diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 64401b68..bb376e3c 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -6,7 +6,6 @@ import { SourceChange } from './apply_source_change'; - export async function handle(event: { text: string }): Promise { const editor = vscode.window.activeTextEditor; if ( diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index f9a4e2fc..aa5817c2 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -48,7 +48,11 @@ function createTask(spec: Runnable): vscode.Task { cwd: '.', env: definition.env }; - const exec = new vscode.ShellExecution(definition.command, definition.args, execOption); + const exec = new vscode.ShellExecution( + definition.command, + definition.args, + execOption + ); const f = vscode.workspace.workspaceFolders![0]; const t = new vscode.Task( @@ -59,7 +63,7 @@ function createTask(spec: Runnable): vscode.Task { exec, ['$rustc'] ); - t.presentationOptions.clear = true + t.presentationOptions.clear = true; return t; } @@ -114,8 +118,8 @@ export async function handleSingle(runnable: Runnable) { task.group = vscode.TaskGroup.Build; task.presentationOptions = { reveal: vscode.TaskRevealKind.Always, - panel: vscode.TaskPanelKind.Dedicated, + panel: vscode.TaskPanelKind.Dedicated }; - + return vscode.tasks.executeTask(task); -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 9edfb13b..0098c945 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -37,8 +37,10 @@ export function activate(context: vscode.ExtensionContext) { return await original(...args); } }); - } catch(_) { - vscode.window.showWarningMessage('Enhanced typing feature is disabled because of incompatibility with VIM extension'); + } catch (_) { + vscode.window.showWarningMessage( + 'Enhanced typing feature is disabled because of incompatibility with VIM extension' + ); } } From 01728c77a7334c5c3456bd18f1d278c8aeb45b56 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jan 2019 21:43:13 +0300 Subject: [PATCH 043/819] :arrow_up: npm --- rust-analyzer/editors/code/package-lock.json | 132 +++++++++---------- rust-analyzer/editors/code/package.json | 6 +- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 0bbd85b8..86313d4c 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -11,9 +11,9 @@ "dev": true }, "@types/node": { - "version": "8.10.38", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.38.tgz", - "integrity": "sha512-EibsnbJerd0hBFaDjJStFrVbVBAtOy4dgL8zZFw0uOvPqzBAX59Ci8cgjg3+RgJIWhsB5A4c+pi+D4P9tQQh/A==", + "version": "8.10.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.39.tgz", + "integrity": "sha512-rE7fktr02J8ybFf6eysife+WF+L4sAHWzw09DgdCebEu+qDwMvv4zl6Bc+825ttGZP73kCKxa3dhJOoGJ8+5mA==", "dev": true }, "ajv": { @@ -183,7 +183,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -273,9 +273,9 @@ "dev": true }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -348,7 +348,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -363,7 +363,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -425,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -461,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -507,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -540,7 +540,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -558,7 +558,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -573,7 +573,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -627,7 +627,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -694,7 +694,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -709,7 +709,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -828,7 +828,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -843,7 +843,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -904,7 +904,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -916,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1192,7 +1192,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -1257,9 +1257,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -1319,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1334,7 +1334,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1349,7 +1349,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1384,7 +1384,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -1439,13 +1439,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1532,9 +1532,9 @@ } }, "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, "node.extend": { @@ -1618,7 +1618,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1644,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1666,7 +1666,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1690,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1702,7 +1702,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -1816,9 +1816,9 @@ } }, "readable-stream": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.0.tgz", - "integrity": "sha512-vpydAvIJvPODZNagCPuHG87O9JNPtvFEtjHHRVwNVsVVRBqemvPJkc2SYbxJsiZXawJdtZNmkmnsPuE3IgsG0A==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz", + "integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -1955,7 +1955,7 @@ }, "split": { "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -1964,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1993,7 +1993,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -2017,7 +2017,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2032,7 +2032,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2058,7 +2058,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -2073,7 +2073,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2084,7 +2084,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2100,7 +2100,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2115,7 +2115,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2187,9 +2187,9 @@ "dev": true }, "tslint": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", - "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", + "version": "5.12.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.1.tgz", + "integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -2223,7 +2223,7 @@ }, "tunnel": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, @@ -2254,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2397,7 +2397,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2412,7 +2412,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2489,9 +2489,9 @@ } }, "vsce": { - "version": "1.53.2", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.53.2.tgz", - "integrity": "sha512-yo7ctgQPK7hKnez/be3Tj7RG3eZzgkFhx/27y9guwzhMxHfjlU1pusAsFT8wBEZKZlYA5HNJAx8oClw4WDWi+A==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.54.0.tgz", + "integrity": "sha512-E0Cnz50JK/TzUzTxDQ9oj3/Ichot1qmyin/8yHrH2BrQiXWUTX/FbuzMKFf1gTkNr6VvI3HbEf4VxSP/IASFIg==", "dev": true, "requires": { "cheerio": "^1.0.0-rc.1", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c6340e6d..026ef684 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -35,12 +35,12 @@ }, "devDependencies": { "@types/mocha": "^2.2.42", - "@types/node": "^8.10.38", + "@types/node": "^8.10.39", "prettier": "^1.15.3", - "tslint": "^5.11.0", + "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "typescript": "^2.6.1", - "vsce": "^1.53.2", + "vsce": "^1.54.0", "vscode": "^1.1.26" }, "activationEvents": [ From 885b61f27a96263894e6509906712ac2c2b31ad5 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Mon, 14 Jan 2019 20:56:14 +0100 Subject: [PATCH 044/819] Fix type inference for raw (byte) strings --- rust-analyzer/editors/code/package-lock.json | 90 ++++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 86313d4c..a36fb2f1 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -183,7 +183,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -348,7 +348,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -363,7 +363,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -425,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -461,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -507,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -540,7 +540,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -558,7 +558,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -573,7 +573,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -627,7 +627,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -694,7 +694,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -709,7 +709,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -828,7 +828,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -843,7 +843,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -904,7 +904,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -916,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1192,7 +1192,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -1319,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1334,7 +1334,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1349,7 +1349,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1384,7 +1384,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -1439,13 +1439,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1618,7 +1618,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1644,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1666,7 +1666,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1690,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1702,7 +1702,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -1955,7 +1955,7 @@ }, "split": { "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -1964,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1993,7 +1993,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -2017,7 +2017,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2032,7 +2032,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2058,7 +2058,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -2073,7 +2073,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2084,7 +2084,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2100,7 +2100,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2115,7 +2115,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2223,7 +2223,7 @@ }, "tunnel": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, @@ -2254,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2397,7 +2397,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2412,7 +2412,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { From dc5f3bb860b2db28028d56f05c276b5241b53661 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Mon, 14 Jan 2019 21:52:08 +0100 Subject: [PATCH 045/819] Address issues found in review --- rust-analyzer/editors/code/package-lock.json | 90 ++++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index a36fb2f1..86313d4c 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -183,7 +183,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -348,7 +348,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -363,7 +363,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -425,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -461,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -507,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -540,7 +540,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -558,7 +558,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -573,7 +573,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -627,7 +627,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -694,7 +694,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -709,7 +709,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -828,7 +828,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -843,7 +843,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -904,7 +904,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -916,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1192,7 +1192,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -1319,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1334,7 +1334,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1349,7 +1349,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1384,7 +1384,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -1439,13 +1439,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1618,7 +1618,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1644,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1666,7 +1666,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1690,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1702,7 +1702,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -1955,7 +1955,7 @@ }, "split": { "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -1964,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1993,7 +1993,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -2017,7 +2017,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2032,7 +2032,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2058,7 +2058,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -2073,7 +2073,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2084,7 +2084,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2100,7 +2100,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2115,7 +2115,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2223,7 +2223,7 @@ }, "tunnel": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, @@ -2254,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2397,7 +2397,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2412,7 +2412,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { From ba2ddcfbde42c1f7bc5624c872900c016e1516cb Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Mon, 14 Jan 2019 17:24:49 -0500 Subject: [PATCH 046/819] Reveal the newly added source change in the editor. --- rust-analyzer/editors/code/src/commands/apply_source_change.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index 675a534c..389061e3 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -46,5 +46,6 @@ export async function handle(change: SourceChange) { return; } editor.selection = new vscode.Selection(position, position); + editor.revealRange(new vscode.Range(position, position), vscode.TextEditorRevealType.Default); } } From 2851690b274b6c8cd990f637b7a55e5b764e1090 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 15 Jan 2019 11:15:39 -0500 Subject: [PATCH 047/819] Fail Travis on Prettier formatting issue --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 026ef684..9433bd3d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -24,7 +24,7 @@ "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", "prettier": "prettier **/*.{json,ts}", - "travis": "npm run compile && npm run lint && npm run prettier --list-different" + "travis": "npm run compile && npm run lint && npm run prettier -- --list-different" }, "prettier": { "tabWidth": 4, From d48bf080b81006711f7e1235208953d778d41849 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 15 Jan 2019 11:15:51 -0500 Subject: [PATCH 048/819] Prettier fix --- .../editors/code/src/commands/apply_source_change.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index 389061e3..dcd074b8 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -46,6 +46,9 @@ export async function handle(change: SourceChange) { return; } editor.selection = new vscode.Selection(position, position); - editor.revealRange(new vscode.Range(position, position), vscode.TextEditorRevealType.Default); + editor.revealRange( + new vscode.Range(position, position), + vscode.TextEditorRevealType.Default + ); } } From fde04570309a0dca6fc38b4d02f129901241501a Mon Sep 17 00:00:00 2001 From: Andrew Ross Date: Fri, 18 Jan 2019 12:59:08 +0200 Subject: [PATCH 049/819] Config for raLspServerPath will be overwritten if __RA_LSP_SERVER_DEBUG is set Changed presentation from clear to reveal silent Removed the vscode gitignore entry Added debugging documentation Added tasks and launch configs --- rust-analyzer/editors/code/src/config.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index cd0c6e6e..cc7a10f7 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -2,9 +2,11 @@ import * as vscode from 'vscode'; import { Server } from './server'; +const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; + export class Config { public highlightingOn = true; - public raLspServerPath = 'ra_lsp_server'; + public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; constructor() { vscode.workspace.onDidChangeConfiguration(_ => @@ -24,7 +26,8 @@ export class Config { } if (config.has('raLspServerPath')) { - this.raLspServerPath = config.get('raLspServerPath') as string; + this.raLspServerPath = + RA_LSP_DEBUG || (config.get('raLspServerPath') as string); } } } From 5640abd1fca1833e42fd95773edfe6b8a4412a35 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Tue, 15 Jan 2019 15:24:04 +0100 Subject: [PATCH 050/819] Add additional pattern variants --- rust-analyzer/editors/code/package-lock.json | 90 ++++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 86313d4c..a36fb2f1 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -183,7 +183,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -348,7 +348,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -363,7 +363,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -425,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -461,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -507,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -540,7 +540,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -558,7 +558,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -573,7 +573,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -627,7 +627,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -694,7 +694,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -709,7 +709,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -828,7 +828,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -843,7 +843,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -904,7 +904,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -916,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1192,7 +1192,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -1319,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1334,7 +1334,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1349,7 +1349,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1384,7 +1384,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -1439,13 +1439,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1618,7 +1618,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1644,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1666,7 +1666,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1690,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1702,7 +1702,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -1955,7 +1955,7 @@ }, "split": { "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -1964,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1993,7 +1993,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -2017,7 +2017,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2032,7 +2032,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2058,7 +2058,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -2073,7 +2073,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2084,7 +2084,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2100,7 +2100,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2115,7 +2115,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2223,7 +2223,7 @@ }, "tunnel": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, @@ -2254,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2397,7 +2397,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2412,7 +2412,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { From 07e216c15426ec22a8a88aa1a8b3c14c891861a3 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Fri, 18 Jan 2019 00:41:02 +0100 Subject: [PATCH 051/819] Address issues flagged in review --- rust-analyzer/editors/code/package-lock.json | 90 ++++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index a36fb2f1..86313d4c 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -183,7 +183,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -348,7 +348,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -363,7 +363,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -425,7 +425,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "dev": true, "requires": { @@ -461,7 +461,7 @@ }, "deep-assign": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", "dev": true, "requires": { @@ -507,7 +507,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -540,7 +540,7 @@ }, "duplexer": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "dev": true }, @@ -558,7 +558,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -573,7 +573,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -627,7 +627,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { @@ -694,7 +694,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -709,7 +709,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -828,7 +828,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -843,7 +843,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -904,7 +904,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -916,13 +916,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -1192,7 +1192,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -1319,7 +1319,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -1334,7 +1334,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1349,7 +1349,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1384,7 +1384,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -1439,13 +1439,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1618,7 +1618,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1633,7 +1633,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -1644,13 +1644,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1666,7 +1666,7 @@ }, "parse-semver": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", "dev": true, "requires": { @@ -1690,7 +1690,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1702,7 +1702,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -1955,7 +1955,7 @@ }, "split": { "version": "0.3.3", - "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", "dev": true, "requires": { @@ -1964,7 +1964,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -1993,7 +1993,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -2017,7 +2017,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2032,7 +2032,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2058,7 +2058,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -2073,7 +2073,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -2084,7 +2084,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2100,7 +2100,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2115,7 +2115,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2223,7 +2223,7 @@ }, "tunnel": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, @@ -2254,7 +2254,7 @@ "dependencies": { "underscore": { "version": "1.8.3", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true } @@ -2397,7 +2397,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -2412,7 +2412,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { From f919d595b16e7a4db17c9e2777c56fa425a992c3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 00:15:03 +0300 Subject: [PATCH 052/819] ad status command --- rust-analyzer/editors/code/package.json | 4 ++++ .../editors/code/src/commands/analyzer_status.ts | 12 ++++++++++++ rust-analyzer/editors/code/src/commands/index.ts | 2 ++ rust-analyzer/editors/code/src/extension.ts | 1 + 4 files changed, 19 insertions(+) create mode 100644 rust-analyzer/editors/code/src/commands/analyzer_status.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9433bd3d..3e07032c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -94,6 +94,10 @@ { "command": "ra-lsp.run", "title": "Rust Run" + }, + { + "command": "ra-lsp.analyzerStatus", + "title": "Status of rust-analyzer (debug)" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts new file mode 100644 index 00000000..5c56b9c4 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -0,0 +1,12 @@ +import * as vscode from 'vscode'; +import { Server } from '../server'; + +// Shows status of rust-analyzer (for debugging) +export async function handle() { + const status = await Server.client.sendRequest( + 'ra/analyzerStatus', + null + ); + const doc = await vscode.workspace.openTextDocument({ content: status }); + await vscode.window.showTextDocument(doc, vscode.ViewColumn.Two); +} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 33e2b34a..f36c4b04 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,3 +1,4 @@ +import * as analyzerStatus from './analyzer_status'; import * as applySourceChange from './apply_source_change'; import * as extendSelection from './extend_selection'; import * as joinLines from './join_lines'; @@ -8,6 +9,7 @@ import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; export { + analyzerStatus, applySourceChange, extendSelection, joinLines, diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 0098c945..288a852a 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -45,6 +45,7 @@ export function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server + registerCommand('ra-lsp.analyzerStatus', commands.analyzerStatus.handle); registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); From 0a90cfc2b18bb77266493e339ba23e7b5f2f81f3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 16:10:34 +0300 Subject: [PATCH 053/819] better stats --- .../code/src/commands/analyzer_status.ts | 61 +++++++++++++++++-- rust-analyzer/editors/code/src/extension.ts | 5 +- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 5c56b9c4..bb46a199 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,12 +1,61 @@ import * as vscode from 'vscode'; import { Server } from '../server'; +const statusUri = vscode.Uri.parse('ra-lsp-status://status'); + +export class TextDocumentContentProvider + implements vscode.TextDocumentContentProvider { + public eventEmitter = new vscode.EventEmitter(); + public syntaxTree: string = 'Not available'; + + public provideTextDocumentContent( + uri: vscode.Uri + ): vscode.ProviderResult { + const editor = vscode.window.activeTextEditor; + if (editor == null) { + return ''; + } + return Server.client.sendRequest('ra/analyzerStatus', null); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } +} + +let poller: NodeJS.Timer | null = null; + // Shows status of rust-analyzer (for debugging) -export async function handle() { - const status = await Server.client.sendRequest( - 'ra/analyzerStatus', - null + +export function makeCommand(context: vscode.ExtensionContext) { + const textDocumentContentProvider = new TextDocumentContentProvider(); + context.subscriptions.push( + vscode.workspace.registerTextDocumentContentProvider( + 'ra-lsp-status', + textDocumentContentProvider + ) ); - const doc = await vscode.workspace.openTextDocument({ content: status }); - await vscode.window.showTextDocument(doc, vscode.ViewColumn.Two); + + context.subscriptions.push({ + dispose() { + if (poller != null) { + clearInterval(poller); + } + } + }); + + return async function handle() { + if (poller == null) { + poller = setInterval( + () => textDocumentContentProvider.eventEmitter.fire(statusUri), + 1000 + ); + } + const document = await vscode.workspace.openTextDocument(statusUri); + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true + ); + }; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 288a852a..3af95c59 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -45,7 +45,10 @@ export function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand('ra-lsp.analyzerStatus', commands.analyzerStatus.handle); + registerCommand( + 'ra-lsp.analyzerStatus', + commands.analyzerStatus.makeCommand(context) + ); registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); From 5aa70003c36c60253927094f8a4b0f51ebc2b9ed Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 19:11:58 +0300 Subject: [PATCH 054/819] add gc request --- rust-analyzer/editors/code/package.json | 4 ++++ rust-analyzer/editors/code/src/extension.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3e07032c..86683eb7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -98,6 +98,10 @@ { "command": "ra-lsp.analyzerStatus", "title": "Status of rust-analyzer (debug)" + }, + { + "command": "ra-lsp.collectGarbage", + "title": "Run rust-analyzer's GC" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 3af95c59..dc7b0140 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -49,6 +49,9 @@ export function activate(context: vscode.ExtensionContext) { 'ra-lsp.analyzerStatus', commands.analyzerStatus.makeCommand(context) ); + registerCommand('ra-lsp.collectGarbage', () => + Server.client.sendRequest('ra/collectGarbage', null) + ); registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); From 7f78c241b8ae65d0ecc010bb177ea5acb6c9dfa0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 28 Jan 2019 14:43:07 +0300 Subject: [PATCH 055/819] align command naming --- rust-analyzer/editors/code/package.json | 50 +++++++++---------- .../code/src/commands/analyzer_status.ts | 9 ++-- .../code/src/commands/extend_selection.ts | 2 +- .../editors/code/src/commands/join_lines.ts | 2 +- .../code/src/commands/matching_brace.ts | 2 +- .../editors/code/src/commands/on_enter.ts | 2 +- .../code/src/commands/parent_module.ts | 2 +- .../editors/code/src/commands/runnables.ts | 2 +- .../editors/code/src/commands/syntaxTree.ts | 4 +- rust-analyzer/editors/code/src/config.ts | 2 +- .../src/events/change_active_text_editor.ts | 2 +- rust-analyzer/editors/code/src/extension.ts | 40 +++++++++------ rust-analyzer/editors/code/src/server.ts | 8 ++- 13 files changed, 72 insertions(+), 55 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 86683eb7..05c67d82 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -72,61 +72,61 @@ ], "commands": [ { - "command": "ra-lsp.syntaxTree", - "title": "Show Rust syntax tree" + "command": "rust-analyzer.syntaxTree", + "title": "rust-analyzer: syntax tree" }, { - "command": "ra-lsp.extendSelection", - "title": "Rust Extend Selection" + "command": "rust-analyzer.extendSelection", + "title": "rust-analyzer: extend selection" }, { - "command": "ra-lsp.matchingBrace", - "title": "Rust Matching Brace" + "command": "rust-analyzer.matchingBrace", + "title": "rust-analyzer: matching brace" }, { - "command": "ra-lsp.parentModule", - "title": "Rust Parent Module" + "command": "rust-analyzer.parentModule", + "title": "rust-analyzer: parent module" }, { - "command": "ra-lsp.joinLines", - "title": "Rust Join Lines" + "command": "rust-analyzer.joinLines", + "title": "rust-analyzer: join lines" }, { - "command": "ra-lsp.run", - "title": "Rust Run" + "command": "rust-analyzer.run", + "title": "rust-analyzer: run" }, { - "command": "ra-lsp.analyzerStatus", - "title": "Status of rust-analyzer (debug)" + "command": "rust-analyzer.analyzerStatus", + "title": "rust-analyzer: status" }, { - "command": "ra-lsp.collectGarbage", - "title": "Run rust-analyzer's GC" + "command": "rust-analyzer.collectGarbage", + "title": "rust-analyzer: run gc" } ], "keybindings": [ { - "command": "ra-lsp.parentModule", + "command": "rust-analyzer.parentModule", "key": "ctrl+u", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.matchingBrace", + "command": "rust-analyzer.matchingBrace", "key": "ctrl+shift+m", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.extendSelection", + "command": "rust-analyzer.extendSelection", "key": "shift+alt+right", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.joinLines", + "command": "rust-analyzer.joinLines", "key": "ctrl+shift+j", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.run", + "command": "rust-analyzer.run", "key": "ctrl+r", "when": "editorTextFocus && editorLangId == rust" } @@ -135,19 +135,19 @@ "type": "object", "title": "Rust Analyzer", "properties": { - "ra-lsp.highlightingOn": { + "rust-analyzer.highlightingOn": { "type": "boolean", "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, - "ra-lsp.raLspServerPath": { + "rust-analyzer.raLspServerPath": { "type": [ "string" ], "default": "ra_lsp_server", "description": "Path to ra_lsp_server executable" }, - "ra-lsp.trace.server": { + "rust-analyzer.trace.server": { "type": "string", "scope": "window", "enum": [ @@ -156,7 +156,7 @@ "verbose" ], "default": "off", - "description": "Trace requests to the ra-lsp server" + "description": "Trace requests to the ra_lsp_server" } } }, diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index bb46a199..63f82c92 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import { Server } from '../server'; -const statusUri = vscode.Uri.parse('ra-lsp-status://status'); +const statusUri = vscode.Uri.parse('rust-analyzer-status://status'); export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { @@ -15,7 +15,10 @@ export class TextDocumentContentProvider if (editor == null) { return ''; } - return Server.client.sendRequest('ra/analyzerStatus', null); + return Server.client.sendRequest( + 'rust-analyzer/analyzerStatus', + null + ); } get onDidChange(): vscode.Event { @@ -31,7 +34,7 @@ export function makeCommand(context: vscode.ExtensionContext) { const textDocumentContentProvider = new TextDocumentContentProvider(); context.subscriptions.push( vscode.workspace.registerTextDocumentContentProvider( - 'ra-lsp-status', + 'rust-analyzer-status', textDocumentContentProvider ) ); diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts index 7b96bbc3..6f4187d1 100644 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ b/rust-analyzer/editors/code/src/commands/extend_selection.ts @@ -24,7 +24,7 @@ export async function handle() { textDocument: { uri: editor.document.uri.toString() } }; const response = await Server.client.sendRequest( - 'm/extendSelection', + 'rust-analyzer/extendSelection', request ); editor.selections = response.selections.map((range: Range) => { diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 27d263b8..0d4b12f4 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -22,7 +22,7 @@ export async function handle() { textDocument: { uri: editor.document.uri.toString() } }; const change = await Server.client.sendRequest( - 'm/joinLines', + 'rust-analyzer/joinLines', request ); await applySourceChange(change); diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 5e6638e8..d86faf40 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -20,7 +20,7 @@ export async function handle() { }) }; const response = await Server.client.sendRequest( - 'm/findMatchingBrace', + 'rust-analyzer/findMatchingBrace', request ); editor.selections = editor.selections.map((sel, idx) => { diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index bb376e3c..16dcb70c 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -22,7 +22,7 @@ export async function handle(event: { text: string }): Promise { ) }; const change = await Server.client.sendRequest( - 'm/onEnter', + 'rust-analyzer/onEnter', request ); if (!change) { diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 806c3d34..9d30b7b5 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -15,7 +15,7 @@ export async function handle() { ) }; const response = await Server.client.sendRequest( - 'm/parentModule', + 'rust-analyzer/parentModule', request ); const loc = response[0]; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index aa5817c2..d9ae5642 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -83,7 +83,7 @@ export async function handle() { ) }; const runnables = await Server.client.sendRequest( - 'm/runnables', + 'rust-analyzer/runnables', params ); const items: RunnableQuickPick[] = []; diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index 5d5cdd7a..c0baf08c 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -3,7 +3,7 @@ import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); +export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree'); export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { @@ -21,7 +21,7 @@ export class TextDocumentContentProvider textDocument: { uri: editor.document.uri.toString() } }; return Server.client.sendRequest( - 'm/syntaxTree', + 'rust-analyzer/syntaxTree', request ); } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index cc7a10f7..d26f5df0 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -16,7 +16,7 @@ export class Config { } public userConfigChanged() { - const config = vscode.workspace.getConfiguration('ra-lsp'); + const config = vscode.workspace.getConfiguration('rust-analyzer'); if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; } diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index 0b7ceb65..af295b2e 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -16,7 +16,7 @@ export async function handle(editor: TextEditor | undefined) { uri: editor.document.uri.toString() }; const decorations = await Server.client.sendRequest( - 'm/decorationsRequest', + 'rust-analyzer/decorationsRequest', params ); Server.highlighter.setHighlights(editor, decorations); diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index dc7b0140..0b2a6095 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -46,31 +46,41 @@ export function activate(context: vscode.ExtensionContext) { // Commands are requests from vscode to the language server registerCommand( - 'ra-lsp.analyzerStatus', + 'rust-analyzer.analyzerStatus', commands.analyzerStatus.makeCommand(context) ); - registerCommand('ra-lsp.collectGarbage', () => - Server.client.sendRequest('ra/collectGarbage', null) + registerCommand('rust-analyzer.collectGarbage', () => + Server.client.sendRequest('rust-analyzer/collectGarbage', null) ); - registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); - registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); - registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); - registerCommand('ra-lsp.joinLines', commands.joinLines.handle); - registerCommand('ra-lsp.parentModule', commands.parentModule.handle); - registerCommand('ra-lsp.run', commands.runnables.handle); + registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle); registerCommand( - 'ra-lsp.applySourceChange', + 'rust-analyzer.extendSelection', + commands.extendSelection.handle + ); + registerCommand( + 'rust-analyzer.matchingBrace', + commands.matchingBrace.handle + ); + registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); + registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); + registerCommand('rust-analyzer.run', commands.runnables.handle); + // Unlike the above this does not send requests to the language server + registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); + registerCommand( + 'rust-analyzer.applySourceChange', commands.applySourceChange.handle ); overrideCommand('type', commands.onEnter.handle); - // Unlike the above this does not send requests to the language server - registerCommand('ra-lsp.run-single', commands.runnables.handleSingle); - // Notifications are events triggered by the language server const allNotifications: Iterable< [string, lc.GenericNotificationHandler] - > = [['m/publishDecorations', notifications.publishDecorations.handle]]; + > = [ + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( @@ -80,7 +90,7 @@ export function activate(context: vscode.ExtensionContext) { const textDocumentContentProvider = new TextDocumentContentProvider(); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( - 'ra-lsp', + 'rust-analyzer', textDocumentContentProvider ) ); diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 35fb7e3f..0d263270 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -42,8 +42,12 @@ export class Server { log: (messageOrDataObject: string | any, data?: string) => { if (typeof messageOrDataObject === 'string') { if ( - messageOrDataObject.includes('m/publishDecorations') || - messageOrDataObject.includes('m/decorationsRequest') + messageOrDataObject.includes( + 'rust-analyzer/publishDecorations' + ) || + messageOrDataObject.includes( + 'rust-analyzer/decorationsRequest' + ) ) { // Don't log publish decorations requests } else { From 1e2faa8eeed6366a9165a6c91b658b2c6a5a13d7 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 29 Jan 2019 17:08:02 +0000 Subject: [PATCH 056/819] Start the extension when rust-analyzer status is run --- rust-analyzer/editors/code/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 05c67d82..506137d1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -44,7 +44,9 @@ "vscode": "^1.1.26" }, "activationEvents": [ - "onLanguage:rust" + "onLanguage:rust", + "onCommand:rust-analyzer.analyzerStatus", + "onCommand:rust-analyzer.collectGarbage" ], "main": "./out/extension", "contributes": { From 7f45e7116906dc0463e1ef789ec9ed335f4ddbec Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 29 Jan 2019 17:16:14 +0000 Subject: [PATCH 057/819] Add category to the commands --- rust-analyzer/editors/code/package.json | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 506137d1..1ed834d6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -75,35 +75,43 @@ "commands": [ { "command": "rust-analyzer.syntaxTree", - "title": "rust-analyzer: syntax tree" + "title": "Show syntax tree for current file", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.extendSelection", - "title": "rust-analyzer: extend selection" + "title": "Extend selection", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.matchingBrace", - "title": "rust-analyzer: matching brace" + "title": "Find matching brace", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.parentModule", - "title": "rust-analyzer: parent module" + "title": "Locate parent module", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.joinLines", - "title": "rust-analyzer: join lines" + "title": "Join lines", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.run", - "title": "rust-analyzer: run" + "title": "Run", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.analyzerStatus", - "title": "rust-analyzer: status" + "title": "Status", + "category": "Rust Analyzer" }, { "command": "rust-analyzer.collectGarbage", - "title": "rust-analyzer: run gc" + "title": "Run garbage collection", + "category": "Rust Analyzer" } ], "keybindings": [ From b3534e14135249b2dbf095c84ffc001151b8a2fc Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 30 Jan 2019 13:46:31 -0500 Subject: [PATCH 058/819] Clear the console when running single tasks --- rust-analyzer/editors/code/src/commands/runnables.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index d9ae5642..c0f2ada7 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -118,7 +118,8 @@ export async function handleSingle(runnable: Runnable) { task.group = vscode.TaskGroup.Build; task.presentationOptions = { reveal: vscode.TaskRevealKind.Always, - panel: vscode.TaskPanelKind.Dedicated + panel: vscode.TaskPanelKind.Dedicated, + clear: true }; return vscode.tasks.executeTask(task); From 37cef502810d7f7d0edf7a351c3ce0311c46d7f4 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Fri, 1 Feb 2019 08:44:23 -0500 Subject: [PATCH 059/819] Implement lens for impls and support resolving lenses. --- rust-analyzer/editors/code/src/extension.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 0b2a6095..a0be7020 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -70,6 +70,18 @@ export function activate(context: vscode.ExtensionContext) { 'rust-analyzer.applySourceChange', commands.applySourceChange.handle ); + registerCommand( + 'rust-analyzer.showReferences', + (uri: string, position: lc.Position, locations: lc.Location[]) => { + vscode.commands.executeCommand( + 'editor.action.showReferences', + vscode.Uri.parse(uri), + Server.client.protocol2CodeConverter.asPosition(position), + locations.map(Server.client.protocol2CodeConverter.asLocation) + ); + } + ); + overrideCommand('type', commands.onEnter.handle); // Notifications are events triggered by the language server From 37eec5d09cf1e7656bc883a79bdfe2008931e27f Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Thu, 7 Feb 2019 12:37:36 +0200 Subject: [PATCH 060/819] Add new configuration "enableEnhancedTyping" to control registering of "type" command This further fixes problems when having a VIM extension (at least vscodevim) enabled, by not calling `overrideCommand('type', commands.onEnter.handle)` when enableEnhancedTyping is set to `false`. The problem is dependent on the order in which extensions are activated, if rust-analyzer is activated before `vscodevim`, rust-analyzer will register the `type` command, and when `vscodevim` finally attempts to activate, it will fail to register the command. This causes `vscodevim` to stop working properly. This setting allows users to disable the registerCommand `type` in rust-analyzer, allowing `vscodevim` to work. The setting defaults to `true`. Currently changing the setting requires reloading of the window. --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 25 +++++++++++++++++++++ rust-analyzer/editors/code/src/extension.ts | 4 +++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1ed834d6..20b04c66 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -150,6 +150,11 @@ "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "rust-analyzer.enableEnhancedTyping": { + "type": "boolean", + "default": true, + "description": "Enables enhanced typing. NOTE: If using a VIM extension, you should set this to false" + }, "rust-analyzer.raLspServerPath": { "type": [ "string" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index d26f5df0..d49917c7 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -6,8 +6,11 @@ const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; export class Config { public highlightingOn = true; + public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; + private prevEnhancedTyping: null | boolean = null; + constructor() { vscode.workspace.onDidChangeConfiguration(_ => this.userConfigChanged() @@ -25,6 +28,28 @@ export class Config { Server.highlighter.removeHighlights(); } + if (config.has('enableEnhancedTyping')) { + this.enableEnhancedTyping = config.get('enableEnhancedTyping') as boolean; + + if (this.prevEnhancedTyping === null) { + this.prevEnhancedTyping = this.enableEnhancedTyping; + } + } else if (this.prevEnhancedTyping === null) { + this.prevEnhancedTyping = this.enableEnhancedTyping; + } + + if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { + const reloadAction = 'Reload now'; + vscode.window.showInformationMessage('Changing enhanced typing setting requires a reload', reloadAction) + .then(selectedAction => { + if (selectedAction === reloadAction) { + vscode.commands.executeCommand('workbench.action.reloadWindow'); + } + }); + this.prevEnhancedTyping = this.enableEnhancedTyping; + } + + if (config.has('raLspServerPath')) { this.raLspServerPath = RA_LSP_DEBUG || (config.get('raLspServerPath') as string); diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index a0be7020..8b332eeb 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -82,7 +82,9 @@ export function activate(context: vscode.ExtensionContext) { } ); - overrideCommand('type', commands.onEnter.handle); + if (Server.config.enableEnhancedTyping) { + overrideCommand('type', commands.onEnter.handle); + } // Notifications are events triggered by the language server const allNotifications: Iterable< From 5402af58ac00b32a6b38ad0f6d5e25e7c8dff1e1 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Thu, 7 Feb 2019 12:54:41 +0200 Subject: [PATCH 061/819] Run prettier --- rust-analyzer/editors/code/src/config.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index d49917c7..4e353798 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -29,7 +29,9 @@ export class Config { } if (config.has('enableEnhancedTyping')) { - this.enableEnhancedTyping = config.get('enableEnhancedTyping') as boolean; + this.enableEnhancedTyping = config.get( + 'enableEnhancedTyping' + ) as boolean; if (this.prevEnhancedTyping === null) { this.prevEnhancedTyping = this.enableEnhancedTyping; @@ -40,16 +42,21 @@ export class Config { if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { const reloadAction = 'Reload now'; - vscode.window.showInformationMessage('Changing enhanced typing setting requires a reload', reloadAction) + vscode.window + .showInformationMessage( + 'Changing enhanced typing setting requires a reload', + reloadAction + ) .then(selectedAction => { if (selectedAction === reloadAction) { - vscode.commands.executeCommand('workbench.action.reloadWindow'); + vscode.commands.executeCommand( + 'workbench.action.reloadWindow' + ); } }); this.prevEnhancedTyping = this.enableEnhancedTyping; } - if (config.has('raLspServerPath')) { this.raLspServerPath = RA_LSP_DEBUG || (config.get('raLspServerPath') as string); From e88d9fbfa900f5d00256c43c6dc44b18939ebc72 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 7 Feb 2019 14:55:09 -0500 Subject: [PATCH 062/819] Update npm packages --- rust-analyzer/editors/code/package-lock.json | 150 +++++++------------ rust-analyzer/editors/code/package.json | 14 +- 2 files changed, 65 insertions(+), 99 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 86313d4c..7c739226 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -5,21 +5,21 @@ "requires": true, "dependencies": { "@types/mocha": { - "version": "2.2.48", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz", - "integrity": "sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw==", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", "dev": true }, "@types/node": { - "version": "8.10.39", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.39.tgz", - "integrity": "sha512-rE7fktr02J8ybFf6eysife+WF+L4sAHWzw09DgdCebEu+qDwMvv4zl6Bc+825ttGZP73kCKxa3dhJOoGJ8+5mA==", + "version": "10.12.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.21.tgz", + "integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==", "dev": true }, "ajv": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz", - "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.8.1.tgz", + "integrity": "sha512-eqxCp82P+JfqL683wwsL73XmFs1eG6qjw+RD3YHx+Jll1r0jNd4dh8QG9NYAeNGA/hnZjeEDgtTskgJULbxpWQ==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -545,9 +545,9 @@ "dev": true }, "duplexify": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", - "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", "dev": true, "requires": { "end-of-stream": "^1.0.0", @@ -683,39 +683,13 @@ } }, "flush-write-stream": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", - "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.0.tgz", + "integrity": "sha512-6MHED/cmsyux1G4/Cek2Z776y9t7WCNd3h2h/HW91vFeU7pzMhA8XvAlDhHcanG5IWuIh/xcC7JASY4WQpG6xg==", "dev": true, "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" } }, "forever-agent": { @@ -1284,14 +1258,11 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify": { + "json-stable-stringify-without-jsonify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true }, "json-stringify-safe": { "version": "5.0.1", @@ -1299,12 +1270,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -1735,9 +1700,9 @@ } }, "prettier": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz", - "integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==", + "version": "1.16.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.16.4.tgz", + "integrity": "sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==", "dev": true }, "process-nextick-args": { @@ -1912,12 +1877,12 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { @@ -1944,9 +1909,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", - "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", + "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -1969,9 +1934,9 @@ "dev": true }, "sshpk": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz", - "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, "requires": { "asn1": "~0.2.3", @@ -2125,9 +2090,9 @@ } }, "through2-filter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", - "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", + "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", "dev": true, "requires": { "through2": "~2.0.0", @@ -2207,9 +2172,9 @@ } }, "tslint-config-prettier": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.17.0.tgz", - "integrity": "sha512-NKWNkThwqE4Snn4Cm6SZB7lV5RMDDFsBwz6fWUkTxOKGjMx8ycOHnjIbhn7dZd5XmssW3CwqUjlANR6EhP9YQw==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", + "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", "dev": true }, "tsutils": { @@ -2261,15 +2226,15 @@ } }, "typescript": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3.tgz", + "integrity": "sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==", "dev": true }, "uc.micro": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.5.tgz", - "integrity": "sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "dev": true }, "unc-path-regex": { @@ -2285,13 +2250,13 @@ "dev": true }, "unique-stream": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz", - "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", + "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", "dev": true, "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" + "json-stable-stringify-without-jsonify": "^1.0.1", + "through2-filter": "^3.0.0" } }, "uri-js": { @@ -2489,11 +2454,12 @@ } }, "vsce": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.54.0.tgz", - "integrity": "sha512-E0Cnz50JK/TzUzTxDQ9oj3/Ichot1qmyin/8yHrH2BrQiXWUTX/FbuzMKFf1gTkNr6VvI3HbEf4VxSP/IASFIg==", + "version": "1.56.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.56.0.tgz", + "integrity": "sha512-Kvc+b1qEx8tEMnYC3bHyTQyCPWHs1dJ2kDK2y8f63fVzwwYmwq2XOXP7rCgBoB2nGEFwP5YT/kwkdmgQzKnhlg==", "dev": true, "requires": { + "chalk": "^2.4.2", "cheerio": "^1.0.0-rc.1", "commander": "^2.8.1", "denodeify": "^1.2.1", @@ -2514,9 +2480,9 @@ } }, "vscode": { - "version": "1.1.26", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.26.tgz", - "integrity": "sha512-z1Nf5J38gjUFbuDCbJHPN6OJ//5EG+e/yHlh6ERxj/U9B2Qc3aiHaFr38/fee/GGnxvRw/XegLMOG+UJwKi/Qg==", + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.29.tgz", + "integrity": "sha512-E6hzqGtCD65BnBxdZzSIi8FPCM4seEEK/bbTeYdJntg+4D5R6GLbdYFySE9DNTtMJF4iB9UGoucKU/p8Guts1g==", "dev": true, "requires": { "glob": "^7.1.2", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 20b04c66..2b429947 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -34,14 +34,14 @@ "vscode-languageclient": "^5.2.1" }, "devDependencies": { - "@types/mocha": "^2.2.42", - "@types/node": "^8.10.39", - "prettier": "^1.15.3", + "@types/mocha": "^5.2.5", + "@types/node": "^10.12.21", + "prettier": "^1.16.4", "tslint": "^5.12.1", - "tslint-config-prettier": "^1.17.0", - "typescript": "^2.6.1", - "vsce": "^1.54.0", - "vscode": "^1.1.26" + "tslint-config-prettier": "^1.18.0", + "typescript": "^3.3.1", + "vsce": "^1.56.0", + "vscode": "^1.1.29" }, "activationEvents": [ "onLanguage:rust", From 717b59d6c57b7c929c3e7b5b3ad9766c944e136f Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 10 Feb 2019 10:06:33 +0000 Subject: [PATCH 063/819] Add support for a seperate output channel for trace messages --- rust-analyzer/editors/code/package-lock.json | 14 +++++++------- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/server.ts | 7 +++++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 7c739226..144a46e2 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -2507,18 +2507,18 @@ "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" }, "vscode-languageclient": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", - "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", + "version": "5.3.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.1.tgz", + "integrity": "sha512-q5o6vHHDi+HjFOFUNC288Dee5jyAO4mEufoOaF2wKCjVP1qoJGbnBalTNGuakJThrdn0RDa0XdHZgXKFyZomCQ==", "requires": { "semver": "^5.5.0", - "vscode-languageserver-protocol": "3.14.1" + "vscode-languageserver-protocol": "3.15.0-next.1" } }, "vscode-languageserver-protocol": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", - "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", + "version": "3.15.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.1.tgz", + "integrity": "sha512-LXF0d9s3vxFBxVQ4aKl/XghdEMAncGt3dh4urIYa9Is43g3MfIQL9fC44YZtP+XXOrI2rpZU8lRNN01U1V6CDg==", "requires": { "vscode-jsonrpc": "^4.0.0", "vscode-languageserver-types": "3.14.0" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2b429947..fc63d988 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -31,7 +31,7 @@ "singleQuote": true }, "dependencies": { - "vscode-languageclient": "^5.2.1" + "vscode-languageclient": "^5.3.0-next.1" }, "devDependencies": { "@types/mocha": "^5.2.5", diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 0d263270..7bb0e56c 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,5 +1,6 @@ import * as lc from 'vscode-languageclient'; +import { window } from 'vscode'; import { Config } from './config'; import { Highlighter } from './highlighting'; @@ -19,16 +20,18 @@ export class Server { run, debug: run }; + const traceOutputChannel = window.createOutputChannel('Rust Analyzer Language Server Trace'); const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { publishDecorations: true - } + }, + traceOutputChannel }; Server.client = new lc.LanguageClient( 'ra-lsp', - 'rust-analyzer language server', + 'Rust Analyzer Language Server', serverOptions, clientOptions ); From 9384815934ec2311018e050636487f38d02d6be7 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 10 Feb 2019 10:30:16 +0000 Subject: [PATCH 064/819] Fix trace and prettier --- rust-analyzer/editors/code/src/server.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 7bb0e56c..9ead87fa 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -20,7 +20,9 @@ export class Server { run, debug: run }; - const traceOutputChannel = window.createOutputChannel('Rust Analyzer Language Server Trace'); + const traceOutputChannel = window.createOutputChannel( + 'Rust Analyzer Language Server Trace' + ); const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { @@ -30,7 +32,7 @@ export class Server { }; Server.client = new lc.LanguageClient( - 'ra-lsp', + 'rust-analyzer', 'Rust Analyzer Language Server', serverOptions, clientOptions From 6b6b4303706df7318cdc3fa7e046ed2e100b18d8 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 10 Feb 2019 10:32:45 +0000 Subject: [PATCH 065/819] Update dependencies --- rust-analyzer/editors/code/package-lock.json | 12 ++++++------ rust-analyzer/editors/code/package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 144a46e2..5a0d21e7 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -11,9 +11,9 @@ "dev": true }, "@types/node": { - "version": "10.12.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.21.tgz", - "integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==", + "version": "10.12.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.24.tgz", + "integrity": "sha512-GWWbvt+z9G5otRBW8rssOFgRY87J9N/qbhqfjMZ+gUuL6zoL+Hm6gP/8qQBG4jjimqdaNLCehcVapZ/Fs2WjCQ==", "dev": true }, "ajv": { @@ -2454,9 +2454,9 @@ } }, "vsce": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.56.0.tgz", - "integrity": "sha512-Kvc+b1qEx8tEMnYC3bHyTQyCPWHs1dJ2kDK2y8f63fVzwwYmwq2XOXP7rCgBoB2nGEFwP5YT/kwkdmgQzKnhlg==", + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.57.0.tgz", + "integrity": "sha512-ULiWDQBt0XZAA5PI7XL0TxeKZ6cXk3e3ZH/lL9xk93WeckqWzR79D3xNsf0GRacOGYU+UmbhXWRtP8C6wnDNmg==", "dev": true, "requires": { "chalk": "^2.4.2", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fc63d988..045d372e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -35,12 +35,12 @@ }, "devDependencies": { "@types/mocha": "^5.2.5", - "@types/node": "^10.12.21", + "@types/node": "^10.12.24", "prettier": "^1.16.4", "tslint": "^5.12.1", "tslint-config-prettier": "^1.18.0", "typescript": "^3.3.1", - "vsce": "^1.56.0", + "vsce": "^1.57.0", "vscode": "^1.1.29" }, "activationEvents": [ From 687bd84dd128b1ee180a65f1279713eb4fa7ae0c Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 12 Feb 2019 10:31:11 -0500 Subject: [PATCH 066/819] Specify vscode 1.31 --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 045d372e..4fc2cb75 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.30.0" + "vscode": "^1.31.0" }, "scripts": { "vscode:prepublish": "npm run compile", From 02b99128bcccfdbfb0030d68f8fc1600507666ef Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 18 Feb 2019 13:12:54 -0500 Subject: [PATCH 067/819] Use named multiline Problem Matcher Now that https://github.com/Microsoft/vscode/pull/65840 is in the latest release we can use the first commit from https://github.com/rust-analyzer/rust-analyzer/pull/408 --- rust-analyzer/editors/code/package.json | 31 ++----------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4fc2cb75..caec5a41 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -177,7 +177,6 @@ }, "problemPatterns": [ { - "//comment": "named multiline problem patterns are not parsed properly in vscode at the moment, when fixed in vscode replace both \"pattern\": [...] below with \"pattern\": \"$rustc\"", "name": "rustc", "patterns": [ { @@ -202,20 +201,7 @@ "relative", "${workspaceRoot}" ], - "pattern": [ - { - "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", - "severity": 1, - "code": 2, - "message": 3 - }, - { - "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", - "file": 1, - "line": 2, - "column": 3 - } - ] + "pattern": "$rustc" }, { "name": "rustc-watch", @@ -227,20 +213,7 @@ "beginsPattern": "^\\[Running ", "endsPattern": "^(\\[Finished running\\]|To learn more, run the command again with --verbose\\.)$" }, - "pattern": [ - { - "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", - "severity": 1, - "code": 2, - "message": 3 - }, - { - "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", - "file": 1, - "line": 2, - "column": 3 - } - ] + "pattern": "$rustc" } ] } From 9e70b1f009cf74ffaf31c3e2826e4da2bcddee7d Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Tue, 26 Feb 2019 08:56:11 +0200 Subject: [PATCH 068/819] Change default value of highlightingOn to false --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index caec5a41..d4ce2ae2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -147,7 +147,7 @@ "properties": { "rust-analyzer.highlightingOn": { "type": "boolean", - "default": true, + "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, "rust-analyzer.enableEnhancedTyping": { From 2cf53194280f58144fba22581cdfc34f2c217ea3 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sun, 3 Mar 2019 21:21:40 +0200 Subject: [PATCH 069/819] Add vscode support for range in SyntaxTreeParams This enables the client to use a command to either show the live-updating version of the syntax tree for the current file. Or optionally when a selected range is provided, we then provide a snapshot of the syntax tree for the range. --- rust-analyzer/editors/code/package.json | 2 +- .../editors/code/src/commands/syntaxTree.ts | 44 +++++++++++++++---- rust-analyzer/editors/code/src/extension.ts | 6 ++- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d4ce2ae2..fda41181 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -75,7 +75,7 @@ "commands": [ { "command": "rust-analyzer.syntaxTree", - "title": "Show syntax tree for current file", + "title": "Show Syntax Tree", "category": "Rust Analyzer" }, { diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index c0baf08c..7200ae82 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { TextDocumentIdentifier } from 'vscode-languageclient'; +import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; @@ -17,8 +17,21 @@ export class TextDocumentContentProvider if (editor == null) { return ''; } + + let range: Range | undefined; + + // When the range based query is enabled we take the range of the selection + if (uri.query === 'range=true') { + range = editor.selection.isEmpty + ? undefined + : Server.client.code2ProtocolConverter.asRange( + editor.selection + ); + } + const request: SyntaxTreeParams = { - textDocument: { uri: editor.document.uri.toString() } + textDocument: { uri: editor.document.uri.toString() }, + range }; return Server.client.sendRequest( 'rust-analyzer/syntaxTree', @@ -33,6 +46,7 @@ export class TextDocumentContentProvider interface SyntaxTreeParams { textDocument: TextDocumentIdentifier; + range?: Range; } type SyntaxTreeResult = string; @@ -40,11 +54,23 @@ type SyntaxTreeResult = string; // Opens the virtual file that will show the syntax tree // // The contents of the file come from the `TextDocumentContentProvider` -export async function handle() { - const document = await vscode.workspace.openTextDocument(syntaxTreeUri); - return vscode.window.showTextDocument( - document, - vscode.ViewColumn.Two, - true - ); +export function createHandle(provider: TextDocumentContentProvider) { + return async () => { + const editor = vscode.window.activeTextEditor; + const rangeEnabled = !!(editor && !editor.selection.isEmpty); + + const uri = rangeEnabled + ? vscode.Uri.parse(`${syntaxTreeUri.toString()}?range=true`) + : syntaxTreeUri; + + const document = await vscode.workspace.openTextDocument(uri); + + provider.eventEmitter.fire(uri); + + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true + ); + }; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 8b332eeb..5134bb25 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -52,7 +52,6 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('rust-analyzer.collectGarbage', () => Server.client.sendRequest('rust-analyzer/collectGarbage', null) ); - registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle); registerCommand( 'rust-analyzer.extendSelection', commands.extendSelection.handle @@ -109,6 +108,11 @@ export function activate(context: vscode.ExtensionContext) { ) ); + registerCommand( + 'rust-analyzer.syntaxTree', + commands.syntaxTree.createHandle(textDocumentContentProvider) + ); + vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(textDocumentContentProvider), null, From 40958c05f0461b80070bf3453febece272e0b797 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sun, 3 Mar 2019 21:54:51 +0200 Subject: [PATCH 070/819] Rename syntaxtree text provider to SyntaxTreeContentProvider --- rust-analyzer/editors/code/src/commands/syntaxTree.ts | 4 ++-- .../editors/code/src/events/change_text_document.ts | 10 ++++------ rust-analyzer/editors/code/src/extension.ts | 10 +++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index 7200ae82..2f50fe14 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -5,7 +5,7 @@ import { Server } from '../server'; export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree'); -export class TextDocumentContentProvider +export class SyntaxTreeContentProvider implements vscode.TextDocumentContentProvider { public eventEmitter = new vscode.EventEmitter(); public syntaxTree: string = 'Not available'; @@ -54,7 +54,7 @@ type SyntaxTreeResult = string; // Opens the virtual file that will show the syntax tree // // The contents of the file come from the `TextDocumentContentProvider` -export function createHandle(provider: TextDocumentContentProvider) { +export function createHandle(provider: SyntaxTreeContentProvider) { return async () => { const editor = vscode.window.activeTextEditor; const rangeEnabled = !!(editor && !editor.selection.isEmpty); diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts index 6be05724..89488bc6 100644 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -1,20 +1,18 @@ import * as vscode from 'vscode'; import { - syntaxTreeUri, - TextDocumentContentProvider + SyntaxTreeContentProvider, + syntaxTreeUri } from '../commands/syntaxTree'; -export function createHandler( - textDocumentContentProvider: TextDocumentContentProvider -) { +export function createHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { return (event: vscode.TextDocumentChangeEvent) => { const doc = event.document; if (doc.languageId !== 'rust') { return; } afterLs(() => { - textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); + syntaxTreeProvider.eventEmitter.fire(syntaxTreeUri); }); }; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 5134bb25..894334c5 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { TextDocumentContentProvider } from './commands/syntaxTree'; +import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; @@ -100,21 +100,21 @@ export function activate(context: vscode.ExtensionContext) { events.changeActiveTextEditor.handle ); - const textDocumentContentProvider = new TextDocumentContentProvider(); + const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', - textDocumentContentProvider + syntaxTreeContentProvider ) ); registerCommand( 'rust-analyzer.syntaxTree', - commands.syntaxTree.createHandle(textDocumentContentProvider) + commands.syntaxTree.createHandle(syntaxTreeContentProvider) ); vscode.workspace.onDidChangeTextDocument( - events.changeTextDocument.createHandler(textDocumentContentProvider), + events.changeTextDocument.createHandler(syntaxTreeContentProvider), null, context.subscriptions ); From 171977c6f7a398fbca3cdad62e16811ac6d936da Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sun, 3 Mar 2019 22:03:37 +0200 Subject: [PATCH 071/819] Allow syntax tree to update when changing files Previously when using the file based syntax tree, it would not update until a change had been made in the new file. Now we automatically update the syntax tree to match the current file. --- .../src/events/change_active_text_editor.ts | 39 ++++++++++++------- rust-analyzer/editors/code/src/extension.ts | 4 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index af295b2e..64be5622 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -1,23 +1,32 @@ import { TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; +import { + SyntaxTreeContentProvider, + syntaxTreeUri +} from '../commands/syntaxTree'; import { Decoration } from '../highlighting'; import { Server } from '../server'; -export async function handle(editor: TextEditor | undefined) { - if ( - !Server.config.highlightingOn || - !editor || - editor.document.languageId !== 'rust' - ) { - return; - } - const params: TextDocumentIdentifier = { - uri: editor.document.uri.toString() +export function makeHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { + return async function handle(editor: TextEditor | undefined) { + if (!editor || editor.document.languageId !== 'rust') { + return; + } + + syntaxTreeProvider.eventEmitter.fire(syntaxTreeUri); + + if (!Server.config.highlightingOn) { + return; + } + + const params: TextDocumentIdentifier = { + uri: editor.document.uri.toString() + }; + const decorations = await Server.client.sendRequest( + 'rust-analyzer/decorationsRequest', + params + ); + Server.highlighter.setHighlights(editor, decorations); }; - const decorations = await Server.client.sendRequest( - 'rust-analyzer/decorationsRequest', - params - ); - Server.highlighter.setHighlights(editor, decorations); } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 894334c5..941beba1 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -94,13 +94,13 @@ export function activate(context: vscode.ExtensionContext) { notifications.publishDecorations.handle ] ]; + const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( - events.changeActiveTextEditor.handle + events.changeActiveTextEditor.makeHandler(syntaxTreeContentProvider) ); - const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', From 1bfa29a0dfea5cffd6c39be153c9637e92948f26 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 6 Mar 2019 11:34:38 +0200 Subject: [PATCH 072/819] Add showWorkspaceLoadedNotification to vscode client This allows users to control whether or not they want to see the "workspace loaded" notification. This is done on the server side using InitializationOptions which are provided by the client. By default show_workspace_loaded is true, meaning the notification is sent. --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 7 +++++++ rust-analyzer/editors/code/src/server.ts | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fda41181..47eaac87 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -150,6 +150,11 @@ "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "rust-analyzer.showWorkspaceLoadedNotification": { + "type": "boolean", + "default": true, + "description": "Show notification when workspace was loaded" + }, "rust-analyzer.enableEnhancedTyping": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 4e353798..afc5cc6a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -8,6 +8,7 @@ export class Config { public highlightingOn = true; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; + public showWorkspaceLoadedNotification = true; private prevEnhancedTyping: null | boolean = null; @@ -24,6 +25,12 @@ export class Config { this.highlightingOn = config.get('highlightingOn') as boolean; } + if (config.has('showWorkspaceLoadedNotification')) { + this.showWorkspaceLoadedNotification = config.get( + 'showWorkspaceLoadedNotification' + ) as boolean; + } + if (!this.highlightingOn && Server) { Server.highlighter.removeHighlights(); } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 9ead87fa..50461b0c 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -26,7 +26,9 @@ export class Server { const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { - publishDecorations: true + publishDecorations: true, + showWorkspaceLoaded: + Server.config.showWorkspaceLoadedNotification }, traceOutputChannel }; From 96225a98750f47233fd6562beeac7535eff87dd3 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sun, 24 Feb 2019 13:41:19 +0100 Subject: [PATCH 073/819] simplify watch patterns --- rust-analyzer/editors/code/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 47eaac87..2177d875 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -215,11 +215,11 @@ "${workspaceRoot}" ], "background": { - "beginsPattern": "^\\[Running ", - "endsPattern": "^(\\[Finished running\\]|To learn more, run the command again with --verbose\\.)$" + "beginsPattern": "^\\[Running\\b", + "endsPattern": "^\\[Finished running\\b" }, "pattern": "$rustc" } ] } -} +} \ No newline at end of file From a00d7f4e515dbb2c6d9c48abb3cf45796a367fea Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sun, 10 Mar 2019 15:20:27 +0100 Subject: [PATCH 074/819] prettier format --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2177d875..0a1e84b4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -222,4 +222,4 @@ } ] } -} \ No newline at end of file +} From 7deecb7e4ab1177662b661b3e62a3a649376c938 Mon Sep 17 00:00:00 2001 From: Lucas Spits Date: Mon, 11 Mar 2019 20:38:46 +0100 Subject: [PATCH 075/819] Retrieve current directory from workspaces --- rust-analyzer/editors/code/src/server.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 50461b0c..30ab874a 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,6 +1,6 @@ import * as lc from 'vscode-languageclient'; -import { window } from 'vscode'; +import { window, workspace } from 'vscode'; import { Config } from './config'; import { Highlighter } from './highlighting'; @@ -12,9 +12,25 @@ export class Server { public static start( notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> ) { + + // '.' Is the fallback if no folder is open + // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. + let folder: string = '.'; + if (workspace.workspaceFolders !== undefined) { + + folder = workspace + .workspaceFolders[0].uri.fsPath + .toString(); + + if (workspace.workspaceFolders.length > 1) { + // Tell the user that we do not support multi-root workspaces yet + window.showWarningMessage("Multi-root workspaces are not currently supported"); + } + } + const run: lc.Executable = { command: this.config.raLspServerPath, - options: { cwd: '.' } + options: { cwd: folder } }; const serverOptions: lc.ServerOptions = { run, From 32868b8e583f8b86d0687ef11c5ebadc512a5e51 Mon Sep 17 00:00:00 2001 From: Lucas Spits Date: Mon, 11 Mar 2019 20:53:56 +0100 Subject: [PATCH 076/819] Fix typescript linting errors --- rust-analyzer/editors/code/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 30ab874a..b3a874b3 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -24,7 +24,7 @@ export class Server { if (workspace.workspaceFolders.length > 1) { // Tell the user that we do not support multi-root workspaces yet - window.showWarningMessage("Multi-root workspaces are not currently supported"); + window.showWarningMessage('Multi-root workspaces are not currently supported'); } } From e2775c74d864d928607633697d3af8c2eef4065b Mon Sep 17 00:00:00 2001 From: Lucas Spits Date: Mon, 11 Mar 2019 21:22:54 +0100 Subject: [PATCH 077/819] Applied code style of ``npm run fix`` --- rust-analyzer/editors/code/src/server.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index b3a874b3..f319f148 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -12,19 +12,17 @@ export class Server { public static start( notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> ) { - // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. let folder: string = '.'; if (workspace.workspaceFolders !== undefined) { + folder = workspace.workspaceFolders[0].uri.fsPath.toString(); - folder = workspace - .workspaceFolders[0].uri.fsPath - .toString(); - if (workspace.workspaceFolders.length > 1) { // Tell the user that we do not support multi-root workspaces yet - window.showWarningMessage('Multi-root workspaces are not currently supported'); + window.showWarningMessage( + 'Multi-root workspaces are not currently supported' + ); } } From efa5154263e1a691ac2277d9fbd4bbd76310f265 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 13 Mar 2019 16:14:30 +0300 Subject: [PATCH 078/819] activate extension if Cargo.toml is present --- rust-analyzer/editors/code/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 0a1e84b4..3834f284 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -46,7 +46,8 @@ "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", - "onCommand:rust-analyzer.collectGarbage" + "onCommand:rust-analyzer.collectGarbage", + "workspaceContains:**/Cargo.toml" ], "main": "./out/extension", "contributes": { From 378f95e54b10c0aea0d9b96c2206d20d0f0c2aec Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 17:53:07 +0100 Subject: [PATCH 079/819] Remove redundant Runnable.range --- rust-analyzer/editors/code/src/commands/runnables.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c0f2ada7..28ad7a30 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -8,7 +8,6 @@ interface RunnablesParams { } interface Runnable { - range: lc.Range; label: string; bin: string; args: string[]; From 0b30bf62b799b1047d7c2cd4b68899aabaacdf17 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 20:47:52 +0100 Subject: [PATCH 080/819] Define a cargo watch task --- .../editors/code/src/commands/runnables.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 28ad7a30..74d66403 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -33,7 +33,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { env?: { [key: string]: string }; } -function createTask(spec: Runnable): vscode.Task { +export function createTask(spec: Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; const definition: CargoTaskDefinition = { type: 'cargo', @@ -123,3 +123,23 @@ export async function handleSingle(runnable: Runnable) { return vscode.tasks.executeTask(task); } + +export const autoCargoWatchTask: vscode.Task = { + name: 'cargo watch', + source: 'rust-analyzer', + definition: { + type: "dupa", + }, + execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }), + + isBackground: true, + problemMatchers: ['$rustc-watch'], + presentationOptions: { + clear: true + }, + // Not yet exposed in the vscode.d.ts + runOptions: { + runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456 + } as unknown as vscode.RunOptions, + +}; From b328cf89b8df67f999b6714e62a90e8c9d7c0bba Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 20:50:52 +0100 Subject: [PATCH 081/819] Ask the user to install and start cargo watch --- rust-analyzer/editors/code/src/extension.ts | 66 +++++++++++++++++++-- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 941beba1..d5b496b1 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,11 +1,15 @@ +import { exec, spawn } from 'child_process'; +import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; +import { autoCargoWatchTask, createTask } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; +import { TextDecoder } from 'util'; export function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { @@ -89,11 +93,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode @@ -119,6 +123,9 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); + // Attempts to run `cargo watch`, which provides inline diagnostics on save + askToCargoWatch(); + // Start the language server, finally! Server.start(allNotifications); } @@ -129,3 +136,52 @@ export function deactivate(): Thenable { } return Server.client.stop(); } + +async function askToCargoWatch() { + const watch = await vscode.window.showInformationMessage( + 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', + 'yes', + 'no' + ); + if (watch === 'no') { + return; + } + + const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); + if (stderr.includes('no such subcommand: `watch`')) { + const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; + const install = await vscode.window.showInformationMessage(msg, 'yes', 'no'); + if (install === 'no') { + return; + } + + try { + // await vscode.tasks.executeTask(createTask({label: '', bin: 'cargo', args: ['install', 'cargo-watch'], env: {}})); + + const channel = vscode.window.createOutputChannel('cargo-watch'); + channel.show(false); + const sup = spawn('cargo', ['install', 'cargo-watch']); + sup.stderr.on('data', chunk => { + const output = new TextDecoder().decode(chunk); + channel.append(output); + }); + await new Promise((resolve, reject) => { + sup.on('close', (code, signal) => { + if (code === 0) { + resolve(code); + } else { + reject(code); + } + }); + }); + channel.dispose(); + } catch (err) { + vscode.window.showErrorMessage( + `Couldn't install \`cargo-watch\`: ${err.message}` + ); + return; + } + } + + vscode.tasks.executeTask(autoCargoWatchTask); +} From 2a5e48b80dc12ecfa7f61373e182a889bfcb162d Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 21:04:33 +0100 Subject: [PATCH 082/819] Respect the user-provided label when creating task --- rust-analyzer/editors/code/src/commands/runnables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 74d66403..c6d23a18 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -37,7 +37,7 @@ export function createTask(spec: Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; const definition: CargoTaskDefinition = { type: 'cargo', - label: 'cargo', + label: spec.label, command: spec.bin, args: spec.args, env: spec.env From e3834de3039fc4d11b7e5a1b6612f44a53fc2f30 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 21:13:49 +0100 Subject: [PATCH 083/819] Prefer installing `cargo-watch` via Task API This gives us much more fine-grained stdout buffering and ANSI terminal colors. --- rust-analyzer/editors/code/src/extension.ts | 37 ++++++++------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index d5b496b1..f06c5445 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -155,30 +155,21 @@ async function askToCargoWatch() { return; } - try { - // await vscode.tasks.executeTask(createTask({label: '', bin: 'cargo', args: ['install', 'cargo-watch'], env: {}})); - - const channel = vscode.window.createOutputChannel('cargo-watch'); - channel.show(false); - const sup = spawn('cargo', ['install', 'cargo-watch']); - sup.stderr.on('data', chunk => { - const output = new TextDecoder().decode(chunk); - channel.append(output); - }); - await new Promise((resolve, reject) => { - sup.on('close', (code, signal) => { - if (code === 0) { - resolve(code); - } else { - reject(code); - } - }); + const label = 'install-cargo-watch'; + const taskFinished = new Promise((resolve, reject) => { + let disposable = vscode.tasks.onDidEndTask(({ execution }) => { + if (execution.task.name === label) { + disposable.dispose(); + resolve(); + }; }); - channel.dispose(); - } catch (err) { - vscode.window.showErrorMessage( - `Couldn't install \`cargo-watch\`: ${err.message}` - ); + }); + + vscode.tasks.executeTask(createTask({ label, bin: 'cargo', args: ['install', 'cargo-watch'], env: {} })); + await taskFinished; + const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); + if (stderr !== '') { + vscode.window.showErrorMessage(`Couldn't install \`cargo-\`watch: ${stderr}`); return; } } From ae698525f354a96f1a8b1442e1925db75fb7ca5d Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 21:16:20 +0100 Subject: [PATCH 084/819] Remove unused imports --- rust-analyzer/editors/code/src/extension.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index f06c5445..442c9cd0 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,4 +1,4 @@ -import { exec, spawn } from 'child_process'; +import { exec } from 'child_process'; import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; @@ -9,7 +9,6 @@ import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; -import { TextDecoder } from 'util'; export function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { From 13b6a15a0d1425be903bab76b1a5cd1f98763059 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 22:15:03 +0100 Subject: [PATCH 085/819] Reformat using Prettier --- .../editors/code/src/commands/runnables.ts | 10 ++--- rust-analyzer/editors/code/src/extension.ts | 42 +++++++++++++------ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c6d23a18..23fd280b 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -128,7 +128,7 @@ export const autoCargoWatchTask: vscode.Task = { name: 'cargo watch', source: 'rust-analyzer', definition: { - type: "dupa", + type: 'watch' }, execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }), @@ -138,8 +138,8 @@ export const autoCargoWatchTask: vscode.Task = { clear: true }, // Not yet exposed in the vscode.d.ts - runOptions: { - runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456 - } as unknown as vscode.RunOptions, - + // https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456 + runOptions: ({ + runOn: 2 // RunOnOptions.folderOpen + } as unknown) as vscode.RunOptions }; diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 442c9cd0..f915a502 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode @@ -146,10 +146,17 @@ async function askToCargoWatch() { return; } - const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); + const { stderr } = await util + .promisify(exec)('cargo watch --version') + .catch(e => e); if (stderr.includes('no such subcommand: `watch`')) { - const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; - const install = await vscode.window.showInformationMessage(msg, 'yes', 'no'); + const msg = + 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; + const install = await vscode.window.showInformationMessage( + msg, + 'yes', + 'no' + ); if (install === 'no') { return; } @@ -160,15 +167,26 @@ async function askToCargoWatch() { if (execution.task.name === label) { disposable.dispose(); resolve(); - }; + } }); }); - vscode.tasks.executeTask(createTask({ label, bin: 'cargo', args: ['install', 'cargo-watch'], env: {} })); + vscode.tasks.executeTask( + createTask({ + label, + bin: 'cargo', + args: ['install', 'cargo-watch'], + env: {} + }) + ); await taskFinished; - const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); + const { stderr } = await util + .promisify(exec)('cargo watch --version') + .catch(e => e); if (stderr !== '') { - vscode.window.showErrorMessage(`Couldn't install \`cargo-\`watch: ${stderr}`); + vscode.window.showErrorMessage( + `Couldn't install \`cargo-\`watch: ${stderr}` + ); return; } } From f4beaffa8ed662052264d19cd0df5ded4e362999 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 22:30:23 +0100 Subject: [PATCH 086/819] Separate out the interactive cargo watch procedure --- .../editors/code/src/commands/runnables.ts | 68 ++++++++++++++++++- rust-analyzer/editors/code/src/extension.ts | 66 +----------------- 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 23fd280b..285afaaf 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,5 +1,8 @@ +import { exec } from 'child_process'; +import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; + import { Server } from '../server'; interface RunnablesParams { @@ -33,7 +36,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { env?: { [key: string]: string }; } -export function createTask(spec: Runnable): vscode.Task { +function createTask(spec: Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; const definition: CargoTaskDefinition = { type: 'cargo', @@ -143,3 +146,66 @@ export const autoCargoWatchTask: vscode.Task = { runOn: 2 // RunOnOptions.folderOpen } as unknown) as vscode.RunOptions }; + +/** + * Interactively asks the user whether we should run `cargo check` in order to + * provide inline diagnostics; the user is met with a series of dialog boxes + * that, when accepted, allow us to `cargo install cargo-watch` and then run it. + */ +export async function interactivelyStartCargoWatch() { + const execAsync = util.promisify(exec); + + const watch = await vscode.window.showInformationMessage( + 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', + 'yes', + 'no' + ); + if (watch === 'no') { + return; + } + + const { stderr } = await execAsync('cargo watch --version').catch(e => e); + if (stderr.includes('no such subcommand: `watch`')) { + const msg = + 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; + const install = await vscode.window.showInformationMessage( + msg, + 'yes', + 'no' + ); + if (install === 'no') { + return; + } + + const label = 'install-cargo-watch'; + const taskFinished = new Promise((resolve, reject) => { + let disposable = vscode.tasks.onDidEndTask(({ execution }) => { + if (execution.task.name === label) { + disposable.dispose(); + resolve(); + } + }); + }); + + vscode.tasks.executeTask( + createTask({ + label, + bin: 'cargo', + args: ['install', 'cargo-watch'], + env: {} + }) + ); + await taskFinished; + const { stderr } = await execAsync('cargo watch --version').catch( + e => e + ); + if (stderr !== '') { + vscode.window.showErrorMessage( + `Couldn't install \`cargo-\`watch: ${stderr}` + ); + return; + } + } + + vscode.tasks.executeTask(autoCargoWatchTask); +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index f915a502..2e13c87d 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -1,10 +1,8 @@ -import { exec } from 'child_process'; -import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { autoCargoWatchTask, createTask } from './commands/runnables'; +import { interactivelyStartCargoWatch } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; @@ -122,8 +120,8 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); - // Attempts to run `cargo watch`, which provides inline diagnostics on save - askToCargoWatch(); + // Executing `cargo watch` provides us with inline diagnostics on save + interactivelyStartCargoWatch(); // Start the language server, finally! Server.start(allNotifications); @@ -135,61 +133,3 @@ export function deactivate(): Thenable { } return Server.client.stop(); } - -async function askToCargoWatch() { - const watch = await vscode.window.showInformationMessage( - 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', - 'yes', - 'no' - ); - if (watch === 'no') { - return; - } - - const { stderr } = await util - .promisify(exec)('cargo watch --version') - .catch(e => e); - if (stderr.includes('no such subcommand: `watch`')) { - const msg = - 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; - const install = await vscode.window.showInformationMessage( - msg, - 'yes', - 'no' - ); - if (install === 'no') { - return; - } - - const label = 'install-cargo-watch'; - const taskFinished = new Promise((resolve, reject) => { - let disposable = vscode.tasks.onDidEndTask(({ execution }) => { - if (execution.task.name === label) { - disposable.dispose(); - resolve(); - } - }); - }); - - vscode.tasks.executeTask( - createTask({ - label, - bin: 'cargo', - args: ['install', 'cargo-watch'], - env: {} - }) - ); - await taskFinished; - const { stderr } = await util - .promisify(exec)('cargo watch --version') - .catch(e => e); - if (stderr !== '') { - vscode.window.showErrorMessage( - `Couldn't install \`cargo-\`watch: ${stderr}` - ); - return; - } - } - - vscode.tasks.executeTask(autoCargoWatchTask); -} From 3e3d3610167f34d97b0531b7b99dabe6d5248a8c Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 22:35:47 +0100 Subject: [PATCH 087/819] Guard auto cargo watch behind a config option --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/commands/runnables.ts | 4 ++++ rust-analyzer/editors/code/src/config.ts | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3834f284..3e8cde38 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -168,6 +168,11 @@ "default": "ra_lsp_server", "description": "Path to ra_lsp_server executable" }, + "rust-analyzer.enableCargoWatchOnStartup": { + "type": "boolean", + "default": "true", + "description": "When enabled, ask the user whether to run `cargo watch` on startup" + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 285afaaf..74407dc3 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -153,6 +153,10 @@ export const autoCargoWatchTask: vscode.Task = { * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ export async function interactivelyStartCargoWatch() { + if (!Server.config.enableCargoWatchOnStartup) { + return; + } + const execAsync = util.promisify(exec); const watch = await vscode.window.showInformationMessage( diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index afc5cc6a..d8795f3b 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -9,6 +9,7 @@ export class Config { public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; + public enableCargoWatchOnStartup = true; private prevEnhancedTyping: null | boolean = null; @@ -68,5 +69,12 @@ export class Config { this.raLspServerPath = RA_LSP_DEBUG || (config.get('raLspServerPath') as string); } + + if (config.has('enableCargoWatchOnStartup')) { + this.enableCargoWatchOnStartup = config.get( + 'enableCargoWatchOnStartup', + true + ); + } } } From 5ed204993ec7f7c66d7de1b35c232b5141f4faa6 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 18 Mar 2019 22:51:01 +0100 Subject: [PATCH 088/819] Appease CI --- .../editors/code/src/commands/runnables.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 74407dc3..ea2883ad 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,4 +1,4 @@ -import { exec } from 'child_process'; +import * as child_process from 'child_process'; import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; @@ -157,7 +157,7 @@ export async function interactivelyStartCargoWatch() { return; } - const execAsync = util.promisify(exec); + const execPromise = util.promisify(child_process.exec); const watch = await vscode.window.showInformationMessage( 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', @@ -168,7 +168,7 @@ export async function interactivelyStartCargoWatch() { return; } - const { stderr } = await execAsync('cargo watch --version').catch(e => e); + const { stderr } = await execPromise('cargo watch --version').catch(e => e); if (stderr.includes('no such subcommand: `watch`')) { const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; @@ -183,7 +183,7 @@ export async function interactivelyStartCargoWatch() { const label = 'install-cargo-watch'; const taskFinished = new Promise((resolve, reject) => { - let disposable = vscode.tasks.onDidEndTask(({ execution }) => { + const disposable = vscode.tasks.onDidEndTask(({ execution }) => { if (execution.task.name === label) { disposable.dispose(); resolve(); @@ -200,12 +200,10 @@ export async function interactivelyStartCargoWatch() { }) ); await taskFinished; - const { stderr } = await execAsync('cargo watch --version').catch( - e => e - ); - if (stderr !== '') { + const output = await execPromise('cargo watch --version').catch(e => e); + if (output.stderr !== '') { vscode.window.showErrorMessage( - `Couldn't install \`cargo-\`watch: ${stderr}` + `Couldn't install \`cargo-\`watch: ${output.stderr}` ); return; } From 555bfd51abec9f16e134652d8b7682b9d7e71e38 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Thu, 21 Mar 2019 13:56:25 +0200 Subject: [PATCH 089/819] Change enableCargoWatchOnStartup to have three states This fixes #1005. Defaults to `ask` which prompts users each time whether to start `cargo watch` or not. `enabled` always starts `cargo watch` and `disabled` does not. --- rust-analyzer/editors/code/package.json | 16 ++++++++++--- .../editors/code/src/commands/runnables.ts | 23 +++++++++++-------- rust-analyzer/editors/code/src/config.ts | 8 ++++--- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3e8cde38..facb633d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -169,9 +169,19 @@ "description": "Path to ra_lsp_server executable" }, "rust-analyzer.enableCargoWatchOnStartup": { - "type": "boolean", - "default": "true", - "description": "When enabled, ask the user whether to run `cargo watch` on startup" + "type": "string", + "default": "ask", + "enum": [ + "ask", + "enabled", + "disabled" + ], + "enumDescriptions": [ + "Asks each time whether to run `cargo watch`", + "`cargo watch` is always started", + "Don't start `cargo watch`" + ], + "description": "Whether to run `cargo watch` on startup" }, "rust-analyzer.trace.server": { "type": "string", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index ea2883ad..420635f4 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -153,22 +153,25 @@ export const autoCargoWatchTask: vscode.Task = { * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ export async function interactivelyStartCargoWatch() { - if (!Server.config.enableCargoWatchOnStartup) { + if (Server.config.enableCargoWatchOnStartup === 'disabled') { return; } - const execPromise = util.promisify(child_process.exec); - - const watch = await vscode.window.showInformationMessage( - 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', - 'yes', - 'no' - ); - if (watch === 'no') { - return; + if (Server.config.enableCargoWatchOnStartup === 'ask') { + const watch = await vscode.window.showInformationMessage( + 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', + 'yes', + 'no' + ); + if (watch === 'no') { + return; + } } + const execPromise = util.promisify(child_process.exec); + const { stderr } = await execPromise('cargo watch --version').catch(e => e); + if (stderr.includes('no such subcommand: `watch`')) { const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index d8795f3b..42058906 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -4,12 +4,14 @@ import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; +export type CargoWatchOptions = 'ask' | 'enabled' | 'disabled'; + export class Config { public highlightingOn = true; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; - public enableCargoWatchOnStartup = true; + public enableCargoWatchOnStartup: CargoWatchOptions = 'ask'; private prevEnhancedTyping: null | boolean = null; @@ -71,9 +73,9 @@ export class Config { } if (config.has('enableCargoWatchOnStartup')) { - this.enableCargoWatchOnStartup = config.get( + this.enableCargoWatchOnStartup = config.get( 'enableCargoWatchOnStartup', - true + 'ask' ); } } From 23fb0c1719c215ecc8b03fafcda325ee1022bf25 Mon Sep 17 00:00:00 2001 From: pcpthm Date: Fri, 22 Mar 2019 09:38:48 +0900 Subject: [PATCH 090/819] Don't execute cargo watch when popup is dismissed --- rust-analyzer/editors/code/src/commands/runnables.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 420635f4..4187ef4d 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -163,7 +163,7 @@ export async function interactivelyStartCargoWatch() { 'yes', 'no' ); - if (watch === 'no') { + if (watch !== 'yes') { return; } } @@ -180,7 +180,7 @@ export async function interactivelyStartCargoWatch() { 'yes', 'no' ); - if (install === 'no') { + if (install !== 'yes') { return; } From b01571c6138ef6faf1e75886302ed3c8a33cbbbf Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 31 Mar 2019 20:00:50 +0800 Subject: [PATCH 091/819] Improve cargo-watch usage --- rust-analyzer/editors/code/package.json | 12 -- .../editors/code/src/commands/cargo_watch.ts | 168 ++++++++++++++++++ .../editors/code/src/commands/runnables.ts | 29 +-- rust-analyzer/editors/code/src/extension.ts | 4 +- 4 files changed, 177 insertions(+), 36 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands/cargo_watch.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index facb633d..240aff6c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -223,18 +223,6 @@ "${workspaceRoot}" ], "pattern": "$rustc" - }, - { - "name": "rustc-watch", - "fileLocation": [ - "relative", - "${workspaceRoot}" - ], - "background": { - "beginsPattern": "^\\[Running\\b", - "endsPattern": "^\\[Finished running\\b" - }, - "pattern": "$rustc" } ] } diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts new file mode 100644 index 00000000..55a1909c --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -0,0 +1,168 @@ +import * as child_process from 'child_process'; +import * as path from 'path'; +import * as vscode from 'vscode'; +import { setInterval } from 'timers'; + +const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; + +class StatusDisplay { + private i = 0; + private statusBarItem: vscode.StatusBarItem; + private timer?: NodeJS.Timeout; + + constructor(subscriptions: vscode.Disposable[]) { + this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); + subscriptions.push(this.statusBarItem); + this.statusBarItem.hide(); + } + + public show() { + this.timer = this.timer || setInterval(() => { + this.statusBarItem!.text = "cargo check " + this.frame(); + }, 300); + + this.statusBarItem!.show(); + } + + public hide() { + if(this.timer) { + clearInterval(this.timer); + this.timer = undefined; + } + + this.statusBarItem!.hide(); + } + + frame() { + return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; + } +} + +export class CargoWatchProvider { + private diagnosticCollection?: vscode.DiagnosticCollection; + private cargoProcess?: child_process.ChildProcess; + private outBuffer: string = ""; + private statusDisplay? : StatusDisplay; + + constructor() { + } + + public activate(subscriptions: vscode.Disposable[]) { + subscriptions.push(this); + this.diagnosticCollection = vscode.languages.createDiagnosticCollection("rustc"); + + this.statusDisplay = new StatusDisplay(subscriptions); + + // Start the cargo watch with json message + this.cargoProcess = child_process.spawn('cargo', + ["watch", "-x", "\"check --message-format json\""], + { + // stdio: ['ignore', 'pipe', 'ignore'], + shell: true, + cwd: vscode.workspace.rootPath, + }); + + + this.cargoProcess.stdout.on('data', (s: string) => { + this.processOutput(s); + }); + + this.cargoProcess.stderr.on('data', (s: string) => { + console.error('Error on cargo watch : ' + s); + }); + + this.cargoProcess.on('error', (err: Error) => { + console.error('Error on spawn cargo process : ' + err); + }); + } + + public dispose(): void { + if (this.diagnosticCollection) { + this.diagnosticCollection.clear(); + this.diagnosticCollection.dispose(); + } + + if (this.cargoProcess) { + this.cargoProcess.kill(); + } + } + + parseLine(line: string) { + if (line.startsWith("[Running")) { + this.diagnosticCollection!.clear(); + this.statusDisplay!.show(); + } + + if (line.startsWith("[Finished running")) { + this.statusDisplay!.hide(); + } + + function getLevel(s: string): vscode.DiagnosticSeverity { + if (s === "error") + return vscode.DiagnosticSeverity.Error; + + if (s.startsWith("warn")) + return vscode.DiagnosticSeverity.Warning; + + return vscode.DiagnosticSeverity.Information; + } + + // cargo-watch itself output non json format + // Ignore these lines + let data = null; + try { + data = JSON.parse(line.trim()); + } catch (error) { + return; + } + + // Only handle compiler-message now + if (data.reason !== "compiler-message") { + return; + } + + let spans: any[] = data.message.spans; + spans = spans.filter(o => o.is_primary); + let file_name = null; + + // We only handle primary span right now. + if (spans.length > 0) { + let o = spans[0]; + + console.log("o", o); + let rendered = data.message.rendered; + let level = getLevel(data.message.level); + let range = new vscode.Range( + new vscode.Position(o.line_start - 1, o.column_start - 1), + new vscode.Position(o.line_end - 1, o.column_end - 1) + ); + + file_name = path.join(vscode.workspace.rootPath!, o.file_name); + const diagnostic = new vscode.Diagnostic(range, rendered, level); + + diagnostic.source = 'rustc'; + diagnostic.code = data.message.code.code; + diagnostic.relatedInformation = []; + + let fileUrl = vscode.Uri.file(file_name!); + + let diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; + diagnostics.push(diagnostic); + + this.diagnosticCollection!.set(fileUrl, diagnostics); + } + } + + processOutput(chunk: string) { + // The stdout is not line based, convert it to line based for proceess. + this.outBuffer += chunk; + let eolIndex; + while ((eolIndex = this.outBuffer.indexOf('\n')) >= 0) { + // line includes the EOL + const line = this.outBuffer.slice(0, eolIndex + 1); + this.parseLine(line); + this.outBuffer = this.outBuffer.slice(eolIndex + 1); + } + } + +} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 4187ef4d..722db158 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,9 +1,11 @@ import * as child_process from 'child_process'; + import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from '../server'; +import { CargoWatchProvider } from './cargo_watch'; interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; @@ -127,32 +129,13 @@ export async function handleSingle(runnable: Runnable) { return vscode.tasks.executeTask(task); } -export const autoCargoWatchTask: vscode.Task = { - name: 'cargo watch', - source: 'rust-analyzer', - definition: { - type: 'watch' - }, - execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }), - - isBackground: true, - problemMatchers: ['$rustc-watch'], - presentationOptions: { - clear: true - }, - // Not yet exposed in the vscode.d.ts - // https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456 - runOptions: ({ - runOn: 2 // RunOnOptions.folderOpen - } as unknown) as vscode.RunOptions -}; - /** * Interactively asks the user whether we should run `cargo check` in order to * provide inline diagnostics; the user is met with a series of dialog boxes * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ -export async function interactivelyStartCargoWatch() { +export async function interactivelyStartCargoWatch(context: vscode.ExtensionContext) { + if (Server.config.enableCargoWatchOnStartup === 'disabled') { return; } @@ -212,5 +195,7 @@ export async function interactivelyStartCargoWatch() { } } - vscode.tasks.executeTask(autoCargoWatchTask); + + let validater = new CargoWatchProvider(); + validater.activate(context.subscriptions); } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 2e13c87d..5cbf285e 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { interactivelyStartCargoWatch } from './commands/runnables'; +import { interactivelyStartCargoWatch} from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; @@ -121,7 +121,7 @@ export function activate(context: vscode.ExtensionContext) { ); // Executing `cargo watch` provides us with inline diagnostics on save - interactivelyStartCargoWatch(); + interactivelyStartCargoWatch(context); // Start the language server, finally! Server.start(allNotifications); From 4704f2dcf962686c27ec6be64a34ea60408b1838 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 31 Mar 2019 20:51:17 +0800 Subject: [PATCH 092/819] Fix tslint error --- .../editors/code/src/commands/cargo_watch.ts | 91 ++++++------------- .../editors/code/src/commands/watch_status.ts | 37 ++++++++ 2 files changed, 65 insertions(+), 63 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands/watch_status.ts diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 55a1909c..c6ce6ba0 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -1,61 +1,24 @@ import * as child_process from 'child_process'; import * as path from 'path'; +import * as timers from 'timers'; import * as vscode from 'vscode'; -import { setInterval } from 'timers'; - -const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; - -class StatusDisplay { - private i = 0; - private statusBarItem: vscode.StatusBarItem; - private timer?: NodeJS.Timeout; - - constructor(subscriptions: vscode.Disposable[]) { - this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); - subscriptions.push(this.statusBarItem); - this.statusBarItem.hide(); - } - - public show() { - this.timer = this.timer || setInterval(() => { - this.statusBarItem!.text = "cargo check " + this.frame(); - }, 300); - - this.statusBarItem!.show(); - } - - public hide() { - if(this.timer) { - clearInterval(this.timer); - this.timer = undefined; - } - - this.statusBarItem!.hide(); - } - - frame() { - return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; - } -} +import {StatusDisplay} from './watch_status'; export class CargoWatchProvider { private diagnosticCollection?: vscode.DiagnosticCollection; private cargoProcess?: child_process.ChildProcess; - private outBuffer: string = ""; - private statusDisplay? : StatusDisplay; - - constructor() { - } + private outBuffer: string = ''; + private statusDisplay?: StatusDisplay; public activate(subscriptions: vscode.Disposable[]) { subscriptions.push(this); - this.diagnosticCollection = vscode.languages.createDiagnosticCollection("rustc"); + this.diagnosticCollection = vscode.languages.createDiagnosticCollection('rustc'); this.statusDisplay = new StatusDisplay(subscriptions); // Start the cargo watch with json message this.cargoProcess = child_process.spawn('cargo', - ["watch", "-x", "\"check --message-format json\""], + ['watch', '-x', '\"check --message-format json\"'], { // stdio: ['ignore', 'pipe', 'ignore'], shell: true, @@ -68,11 +31,11 @@ export class CargoWatchProvider { }); this.cargoProcess.stderr.on('data', (s: string) => { - console.error('Error on cargo watch : ' + s); + // console.error('Error on cargo watch : ' + s); }); this.cargoProcess.on('error', (err: Error) => { - console.error('Error on spawn cargo process : ' + err); + // console.error('Error on spawn cargo process : ' + err); }); } @@ -87,22 +50,24 @@ export class CargoWatchProvider { } } - parseLine(line: string) { - if (line.startsWith("[Running")) { + private parseLine(line: string) { + if (line.startsWith('[Running')) { this.diagnosticCollection!.clear(); this.statusDisplay!.show(); } - if (line.startsWith("[Finished running")) { + if (line.startsWith('[Finished running')) { this.statusDisplay!.hide(); } function getLevel(s: string): vscode.DiagnosticSeverity { - if (s === "error") + if (s === 'error') { return vscode.DiagnosticSeverity.Error; + } - if (s.startsWith("warn")) + if (s.startsWith('warn')) { return vscode.DiagnosticSeverity.Warning; + } return vscode.DiagnosticSeverity.Information; } @@ -117,51 +82,51 @@ export class CargoWatchProvider { } // Only handle compiler-message now - if (data.reason !== "compiler-message") { + if (data.reason !== 'compiler-message') { return; } let spans: any[] = data.message.spans; spans = spans.filter(o => o.is_primary); - let file_name = null; // We only handle primary span right now. if (spans.length > 0) { - let o = spans[0]; + const o = spans[0]; - console.log("o", o); - let rendered = data.message.rendered; - let level = getLevel(data.message.level); - let range = new vscode.Range( + const rendered = data.message.rendered; + const level = getLevel(data.message.level); + const range = new vscode.Range( new vscode.Position(o.line_start - 1, o.column_start - 1), new vscode.Position(o.line_end - 1, o.column_end - 1) ); - file_name = path.join(vscode.workspace.rootPath!, o.file_name); + const fileName = path.join(vscode.workspace.rootPath!, o.file_name); const diagnostic = new vscode.Diagnostic(range, rendered, level); diagnostic.source = 'rustc'; diagnostic.code = data.message.code.code; diagnostic.relatedInformation = []; - let fileUrl = vscode.Uri.file(file_name!); + const fileUrl = vscode.Uri.file(fileName!); - let diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; + const diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; diagnostics.push(diagnostic); this.diagnosticCollection!.set(fileUrl, diagnostics); } } - processOutput(chunk: string) { + private processOutput(chunk: string) { // The stdout is not line based, convert it to line based for proceess. this.outBuffer += chunk; - let eolIndex; - while ((eolIndex = this.outBuffer.indexOf('\n')) >= 0) { + let eolIndex = this.outBuffer.indexOf('\n'); + while (eolIndex >= 0) { // line includes the EOL const line = this.outBuffer.slice(0, eolIndex + 1); this.parseLine(line); this.outBuffer = this.outBuffer.slice(eolIndex + 1); + + eolIndex = this.outBuffer.indexOf('\n'); } } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts new file mode 100644 index 00000000..0943e853 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -0,0 +1,37 @@ +import * as timers from 'timers'; +import * as vscode from 'vscode'; + +const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; + +export class StatusDisplay { + private i = 0; + private statusBarItem: vscode.StatusBarItem; + private timer?: NodeJS.Timeout; + + constructor(subscriptions: vscode.Disposable[]) { + this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); + subscriptions.push(this.statusBarItem); + this.statusBarItem.hide(); + } + + public show() { + this.timer = this.timer || setInterval(() => { + this.statusBarItem!.text = 'cargo check ' + this.frame(); + }, 300); + + this.statusBarItem!.show(); + } + + public hide() { + if (this.timer) { + clearInterval(this.timer); + this.timer = undefined; + } + + this.statusBarItem!.hide(); + } + + private frame() { + return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; + } +} \ No newline at end of file From 780741126203775626e54d8a169878bd2cfd6bea Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 31 Mar 2019 21:01:51 +0800 Subject: [PATCH 093/819] Fixed tslint error --- rust-analyzer/editors/code/src/commands/runnables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 722db158..0adb85d5 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -196,6 +196,6 @@ export async function interactivelyStartCargoWatch(context: vscode.ExtensionCont } - let validater = new CargoWatchProvider(); + const validater = new CargoWatchProvider(); validater.activate(context.subscriptions); } From 165503a106106521557cf447feeca6840ae7a40e Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 31 Mar 2019 21:21:14 +0800 Subject: [PATCH 094/819] Fix prettier error --- .../editors/code/src/commands/cargo_watch.ts | 26 +++++++++++-------- .../editors/code/src/commands/runnables.ts | 8 +++--- .../editors/code/src/commands/watch_status.ts | 17 +++++++----- rust-analyzer/editors/code/src/extension.ts | 2 +- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index c6ce6ba0..037f1e30 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -2,7 +2,7 @@ import * as child_process from 'child_process'; import * as path from 'path'; import * as timers from 'timers'; import * as vscode from 'vscode'; -import {StatusDisplay} from './watch_status'; +import { StatusDisplay } from './watch_status'; export class CargoWatchProvider { private diagnosticCollection?: vscode.DiagnosticCollection; @@ -12,19 +12,22 @@ export class CargoWatchProvider { public activate(subscriptions: vscode.Disposable[]) { subscriptions.push(this); - this.diagnosticCollection = vscode.languages.createDiagnosticCollection('rustc'); + this.diagnosticCollection = vscode.languages.createDiagnosticCollection( + 'rustc' + ); this.statusDisplay = new StatusDisplay(subscriptions); - // Start the cargo watch with json message - this.cargoProcess = child_process.spawn('cargo', - ['watch', '-x', '\"check --message-format json\"'], + // Start the cargo watch with json message + this.cargoProcess = child_process.spawn( + 'cargo', + ['watch', '-x', '"check --message-format json"'], { - // stdio: ['ignore', 'pipe', 'ignore'], + // stdio: ['ignore', 'pipe', 'ignore'], shell: true, - cwd: vscode.workspace.rootPath, - }); - + cwd: vscode.workspace.rootPath + } + ); this.cargoProcess.stdout.on('data', (s: string) => { this.processOutput(s); @@ -109,7 +112,9 @@ export class CargoWatchProvider { const fileUrl = vscode.Uri.file(fileName!); - const diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; + const diagnostics: vscode.Diagnostic[] = [ + ...(this.diagnosticCollection!.get(fileUrl) || []) + ]; diagnostics.push(diagnostic); this.diagnosticCollection!.set(fileUrl, diagnostics); @@ -129,5 +134,4 @@ export class CargoWatchProvider { eolIndex = this.outBuffer.indexOf('\n'); } } - } diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 0adb85d5..7bba6f9c 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -134,8 +134,9 @@ export async function handleSingle(runnable: Runnable) { * provide inline diagnostics; the user is met with a series of dialog boxes * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ -export async function interactivelyStartCargoWatch(context: vscode.ExtensionContext) { - +export async function interactivelyStartCargoWatch( + context: vscode.ExtensionContext +) { if (Server.config.enableCargoWatchOnStartup === 'disabled') { return; } @@ -195,7 +196,6 @@ export async function interactivelyStartCargoWatch(context: vscode.ExtensionCont } } - const validater = new CargoWatchProvider(); - validater.activate(context.subscriptions); + validater.activate(context.subscriptions); } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 0943e853..1b0611ce 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -9,15 +9,20 @@ export class StatusDisplay { private timer?: NodeJS.Timeout; constructor(subscriptions: vscode.Disposable[]) { - this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); + this.statusBarItem = vscode.window.createStatusBarItem( + vscode.StatusBarAlignment.Left, + 10 + ); subscriptions.push(this.statusBarItem); this.statusBarItem.hide(); } public show() { - this.timer = this.timer || setInterval(() => { - this.statusBarItem!.text = 'cargo check ' + this.frame(); - }, 300); + this.timer = + this.timer || + setInterval(() => { + this.statusBarItem!.text = 'cargo check ' + this.frame(); + }, 300); this.statusBarItem!.show(); } @@ -32,6 +37,6 @@ export class StatusDisplay { } private frame() { - return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; + return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; } -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 5cbf285e..ef83c0b8 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { interactivelyStartCargoWatch} from './commands/runnables'; +import { interactivelyStartCargoWatch } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; From 13fbd1d8ede2c3cc449f8bf68a763b5f405e8d37 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 01:11:22 +0800 Subject: [PATCH 095/819] Add proper process teminate method --- rust-analyzer/editors/code/package-lock.json | 51 +++++++++++++++++++ rust-analyzer/editors/code/package.json | 5 +- .../editors/code/src/commands/cargo_watch.ts | 17 ++++--- .../editors/code/src/commands/watch_status.ts | 1 - .../editors/code/src/utils/processes.ts | 40 +++++++++++++++ .../code/src/utils/terminateProcess.sh | 12 +++++ 6 files changed, 116 insertions(+), 10 deletions(-) create mode 100644 rust-analyzer/editors/code/src/utils/processes.ts create mode 100644 rust-analyzer/editors/code/src/utils/terminateProcess.sh diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5a0d21e7..008df6f5 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -607,6 +607,12 @@ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -1121,6 +1127,12 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, "is": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", @@ -1791,6 +1803,15 @@ "util-deprecate": "^1.0.1" } }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, "remove-bom-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", @@ -1902,6 +1923,36 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", + "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", + "dev": true, + "requires": { + "es6-object-assign": "^1.0.3", + "minimist": "^1.2.0", + "shelljs": "^0.8.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 240aff6c..ba9c9433 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,7 +18,7 @@ "scripts": { "vscode:prepublish": "npm run compile", "package": "vsce package", - "compile": "tsc -p ./", + "compile": "tsc -p ./ && shx cp src/utils/terminateProcess.sh out/utils/terminateProcess.sh", "watch": "tsc -watch -p ./", "postinstall": "node ./node_modules/vscode/bin/install", "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", @@ -41,7 +41,8 @@ "tslint-config-prettier": "^1.18.0", "typescript": "^3.3.1", "vsce": "^1.57.0", - "vscode": "^1.1.29" + "vscode": "^1.1.29", + "shx": "^0.3.1" }, "activationEvents": [ "onLanguage:rust", diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 037f1e30..e51cac78 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -1,9 +1,10 @@ import * as child_process from 'child_process'; import * as path from 'path'; -import * as timers from 'timers'; import * as vscode from 'vscode'; +import { terminate } from '../utils/processes'; import { StatusDisplay } from './watch_status'; + export class CargoWatchProvider { private diagnosticCollection?: vscode.DiagnosticCollection; private cargoProcess?: child_process.ChildProcess; @@ -21,24 +22,25 @@ export class CargoWatchProvider { // Start the cargo watch with json message this.cargoProcess = child_process.spawn( 'cargo', - ['watch', '-x', '"check --message-format json"'], + ['watch', '-x', '\"check --message-format json\"'], { - // stdio: ['ignore', 'pipe', 'ignore'], - shell: true, - cwd: vscode.workspace.rootPath + stdio: ['ignore', 'pipe', 'pipe'], + cwd: vscode.workspace.rootPath, + windowsVerbatimArguments: true, } ); this.cargoProcess.stdout.on('data', (s: string) => { this.processOutput(s); + console.log(s); }); this.cargoProcess.stderr.on('data', (s: string) => { - // console.error('Error on cargo watch : ' + s); + console.error('Error on cargo watch : ' + s); }); this.cargoProcess.on('error', (err: Error) => { - // console.error('Error on spawn cargo process : ' + err); + console.error('Error on spawn cargo process : ' + err); }); } @@ -50,6 +52,7 @@ export class CargoWatchProvider { if (this.cargoProcess) { this.cargoProcess.kill(); + terminate(this.cargoProcess); } } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 1b0611ce..f027d7bb 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -1,4 +1,3 @@ -import * as timers from 'timers'; import * as vscode from 'vscode'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts new file mode 100644 index 00000000..09fdf6e2 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/processes.ts @@ -0,0 +1,40 @@ +'use strict'; + +import * as cp from 'child_process'; +import ChildProcess = cp.ChildProcess; + +import { join } from 'path'; + +const isWindows = (process.platform === 'win32'); +const isMacintosh = (process.platform === 'darwin'); +const isLinux = (process.platform === 'linux'); +export function terminate(process: ChildProcess, cwd?: string): boolean { + if (isWindows) { + try { + // This we run in Atom execFileSync is available. + // Ignore stderr since this is otherwise piped to parent.stderr + // which might be already closed. + const options: any = { + stdio: ['pipe', 'pipe', 'ignore'] + }; + if (cwd) { + options.cwd = cwd + } + (cp).execFileSync('taskkill', ['/T', '/F', '/PID', process.pid.toString()], options); + return true; + } catch (err) { + return false; + } + } else if (isLinux || isMacintosh) { + try { + const cmd = join(__dirname, 'terminateProcess.sh'); + const result = cp.spawnSync(cmd, [process.pid.toString()]); + return result.error ? false : true; + } catch (err) { + return false; + } + } else { + process.kill('SIGKILL'); + return true; + } +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/utils/terminateProcess.sh b/rust-analyzer/editors/code/src/utils/terminateProcess.sh new file mode 100644 index 00000000..2ec9e1c2 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/terminateProcess.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +terminateTree() { + for cpid in $(pgrep -P $1); do + terminateTree $cpid + done + kill -9 $1 > /dev/null 2>&1 +} + +for pid in $*; do + terminateTree $pid +done \ No newline at end of file From 3fa9b57d2af495b4b05854d57511cf93e6a3d2f2 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 13:07:40 +0800 Subject: [PATCH 096/819] Add config for cargo-watch trace --- rust-analyzer/editors/code/package.json | 11 +++++ .../editors/code/src/commands/cargo_watch.ts | 41 +++++++++++++++---- .../editors/code/src/commands/runnables.ts | 4 +- rust-analyzer/editors/code/src/config.ts | 25 ++++++++--- 4 files changed, 66 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ba9c9433..cc364d47 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -194,6 +194,17 @@ ], "default": "off", "description": "Trace requests to the ra_lsp_server" + }, + "rust-analyzer.trace.cargo-watch": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "error", + "verbose" + ], + "default": "off", + "description": "Trace output of cargo-watch" } } }, diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index e51cac78..9864ce01 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -1,6 +1,7 @@ import * as child_process from 'child_process'; import * as path from 'path'; import * as vscode from 'vscode'; +import { Server } from '../server'; import { terminate } from '../utils/processes'; import { StatusDisplay } from './watch_status'; @@ -10,6 +11,7 @@ export class CargoWatchProvider { private cargoProcess?: child_process.ChildProcess; private outBuffer: string = ''; private statusDisplay?: StatusDisplay; + private outputChannel?: vscode.OutputChannel; public activate(subscriptions: vscode.Disposable[]) { subscriptions.push(this); @@ -18,7 +20,10 @@ export class CargoWatchProvider { ); this.statusDisplay = new StatusDisplay(subscriptions); - + this.outputChannel = vscode.window.createOutputChannel( + 'Cargo Watch Trace' + ); + // Start the cargo watch with json message this.cargoProcess = child_process.spawn( 'cargo', @@ -31,17 +36,23 @@ export class CargoWatchProvider { ); this.cargoProcess.stdout.on('data', (s: string) => { - this.processOutput(s); - console.log(s); + this.processOutput(s, (line) => { + this.logInfo(line); + this.parseLine(line); + }); }); this.cargoProcess.stderr.on('data', (s: string) => { - console.error('Error on cargo watch : ' + s); + this.processOutput(s, (line) => { + this.logError('Error on cargo-watch : {\n' + line + '}\n' ); + }); }); this.cargoProcess.on('error', (err: Error) => { - console.error('Error on spawn cargo process : ' + err); + this.logError('Error on cargo-watch process : {\n' + err.message + '}\n'); }); + + this.logInfo('cargo-watch started.'); } public dispose(): void { @@ -54,6 +65,22 @@ export class CargoWatchProvider { this.cargoProcess.kill(); terminate(this.cargoProcess); } + + if(this.outputChannel) { + this.outputChannel.dispose(); + } + } + + private logInfo(line: string) { + if (Server.config.cargoWatchOptions.trace === 'verbose') { + this.outputChannel!.append(line); + } + } + + private logError(line: string) { + if (Server.config.cargoWatchOptions.trace === 'error' || Server.config.cargoWatchOptions.trace === 'verbose' ) { + this.outputChannel!.append(line); + } } private parseLine(line: string) { @@ -124,14 +151,14 @@ export class CargoWatchProvider { } } - private processOutput(chunk: string) { + private processOutput(chunk: string, cb: (line: string) => void ) { // The stdout is not line based, convert it to line based for proceess. this.outBuffer += chunk; let eolIndex = this.outBuffer.indexOf('\n'); while (eolIndex >= 0) { // line includes the EOL const line = this.outBuffer.slice(0, eolIndex + 1); - this.parseLine(line); + cb(line); this.outBuffer = this.outBuffer.slice(eolIndex + 1); eolIndex = this.outBuffer.indexOf('\n'); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 7bba6f9c..3589edce 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -137,11 +137,11 @@ export async function handleSingle(runnable: Runnable) { export async function interactivelyStartCargoWatch( context: vscode.ExtensionContext ) { - if (Server.config.enableCargoWatchOnStartup === 'disabled') { + if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { return; } - if (Server.config.enableCargoWatchOnStartup === 'ask') { + if (Server.config.cargoWatchOptions.enableOnStartup === 'ask') { const watch = await vscode.window.showInformationMessage( 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', 'yes', diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 42058906..c95d1387 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -4,14 +4,20 @@ import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; -export type CargoWatchOptions = 'ask' | 'enabled' | 'disabled'; +export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; +export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; + +export interface CargoWatchOptions { + enableOnStartup: CargoWatchStartupOptions, + trace: CargoWatchTraceOptions, +}; export class Config { public highlightingOn = true; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; - public enableCargoWatchOnStartup: CargoWatchOptions = 'ask'; + public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off' }; private prevEnhancedTyping: null | boolean = null; @@ -73,10 +79,17 @@ export class Config { } if (config.has('enableCargoWatchOnStartup')) { - this.enableCargoWatchOnStartup = config.get( - 'enableCargoWatchOnStartup', - 'ask' - ); + this.cargoWatchOptions.enableOnStartup = + config.get( + 'enableCargoWatchOnStartup', + 'ask' + ); + this.cargoWatchOptions.trace = + config.get( + 'trace.cargo-watch', + 'off' + ); + } } } From 0d7323cce50fd76f3bfc9b945040d52767ff32e4 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 14:43:02 +0800 Subject: [PATCH 097/819] Add cargo-watch.check-arguments --- rust-analyzer/editors/code/package.json | 10 +++ .../editors/code/src/commands/cargo_watch.ts | 78 ++++++++++++------- .../editors/code/src/commands/line_buffer.ts | 16 ++++ rust-analyzer/editors/code/src/config.ts | 39 ++++++---- .../editors/code/src/utils/processes.ts | 68 ++++++++-------- 5 files changed, 137 insertions(+), 74 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands/line_buffer.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index cc364d47..1c8caaa6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -184,6 +184,11 @@ ], "description": "Whether to run `cargo watch` on startup" }, + "rust-analyzer.cargo-watch.check-arguments": { + "type": "string", + "description": "`cargo-watch` check arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", + "default": "" + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", @@ -192,6 +197,11 @@ "messages", "verbose" ], + "enumDescriptions": [ + "No traces", + "Error only", + "Full log" + ], "default": "off", "description": "Trace requests to the ra_lsp_server" }, diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 9864ce01..fb8fcaeb 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -3,9 +3,9 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { Server } from '../server'; import { terminate } from '../utils/processes'; +import { LineBuffer } from './line_buffer'; import { StatusDisplay } from './watch_status'; - export class CargoWatchProvider { private diagnosticCollection?: vscode.DiagnosticCollection; private cargoProcess?: child_process.ChildProcess; @@ -23,33 +23,44 @@ export class CargoWatchProvider { this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); - + + let args = '"check --message-format json'; + if (Server.config.cargoWatchOptions.checkArguments.length > 0) { + // Excape the double quote string: + args += ' ' + Server.config.cargoWatchOptions.checkArguments; + } + args += '"'; + // Start the cargo watch with json message this.cargoProcess = child_process.spawn( 'cargo', - ['watch', '-x', '\"check --message-format json\"'], + ['watch', '-x', args], { stdio: ['ignore', 'pipe', 'pipe'], cwd: vscode.workspace.rootPath, - windowsVerbatimArguments: true, + windowsVerbatimArguments: true } ); + const stdoutData = new LineBuffer(); this.cargoProcess.stdout.on('data', (s: string) => { - this.processOutput(s, (line) => { + stdoutData.processOutput(s, line => { this.logInfo(line); this.parseLine(line); }); }); + const stderrData = new LineBuffer(); this.cargoProcess.stderr.on('data', (s: string) => { - this.processOutput(s, (line) => { - this.logError('Error on cargo-watch : {\n' + line + '}\n' ); + stderrData.processOutput(s, line => { + this.logError('Error on cargo-watch : {\n' + line + '}\n'); }); }); this.cargoProcess.on('error', (err: Error) => { - this.logError('Error on cargo-watch process : {\n' + err.message + '}\n'); + this.logError( + 'Error on cargo-watch process : {\n' + err.message + '}\n' + ); }); this.logInfo('cargo-watch started.'); @@ -66,7 +77,7 @@ export class CargoWatchProvider { terminate(this.cargoProcess); } - if(this.outputChannel) { + if (this.outputChannel) { this.outputChannel.dispose(); } } @@ -74,13 +85,16 @@ export class CargoWatchProvider { private logInfo(line: string) { if (Server.config.cargoWatchOptions.trace === 'verbose') { this.outputChannel!.append(line); - } + } } private logError(line: string) { - if (Server.config.cargoWatchOptions.trace === 'error' || Server.config.cargoWatchOptions.trace === 'verbose' ) { + if ( + Server.config.cargoWatchOptions.trace === 'error' || + Server.config.cargoWatchOptions.trace === 'verbose' + ) { this.outputChannel!.append(line); - } + } } private parseLine(line: string) { @@ -105,12 +119,32 @@ export class CargoWatchProvider { return vscode.DiagnosticSeverity.Information; } + interface ErrorSpan { + line_start: number; + line_end: number; + column_start: number; + column_end: number; + } + + interface ErrorMessage { + reason: string; + message: { + spans: ErrorSpan[]; + rendered: string; + level: string; + code?: { + code: string; + }; + }; + } + // cargo-watch itself output non json format // Ignore these lines - let data = null; + let data: ErrorMessage; try { data = JSON.parse(line.trim()); } catch (error) { + this.logError(`Fail to pass to json : { ${error} }`); return; } @@ -137,7 +171,9 @@ export class CargoWatchProvider { const diagnostic = new vscode.Diagnostic(range, rendered, level); diagnostic.source = 'rustc'; - diagnostic.code = data.message.code.code; + diagnostic.code = data.message.code + ? data.message.code.code + : undefined; diagnostic.relatedInformation = []; const fileUrl = vscode.Uri.file(fileName!); @@ -150,18 +186,4 @@ export class CargoWatchProvider { this.diagnosticCollection!.set(fileUrl, diagnostics); } } - - private processOutput(chunk: string, cb: (line: string) => void ) { - // The stdout is not line based, convert it to line based for proceess. - this.outBuffer += chunk; - let eolIndex = this.outBuffer.indexOf('\n'); - while (eolIndex >= 0) { - // line includes the EOL - const line = this.outBuffer.slice(0, eolIndex + 1); - cb(line); - this.outBuffer = this.outBuffer.slice(eolIndex + 1); - - eolIndex = this.outBuffer.indexOf('\n'); - } - } } diff --git a/rust-analyzer/editors/code/src/commands/line_buffer.ts b/rust-analyzer/editors/code/src/commands/line_buffer.ts new file mode 100644 index 00000000..fb5b9f7f --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/line_buffer.ts @@ -0,0 +1,16 @@ +export class LineBuffer { + private outBuffer: string = ''; + + public processOutput(chunk: string, cb: (line: string) => void) { + this.outBuffer += chunk; + let eolIndex = this.outBuffer.indexOf('\n'); + while (eolIndex >= 0) { + // line includes the EOL + const line = this.outBuffer.slice(0, eolIndex + 1); + cb(line); + this.outBuffer = this.outBuffer.slice(eolIndex + 1); + + eolIndex = this.outBuffer.indexOf('\n'); + } + } +} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c95d1387..481a5e5f 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -8,16 +8,21 @@ export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; export interface CargoWatchOptions { - enableOnStartup: CargoWatchStartupOptions, - trace: CargoWatchTraceOptions, -}; + enableOnStartup: CargoWatchStartupOptions; + checkArguments: string; + trace: CargoWatchTraceOptions; +} export class Config { public highlightingOn = true; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; - public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off' }; + public cargoWatchOptions: CargoWatchOptions = { + enableOnStartup: 'ask', + trace: 'off', + checkArguments: '' + }; private prevEnhancedTyping: null | boolean = null; @@ -79,17 +84,23 @@ export class Config { } if (config.has('enableCargoWatchOnStartup')) { - this.cargoWatchOptions.enableOnStartup = - config.get( - 'enableCargoWatchOnStartup', - 'ask' - ); - this.cargoWatchOptions.trace = - config.get( - 'trace.cargo-watch', - 'off' - ); + this.cargoWatchOptions.enableOnStartup = config.get< + CargoWatchStartupOptions + >('enableCargoWatchOnStartup', 'ask'); + } + + if (config.has('trace.cargo-watch')) { + this.cargoWatchOptions.trace = config.get( + 'trace.cargo-watch', + 'off' + ); + } + if (config.has('cargo-watch.check-arguments')) { + this.cargoWatchOptions.checkArguments = config.get( + 'cargo-watch.check-arguments', + '' + ); } } } diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts index 09fdf6e2..d4c2c877 100644 --- a/rust-analyzer/editors/code/src/utils/processes.ts +++ b/rust-analyzer/editors/code/src/utils/processes.ts @@ -5,36 +5,40 @@ import ChildProcess = cp.ChildProcess; import { join } from 'path'; -const isWindows = (process.platform === 'win32'); -const isMacintosh = (process.platform === 'darwin'); -const isLinux = (process.platform === 'linux'); +const isWindows = process.platform === 'win32'; +const isMacintosh = process.platform === 'darwin'; +const isLinux = process.platform === 'linux'; export function terminate(process: ChildProcess, cwd?: string): boolean { - if (isWindows) { - try { - // This we run in Atom execFileSync is available. - // Ignore stderr since this is otherwise piped to parent.stderr - // which might be already closed. - const options: any = { - stdio: ['pipe', 'pipe', 'ignore'] - }; - if (cwd) { - options.cwd = cwd - } - (cp).execFileSync('taskkill', ['/T', '/F', '/PID', process.pid.toString()], options); - return true; - } catch (err) { - return false; - } - } else if (isLinux || isMacintosh) { - try { - const cmd = join(__dirname, 'terminateProcess.sh'); - const result = cp.spawnSync(cmd, [process.pid.toString()]); - return result.error ? false : true; - } catch (err) { - return false; - } - } else { - process.kill('SIGKILL'); - return true; - } -} \ No newline at end of file + if (isWindows) { + try { + // This we run in Atom execFileSync is available. + // Ignore stderr since this is otherwise piped to parent.stderr + // which might be already closed. + const options: any = { + stdio: ['pipe', 'pipe', 'ignore'] + }; + if (cwd) { + options.cwd = cwd; + } + cp.execFileSync( + 'taskkill', + ['/T', '/F', '/PID', process.pid.toString()], + options + ); + return true; + } catch (err) { + return false; + } + } else if (isLinux || isMacintosh) { + try { + const cmd = join(__dirname, 'terminateProcess.sh'); + const result = cp.spawnSync(cmd, [process.pid.toString()]); + return result.error ? false : true; + } catch (err) { + return false; + } + } else { + process.kill('SIGKILL'); + return true; + } +} From b7e41756be6f5d91a8b97f53aee72fa6240c7d36 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 14:58:58 +0800 Subject: [PATCH 098/819] Add Cargo.toml file check before cargo watch start --- .../editors/code/src/commands/cargo_watch.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index fb8fcaeb..6d8e4d88 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -1,4 +1,5 @@ import * as child_process from 'child_process'; +import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import { Server } from '../server'; @@ -14,6 +15,27 @@ export class CargoWatchProvider { private outputChannel?: vscode.OutputChannel; public activate(subscriptions: vscode.Disposable[]) { + let cargoExists = false; + const cargoTomlFile = path.join( + vscode.workspace.rootPath!, + 'Cargo.toml' + ); + // Check if the working directory is valid cargo root path + try { + if (fs.existsSync(cargoTomlFile)) { + cargoExists = true; + } + } catch (err) { + cargoExists = false; + } + + if (!cargoExists) { + vscode.window.showErrorMessage( + `Couldn\'t find \'Cargo.toml\' in ${cargoTomlFile}` + ); + return; + } + subscriptions.push(this); this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 'rustc' From c3191cbefc8e26b8383c9b0d3497ec46a40d6ca9 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 17:13:14 +0800 Subject: [PATCH 099/819] Add terminate process implemntation note --- rust-analyzer/editors/code/src/utils/processes.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts index d4c2c877..f62e2a34 100644 --- a/rust-analyzer/editors/code/src/utils/processes.ts +++ b/rust-analyzer/editors/code/src/utils/processes.ts @@ -8,6 +8,13 @@ import { join } from 'path'; const isWindows = process.platform === 'win32'; const isMacintosh = process.platform === 'darwin'; const isLinux = process.platform === 'linux'; + +// this is very complex, but is basically copy-pased from VSCode implementation here: +// https://github.com/Microsoft/vscode-languageserver-node/blob/dbfd37e35953ad0ee14c4eeced8cfbc41697b47e/client/src/utils/processes.ts#L15 + +// And see discussion at +// https://github.com/rust-analyzer/rust-analyzer/pull/1079#issuecomment-478908109 + export function terminate(process: ChildProcess, cwd?: string): boolean { if (isWindows) { try { From a92806c456a82a51e5aa4cbb044c57a8e12e7c1b Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 2 Apr 2019 17:43:09 +0800 Subject: [PATCH 100/819] Fix prettier error --- rust-analyzer/editors/code/src/utils/processes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts index f62e2a34..da8be9eb 100644 --- a/rust-analyzer/editors/code/src/utils/processes.ts +++ b/rust-analyzer/editors/code/src/utils/processes.ts @@ -12,7 +12,7 @@ const isLinux = process.platform === 'linux'; // this is very complex, but is basically copy-pased from VSCode implementation here: // https://github.com/Microsoft/vscode-languageserver-node/blob/dbfd37e35953ad0ee14c4eeced8cfbc41697b47e/client/src/utils/processes.ts#L15 -// And see discussion at +// And see discussion at // https://github.com/rust-analyzer/rust-analyzer/pull/1079#issuecomment-478908109 export function terminate(process: ChildProcess, cwd?: string): boolean { From 3f38696a01787ed4a2ebb38b889d011bc5f6c984 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 3 Apr 2019 01:46:47 +0800 Subject: [PATCH 101/819] Add cargo-watch package animation and refactoring --- .../editors/code/src/commands/cargo_watch.ts | 110 +++++++++++------- .../editors/code/src/commands/watch_status.ts | 12 +- 2 files changed, 78 insertions(+), 44 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 6d8e4d88..d45d0e7d 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -68,7 +68,11 @@ export class CargoWatchProvider { this.cargoProcess.stdout.on('data', (s: string) => { stdoutData.processOutput(s, line => { this.logInfo(line); - this.parseLine(line); + try { + this.parseLine(line); + } catch (err) { + this.logError(`Failed to parse: ${err}, content : ${line}`); + } }); }); @@ -133,79 +137,99 @@ export class CargoWatchProvider { if (s === 'error') { return vscode.DiagnosticSeverity.Error; } - if (s.startsWith('warn')) { return vscode.DiagnosticSeverity.Warning; } - return vscode.DiagnosticSeverity.Information; } - interface ErrorSpan { + // Reference: + // https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs + interface RustDiagnosticSpan { line_start: number; line_end: number; column_start: number; column_end: number; + is_primary: boolean; + file_name: string; } - interface ErrorMessage { - reason: string; - message: { - spans: ErrorSpan[]; - rendered: string; - level: string; - code?: { - code: string; - }; + interface RustDiagnostic { + spans: RustDiagnosticSpan[]; + rendered: string; + level: string; + code?: { + code: string; }; } + interface CargoArtifact { + reason: string; + package_id: string; + } + + // https://github.com/rust-lang/cargo/blob/master/src/cargo/util/machine_message.rs + interface CargoMessage { + reason: string; + package_id: string; + message: RustDiagnostic; + } + // cargo-watch itself output non json format // Ignore these lines - let data: ErrorMessage; + let data: CargoMessage; try { data = JSON.parse(line.trim()); } catch (error) { - this.logError(`Fail to pass to json : { ${error} }`); + this.logError(`Fail to parse to json : { ${error} }`); return; } - // Only handle compiler-message now - if (data.reason !== 'compiler-message') { - return; - } + if (data.reason === 'compiler-artifact') { + const msg = data as CargoArtifact; - let spans: any[] = data.message.spans; - spans = spans.filter(o => o.is_primary); + // The format of the package_id is "{name} {version} ({source_id})", + // https://github.com/rust-lang/cargo/blob/37ad03f86e895bb80b474c1c088322634f4725f5/src/cargo/core/package_id.rs#L53 + this.statusDisplay!.packageName = msg.package_id.split(' ')[0]; + } else if (data.reason === 'compiler-message') { + const msg = data.message as RustDiagnostic; - // We only handle primary span right now. - if (spans.length > 0) { - const o = spans[0]; + const spans = msg.spans.filter(o => o.is_primary); - const rendered = data.message.rendered; - const level = getLevel(data.message.level); - const range = new vscode.Range( - new vscode.Position(o.line_start - 1, o.column_start - 1), - new vscode.Position(o.line_end - 1, o.column_end - 1) - ); + // We only handle primary span right now. + if (spans.length > 0) { + const o = spans[0]; + + const rendered = msg.rendered; + const level = getLevel(msg.level); + const range = new vscode.Range( + new vscode.Position(o.line_start - 1, o.column_start - 1), + new vscode.Position(o.line_end - 1, o.column_end - 1) + ); - const fileName = path.join(vscode.workspace.rootPath!, o.file_name); - const diagnostic = new vscode.Diagnostic(range, rendered, level); + const fileName = path.join( + vscode.workspace.rootPath!, + o.file_name + ); + const diagnostic = new vscode.Diagnostic( + range, + rendered, + level + ); - diagnostic.source = 'rustc'; - diagnostic.code = data.message.code - ? data.message.code.code - : undefined; - diagnostic.relatedInformation = []; + diagnostic.source = 'rustc'; + diagnostic.code = msg.code ? msg.code.code : undefined; + diagnostic.relatedInformation = []; - const fileUrl = vscode.Uri.file(fileName!); + const fileUrl = vscode.Uri.file(fileName!); - const diagnostics: vscode.Diagnostic[] = [ - ...(this.diagnosticCollection!.get(fileUrl) || []) - ]; - diagnostics.push(diagnostic); + const diagnostics: vscode.Diagnostic[] = [ + ...(this.diagnosticCollection!.get(fileUrl) || []) + ]; + diagnostics.push(diagnostic); - this.diagnosticCollection!.set(fileUrl, diagnostics); + this.diagnosticCollection!.set(fileUrl, diagnostics); + } } } } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index f027d7bb..86ae821d 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -3,6 +3,8 @@ import * as vscode from 'vscode'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export class StatusDisplay { + public packageName?: string; + private i = 0; private statusBarItem: vscode.StatusBarItem; private timer?: NodeJS.Timeout; @@ -17,10 +19,18 @@ export class StatusDisplay { } public show() { + this.packageName = undefined; + this.timer = this.timer || setInterval(() => { - this.statusBarItem!.text = 'cargo check ' + this.frame(); + if (this.packageName) { + this.statusBarItem!.text = `cargo check [${ + this.packageName + }] ${this.frame()}`; + } else { + this.statusBarItem!.text = `cargo check ${this.frame()}`; + } }, 300); this.statusBarItem!.show(); From b7559fc4ef0609aef48cff14befa6b7a0295a7c6 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 09:50:38 +0200 Subject: [PATCH 102/819] Fix VSCode cargo-watch functionality on Linux. As of #1079 the VSCode cargo-watch functionality has been broken on Linux systems. The cause seems to be that linux takes the added quotes inside process arguments literally, so it attempts to make cargo-watch run the command `cargo "check --message-format json"` with the entire quoted part being treated as a single long subcommand, which cargo doesn't know how to handle. Removing the extra quotes solves the issue. --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index d45d0e7d..5534084b 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -46,12 +46,11 @@ export class CargoWatchProvider { 'Cargo Watch Trace' ); - let args = '"check --message-format json'; + let args = 'check --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; } - args += '"'; // Start the cargo watch with json message this.cargoProcess = child_process.spawn( From fe011209a27ec798de84f04a698ef1723f7cac66 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 10:38:18 +0200 Subject: [PATCH 103/819] Add extra double quotes only on Windows. As tested by @edwin0cheng, Windows requires the quotes removed in the previous commit. This commit re-adds the quotes gated by an if statement on the node environment, so that quotes are only added on Windows. --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 5534084b..6b611301 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -51,6 +51,10 @@ export class CargoWatchProvider { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; } + // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes + if (process.platform == "win32") { + args = '"' + args + '"'; + } // Start the cargo watch with json message this.cargoProcess = child_process.spawn( From e05759b9e2c79069e9786ac89e0c0ab195487708 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 3 Apr 2019 11:01:34 +0200 Subject: [PATCH 104/819] Fix eslint errors --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 6b611301..32bd38a1 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -52,7 +52,7 @@ export class CargoWatchProvider { args += ' ' + Server.config.cargoWatchOptions.checkArguments; } // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes - if (process.platform == "win32") { + if (process.platform === 'win32') { args = '"' + args + '"'; } From 5c022a04496088f340312cc8c040c3f53daeec3e Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Thu, 11 Apr 2019 08:08:19 +0200 Subject: [PATCH 105/819] Adds support for multiple editor workspaces on initialization This is a quick, partial fix for #1104 --- rust-analyzer/editors/code/src/server.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index f319f148..5e9a1934 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -17,13 +17,6 @@ export class Server { let folder: string = '.'; if (workspace.workspaceFolders !== undefined) { folder = workspace.workspaceFolders[0].uri.fsPath.toString(); - - if (workspace.workspaceFolders.length > 1) { - // Tell the user that we do not support multi-root workspaces yet - window.showWarningMessage( - 'Multi-root workspaces are not currently supported' - ); - } } const run: lc.Executable = { From 37605448dceea4baa6aa6e6b07ea63df58604db0 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Sat, 13 Apr 2019 19:45:21 +0200 Subject: [PATCH 106/819] Sends cwd info for runnables and code lenses --- rust-analyzer/editors/code/src/commands/runnables.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 3589edce..c4df24c7 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -17,6 +17,7 @@ interface Runnable { bin: string; args: string[]; env: { [index: string]: string }; + cwd?: string; } class RunnableQuickPick implements vscode.QuickPickItem { @@ -49,7 +50,7 @@ function createTask(spec: Runnable): vscode.Task { }; const execOption: vscode.ShellExecutionOptions = { - cwd: '.', + cwd: spec.cwd || '.', env: definition.env }; const exec = new vscode.ShellExecution( From a46d0abc9077b7467b1583b117a98711e8bf18de Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Mon, 15 Apr 2019 21:41:27 +0200 Subject: [PATCH 107/819] Adds "restart server" command --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/extension.ts | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1c8caaa6..a0454191 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -114,6 +114,11 @@ "command": "rust-analyzer.collectGarbage", "title": "Run garbage collection", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.reload", + "title": "Restart server", + "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index ef83c0b8..db67bc7e 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -120,11 +120,16 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); + const startServer = () => Server.start(allNotifications); + const reloadCommand = () => reloadServer(startServer); + + vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); + // Executing `cargo watch` provides us with inline diagnostics on save interactivelyStartCargoWatch(context); // Start the language server, finally! - Server.start(allNotifications); + startServer(); } export function deactivate(): Thenable { @@ -133,3 +138,12 @@ export function deactivate(): Thenable { } return Server.client.stop(); } + + +async function reloadServer(startServer: () => void) { + if (Server.client != null) { + vscode.window.showInformationMessage('Reloading rust-analyzer...'); + await Server.client.stop(); + startServer(); + } +} \ No newline at end of file From 109aaf95bf0c4c23c4475bc25a3f3dc9ce6679a2 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Tue, 16 Apr 2019 22:06:27 +0200 Subject: [PATCH 108/819] Fixes unrelated process termination quirk --- rust-analyzer/editors/code/src/utils/terminateProcess.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 rust-analyzer/editors/code/src/utils/terminateProcess.sh diff --git a/rust-analyzer/editors/code/src/utils/terminateProcess.sh b/rust-analyzer/editors/code/src/utils/terminateProcess.sh old mode 100644 new mode 100755 From cee3a5121ad8066b0da39e2db095bdd943be3793 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Tue, 16 Apr 2019 22:11:50 +0200 Subject: [PATCH 109/819] Prettier --- rust-analyzer/editors/code/src/extension.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index db67bc7e..1073a36a 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -139,11 +139,10 @@ export function deactivate(): Thenable { return Server.client.stop(); } - async function reloadServer(startServer: () => void) { if (Server.client != null) { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await Server.client.stop(); startServer(); } -} \ No newline at end of file +} From 5955982f57bf72360c81d5f2832acc79662c36f1 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sat, 13 Apr 2019 22:13:21 +0200 Subject: [PATCH 110/819] cargo watch start and stop commands --- rust-analyzer/editors/code/package.json | 12 ++- .../editors/code/src/commands/cargo_watch.ts | 102 ++++++++++-------- .../editors/code/src/commands/runnables.ts | 7 +- .../editors/code/src/commands/watch_status.ts | 18 +++- rust-analyzer/editors/code/src/extension.ts | 16 ++- 5 files changed, 100 insertions(+), 55 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a0454191..c58171a7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -119,6 +119,16 @@ "command": "rust-analyzer.reload", "title": "Restart server", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.startCargoWatch", + "title": "Start Cargo Watch", + "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.stopCargoWatch", + "title": "Stop Cargo Watch", + "category": "Rust Analyzer" } ], "keybindings": [ @@ -253,4 +263,4 @@ } ] } -} +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 32bd38a1..1d939e28 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -7,44 +7,55 @@ import { terminate } from '../utils/processes'; import { LineBuffer } from './line_buffer'; import { StatusDisplay } from './watch_status'; -export class CargoWatchProvider { - private diagnosticCollection?: vscode.DiagnosticCollection; - private cargoProcess?: child_process.ChildProcess; - private outBuffer: string = ''; - private statusDisplay?: StatusDisplay; - private outputChannel?: vscode.OutputChannel; - - public activate(subscriptions: vscode.Disposable[]) { - let cargoExists = false; - const cargoTomlFile = path.join( - vscode.workspace.rootPath!, - 'Cargo.toml' +export function registerCargoWatchProvider( + subscriptions: vscode.Disposable[] +): CargoWatchProvider | undefined { + let cargoExists = false; + const cargoTomlFile = path.join(vscode.workspace.rootPath!, 'Cargo.toml'); + // Check if the working directory is valid cargo root path + try { + if (fs.existsSync(cargoTomlFile)) { + cargoExists = true; + } + } catch (err) { + cargoExists = false; + } + + if (!cargoExists) { + vscode.window.showErrorMessage( + `Couldn\'t find \'Cargo.toml\' in ${cargoTomlFile}` ); - // Check if the working directory is valid cargo root path - try { - if (fs.existsSync(cargoTomlFile)) { - cargoExists = true; - } - } catch (err) { - cargoExists = false; - } + return; + } - if (!cargoExists) { - vscode.window.showErrorMessage( - `Couldn\'t find \'Cargo.toml\' in ${cargoTomlFile}` - ); - return; - } + const provider = new CargoWatchProvider(); + subscriptions.push(provider); + return provider; +} - subscriptions.push(this); +export class CargoWatchProvider implements vscode.Disposable { + private readonly diagnosticCollection: vscode.DiagnosticCollection; + private readonly statusDisplay: StatusDisplay; + private readonly outputChannel: vscode.OutputChannel; + private cargoProcess?: child_process.ChildProcess; + + constructor() { this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 'rustc' ); - - this.statusDisplay = new StatusDisplay(subscriptions); + this.statusDisplay = new StatusDisplay(); this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); + } + + public start() { + if (this.cargoProcess) { + vscode.window.showInformationMessage( + 'Cargo Watch is already running' + ); + return; + } let args = 'check --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { @@ -95,25 +106,28 @@ export class CargoWatchProvider { this.logInfo('cargo-watch started.'); } - public dispose(): void { - if (this.diagnosticCollection) { - this.diagnosticCollection.clear(); - this.diagnosticCollection.dispose(); - } - + public stop() { if (this.cargoProcess) { this.cargoProcess.kill(); terminate(this.cargoProcess); + this.cargoProcess = undefined; + } else { + vscode.window.showInformationMessage('Cargo Watch is not running'); } + } - if (this.outputChannel) { - this.outputChannel.dispose(); - } + public dispose(): void { + this.stop(); + + this.diagnosticCollection.clear(); + this.diagnosticCollection.dispose(); + this.outputChannel.dispose(); + this.statusDisplay.dispose(); } private logInfo(line: string) { if (Server.config.cargoWatchOptions.trace === 'verbose') { - this.outputChannel!.append(line); + this.outputChannel.append(line); } } @@ -122,18 +136,18 @@ export class CargoWatchProvider { Server.config.cargoWatchOptions.trace === 'error' || Server.config.cargoWatchOptions.trace === 'verbose' ) { - this.outputChannel!.append(line); + this.outputChannel.append(line); } } private parseLine(line: string) { if (line.startsWith('[Running')) { - this.diagnosticCollection!.clear(); - this.statusDisplay!.show(); + this.diagnosticCollection.clear(); + this.statusDisplay.show(); } if (line.startsWith('[Finished running')) { - this.statusDisplay!.hide(); + this.statusDisplay.hide(); } function getLevel(s: string): vscode.DiagnosticSeverity { @@ -193,7 +207,7 @@ export class CargoWatchProvider { // The format of the package_id is "{name} {version} ({source_id})", // https://github.com/rust-lang/cargo/blob/37ad03f86e895bb80b474c1c088322634f4725f5/src/cargo/core/package_id.rs#L53 - this.statusDisplay!.packageName = msg.package_id.split(' ')[0]; + this.statusDisplay.packageName = msg.package_id.split(' ')[0]; } else if (data.reason === 'compiler-message') { const msg = data.message as RustDiagnostic; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c4df24c7..5790252b 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from '../server'; -import { CargoWatchProvider } from './cargo_watch'; +import { CargoWatchProvider, registerCargoWatchProvider } from './cargo_watch'; interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; @@ -137,7 +137,7 @@ export async function handleSingle(runnable: Runnable) { */ export async function interactivelyStartCargoWatch( context: vscode.ExtensionContext -) { +): Promise { if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { return; } @@ -197,6 +197,5 @@ export async function interactivelyStartCargoWatch( } } - const validater = new CargoWatchProvider(); - validater.activate(context.subscriptions); + return registerCargoWatchProvider(context.subscriptions); } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 86ae821d..a3b0178f 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -2,19 +2,18 @@ import * as vscode from 'vscode'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; -export class StatusDisplay { +export class StatusDisplay implements vscode.Disposable { public packageName?: string; private i = 0; private statusBarItem: vscode.StatusBarItem; private timer?: NodeJS.Timeout; - constructor(subscriptions: vscode.Disposable[]) { + constructor() { this.statusBarItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, 10 ); - subscriptions.push(this.statusBarItem); this.statusBarItem.hide(); } @@ -33,7 +32,7 @@ export class StatusDisplay { } }, 300); - this.statusBarItem!.show(); + this.statusBarItem.show(); } public hide() { @@ -42,7 +41,16 @@ export class StatusDisplay { this.timer = undefined; } - this.statusBarItem!.hide(); + this.statusBarItem.hide(); + } + + public dispose() { + if (this.timer) { + clearInterval(this.timer); + this.timer = undefined; + } + + this.statusBarItem.dispose(); } private frame() { diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 1073a36a..b48ad9b2 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; +import { CargoWatchProvider } from './commands/cargo_watch'; import { interactivelyStartCargoWatch } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; @@ -126,7 +127,20 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); // Executing `cargo watch` provides us with inline diagnostics on save - interactivelyStartCargoWatch(context); + let provider: CargoWatchProvider | undefined; + interactivelyStartCargoWatch(context).then(p => { + provider = p; + }); + registerCommand('rust-analyzer.startCargoWatch', () => { + if (provider) { + provider.start(); + } + }); + registerCommand('rust-analyzer.stopCargoWatch', () => { + if (provider) { + provider.stop(); + } + }); // Start the language server, finally! startServer(); From e6babcbf2d5a0d99eb729557bf8f08d971e7d9c8 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Sun, 14 Apr 2019 12:45:36 +0200 Subject: [PATCH 111/819] recover rustc-watch problemMatchers --- rust-analyzer/editors/code/package.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c58171a7..dd984324 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -260,6 +260,18 @@ "${workspaceRoot}" ], "pattern": "$rustc" + }, + { + "name": "rustc-watch", + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "background": { + "beginsPattern": "^\\[Running\\b", + "endsPattern": "^\\[Finished running\\b" + }, + "pattern": "$rustc" } ] } From 5dc69465deb8d34b36564aa4e2beb96d8c7b5f48 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Fri, 19 Apr 2019 18:28:14 +0200 Subject: [PATCH 112/819] start cargo watch if not started interactively --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/commands/runnables.ts | 12 +++++++++++- rust-analyzer/editors/code/src/extension.ts | 9 ++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index dd984324..83ceb19f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -275,4 +275,4 @@ } ] } -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 5790252b..26372c1e 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -153,6 +153,12 @@ export async function interactivelyStartCargoWatch( } } + return startCargoWatch(context); +} + +export async function startCargoWatch( + context: vscode.ExtensionContext +): Promise { const execPromise = util.promisify(child_process.exec); const { stderr } = await execPromise('cargo watch --version').catch(e => e); @@ -197,5 +203,9 @@ export async function interactivelyStartCargoWatch( } } - return registerCargoWatchProvider(context.subscriptions); + const provider = await registerCargoWatchProvider(context.subscriptions); + if (provider) { + provider.start(); + } + return provider; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index b48ad9b2..48dd2a61 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -3,7 +3,10 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { CargoWatchProvider } from './commands/cargo_watch'; -import { interactivelyStartCargoWatch } from './commands/runnables'; +import { + interactivelyStartCargoWatch, + startCargoWatch +} from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; @@ -134,6 +137,10 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('rust-analyzer.startCargoWatch', () => { if (provider) { provider.start(); + } else { + startCargoWatch(context).then(p => { + provider = p; + }); } }); registerCommand('rust-analyzer.stopCargoWatch', () => { From dac139d7297d1f7d55a878aec735d25e8a37e856 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 21 Apr 2019 11:32:48 +0300 Subject: [PATCH 113/819] :arrow_up: code --- rust-analyzer/editors/code/package-lock.json | 1641 ++---------------- rust-analyzer/editors/code/package.json | 20 +- 2 files changed, 202 insertions(+), 1459 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 008df6f5..29cd260a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -4,22 +4,51 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, "@types/mocha": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", - "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", + "version": "5.2.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", + "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", "dev": true }, "@types/node": { - "version": "10.12.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.24.tgz", - "integrity": "sha512-GWWbvt+z9G5otRBW8rssOFgRY87J9N/qbhqfjMZ+gUuL6zoL+Hm6gP/8qQBG4jjimqdaNLCehcVapZ/Fs2WjCQ==", + "version": "10.14.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.5.tgz", + "integrity": "sha512-Ja7d4s0qyGFxjGeDq5S7Si25OFibSAHUi6i17UWnwNnpitADN7hah9q0Tl25gxuV5R1u2Bx+np6w4LHXfHyj/g==", "dev": true }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, "ajv": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.8.1.tgz", - "integrity": "sha512-eqxCp82P+JfqL683wwsL73XmFs1eG6qjw+RD3YHx+Jll1r0jNd4dh8QG9NYAeNGA/hnZjeEDgtTskgJULbxpWQ==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -28,49 +57,13 @@ "uri-js": "^4.2.2" } }, - "ansi-cyan": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", - "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-red": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", - "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true - }, - "append-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", - "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "buffer-equal": "^1.0.0" + "color-convert": "^1.9.0" } }, "argparse": { @@ -82,61 +75,6 @@ "sprintf-js": "~1.0.2" } }, - "arr-diff": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", - "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", - "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", - "dev": true - }, - "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", - "dev": true - }, - "array-slice": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", - "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", - "dev": true - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -170,32 +108,6 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - } - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -211,15 +123,6 @@ "tweetnacl": "^0.14.3" } }, - "block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -248,12 +151,6 @@ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", "dev": true }, - "buffer-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", - "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", - "dev": true - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -281,97 +178,22 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } } }, "cheerio": { - "version": "1.0.0-rc.2", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz", - "integrity": "sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=", + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", "dev": true, "requires": { "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", + "dom-serializer": "~0.1.1", "entities": "~1.1.1", "htmlparser2": "^3.9.1", "lodash": "^4.15.0", "parse5": "^3.0.1" } }, - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "dev": true - }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", - "dev": true - }, - "cloneable-readable": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz", - "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -397,9 +219,9 @@ } }, "commander": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, "concat-map": { @@ -408,15 +230,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -436,9 +249,9 @@ } }, "css-what": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.2.tgz", - "integrity": "sha512-wan8dMWQ0GUeF7DGEPVjhHemVW/vy6xUYmFzRY8RYqgA0JtXC9rJmbScBjqSu6dg9q0lwPQy6ZAmJVr3PPTvqQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, "dashdash": { @@ -459,24 +272,6 @@ "ms": "2.0.0" } }, - "deep-assign": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-1.0.0.tgz", - "integrity": "sha1-sJJ0O+hCfcYh6gBnzex+cN0Z83s=", - "dev": true, - "requires": { - "is-obj": "^1.0.0" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -496,21 +291,13 @@ "dev": true }, "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", "dev": true, "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" - }, - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", - "dev": true - } + "domelementtype": "^1.3.0", + "entities": "^1.1.1" } }, "domelementtype": { @@ -538,50 +325,6 @@ "domelementtype": "1" } }, - "duplexer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", - "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", - "dev": true - }, - "duplexify": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", - "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -592,15 +335,6 @@ "safer-buffer": "^2.1.0" } }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -613,6 +347,21 @@ "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", "dev": true }, + "es6-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", + "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -631,36 +380,12 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "event-stream": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", - "dev": true, - "requires": { - "duplexer": "~0.1.1", - "from": "~0", - "map-stream": "~0.1.0", - "pause-stream": "0.0.11", - "split": "0.3", - "stream-combiner": "~0.0.4", - "through": "~2.3.1" - } - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, - "extend-shallow": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", - "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", - "dev": true, - "requires": { - "kind-of": "^1.1.0" - } - }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -688,16 +413,6 @@ "pend": "~1.2.0" } }, - "flush-write-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.0.tgz", - "integrity": "sha512-6MHED/cmsyux1G4/Cek2Z776y9t7WCNd3h2h/HW91vFeU7pzMhA8XvAlDhHcanG5IWuIh/xcC7JASY4WQpG6xg==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -715,46 +430,12 @@ "mime-types": "^2.1.12" } }, - "from": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", - "dev": true - }, - "fs-mkdirp-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", - "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -778,262 +459,12 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "glob-stream": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", - "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", - "dev": true, - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "graceful-fs": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", - "dev": true - }, "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, - "gulp-chmod": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/gulp-chmod/-/gulp-chmod-2.0.0.tgz", - "integrity": "sha1-AMOQuSigeZslGsz2MaoJ4BzGKZw=", - "dev": true, - "requires": { - "deep-assign": "^1.0.0", - "stat-mode": "^0.2.0", - "through2": "^2.0.0" - } - }, - "gulp-filter": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/gulp-filter/-/gulp-filter-5.1.0.tgz", - "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", - "dev": true, - "requires": { - "multimatch": "^2.0.0", - "plugin-error": "^0.1.2", - "streamfilter": "^1.0.5" - } - }, - "gulp-gunzip": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulp-gunzip/-/gulp-gunzip-1.0.0.tgz", - "integrity": "sha1-FbdBFF6Dqcb1CIYkG1fMWHHxUak=", - "dev": true, - "requires": { - "through2": "~0.6.5", - "vinyl": "~0.4.6" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "dev": true, - "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - } - } - } - }, - "gulp-remote-src-vscode": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/gulp-remote-src-vscode/-/gulp-remote-src-vscode-0.5.1.tgz", - "integrity": "sha512-mw4OGjtC/jlCWJFhbcAlel4YPvccChlpsl3JceNiB/DLJi24/UPxXt53/N26lgI3dknEqd4ErfdHrO8sJ5bATQ==", - "dev": true, - "requires": { - "event-stream": "3.3.4", - "node.extend": "^1.1.2", - "request": "^2.79.0", - "through2": "^2.0.3", - "vinyl": "^2.0.1" - }, - "dependencies": { - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - } - } - }, - "gulp-untar": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/gulp-untar/-/gulp-untar-0.0.7.tgz", - "integrity": "sha512-0QfbCH2a1k2qkTLWPqTX+QO4qNsHn3kC546YhAP3/n0h+nvtyGITDuDrYBMDZeW4WnFijmkOvBWa5HshTic1tw==", - "dev": true, - "requires": { - "event-stream": "~3.3.4", - "streamifier": "~0.1.1", - "tar": "^2.2.1", - "through2": "~2.0.3", - "vinyl": "^1.2.0" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", - "dev": true - }, - "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", - "dev": true, - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulp-vinyl-zip": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.2.tgz", - "integrity": "sha512-wJn09jsb8PyvUeyFF7y7ImEJqJwYy40BqL9GKfJs6UGpaGW9A+N68Q+ajsIpb9AeR6lAdjMbIdDPclIGo1/b7Q==", - "dev": true, - "requires": { - "event-stream": "3.3.4", - "queue": "^4.2.1", - "through2": "^2.0.3", - "vinyl": "^2.0.2", - "vinyl-fs": "^3.0.3", - "yauzl": "^2.2.1", - "yazl": "^2.2.1" - }, - "dependencies": { - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - } - } - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -1050,36 +481,12 @@ "har-schema": "^2.0.0" } }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -1087,17 +494,27 @@ "dev": true }, "htmlparser2": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.0.tgz", - "integrity": "sha512-J1nEUGv+MkXS0weHNWVKJJ+UrLfePxRWpN3C9bEi9fLxL2+ggW94DQvgYVXsaT30PGwYRIZKNZXuyMhp3Di4bQ==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", "dev": true, "requires": { - "domelementtype": "^1.3.0", + "domelementtype": "^1.3.1", "domhandler": "^2.3.0", "domutils": "^1.5.1", "entities": "^1.1.1", "inherits": "^2.0.1", - "readable-stream": "^3.0.6" + "readable-stream": "^3.1.1" + } + }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dev": true, + "requires": { + "agent-base": "4", + "debug": "3.1.0" } }, "http-signature": { @@ -1111,6 +528,16 @@ "sshpk": "^1.7.0" } }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "^4.1.0", + "debug": "^3.1.0" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1133,103 +560,12 @@ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", "dev": true }, - "is": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", - "integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", - "dev": true - }, - "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true - }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" - } - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -1237,15 +573,15 @@ "dev": true }, "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "js-yaml": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", - "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -1266,82 +602,26 @@ }, "json-schema-traverse": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kind-of": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", - "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", - "dev": true - }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, - "lead": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", - "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "dev": true, "requires": { - "flush-write-stream": "^1.0.2" + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" } }, "linkify-it": { @@ -1359,12 +639,6 @@ "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, - "map-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", - "dev": true - }, "markdown-it": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", @@ -1391,18 +665,18 @@ "dev": true }, "mime-db": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", "dev": true }, "mime-types": { - "version": "2.1.21", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", "dev": true, "requires": { - "mime-db": "~1.37.0" + "mime-db": "1.40.0" } }, "minimatch": { @@ -1496,52 +770,12 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "multimatch": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", - "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", - "dev": true, - "requires": { - "array-differ": "^1.0.0", - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "minimatch": "^3.0.0" - } - }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "node.extend": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz", - "integrity": "sha512-L/dvEBwyg3UowwqOUTyDsGBU6kjBQOpOhshio9V3i3BMPv5YUb9+mWNN8MK0IbWqT0AqaTSONZf0aTuMMahWgA==", - "dev": true, - "requires": { - "has": "^1.0.3", - "is": "^3.2.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "now-and-later": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", - "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", - "dev": true, - "requires": { - "once": "^1.3.2" - } - }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -1557,24 +791,6 @@ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1584,41 +800,6 @@ "wrappy": "1" } }, - "ordered-read-streams": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", - "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -1659,12 +840,6 @@ "@types/node": "*" } }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1677,15 +852,6 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "pause-stream": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", - "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", - "dev": true, - "requires": { - "through": "~2.3" - } - }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -1698,29 +864,10 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, - "plugin-error": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", - "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", - "dev": true, - "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" - } - }, "prettier": { - "version": "1.16.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.16.4.tgz", - "integrity": "sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz", + "integrity": "sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==", "dev": true }, "psl": { @@ -1729,27 +876,6 @@ "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", "dev": true }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -1769,20 +895,11 @@ "dev": true }, "querystringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", - "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", + "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", "dev": true }, - "queue": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.1.tgz", - "integrity": "sha512-AMD7w5hRXcFSb8s9u38acBZ+309u6GsiibP4/0YacJeaurRshogB7v/ZcVPxP5gD5+zIw6ixRHdutiYUJfwKHw==", - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -1793,9 +910,9 @@ } }, "readable-stream": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz", - "integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -1812,39 +929,6 @@ "resolve": "^1.1.6" } }, - "remove-bom-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", - "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", - "dev": true, - "requires": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" - } - }, - "remove-bom-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz", - "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", - "dev": true, - "requires": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -1888,24 +972,6 @@ "path-parse": "^1.0.6" } }, - "resolve-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz", - "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", - "dev": true, - "requires": { - "value-or-function": "^3.0.0" - } - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -1919,9 +985,9 @@ "dev": true }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, "shelljs": { "version": "0.8.3", @@ -1960,24 +1026,15 @@ "dev": true }, "source-map-support": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", - "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "split": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", - "dev": true, - "requires": { - "through": "2" - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -2001,68 +1058,6 @@ "tweetnacl": "~0.14.0" } }, - "stat-mode": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz", - "integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI=", - "dev": true - }, - "stream-combiner": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", - "dev": true, - "requires": { - "duplexer": "~0.1.1" - } - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", - "dev": true - }, - "streamfilter": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/streamfilter/-/streamfilter-1.0.7.tgz", - "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "streamifier": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", - "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=", - "dev": true - }, "string_decoder": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", @@ -2072,82 +1067,13 @@ "safe-buffer": "~5.1.0" } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "through2-filter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", - "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" + "has-flag": "^3.0.0" } }, "tmp": { @@ -2159,25 +1085,6 @@ "os-tmpdir": "~1.0.1" } }, - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, - "to-through": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz", - "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", - "dev": true, - "requires": { - "through2": "^2.0.3" - } - }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", @@ -2203,23 +1110,24 @@ "dev": true }, "tslint": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.1.tgz", - "integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz", + "integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", "diff": "^3.2.0", "glob": "^7.1.1", - "js-yaml": "^3.7.0", + "js-yaml": "^3.13.0", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.27.2" + "tsutils": "^2.29.0" } }, "tslint-config-prettier": { @@ -2277,9 +1185,9 @@ } }, "typescript": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3.tgz", - "integrity": "sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.4.tgz", + "integrity": "sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==", "dev": true }, "uc.micro": { @@ -2288,28 +1196,12 @@ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "dev": true }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", - "dev": true - }, "underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", "dev": true }, - "unique-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", - "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", - "dev": true, - "requires": { - "json-stable-stringify-without-jsonify": "^1.0.1", - "through2-filter": "^3.0.0" - } - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -2326,9 +1218,9 @@ "dev": true }, "url-parse": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", - "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.6.tgz", + "integrity": "sha512-/B8AD9iQ01seoXmXf9z/MjLZQIdOoYl/+gvsQF6+mpnxaTfG9P7srYaiqaDMyKkR36XMXfhqSHss5MyFAO8lew==", "dev": true, "requires": { "querystringify": "^2.0.0", @@ -2347,12 +1239,6 @@ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, - "value-or-function": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", - "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", - "dev": true - }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -2364,150 +1250,10 @@ "extsprintf": "^1.2.0" } }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", - "dev": true, - "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" - } - }, - "vinyl-fs": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz", - "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==", - "dev": true, - "requires": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" - }, - "dependencies": { - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - } - } - }, - "vinyl-source-stream": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-1.1.2.tgz", - "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", - "dev": true, - "requires": { - "through2": "^2.0.3", - "vinyl": "^0.4.3" - } - }, - "vinyl-sourcemap": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", - "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", - "dev": true, - "requires": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" - }, - "dependencies": { - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - } - } - }, "vsce": { - "version": "1.57.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.57.0.tgz", - "integrity": "sha512-ULiWDQBt0XZAA5PI7XL0TxeKZ6cXk3e3ZH/lL9xk93WeckqWzR79D3xNsf0GRacOGYU+UmbhXWRtP8C6wnDNmg==", + "version": "1.59.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.59.0.tgz", + "integrity": "sha512-tkB97885k5ce25Brbe9AZTCAXAkBh7oa5EOzY0BCJQ51W/mfRaQuCluCd9gZpWdgiU4AbPvwxtoVKKsenlSt8w==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -2531,54 +1277,57 @@ } }, "vscode": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.29.tgz", - "integrity": "sha512-E6hzqGtCD65BnBxdZzSIi8FPCM4seEEK/bbTeYdJntg+4D5R6GLbdYFySE9DNTtMJF4iB9UGoucKU/p8Guts1g==", + "version": "1.1.33", + "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.33.tgz", + "integrity": "sha512-sXedp2oF6y4ZvqrrFiZpeMzaCLSWV+PpYkIxjG/iYquNZ9KrLL2LujltGxPLvzn49xu2sZkyC+avVNFgcJD1Iw==", "dev": true, "requires": { "glob": "^7.1.2", - "gulp-chmod": "^2.0.0", - "gulp-filter": "^5.0.1", - "gulp-gunzip": "1.0.0", - "gulp-remote-src-vscode": "^0.5.1", - "gulp-untar": "^0.0.7", - "gulp-vinyl-zip": "^2.1.2", "mocha": "^4.0.1", "request": "^2.88.0", "semver": "^5.4.1", "source-map-support": "^0.5.0", - "url-parse": "^1.4.3", - "vinyl-fs": "^3.0.3", - "vinyl-source-stream": "^1.1.0" + "url-parse": "^1.4.4", + "vscode-test": "^0.1.4" } }, "vscode-jsonrpc": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", - "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" + "version": "4.1.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.1.tgz", + "integrity": "sha512-FzNkvHmg3GXpzZAlnGnpdRbQQX6LDRb0bvc+oxxjMUwIJ66kTO/DyeE2bwU0fsiOEGfsJTCzvjESVl368jZ0/g==" }, "vscode-languageclient": { - "version": "5.3.0-next.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.1.tgz", - "integrity": "sha512-q5o6vHHDi+HjFOFUNC288Dee5jyAO4mEufoOaF2wKCjVP1qoJGbnBalTNGuakJThrdn0RDa0XdHZgXKFyZomCQ==", + "version": "5.3.0-next.4", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.4.tgz", + "integrity": "sha512-RODuzXErVpJRSgHv+Xei8fwQtZ/iZOWPCqlLl07NTtkzgTAepJf9r4EioZVuTviGJ5DEJ9xs0bjrit8shKtW6Q==", "requires": { "semver": "^5.5.0", - "vscode-languageserver-protocol": "3.15.0-next.1" + "vscode-languageserver-protocol": "3.15.0-next.4" } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.1.tgz", - "integrity": "sha512-LXF0d9s3vxFBxVQ4aKl/XghdEMAncGt3dh4urIYa9Is43g3MfIQL9fC44YZtP+XXOrI2rpZU8lRNN01U1V6CDg==", + "version": "3.15.0-next.4", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.4.tgz", + "integrity": "sha512-4AgisQ8GWa3irdRu3/UNr3brcSSm0oobmoV1eSOnV7JM32lYyXDnSKB7RuTTXvaAjD/0xQJLEGhkyGHS5gbywA==", "requires": { - "vscode-jsonrpc": "^4.0.0", - "vscode-languageserver-types": "3.14.0" + "vscode-jsonrpc": "^4.1.0-next.1", + "vscode-languageserver-types": "3.15.0-next.1" } }, "vscode-languageserver-types": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", - "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==" + "version": "3.15.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.1.tgz", + "integrity": "sha512-R0kzmaI8gOGEoU7b9huYQAzgZzRQ/5Q8HKjsIUdfz0MjXcBZ4tr1ik1So1p1O5kGrI1VTCd22Fw/wI7ECGoIPw==" + }, + "vscode-test": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.1.5.tgz", + "integrity": "sha512-s+lbF1Dtasc0yXVB9iQTexBe2JK6HJAUJe3fWezHKIjq+xRw5ZwCMEMBaonFIPy7s95qg2HPTRDR5W4h4kbxGw==", + "dev": true, + "requires": { + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^2.2.1" + } }, "vso-node-api": { "version": "6.1.2-preview", @@ -2598,12 +1347,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, "yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 83ceb19f..8f195c99 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.31.0" + "vscode": "^1.33.0" }, "scripts": { "vscode:prepublish": "npm run compile", @@ -31,18 +31,18 @@ "singleQuote": true }, "dependencies": { - "vscode-languageclient": "^5.3.0-next.1" + "vscode-languageclient": "^5.3.0-next.4" }, "devDependencies": { - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.24", - "prettier": "^1.16.4", - "tslint": "^5.12.1", + "@types/mocha": "^5.2.6", + "@types/node": "^10.14.5", + "prettier": "^1.17.0", + "shx": "^0.3.1", + "tslint": "^5.16.0", "tslint-config-prettier": "^1.18.0", - "typescript": "^3.3.1", - "vsce": "^1.57.0", - "vscode": "^1.1.29", - "shx": "^0.3.1" + "typescript": "^3.4.4", + "vsce": "^1.59.0", + "vscode": "^1.1.33" }, "activationEvents": [ "onLanguage:rust", From b4cb354242498641299bd2f13a280116bfd9cd26 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 21 Apr 2019 12:13:48 +0300 Subject: [PATCH 114/819] switch to official extend selection API --- rust-analyzer/editors/code/package.json | 5 --- .../code/src/commands/extend_selection.ts | 34 ------------------- .../editors/code/src/commands/index.ts | 2 -- rust-analyzer/editors/code/src/extension.ts | 4 --- rust-analyzer/editors/code/src/server.ts | 1 + 5 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/extend_selection.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8f195c99..015b912b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -80,11 +80,6 @@ "title": "Show Syntax Tree", "category": "Rust Analyzer" }, - { - "command": "rust-analyzer.extendSelection", - "title": "Extend selection", - "category": "Rust Analyzer" - }, { "command": "rust-analyzer.matchingBrace", "title": "Find matching brace", diff --git a/rust-analyzer/editors/code/src/commands/extend_selection.ts b/rust-analyzer/editors/code/src/commands/extend_selection.ts deleted file mode 100644 index 6f4187d1..00000000 --- a/rust-analyzer/editors/code/src/commands/extend_selection.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as vscode from 'vscode'; - -import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; -import { Server } from '../server'; - -interface ExtendSelectionParams { - textDocument: TextDocumentIdentifier; - selections: Range[]; -} - -interface ExtendSelectionResult { - selections: Range[]; -} - -export async function handle() { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - const request: ExtendSelectionParams = { - selections: editor.selections.map(s => - Server.client.code2ProtocolConverter.asRange(s) - ), - textDocument: { uri: editor.document.uri.toString() } - }; - const response = await Server.client.sendRequest( - 'rust-analyzer/extendSelection', - request - ); - editor.selections = response.selections.map((range: Range) => { - const r = Server.client.protocol2CodeConverter.asRange(range); - return new vscode.Selection(r.start, r.end); - }); -} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index f36c4b04..19465849 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,6 +1,5 @@ import * as analyzerStatus from './analyzer_status'; import * as applySourceChange from './apply_source_change'; -import * as extendSelection from './extend_selection'; import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; import * as onEnter from './on_enter'; @@ -11,7 +10,6 @@ import * as syntaxTree from './syntaxTree'; export { analyzerStatus, applySourceChange, - extendSelection, joinLines, matchingBrace, parentModule, diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 48dd2a61..c8c3004a 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -57,10 +57,6 @@ export function activate(context: vscode.ExtensionContext) { registerCommand('rust-analyzer.collectGarbage', () => Server.client.sendRequest('rust-analyzer/collectGarbage', null) ); - registerCommand( - 'rust-analyzer.extendSelection', - commands.extendSelection.handle - ); registerCommand( 'rust-analyzer.matchingBrace', commands.matchingBrace.handle diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 5e9a1934..81c2b3ff 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -74,6 +74,7 @@ export class Server { } } }; + Server.client.registerProposedFeatures(); Server.client.onReady().then(() => { for (const [type, handler] of notificationHandlers) { Server.client.onNotification(type, handler); From a96546cc99fa585cb840346c77f5066439f414e8 Mon Sep 17 00:00:00 2001 From: Aleksi Juvani Date: Tue, 21 May 2019 09:44:28 +0300 Subject: [PATCH 115/819] Pass `--all-targets` to `cargo watch` --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 1d939e28..6ba794bb 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -57,7 +57,7 @@ export class CargoWatchProvider implements vscode.Disposable { return; } - let args = 'check --message-format json'; + let args = 'check --all-targets --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; From f304c39596d76efb5cb668ad7dc9fc79dff803c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Tue, 21 May 2019 14:04:54 +0300 Subject: [PATCH 116/819] Use ThemeColor and add support for light themes --- rust-analyzer/editors/code/package.json | 119 ++++++++++++++++++ .../editors/code/src/highlighting.ts | 35 ++++-- 2 files changed, 141 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 015b912b..c72037da 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -268,6 +268,125 @@ }, "pattern": "$rustc" } + ], + "colors": [ + { + "id": "ralsp.background", + "description": "Background color", + "defaults": { + "dark": "#3F3F3F", + "light": "#001080", + "highContrast": "#000000" + } + }, + { + "id": "ralsp.comment", + "description": "Color for comments", + "defaults": { + "dark": "#7F9F7F", + "light": "#008000", + "highContrast": "#7CA668" + } + }, + { + "id": "ralsp.string", + "description": "Color for strings", + "defaults": { + "dark": "#CC9393", + "light": "#A31515", + "highContrast": "#CE9178" + } + }, + { + "id": "ralsp.unsafe", + "description": "Color for unsafe", + "defaults": { + "dark": "#FF3030", + "light": "#FF1010", + "highContrast": "#FF1010" + } + }, + { + "id": "ralsp.keyword", + "description": "Color for keywords", + "defaults": { + "dark": "#F0DFAF", + "light": "#0000FF", + "highContrast": "#569CD6" + } + }, + { + "id": "ralsp.control", + "description": "Color for control keywords", + "defaults": { + "dark": "#CF20FB", + "light": "#AF00DB", + "highContrast": "#C586C0" + } + }, + { + "id": "ralsp.function", + "description": "Color for functions", + "defaults": { + "dark": "#93E0E3", + "light": "#795E26", + "highContrast": "#DCDCAA" + } + }, + { + "id": "ralsp.parameter", + "description": "Color for parameters", + "defaults": { + "dark": "#94BFF3", + "light": "#001080", + "highContrast": "#9CDCFE" + } + }, + { + "id": "ralsp.builtin", + "description": "Color for builtins", + "defaults": { + "dark": "#DD6718", + "light": "#DD6718", + "highContrast": "#DD6718" + } + }, + { + "id": "ralsp.text", + "description": "Color for text", + "defaults": { + "dark": "#DCDCCC", + "light": "#000000", + "highContrast": "#FFFFFF" + } + }, + { + "id": "ralsp.attribute", + "description": "Color for attributes", + "defaults": { + "dark": "#BFEBBF", + "light": "#1F4B1F", + "highContrast": "#108010" + } + }, + { + "id": "ralsp.literal", + "description": "Color for literals", + "defaults": { + "dark": "#DFAF8F", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, + { + "id": "ralsp.macro", + "description": "Color for DFAF8F", + "defaults": { + "dark": "#BFEBBF", + "light": "#DD6718", + "highContrast": "#ED7718" + } + } ] } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 2521dff6..432f40ff 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -13,23 +13,32 @@ export class Highlighter { string, vscode.TextEditorDecorationType > { - const decor = (color: string) => - vscode.window.createTextEditorDecorationType({ color }); + const colorContrib = ( + tag: string + ): [string, vscode.TextEditorDecorationType] => { + const color = new vscode.ThemeColor('ralsp.' + tag); + const decor = vscode.window.createTextEditorDecorationType({ + color + }); + return [tag, decor]; + }; const decorations: Iterable< [string, vscode.TextEditorDecorationType] > = [ - ['background', decor('#3F3F3F')], - ['comment', decor('#7F9F7F')], - ['string', decor('#CC9393')], - ['keyword', decor('#F0DFAF')], - ['function', decor('#93E0E3')], - ['parameter', decor('#94BFF3')], - ['builtin', decor('#DD6718')], - ['text', decor('#DCDCCC')], - ['attribute', decor('#BFEBBF')], - ['literal', decor('#DFAF8F')], - ['macro', decor('#DFAF8F')] + colorContrib('background'), + colorContrib('comment'), + colorContrib('string'), + colorContrib('unsafe'), + colorContrib('keyword'), + colorContrib('control'), + colorContrib('function'), + colorContrib('parameter'), + colorContrib('builtin'), + colorContrib('text'), + colorContrib('attribute'), + colorContrib('literal'), + colorContrib('macro') ]; return new Map(decorations); From 98f6ca9bbf806d16323f83ad52bfd1fd0312504c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Tue, 21 May 2019 16:28:10 +0300 Subject: [PATCH 117/819] Address feedback --- rust-analyzer/editors/code/package.json | 47 ++++++++----------- .../editors/code/src/highlighting.ts | 5 +- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c72037da..750c97bb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -270,20 +270,11 @@ } ], "colors": [ - { - "id": "ralsp.background", - "description": "Background color", - "defaults": { - "dark": "#3F3F3F", - "light": "#001080", - "highContrast": "#000000" - } - }, { "id": "ralsp.comment", "description": "Color for comments", "defaults": { - "dark": "#7F9F7F", + "dark": "#6A9955", "light": "#008000", "highContrast": "#7CA668" } @@ -292,43 +283,43 @@ "id": "ralsp.string", "description": "Color for strings", "defaults": { - "dark": "#CC9393", + "dark": "#CE9178", "light": "#A31515", "highContrast": "#CE9178" } }, - { - "id": "ralsp.unsafe", - "description": "Color for unsafe", - "defaults": { - "dark": "#FF3030", - "light": "#FF1010", - "highContrast": "#FF1010" - } - }, { "id": "ralsp.keyword", "description": "Color for keywords", "defaults": { - "dark": "#F0DFAF", + "dark": "#569cd6", "light": "#0000FF", "highContrast": "#569CD6" } }, { - "id": "ralsp.control", + "id": "ralsp.keyword.control", "description": "Color for control keywords", "defaults": { - "dark": "#CF20FB", + "dark": "#C586C0", "light": "#AF00DB", "highContrast": "#C586C0" } }, + { + "id": "ralsp.keyword.unsafe", + "description": "Color for unsafe", + "defaults": { + "dark": "#FF3030", + "light": "#FF1010", + "highContrast": "#FF1010" + } + }, { "id": "ralsp.function", "description": "Color for functions", "defaults": { - "dark": "#93E0E3", + "dark": "#DCDCAA", "light": "#795E26", "highContrast": "#DCDCAA" } @@ -337,7 +328,7 @@ "id": "ralsp.parameter", "description": "Color for parameters", "defaults": { - "dark": "#94BFF3", + "dark": "#9CDCFE", "light": "#001080", "highContrast": "#9CDCFE" } @@ -355,7 +346,7 @@ "id": "ralsp.text", "description": "Color for text", "defaults": { - "dark": "#DCDCCC", + "dark": "#D4D4D4", "light": "#000000", "highContrast": "#FFFFFF" } @@ -364,7 +355,7 @@ "id": "ralsp.attribute", "description": "Color for attributes", "defaults": { - "dark": "#BFEBBF", + "dark": "#9FE9BF", "light": "#1F4B1F", "highContrast": "#108010" } @@ -373,7 +364,7 @@ "id": "ralsp.literal", "description": "Color for literals", "defaults": { - "dark": "#DFAF8F", + "dark": "#BECEA8", "light": "#09885A", "highContrast": "#B5CEA8" } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 432f40ff..e1a68544 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -26,12 +26,11 @@ export class Highlighter { const decorations: Iterable< [string, vscode.TextEditorDecorationType] > = [ - colorContrib('background'), colorContrib('comment'), colorContrib('string'), - colorContrib('unsafe'), colorContrib('keyword'), - colorContrib('control'), + colorContrib('keyword.control'), + colorContrib('keyword.unsafe'), colorContrib('function'), colorContrib('parameter'), colorContrib('builtin'), From 6455422542fdf076734f8e20d629537415a56dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 23 May 2019 13:26:38 +0300 Subject: [PATCH 118/819] Improve highlighting of name refs --- rust-analyzer/editors/code/package.json | 47 ++++++++++++++++++- .../editors/code/src/highlighting.ts | 7 ++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 750c97bb..cde5fbcb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -371,12 +371,57 @@ }, { "id": "ralsp.macro", - "description": "Color for DFAF8F", + "description": "Color for macros", "defaults": { "dark": "#BFEBBF", "light": "#DD6718", "highContrast": "#ED7718" } + }, + { + "id": "ralsp.constant", + "description": "Color for constants", + "defaults": { + "dark": "#569cd6", + "light": "#267cb6", + "highContrast": "#569cd6" + } + }, + { + "id": "ralsp.type", + "description": "Color for types", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.field", + "description": "Color for fields", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.variable", + "description": "Color for variables", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.module", + "description": "Color for modules", + "defaults": { + "dark": "#D4D4D4", + "light": "#000000", + "highContrast": "#FFFFFF" + } } ] } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index e1a68544..8389d94b 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -33,11 +33,16 @@ export class Highlighter { colorContrib('keyword.unsafe'), colorContrib('function'), colorContrib('parameter'), + colorContrib('constant'), + colorContrib('type'), colorContrib('builtin'), colorContrib('text'), colorContrib('attribute'), colorContrib('literal'), - colorContrib('macro') + colorContrib('macro'), + colorContrib('variable'), + colorContrib('field'), + colorContrib('module') ]; return new Map(decorations); From 36375fbbfd6d08fbf870e9366b6390bc79c5f8a2 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Thu, 23 May 2019 19:42:42 +0200 Subject: [PATCH 119/819] Semantic highlighting spike Very simple approach: For each identifier, set the hash of the range where it's defined as its 'id' and use it in the VSCode extension to generate unique colors. Thus, the generated colors are per-file. They are also quite fragile, and I'm not entirely sure why. Looks like we need to make sure the same ranges aren't overwritten by a later request? --- rust-analyzer/editors/code/package-lock.json | 10 +++++ rust-analyzer/editors/code/package.json | 2 + .../editors/code/src/highlighting.ts | 45 +++++++++++++++++-- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 29cd260a..6b3a12f9 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -36,6 +36,11 @@ "integrity": "sha512-Ja7d4s0qyGFxjGeDq5S7Si25OFibSAHUi6i17UWnwNnpitADN7hah9q0Tl25gxuV5R1u2Bx+np6w4LHXfHyj/g==", "dev": true }, + "@types/seedrandom": { + "version": "2.4.28", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", + "integrity": "sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==" + }, "agent-base": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", @@ -984,6 +989,11 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "seedrandom": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.1.tgz", + "integrity": "sha512-1/02Y/rUeU1CJBAGLebiC5Lbo5FnB22gQbIFFYTLkwvp1xdABZJH1sn4ZT1MzXmPpzv+Rf/Lu2NcsLJiK4rcDg==" + }, "semver": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index cde5fbcb..d8ba914f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -31,11 +31,13 @@ "singleQuote": true }, "dependencies": { + "seedrandom": "^3.0.1", "vscode-languageclient": "^5.3.0-next.4" }, "devDependencies": { "@types/mocha": "^5.2.6", "@types/node": "^10.14.5", + "@types/seedrandom": "^2.4.28", "prettier": "^1.17.0", "shx": "^0.3.1", "tslint": "^5.16.0", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 8389d94b..4597db08 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,3 +1,4 @@ +import seedrandom = require('seedrandom'); import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; @@ -6,6 +7,20 @@ import { Server } from './server'; export interface Decoration { range: lc.Range; tag: string; + id?: string; +} + +// Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 +function fancify(seed: string, shade: 'light' | 'dark') { + const random = seedrandom(seed); + const randomInt = (min: number, max: number) => { + return Math.floor(random() * (max - min + 1)) + min; + }; + + const h = randomInt(0, 360); + const s = randomInt(42, 98); + const l = shade === 'light' ? randomInt(15, 40) : randomInt(40, 90); + return `hsl(${h},${s}%,${l}%)`; } export class Highlighter { @@ -76,6 +91,8 @@ export class Highlighter { } const byTag: Map = new Map(); + const colorfulIdents: Map = new Map(); + for (const tag of this.decorations.keys()) { byTag.set(tag, []); } @@ -84,9 +101,23 @@ export class Highlighter { if (!byTag.get(d.tag)) { continue; } - byTag - .get(d.tag)! - .push(Server.client.protocol2CodeConverter.asRange(d.range)); + + if (d.id) { + if (!colorfulIdents.has(d.id)) { + colorfulIdents.set(d.id, []); + } + colorfulIdents + .get(d.id)! + .push( + Server.client.protocol2CodeConverter.asRange(d.range) + ); + } else { + byTag + .get(d.tag)! + .push( + Server.client.protocol2CodeConverter.asRange(d.range) + ); + } } for (const tag of byTag.keys()) { @@ -96,5 +127,13 @@ export class Highlighter { const ranges = byTag.get(tag)!; editor.setDecorations(dec, ranges); } + + for (const [hash, ranges] of colorfulIdents.entries()) { + const dec = vscode.window.createTextEditorDecorationType({ + light: { color: fancify(hash, 'light') }, + dark: { color: fancify(hash, 'dark') } + }); + editor.setDecorations(dec, ranges); + } } } From 7ebced6d54d6fe7e590de51ba1ca6be1a4490a90 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Mon, 27 May 2019 11:26:15 +0200 Subject: [PATCH 120/819] Make rainbows optional --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 7 +++++++ rust-analyzer/editors/code/src/highlighting.ts | 11 ++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d8ba914f..05c80839 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -164,6 +164,11 @@ "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "rust-analyzer.rainbowHighlightingOn": { + "type": "boolean", + "default": false, + "description": "When highlighting Rust code, use a unique color per identifier" + }, "rust-analyzer.showWorkspaceLoadedNotification": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 481a5e5f..8d73a6b3 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -15,6 +15,7 @@ export interface CargoWatchOptions { export class Config { public highlightingOn = true; + public rainbowHighlightingOn = false; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; @@ -39,6 +40,12 @@ export class Config { this.highlightingOn = config.get('highlightingOn') as boolean; } + if (config.has('rainbowHighlightingOn')) { + this.rainbowHighlightingOn = config.get( + 'rainbowHighlightingOn' + ) as boolean; + } + if (config.has('showWorkspaceLoadedNotification')) { this.showWorkspaceLoadedNotification = config.get( 'showWorkspaceLoadedNotification' diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4597db08..52a0bd4b 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -7,7 +7,7 @@ import { Server } from './server'; export interface Decoration { range: lc.Range; tag: string; - id?: string; + bindingHash?: string; } // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 @@ -92,6 +92,7 @@ export class Highlighter { const byTag: Map = new Map(); const colorfulIdents: Map = new Map(); + const rainbowTime = Server.config.rainbowHighlightingOn; for (const tag of this.decorations.keys()) { byTag.set(tag, []); @@ -102,12 +103,12 @@ export class Highlighter { continue; } - if (d.id) { - if (!colorfulIdents.has(d.id)) { - colorfulIdents.set(d.id, []); + if (rainbowTime && d.bindingHash) { + if (!colorfulIdents.has(d.bindingHash)) { + colorfulIdents.set(d.bindingHash, []); } colorfulIdents - .get(d.id)! + .get(d.bindingHash)! .push( Server.client.protocol2CodeConverter.asRange(d.range) ); From 5a4ae3fe43c1d274538ed1ba4257d93445e0f577 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 7 Jun 2019 20:49:29 +0300 Subject: [PATCH 121/819] make LRU cache configurable --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 4 ++++ rust-analyzer/editors/code/src/server.ts | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 05c80839..c2ed8d12 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -232,6 +232,11 @@ ], "default": "off", "description": "Trace output of cargo-watch" + }, + "rust-analyzer.lruCapacity": { + "type": "number", + "default": null, + "description": "Number of syntax trees rust-analyzer keeps in memory" } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 8d73a6b3..3024546d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -19,6 +19,7 @@ export class Config { public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; + public lruCapacity: null | number = null; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -109,5 +110,8 @@ export class Config { '' ); } + if (config.has('lruCapacity')) { + this.lruCapacity = config.get('lruCapacity') as number; + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 81c2b3ff..7029142f 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -35,7 +35,8 @@ export class Server { initializationOptions: { publishDecorations: true, showWorkspaceLoaded: - Server.config.showWorkspaceLoadedNotification + Server.config.showWorkspaceLoadedNotification, + lruCapacity: Server.config.lruCapacity }, traceOutputChannel }; From b4927cf3a49780f774b780867d966ea808557052 Mon Sep 17 00:00:00 2001 From: Aleksei Sidorov Date: Mon, 24 Jun 2019 13:02:20 +0300 Subject: [PATCH 122/819] Introduce cargo-watch.check-command --- rust-analyzer/editors/code/package.json | 7 ++++++- .../editors/code/src/commands/cargo_watch.ts | 6 ++++-- .../editors/code/src/commands/watch_status.ts | 8 +++++--- rust-analyzer/editors/code/src/config.ts | 13 ++++++++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c2ed8d12..e4fc682d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -203,9 +203,14 @@ }, "rust-analyzer.cargo-watch.check-arguments": { "type": "string", - "description": "`cargo-watch` check arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", + "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": "" }, + "rust-analyzer.cargo-watch.check-command": { + "type": "string", + "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", + "default": "check" + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 6ba794bb..db92e03f 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -43,7 +43,7 @@ export class CargoWatchProvider implements vscode.Disposable { this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 'rustc' ); - this.statusDisplay = new StatusDisplay(); + this.statusDisplay = new StatusDisplay(Server.config.cargoWatchOptions.checkCommand); this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); @@ -57,7 +57,9 @@ export class CargoWatchProvider implements vscode.Disposable { return; } - let args = 'check --all-targets --message-format json'; + let command = Server.config.cargoWatchOptions.checkCommand; + + let args = command + ' --all-targets --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index a3b0178f..91bc7195 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -7,13 +7,15 @@ export class StatusDisplay implements vscode.Disposable { private i = 0; private statusBarItem: vscode.StatusBarItem; + private command: string; private timer?: NodeJS.Timeout; - constructor() { + constructor(command: string) { this.statusBarItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, 10 ); + this.command = command; this.statusBarItem.hide(); } @@ -24,11 +26,11 @@ export class StatusDisplay implements vscode.Disposable { this.timer || setInterval(() => { if (this.packageName) { - this.statusBarItem!.text = `cargo check [${ + this.statusBarItem!.text = `cargo ${this.command} [${ this.packageName }] ${this.frame()}`; } else { - this.statusBarItem!.text = `cargo check ${this.frame()}`; + this.statusBarItem!.text = `cargo ${this.command} ${this.frame()}`; } }, 300); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 3024546d..85366fc3 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import { Server } from './server'; +import { strict } from 'assert'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -10,6 +11,7 @@ export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; export interface CargoWatchOptions { enableOnStartup: CargoWatchStartupOptions; checkArguments: string; + checkCommand: string; trace: CargoWatchTraceOptions; } @@ -23,7 +25,8 @@ export class Config { public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', - checkArguments: '' + checkArguments: '', + checkCommand: '' }; private prevEnhancedTyping: null | boolean = null; @@ -110,6 +113,14 @@ export class Config { '' ); } + + if (config.has('cargo-watch.check-command')) { + this.cargoWatchOptions.checkCommand = config.get( + 'cargo-watch.check-command', + '' + ); + } + if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } From 5efb5799894ca91c99bec8da7f5fe602d66504bd Mon Sep 17 00:00:00 2001 From: Aleksei Sidorov Date: Mon, 24 Jun 2019 13:33:37 +0300 Subject: [PATCH 123/819] Fix tslints --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 4 +--- rust-analyzer/editors/code/src/config.ts | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index db92e03f..16aac375 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -57,9 +57,7 @@ export class CargoWatchProvider implements vscode.Disposable { return; } - let command = Server.config.cargoWatchOptions.checkCommand; - - let args = command + ' --all-targets --message-format json'; + let args = Server.config.cargoWatchOptions.checkCommand + ' --all-targets --message-format json'; if (Server.config.cargoWatchOptions.checkArguments.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.checkArguments; diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 85366fc3..db46874d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; -import { Server } from './server'; import { strict } from 'assert'; +import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -116,7 +116,7 @@ export class Config { if (config.has('cargo-watch.check-command')) { this.cargoWatchOptions.checkCommand = config.get( - 'cargo-watch.check-command', + 'cargo-watch.check-command', '' ); } From decfa253faaf5574cbd73acf6b0036d1ba9c0dab Mon Sep 17 00:00:00 2001 From: Aleksey Sidorov Date: Mon, 24 Jun 2019 13:35:11 +0300 Subject: [PATCH 124/819] Apply suggestions from code review Co-Authored-By: Aleksey Kladov --- rust-analyzer/editors/code/package.json | 4 ++-- rust-analyzer/editors/code/src/config.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e4fc682d..02a9b7e5 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -201,12 +201,12 @@ ], "description": "Whether to run `cargo watch` on startup" }, - "rust-analyzer.cargo-watch.check-arguments": { + "rust-analyzer.cargo-watch.command-arguments": { "type": "string", "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": "" }, - "rust-analyzer.cargo-watch.check-command": { + "rust-analyzer.cargo-watch.command": { "type": "string", "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", "default": "check" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index db46874d..c1dd2c05 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -10,8 +10,8 @@ export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; export interface CargoWatchOptions { enableOnStartup: CargoWatchStartupOptions; - checkArguments: string; - checkCommand: string; + arguments: string; + command: string; trace: CargoWatchTraceOptions; } From b62f6c04915e8ab443f32f8b52ed5632a25f6f64 Mon Sep 17 00:00:00 2001 From: Aleksei Sidorov Date: Mon, 24 Jun 2019 13:50:34 +0300 Subject: [PATCH 125/819] Fix code after "apply suggestions" --- rust-analyzer/editors/code/package.json | 4 ++-- .../editors/code/src/commands/cargo_watch.ts | 12 ++++++++---- .../editors/code/src/commands/watch_status.ts | 4 +++- rust-analyzer/editors/code/src/config.ts | 16 ++++++++-------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 02a9b7e5..ac2ba82e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -201,7 +201,7 @@ ], "description": "Whether to run `cargo watch` on startup" }, - "rust-analyzer.cargo-watch.command-arguments": { + "rust-analyzer.cargo-watch.arguments": { "type": "string", "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": "" @@ -209,7 +209,7 @@ "rust-analyzer.cargo-watch.command": { "type": "string", "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", - "default": "check" + "default": "check" }, "rust-analyzer.trace.server": { "type": "string", diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 16aac375..13adf4c1 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -43,7 +43,9 @@ export class CargoWatchProvider implements vscode.Disposable { this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 'rustc' ); - this.statusDisplay = new StatusDisplay(Server.config.cargoWatchOptions.checkCommand); + this.statusDisplay = new StatusDisplay( + Server.config.cargoWatchOptions.command + ); this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); @@ -57,10 +59,12 @@ export class CargoWatchProvider implements vscode.Disposable { return; } - let args = Server.config.cargoWatchOptions.checkCommand + ' --all-targets --message-format json'; - if (Server.config.cargoWatchOptions.checkArguments.length > 0) { + let args = + Server.config.cargoWatchOptions.command + + ' --all-targets --message-format json'; + if (Server.config.cargoWatchOptions.command.length > 0) { // Excape the double quote string: - args += ' ' + Server.config.cargoWatchOptions.checkArguments; + args += ' ' + Server.config.cargoWatchOptions.arguments; } // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes if (process.platform === 'win32') { diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 91bc7195..6c1f9041 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -30,7 +30,9 @@ export class StatusDisplay implements vscode.Disposable { this.packageName }] ${this.frame()}`; } else { - this.statusBarItem!.text = `cargo ${this.command} ${this.frame()}`; + this.statusBarItem!.text = `cargo ${ + this.command + } ${this.frame()}`; } }, 300); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c1dd2c05..10e98d75 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -25,8 +25,8 @@ export class Config { public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', - checkArguments: '', - checkCommand: '' + arguments: '', + command: '' }; private prevEnhancedTyping: null | boolean = null; @@ -107,16 +107,16 @@ export class Config { ); } - if (config.has('cargo-watch.check-arguments')) { - this.cargoWatchOptions.checkArguments = config.get( - 'cargo-watch.check-arguments', + if (config.has('cargo-watch.arguments')) { + this.cargoWatchOptions.arguments = config.get( + 'cargo-watch.arguments', '' ); } - if (config.has('cargo-watch.check-command')) { - this.cargoWatchOptions.checkCommand = config.get( - 'cargo-watch.check-command', + if (config.has('cargo-watch.command')) { + this.cargoWatchOptions.command = config.get( + 'cargo-watch.command', '' ); } From 49b726a36f6105751f056b639e437ce533a65d4c Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Tue, 25 Jun 2019 07:40:06 +1000 Subject: [PATCH 126/819] Rich mapping of cargo watch output Currently we depend on the ASCII rendering string that `rustc` provides to populate Visual Studio Code's diagnostic. This has a number of shortcomings: 1. It's not a very good use of space in the error list 2. We can't jump to secondary spans (e.g. where a called function is defined) 3. We can't use Code Actions aka Quick Fix This moves all of the low-level parsing and mapping to a `rust_diagnostics.ts`. This uses some heuristics to map Rust diagnostics to VsCode: 1. As before, the Rust diagnostic message and primary span is used for the root diagnostic. However, we now just use the message instead of the rendered version. 2. Every secondary span is converted to "related information". This shows as child in the error list and can be jumped to. 3. Every child diagnostic is categorised in to three buckets: 1. If they have no span they're treated as another line of the root messages 2. If they have replacement text they're treated as a Code Action 3. If they have a span but no replacement text they're treated as related information (same as secondary spans). --- .../editors/code/src/commands/cargo_watch.ts | 186 ++++++++++----- .../code/src/utils/rust_diagnostics.ts | 220 ++++++++++++++++++ 2 files changed, 352 insertions(+), 54 deletions(-) create mode 100644 rust-analyzer/editors/code/src/utils/rust_diagnostics.ts diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 13adf4c1..a662f7cc 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -4,6 +4,10 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { Server } from '../server'; import { terminate } from '../utils/processes'; +import { + mapRustDiagnosticToVsCode, + RustDiagnostic +} from '../utils/rust_diagnostics'; import { LineBuffer } from './line_buffer'; import { StatusDisplay } from './watch_status'; @@ -33,10 +37,17 @@ export function registerCargoWatchProvider( return provider; } -export class CargoWatchProvider implements vscode.Disposable { +export class CargoWatchProvider + implements vscode.Disposable, vscode.CodeActionProvider { private readonly diagnosticCollection: vscode.DiagnosticCollection; private readonly statusDisplay: StatusDisplay; private readonly outputChannel: vscode.OutputChannel; + + private codeActions: { + [fileUri: string]: vscode.CodeAction[]; + }; + private readonly codeActionDispose: vscode.Disposable; + private cargoProcess?: child_process.ChildProcess; constructor() { @@ -49,6 +60,16 @@ export class CargoWatchProvider implements vscode.Disposable { this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); + + // Register code actions for rustc's suggested fixes + this.codeActions = {}; + this.codeActionDispose = vscode.languages.registerCodeActionsProvider( + [{ scheme: 'file', language: 'rust' }], + this, + { + providedCodeActionKinds: [vscode.CodeActionKind.QuickFix] + } + ); } public start() { @@ -127,6 +148,14 @@ export class CargoWatchProvider implements vscode.Disposable { this.diagnosticCollection.dispose(); this.outputChannel.dispose(); this.statusDisplay.dispose(); + this.codeActionDispose.dispose(); + } + + public provideCodeActions( + document: vscode.TextDocument + ): vscode.ProviderResult> { + const documentActions = this.codeActions[document.uri.toString()]; + return documentActions || []; } private logInfo(line: string) { @@ -147,6 +176,7 @@ export class CargoWatchProvider implements vscode.Disposable { private parseLine(line: string) { if (line.startsWith('[Running')) { this.diagnosticCollection.clear(); + this.codeActions = {}; this.statusDisplay.show(); } @@ -154,34 +184,65 @@ export class CargoWatchProvider implements vscode.Disposable { this.statusDisplay.hide(); } - function getLevel(s: string): vscode.DiagnosticSeverity { - if (s === 'error') { - return vscode.DiagnosticSeverity.Error; + function areDiagnosticsEqual( + left: vscode.Diagnostic, + right: vscode.Diagnostic + ): boolean { + return ( + left.source === right.source && + left.severity === right.severity && + left.range.isEqual(right.range) && + left.message === right.message + ); + } + + function areCodeActionsEqual( + left: vscode.CodeAction, + right: vscode.CodeAction + ): boolean { + if ( + left.kind !== right.kind || + left.title !== right.title || + !left.edit || + !right.edit + ) { + return false; } - if (s.startsWith('warn')) { - return vscode.DiagnosticSeverity.Warning; + + const leftEditEntries = left.edit.entries(); + const rightEditEntries = right.edit.entries(); + + if (leftEditEntries.length !== leftEditEntries.length) { + return false; } - return vscode.DiagnosticSeverity.Information; - } - // Reference: - // https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs - interface RustDiagnosticSpan { - line_start: number; - line_end: number; - column_start: number; - column_end: number; - is_primary: boolean; - file_name: string; - } + for (let i = 0; i < leftEditEntries.length; i++) { + const [leftUri, leftEdits] = leftEditEntries[i]; + const [rightUri, rightEdits] = rightEditEntries[i]; + + if (leftUri.toString() !== rightUri.toString()) { + return false; + } - interface RustDiagnostic { - spans: RustDiagnosticSpan[]; - rendered: string; - level: string; - code?: { - code: string; - }; + if (leftEdits.length !== rightEdits.length) { + return false; + } + + for (let j = 0; j < leftEdits.length; j++) { + const leftEdit = leftEdits[j]; + const rightEdit = rightEdits[j]; + + if (!leftEdit.range.isEqual(rightEdit.range)) { + return false; + } + + if (leftEdit.newText !== rightEdit.newText) { + return false; + } + } + } + + return true; } interface CargoArtifact { @@ -215,41 +276,58 @@ export class CargoWatchProvider implements vscode.Disposable { } else if (data.reason === 'compiler-message') { const msg = data.message as RustDiagnostic; - const spans = msg.spans.filter(o => o.is_primary); - - // We only handle primary span right now. - if (spans.length > 0) { - const o = spans[0]; + const mapResult = mapRustDiagnosticToVsCode(msg); + if (!mapResult) { + return; + } - const rendered = msg.rendered; - const level = getLevel(msg.level); - const range = new vscode.Range( - new vscode.Position(o.line_start - 1, o.column_start - 1), - new vscode.Position(o.line_end - 1, o.column_end - 1) - ); + const { location, diagnostic, codeActions } = mapResult; + const fileUri = location.uri; - const fileName = path.join( - vscode.workspace.rootPath!, - o.file_name - ); - const diagnostic = new vscode.Diagnostic( - range, - rendered, - level - ); + const diagnostics: vscode.Diagnostic[] = [ + ...(this.diagnosticCollection!.get(fileUri) || []) + ]; - diagnostic.source = 'rustc'; - diagnostic.code = msg.code ? msg.code.code : undefined; - diagnostic.relatedInformation = []; + // If we're building multiple targets it's possible we've already seen this diagnostic + const isDuplicate = diagnostics.some(d => + areDiagnosticsEqual(d, diagnostic) + ); - const fileUrl = vscode.Uri.file(fileName!); + if (isDuplicate) { + return; + } - const diagnostics: vscode.Diagnostic[] = [ - ...(this.diagnosticCollection!.get(fileUrl) || []) - ]; - diagnostics.push(diagnostic); + diagnostics.push(diagnostic); + this.diagnosticCollection!.set(fileUri, diagnostics); + + if (codeActions.length) { + const fileUriString = fileUri.toString(); + const existingActions = this.codeActions[fileUriString] || []; + + for (const newAction of codeActions) { + const existingAction = existingActions.find(existing => + areCodeActionsEqual(existing, newAction) + ); + + if (existingAction) { + if (!existingAction.diagnostics) { + existingAction.diagnostics = []; + } + // This action also applies to this diagnostic + existingAction.diagnostics.push(diagnostic); + } else { + newAction.diagnostics = [diagnostic]; + existingActions.push(newAction); + } + } - this.diagnosticCollection!.set(fileUrl, diagnostics); + // Have VsCode query us for the code actions + this.codeActions[fileUriString] = existingActions; + vscode.commands.executeCommand( + 'vscode.executeCodeActionProvider', + fileUri, + diagnostic.range + ); } } } diff --git a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts new file mode 100644 index 00000000..7d8cc0e0 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts @@ -0,0 +1,220 @@ +import * as path from 'path'; +import * as vscode from 'vscode'; + +// Reference: +// https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs +export interface RustDiagnosticSpan { + line_start: number; + line_end: number; + column_start: number; + column_end: number; + is_primary: boolean; + file_name: string; + label?: string; + suggested_replacement?: string; + suggestion_applicability?: + | 'MachineApplicable' + | 'HasPlaceholders' + | 'MaybeIncorrect' + | 'Unspecified'; +} + +export interface RustDiagnostic { + spans: RustDiagnosticSpan[]; + rendered: string; + message: string; + level: string; + code?: { + code: string; + }; + children: RustDiagnostic[]; +} + +export interface MappedRustDiagnostic { + location: vscode.Location; + diagnostic: vscode.Diagnostic; + codeActions: vscode.CodeAction[]; +} + +interface MappedRustChildDiagnostic { + related?: vscode.DiagnosticRelatedInformation; + codeAction?: vscode.CodeAction; + messageLine?: string; +} + +/** + * Converts a Rust level string to a VsCode severity + */ +function mapLevelToSeverity(s: string): vscode.DiagnosticSeverity { + if (s === 'error') { + return vscode.DiagnosticSeverity.Error; + } + if (s.startsWith('warn')) { + return vscode.DiagnosticSeverity.Warning; + } + return vscode.DiagnosticSeverity.Information; +} + +/** + * Converts a Rust span to a VsCode location + */ +function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { + const fileName = path.join(vscode.workspace.rootPath!, span.file_name); + const fileUri = vscode.Uri.file(fileName); + + const range = new vscode.Range( + new vscode.Position(span.line_start - 1, span.column_start - 1), + new vscode.Position(span.line_end - 1, span.column_end - 1) + ); + + return new vscode.Location(fileUri, range); +} + +/** + * Converts a secondary Rust span to a VsCode related information + * + * If the span is unlabelled this will return `undefined`. + */ +function mapSecondarySpanToRelated( + span: RustDiagnosticSpan +): vscode.DiagnosticRelatedInformation | undefined { + if (!span.label) { + // Nothing to label this with + return; + } + + const location = mapSpanToLocation(span); + return new vscode.DiagnosticRelatedInformation(location, span.label); +} + +/** + * Determines if diagnostic is related to unused code + */ +function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { + if (!rd.code) { + return false; + } + + const { code } = rd.code; + return code.startsWith('unused_') || code === 'dead_code'; +} + +/** + * Converts a Rust child diagnostic to a VsCode related information + * + * This can have three outcomes: + * + * 1. If this is no primary span this will return a `noteLine` + * 2. If there is a primary span with a suggested replacement it will return a + * `codeAction`. + * 3. If there is a primary span without a suggested replacement it will return + * a `related`. + */ +function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { + const span = rd.spans.find(s => s.is_primary); + + if (!span) { + // `rustc` uses these spanless children as a way to print multi-line + // messages + return { messageLine: rd.message }; + } + + // If we have a primary span use its location, otherwise use the parent + const location = mapSpanToLocation(span); + + // We need to distinguish `null` from an empty string + if (span && typeof span.suggested_replacement === 'string') { + const edit = new vscode.WorkspaceEdit(); + edit.replace(location.uri, location.range, span.suggested_replacement); + + // Include our replacement in the label unless it's empty + const title = span.suggested_replacement + ? `${rd.message}: \`${span.suggested_replacement}\`` + : rd.message; + + const codeAction = new vscode.CodeAction( + title, + vscode.CodeActionKind.QuickFix + ); + + codeAction.edit = edit; + codeAction.isPreferred = + span.suggestion_applicability === 'MachineApplicable'; + + return { codeAction }; + } else { + const related = new vscode.DiagnosticRelatedInformation( + location, + rd.message + ); + + return { related }; + } +} + +/** + * Converts a Rust root diagnostic to VsCode form + * + * This flattens the Rust diagnostic by: + * + * 1. Creating a `vscode.Diagnostic` with the root message and primary span. + * 2. Adding any labelled secondary spans to `relatedInformation` + * 3. Categorising child diagnostics as either Quick Fix actions, + * `relatedInformation` or additional message lines. + * + * If the diagnostic has no primary span this will return `undefined` + */ +export function mapRustDiagnosticToVsCode( + rd: RustDiagnostic +): MappedRustDiagnostic | undefined { + const codeActions = []; + + const primarySpan = rd.spans.find(s => s.is_primary); + if (!primarySpan) { + return; + } + + const location = mapSpanToLocation(primarySpan); + const secondarySpans = rd.spans.filter(s => !s.is_primary); + + const severity = mapLevelToSeverity(rd.level); + + const vd = new vscode.Diagnostic(location.range, rd.message, severity); + + vd.source = 'rustc'; + vd.code = rd.code ? rd.code.code : undefined; + vd.relatedInformation = []; + + for (const secondarySpan of secondarySpans) { + const related = mapSecondarySpanToRelated(secondarySpan); + if (related) { + vd.relatedInformation.push(related); + } + } + + for (const child of rd.children) { + const { related, codeAction, messageLine } = mapRustChildDiagnostic( + child + ); + + if (related) { + vd.relatedInformation.push(related); + } + if (codeAction) { + codeActions.push(codeAction); + } + if (messageLine) { + vd.message += `\n${messageLine}`; + } + } + + if (isUnusedOrUnnecessary(rd)) { + vd.tags = [vscode.DiagnosticTag.Unnecessary]; + } + + return { + location, + diagnostic: vd, + codeActions + }; +} From d0d0b69dedfce32383ce34f057127783892545ba Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Tue, 25 Jun 2019 21:36:55 +1000 Subject: [PATCH 127/819] Fix comparison of Code Action edit lengths This happened to work because we always produce a single edit but this is obviously dubious. --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index a662f7cc..126a8b1b 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -212,7 +212,7 @@ export class CargoWatchProvider const leftEditEntries = left.edit.entries(); const rightEditEntries = right.edit.entries(); - if (leftEditEntries.length !== leftEditEntries.length) { + if (leftEditEntries.length !== rightEditEntries.length) { return false; } From 9a699f534154bb045ed9fc4c1a8c5673b2067a06 Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Tue, 25 Jun 2019 21:44:27 +1000 Subject: [PATCH 128/819] Tweak isUnusedOrUnnecessary The first cut was a bit rough with the blanket `unused_*` rule. This trigger for things like `unused_mut` where the code is used but it's suboptimal. It's misleading to grey out the code in those cases. Instead, use an explicit list of things known to be dead code. --- .../editors/code/src/utils/rust_diagnostics.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts index 7d8cc0e0..ed049c95 100644 --- a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts +++ b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts @@ -95,8 +95,14 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { return false; } - const { code } = rd.code; - return code.startsWith('unused_') || code === 'dead_code'; + return [ + 'dead_code', + 'unknown_lints', + 'unused_attributes', + 'unused_imports', + 'unused_macros', + 'unused_variables' + ].includes(rd.code.code); } /** From 87c68833687022c4abbaf4a3bca31d56b99db609 Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Wed, 26 Jun 2019 20:14:18 +1000 Subject: [PATCH 129/819] Initial Visual Studio Code unit tests As promised in #1439 this is an initial attempt at unit testing the VSCode extension. There are two separate parts to this: getting the test framework working and unit testing the code in #1439. The test framework nearly intact from the VSCode extension generator. The main thing missing was `test/index.ts` which acts as an entry point for Mocha. This was simply copied back in. I also needed to open the test VSCode instance inside a workspace as our file URI generation depends on a workspace being open. There are two ways to run the test framework: 1. Opening the extension's source in VSCode, pressing F5 and selecting the "Extensions Test" debug target. 2. Closing all copies of VSCode and running `npm test`. This is started from the command line but actually opens a temporary VSCode window to host the tests. This doesn't attempt to wire this up to CI. That requires running a headless X11 server which is a bit daunting. I'll assess the difficulty of that in a follow-up branch. This PR is at least helpful for local development without having to induce errors on a Rust project. For the actual tests this uses snapshots of `rustc` output from a real Rust project captured from the command line. Except for extracting the `message` object and reformatting they're copied verbatim into fixture JSON files. Only four different types of diagnostics are tested but they represent the main combinations of code actions and related information possible. They can be considered the happy path tests; as we encounter corner-cases we can introduce new tests fixtures. --- .../editors/code/.vscode/launch.json | 1 + rust-analyzer/editors/code/package.json | 1 + .../editors/code/src/commands/cargo_watch.ts | 66 +------ .../clippy/trivially_copy_pass_by_ref.json | 110 ++++++++++++ .../rust-diagnostics/error/E0053.json | 42 +++++ .../rust-diagnostics/error/E0061.json | 114 ++++++++++++ .../warning/unused_variables.json | 72 ++++++++ rust-analyzer/editors/code/src/test/index.ts | 22 +++ .../code/src/test/rust_diagnostics.test.ts | 161 +++++++++++++++++ .../code/src/test/vscode_diagnostics.test.ts | 164 ++++++++++++++++++ .../code/src/utils/vscode_diagnostics.ts | 73 ++++++++ 11 files changed, 765 insertions(+), 61 deletions(-) create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json create mode 100644 rust-analyzer/editors/code/src/test/index.ts create mode 100644 rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts create mode 100644 rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts create mode 100644 rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts diff --git a/rust-analyzer/editors/code/.vscode/launch.json b/rust-analyzer/editors/code/.vscode/launch.json index b9d14ddd..c3578f47 100644 --- a/rust-analyzer/editors/code/.vscode/launch.json +++ b/rust-analyzer/editors/code/.vscode/launch.json @@ -20,6 +20,7 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ + "${workspaceFolder}/src/test/", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test" ], diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ac2ba82e..6e2dd049 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -23,6 +23,7 @@ "postinstall": "node ./node_modules/vscode/bin/install", "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", + "test": "node node_modules/vscode/bin/test", "prettier": "prettier **/*.{json,ts}", "travis": "npm run compile && npm run lint && npm run prettier -- --list-different" }, diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 126a8b1b..1ec5f8d5 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -2,12 +2,17 @@ import * as child_process from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; + import { Server } from '../server'; import { terminate } from '../utils/processes'; import { mapRustDiagnosticToVsCode, RustDiagnostic } from '../utils/rust_diagnostics'; +import { + areCodeActionsEqual, + areDiagnosticsEqual +} from '../utils/vscode_diagnostics'; import { LineBuffer } from './line_buffer'; import { StatusDisplay } from './watch_status'; @@ -184,67 +189,6 @@ export class CargoWatchProvider this.statusDisplay.hide(); } - function areDiagnosticsEqual( - left: vscode.Diagnostic, - right: vscode.Diagnostic - ): boolean { - return ( - left.source === right.source && - left.severity === right.severity && - left.range.isEqual(right.range) && - left.message === right.message - ); - } - - function areCodeActionsEqual( - left: vscode.CodeAction, - right: vscode.CodeAction - ): boolean { - if ( - left.kind !== right.kind || - left.title !== right.title || - !left.edit || - !right.edit - ) { - return false; - } - - const leftEditEntries = left.edit.entries(); - const rightEditEntries = right.edit.entries(); - - if (leftEditEntries.length !== rightEditEntries.length) { - return false; - } - - for (let i = 0; i < leftEditEntries.length; i++) { - const [leftUri, leftEdits] = leftEditEntries[i]; - const [rightUri, rightEdits] = rightEditEntries[i]; - - if (leftUri.toString() !== rightUri.toString()) { - return false; - } - - if (leftEdits.length !== rightEdits.length) { - return false; - } - - for (let j = 0; j < leftEdits.length; j++) { - const leftEdit = leftEdits[j]; - const rightEdit = rightEdits[j]; - - if (!leftEdit.range.isEqual(rightEdit.range)) { - return false; - } - - if (leftEdit.newText !== rightEdit.newText) { - return false; - } - } - } - - return true; - } - interface CargoArtifact { reason: string; package_id: string; diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json new file mode 100644 index 00000000..d874e99b --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json @@ -0,0 +1,110 @@ +{ + "message": "this argument is passed by reference, but would be more efficient if passed by value", + "code": { + "code": "clippy::trivially_copy_pass_by_ref", + "explanation": null + }, + "level": "warning", + "spans": [ + { + "file_name": "compiler/mir/tagset.rs", + "byte_start": 941, + "byte_end": 946, + "line_start": 42, + "line_end": 42, + "column_start": 24, + "column_end": 29, + "is_primary": true, + "text": [ + { + "text": " pub fn is_disjoint(&self, other: Self) -> bool {", + "highlight_start": 24, + "highlight_end": 29 + } + ], + "label": null, + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [ + { + "message": "lint level defined here", + "code": null, + "level": "note", + "spans": [ + { + "file_name": "compiler/lib.rs", + "byte_start": 8, + "byte_end": 19, + "line_start": 1, + "line_end": 1, + "column_start": 9, + "column_end": 20, + "is_primary": true, + "text": [ + { + "text": "#![warn(clippy::all)]", + "highlight_start": 9, + "highlight_end": 20 + } + ], + "label": null, + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [], + "rendered": null + }, + { + "message": "#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]", + "code": null, + "level": "note", + "spans": [], + "children": [], + "rendered": null + }, + { + "message": "for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref", + "code": null, + "level": "help", + "spans": [], + "children": [], + "rendered": null + }, + { + "message": "consider passing by value instead", + "code": null, + "level": "help", + "spans": [ + { + "file_name": "compiler/mir/tagset.rs", + "byte_start": 941, + "byte_end": 946, + "line_start": 42, + "line_end": 42, + "column_start": 24, + "column_end": 29, + "is_primary": true, + "text": [ + { + "text": " pub fn is_disjoint(&self, other: Self) -> bool {", + "highlight_start": 24, + "highlight_end": 29 + } + ], + "label": null, + "suggested_replacement": "self", + "suggestion_applicability": "Unspecified", + "expansion": null + } + ], + "children": [], + "rendered": null + } + ], + "rendered": "warning: this argument is passed by reference, but would be more efficient if passed by value\n --> compiler/mir/tagset.rs:42:24\n |\n42 | pub fn is_disjoint(&self, other: Self) -> bool {\n | ^^^^^ help: consider passing by value instead: `self`\n |\nnote: lint level defined here\n --> compiler/lib.rs:1:9\n |\n1 | #![warn(clippy::all)]\n | ^^^^^^^^^^^\n = note: #[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref\n\n" +} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json new file mode 100644 index 00000000..ea5c976d --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json @@ -0,0 +1,42 @@ +{ + "message": "method `next` has an incompatible type for trait", + "code": { + "code": "E0053", + "explanation": "\nThe parameters of any trait method must match between a trait implementation\nand the trait definition.\n\nHere are a couple examples of this error:\n\n```compile_fail,E0053\ntrait Foo {\n fn foo(x: u16);\n fn bar(&self);\n}\n\nstruct Bar;\n\nimpl Foo for Bar {\n // error, expected u16, found i16\n fn foo(x: i16) { }\n\n // error, types differ in mutability\n fn bar(&mut self) { }\n}\n```\n" + }, + "level": "error", + "spans": [ + { + "file_name": "compiler/ty/list_iter.rs", + "byte_start": 1307, + "byte_end": 1350, + "line_start": 52, + "line_end": 52, + "column_start": 5, + "column_end": 48, + "is_primary": true, + "text": [ + { + "text": " fn next(&self) -> Option<&'list ty::Ref> {", + "highlight_start": 5, + "highlight_end": 48 + } + ], + "label": "types differ in mutability", + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [ + { + "message": "expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>`", + "code": null, + "level": "note", + "spans": [], + "children": [], + "rendered": null + } + ], + "rendered": "error[E0053]: method `next` has an incompatible type for trait\n --> compiler/ty/list_iter.rs:52:5\n |\n52 | fn next(&self) -> Option<&'list ty::Ref> {\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability\n |\n = note: expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>`\n\n" +} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json new file mode 100644 index 00000000..3154d109 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json @@ -0,0 +1,114 @@ +{ + "message": "this function takes 2 parameters but 3 parameters were supplied", + "code": { + "code": "E0061", + "explanation": "\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g., `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n" + }, + "level": "error", + "spans": [ + { + "file_name": "compiler/ty/select.rs", + "byte_start": 8787, + "byte_end": 9241, + "line_start": 219, + "line_end": 231, + "column_start": 5, + "column_end": 6, + "is_primary": false, + "text": [ + { + "text": " pub fn add_evidence(", + "highlight_start": 5, + "highlight_end": 25 + }, + { + "text": " &mut self,", + "highlight_start": 1, + "highlight_end": 19 + }, + { + "text": " target_poly: &ty::Ref,", + "highlight_start": 1, + "highlight_end": 41 + }, + { + "text": " evidence_poly: &ty::Ref,", + "highlight_start": 1, + "highlight_end": 43 + }, + { + "text": " ) {", + "highlight_start": 1, + "highlight_end": 8 + }, + { + "text": " match target_poly {", + "highlight_start": 1, + "highlight_end": 28 + }, + { + "text": " ty::Ref::Var(tvar, _) => self.add_var_evidence(tvar, evidence_poly),", + "highlight_start": 1, + "highlight_end": 81 + }, + { + "text": " ty::Ref::Fixed(target_ty) => {", + "highlight_start": 1, + "highlight_end": 43 + }, + { + "text": " let evidence_ty = evidence_poly.resolve_to_ty();", + "highlight_start": 1, + "highlight_end": 65 + }, + { + "text": " self.add_evidence_ty(target_ty, evidence_poly, evidence_ty)", + "highlight_start": 1, + "highlight_end": 76 + }, + { + "text": " }", + "highlight_start": 1, + "highlight_end": 14 + }, + { + "text": " }", + "highlight_start": 1, + "highlight_end": 10 + }, + { + "text": " }", + "highlight_start": 1, + "highlight_end": 6 + } + ], + "label": "defined here", + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + }, + { + "file_name": "compiler/ty/select.rs", + "byte_start": 4045, + "byte_end": 4057, + "line_start": 104, + "line_end": 104, + "column_start": 18, + "column_end": 30, + "is_primary": true, + "text": [ + { + "text": " self.add_evidence(target_fixed, evidence_fixed, false);", + "highlight_start": 18, + "highlight_end": 30 + } + ], + "label": "expected 2 parameters", + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [], + "rendered": "error[E0061]: this function takes 2 parameters but 3 parameters were supplied\n --> compiler/ty/select.rs:104:18\n |\n104 | self.add_evidence(target_fixed, evidence_fixed, false);\n | ^^^^^^^^^^^^ expected 2 parameters\n...\n219 | / pub fn add_evidence(\n220 | | &mut self,\n221 | | target_poly: &ty::Ref,\n222 | | evidence_poly: &ty::Ref,\n... |\n230 | | }\n231 | | }\n | |_____- defined here\n\n" +} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json new file mode 100644 index 00000000..d1e2be72 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json @@ -0,0 +1,72 @@ +{ + "message": "unused variable: `foo`", + "code": { + "code": "unused_variables", + "explanation": null + }, + "level": "warning", + "spans": [ + { + "file_name": "driver/subcommand/repl.rs", + "byte_start": 9228, + "byte_end": 9231, + "line_start": 291, + "line_end": 291, + "column_start": 9, + "column_end": 12, + "is_primary": true, + "text": [ + { + "text": " let foo = 42;", + "highlight_start": 9, + "highlight_end": 12 + } + ], + "label": null, + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [ + { + "message": "#[warn(unused_variables)] on by default", + "code": null, + "level": "note", + "spans": [], + "children": [], + "rendered": null + }, + { + "message": "consider prefixing with an underscore", + "code": null, + "level": "help", + "spans": [ + { + "file_name": "driver/subcommand/repl.rs", + "byte_start": 9228, + "byte_end": 9231, + "line_start": 291, + "line_end": 291, + "column_start": 9, + "column_end": 12, + "is_primary": true, + "text": [ + { + "text": " let foo = 42;", + "highlight_start": 9, + "highlight_end": 12 + } + ], + "label": null, + "suggested_replacement": "_foo", + "suggestion_applicability": "MachineApplicable", + "expansion": null + } + ], + "children": [], + "rendered": null + } + ], + "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n" +} diff --git a/rust-analyzer/editors/code/src/test/index.ts b/rust-analyzer/editors/code/src/test/index.ts new file mode 100644 index 00000000..6e565c25 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/index.ts @@ -0,0 +1,22 @@ +// +// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING +// +// This file is providing the test runner to use when running extension tests. +// By default the test runner in use is Mocha based. +// +// You can provide your own test runner if you want to override it by exporting +// a function run(testRoot: string, clb: (error:Error) => void) that the extension +// host can call to run the tests. The test runner is expected to use console.log +// to report the results back to the caller. When the tests are finished, return +// a possible error to the callback or null if none. + +import * as testRunner from 'vscode/lib/testrunner'; + +// You can directly control Mocha options by uncommenting the following lines +// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info +testRunner.configure({ + ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) + useColors: true // colored output from test results +}); + +module.exports = testRunner; diff --git a/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts new file mode 100644 index 00000000..5eb064b9 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts @@ -0,0 +1,161 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as vscode from 'vscode'; + +import { + MappedRustDiagnostic, + mapRustDiagnosticToVsCode, + RustDiagnostic +} from '../utils/rust_diagnostics'; + +function loadDiagnosticFixture(name: string): RustDiagnostic { + const jsonText = fs + .readFileSync( + // We're actually in our JavaScript output directory, climb out + `${__dirname}/../../src/test/fixtures/rust-diagnostics/${name}.json` + ) + .toString(); + + return JSON.parse(jsonText); +} + +function mapFixtureToVsCode(name: string): MappedRustDiagnostic { + const rd = loadDiagnosticFixture(name); + const mapResult = mapRustDiagnosticToVsCode(rd); + + if (!mapResult) { + return assert.fail('Mapping unexpectedly failed'); + } + return mapResult; +} + +describe('mapRustDiagnosticToVsCode', () => { + it('should map an incompatible type for trait error', () => { + const { diagnostic, codeActions } = mapFixtureToVsCode('error/E0053'); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Error + ); + assert.strictEqual( + diagnostic.message, + [ + `method \`next\` has an incompatible type for trait`, + `expected type \`fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>\``, + ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\`` + ].join('\n') + ); + assert.strictEqual(diagnostic.code, 'E0053'); + assert.strictEqual(diagnostic.tags, undefined); + + // No related information + assert.deepStrictEqual(diagnostic.relatedInformation, []); + + // There are no code actions available + assert.strictEqual(codeActions.length, 0); + }); + + it('should map an unused variable warning', () => { + const { diagnostic, codeActions } = mapFixtureToVsCode( + 'warning/unused_variables' + ); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Warning + ); + assert.strictEqual( + diagnostic.message, + [ + 'unused variable: `foo`', + '#[warn(unused_variables)] on by default' + ].join('\n') + ); + assert.strictEqual(diagnostic.code, 'unused_variables'); + assert.deepStrictEqual(diagnostic.tags, [ + vscode.DiagnosticTag.Unnecessary + ]); + + // No related information + assert.deepStrictEqual(diagnostic.relatedInformation, []); + + // One code action available to prefix the variable + assert.strictEqual(codeActions.length, 1); + const [codeAction] = codeActions; + assert.strictEqual( + codeAction.title, + 'consider prefixing with an underscore: `_foo`' + ); + assert(codeAction.isPreferred); + }); + + it('should map a wrong number of parameters error', () => { + const { diagnostic, codeActions } = mapFixtureToVsCode('error/E0061'); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Error + ); + assert.strictEqual( + diagnostic.message, + 'this function takes 2 parameters but 3 parameters were supplied' + ); + assert.strictEqual(diagnostic.code, 'E0061'); + assert.strictEqual(diagnostic.tags, undefined); + + // One related information for the original definition + const relatedInformation = diagnostic.relatedInformation; + if (!relatedInformation) { + return assert.fail('Related information unexpectedly undefined'); + } + assert.strictEqual(relatedInformation.length, 1); + const [related] = relatedInformation; + assert.strictEqual(related.message, 'defined here'); + + // There are no actions available + assert.strictEqual(codeActions.length, 0); + }); + + it('should map a Clippy copy pass by ref warning', () => { + const { diagnostic, codeActions } = mapFixtureToVsCode( + 'clippy/trivially_copy_pass_by_ref' + ); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Warning + ); + assert.strictEqual( + diagnostic.message, + [ + 'this argument is passed by reference, but would be more efficient if passed by value', + '#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]', + 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref' + ].join('\n') + ); + assert.strictEqual( + diagnostic.code, + 'clippy::trivially_copy_pass_by_ref' + ); + assert.strictEqual(diagnostic.tags, undefined); + + // One related information for the lint definition + const relatedInformation = diagnostic.relatedInformation; + if (!relatedInformation) { + return assert.fail('Related information unexpectedly undefined'); + } + assert.strictEqual(relatedInformation.length, 1); + const [related] = relatedInformation; + assert.strictEqual(related.message, 'lint level defined here'); + + // One code action available to pass by value + assert.strictEqual(codeActions.length, 1); + const [codeAction] = codeActions; + assert.strictEqual( + codeAction.title, + 'consider passing by value instead: `self`' + ); + // Clippy does not mark this as machine applicable + assert.strictEqual(codeAction.isPreferred, false); + }); +}); diff --git a/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts new file mode 100644 index 00000000..ca434562 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts @@ -0,0 +1,164 @@ +import * as assert from 'assert'; +import * as vscode from 'vscode'; + +import { + areCodeActionsEqual, + areDiagnosticsEqual +} from '../utils/vscode_diagnostics'; + +const uri = vscode.Uri.file('/file/1'); + +const range1 = new vscode.Range( + new vscode.Position(1, 2), + new vscode.Position(3, 4) +); + +const range2 = new vscode.Range( + new vscode.Position(5, 6), + new vscode.Position(7, 8) +); + +describe('areDiagnosticsEqual', () => { + it('should treat identical diagnostics as equal', () => { + const diagnostic1 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + const diagnostic2 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + assert(areDiagnosticsEqual(diagnostic1, diagnostic2)); + }); + + it('should treat diagnostics with different ranges as inequal', () => { + const diagnostic1 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + const diagnostic2 = new vscode.Diagnostic( + range2, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); + }); + + it('should treat diagnostics with different messages as inequal', () => { + const diagnostic1 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + const diagnostic2 = new vscode.Diagnostic( + range1, + 'Goodbye!, world!', + vscode.DiagnosticSeverity.Error + ); + + assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); + }); + + it('should treat diagnostics with different severities as inequal', () => { + const diagnostic1 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Warning + ); + + const diagnostic2 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + + assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); + }); +}); + +describe('areCodeActionsEqual', () => { + it('should treat identical actions as equal', () => { + const codeAction1 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.QuickFix + ); + + const codeAction2 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.QuickFix + ); + + const edit = new vscode.WorkspaceEdit(); + edit.replace(uri, range1, 'Replace with this'); + codeAction1.edit = edit; + codeAction2.edit = edit; + + assert(areCodeActionsEqual(codeAction1, codeAction2)); + }); + + it('should treat actions with different types as inequal', () => { + const codeAction1 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.Refactor + ); + + const codeAction2 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.QuickFix + ); + + const edit = new vscode.WorkspaceEdit(); + edit.replace(uri, range1, 'Replace with this'); + codeAction1.edit = edit; + codeAction2.edit = edit; + + assert(!areCodeActionsEqual(codeAction1, codeAction2)); + }); + + it('should treat actions with different titles as inequal', () => { + const codeAction1 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.Refactor + ); + + const codeAction2 = new vscode.CodeAction( + 'Do something different!', + vscode.CodeActionKind.Refactor + ); + + const edit = new vscode.WorkspaceEdit(); + edit.replace(uri, range1, 'Replace with this'); + codeAction1.edit = edit; + codeAction2.edit = edit; + + assert(!areCodeActionsEqual(codeAction1, codeAction2)); + }); + + it('should treat actions with different edits as inequal', () => { + const codeAction1 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.Refactor + ); + const edit1 = new vscode.WorkspaceEdit(); + edit1.replace(uri, range1, 'Replace with this'); + codeAction1.edit = edit1; + + const codeAction2 = new vscode.CodeAction( + 'Fix me!', + vscode.CodeActionKind.Refactor + ); + const edit2 = new vscode.WorkspaceEdit(); + edit2.replace(uri, range1, 'Replace with this other thing'); + codeAction2.edit = edit2; + + assert(!areCodeActionsEqual(codeAction1, codeAction2)); + }); +}); diff --git a/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts b/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts new file mode 100644 index 00000000..9d763c8d --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts @@ -0,0 +1,73 @@ +import * as vscode from 'vscode'; + +/** Compares two `vscode.Diagnostic`s for equality */ +export function areDiagnosticsEqual( + left: vscode.Diagnostic, + right: vscode.Diagnostic +): boolean { + return ( + left.source === right.source && + left.severity === right.severity && + left.range.isEqual(right.range) && + left.message === right.message + ); +} + +/** Compares two `vscode.TextEdit`s for equality */ +function areTextEditsEqual( + left: vscode.TextEdit, + right: vscode.TextEdit +): boolean { + if (!left.range.isEqual(right.range)) { + return false; + } + + if (left.newText !== right.newText) { + return false; + } + + return true; +} + +/** Compares two `vscode.CodeAction`s for equality */ +export function areCodeActionsEqual( + left: vscode.CodeAction, + right: vscode.CodeAction +): boolean { + if ( + left.kind !== right.kind || + left.title !== right.title || + !left.edit || + !right.edit + ) { + return false; + } + + const leftEditEntries = left.edit.entries(); + const rightEditEntries = right.edit.entries(); + + if (leftEditEntries.length !== rightEditEntries.length) { + return false; + } + + for (let i = 0; i < leftEditEntries.length; i++) { + const [leftUri, leftEdits] = leftEditEntries[i]; + const [rightUri, rightEdits] = rightEditEntries[i]; + + if (leftUri.toString() !== rightUri.toString()) { + return false; + } + + if (leftEdits.length !== rightEdits.length) { + return false; + } + + for (let j = 0; j < leftEdits.length; j++) { + if (!areTextEditsEqual(leftEdits[j], rightEdits[j])) { + return false; + } + } + } + + return true; +} From 07b9a1f7f1663ec8f2cb4f0b51b2bc8d6c0778d9 Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Thu, 27 Jun 2019 08:47:36 +1000 Subject: [PATCH 130/819] Extract lint scopes from `cargo watch` Currently all of our VS Code diagnostics are given the source of `rustc`. However, if you have something like `cargo-watch.command` set to `clippy` it will also watch for Clippy lints. The `rustc` source is a bit misleading in that case. Fortunately, Rust's tool lints (RFC 2103) line up perfectly with VS Code's concept of `source`. This checks for lints scoped to a given tool and then splits them in to a `source` and tool-specific `code`. --- .../code/src/test/rust_diagnostics.test.ts | 9 +++++---- .../code/src/test/vscode_diagnostics.test.ts | 18 ++++++++++++++++++ .../editors/code/src/utils/rust_diagnostics.ts | 14 ++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts index 5eb064b9..f27c58fe 100644 --- a/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts +++ b/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts @@ -37,6 +37,7 @@ describe('mapRustDiagnosticToVsCode', () => { diagnostic.severity, vscode.DiagnosticSeverity.Error ); + assert.strictEqual(diagnostic.source, 'rustc'); assert.strictEqual( diagnostic.message, [ @@ -72,6 +73,7 @@ describe('mapRustDiagnosticToVsCode', () => { ].join('\n') ); assert.strictEqual(diagnostic.code, 'unused_variables'); + assert.strictEqual(diagnostic.source, 'rustc'); assert.deepStrictEqual(diagnostic.tags, [ vscode.DiagnosticTag.Unnecessary ]); @@ -101,6 +103,7 @@ describe('mapRustDiagnosticToVsCode', () => { 'this function takes 2 parameters but 3 parameters were supplied' ); assert.strictEqual(diagnostic.code, 'E0061'); + assert.strictEqual(diagnostic.source, 'rustc'); assert.strictEqual(diagnostic.tags, undefined); // One related information for the original definition @@ -125,6 +128,7 @@ describe('mapRustDiagnosticToVsCode', () => { diagnostic.severity, vscode.DiagnosticSeverity.Warning ); + assert.strictEqual(diagnostic.source, 'clippy'); assert.strictEqual( diagnostic.message, [ @@ -133,10 +137,7 @@ describe('mapRustDiagnosticToVsCode', () => { 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref' ].join('\n') ); - assert.strictEqual( - diagnostic.code, - 'clippy::trivially_copy_pass_by_ref' - ); + assert.strictEqual(diagnostic.code, 'trivially_copy_pass_by_ref'); assert.strictEqual(diagnostic.tags, undefined); // One related information for the lint definition diff --git a/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts index ca434562..9c5d812f 100644 --- a/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts +++ b/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts @@ -35,6 +35,24 @@ describe('areDiagnosticsEqual', () => { assert(areDiagnosticsEqual(diagnostic1, diagnostic2)); }); + it('should treat diagnostics with different sources as inequal', () => { + const diagnostic1 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + diagnostic1.source = 'rustc'; + + const diagnostic2 = new vscode.Diagnostic( + range1, + 'Hello, world!', + vscode.DiagnosticSeverity.Error + ); + diagnostic2.source = 'clippy'; + + assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); + }); + it('should treat diagnostics with different ranges as inequal', () => { const diagnostic1 = new vscode.Diagnostic( range1, diff --git a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts index ed049c95..3c524cb3 100644 --- a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts +++ b/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts @@ -187,8 +187,18 @@ export function mapRustDiagnosticToVsCode( const vd = new vscode.Diagnostic(location.range, rd.message, severity); - vd.source = 'rustc'; - vd.code = rd.code ? rd.code.code : undefined; + let source = 'rustc'; + let code = rd.code && rd.code.code; + if (code) { + // See if this is an RFC #2103 scoped lint (e.g. from Clippy) + const scopedCode = code.split('::'); + if (scopedCode.length === 2) { + [source, code] = scopedCode; + } + } + + vd.source = source; + vd.code = code; vd.relatedInformation = []; for (const secondarySpan of secondarySpans) { From 9291bb7753ccfa27541599d29e8e83bde8e4d561 Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Thu, 27 Jun 2019 21:30:23 +1000 Subject: [PATCH 131/819] Fix `cargo watch` code action filtering There are two issues with the implementation of `provideCodeActions` introduced in #1439: 1. We're returning the code action based on the file its diagnostic is in; not the file the suggested fix is in. I'm not sure how often fixes are suggested cross-file but it's something we should handle. 2. We're not filtering code actions based on the passed range. The means if there is any suggestion in a file we'll show an action for every line of the file. I naively thought that VS Code would filter for us but that was wrong. Unfortunately the VS Code `CodeAction` object is very complex - it can handle edits across multiple files, run commands, etc. This makes it complex to check them for equality or see if any of their edits intersects with a specified range. To make it easier to work with suggestions this introduces a `SuggestedFix` model object and a `SuggestFixCollection` code action provider. This is a layer between the raw Rust JSON and VS Code's `CodeAction`s. I was reluctant to introduce another layer of abstraction here but my attempt to work directly with VS Code's model objects was worse. --- .../editors/code/src/commands/cargo_watch.ts | 67 +++------ .../utils/diagnotics/SuggestedFix.test.ts | 133 ++++++++++++++++++ .../diagnotics/SuggestedFixCollection.test.ts | 125 ++++++++++++++++ .../diagnotics/rust.test.ts} | 55 +++++--- .../diagnotics/vscode.test.ts} | 86 +---------- .../src/utils/diagnostics/SuggestedFix.ts | 67 +++++++++ .../diagnostics/SuggestedFixCollection.ts | 74 ++++++++++ .../rust.ts} | 55 ++++---- .../code/src/utils/diagnostics/vscode.ts | 14 ++ .../code/src/utils/vscode_diagnostics.ts | 73 ---------- 10 files changed, 495 insertions(+), 254 deletions(-) create mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts create mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts rename rust-analyzer/editors/code/src/test/{rust_diagnostics.test.ts => utils/diagnotics/rust.test.ts} (77%) rename rust-analyzer/editors/code/src/test/{vscode_diagnostics.test.ts => utils/diagnotics/vscode.test.ts} (50%) create mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts create mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts rename rust-analyzer/editors/code/src/utils/{rust_diagnostics.ts => diagnostics/rust.ts} (85%) create mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts delete mode 100644 rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 1ec5f8d5..4c3c10c8 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -5,16 +5,15 @@ import * as vscode from 'vscode'; import { Server } from '../server'; import { terminate } from '../utils/processes'; +import { LineBuffer } from './line_buffer'; +import { StatusDisplay } from './watch_status'; + import { mapRustDiagnosticToVsCode, RustDiagnostic -} from '../utils/rust_diagnostics'; -import { - areCodeActionsEqual, - areDiagnosticsEqual -} from '../utils/vscode_diagnostics'; -import { LineBuffer } from './line_buffer'; -import { StatusDisplay } from './watch_status'; +} from '../utils/diagnostics/rust'; +import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection'; +import { areDiagnosticsEqual } from '../utils/diagnostics/vscode'; export function registerCargoWatchProvider( subscriptions: vscode.Disposable[] @@ -42,16 +41,13 @@ export function registerCargoWatchProvider( return provider; } -export class CargoWatchProvider - implements vscode.Disposable, vscode.CodeActionProvider { +export class CargoWatchProvider implements vscode.Disposable { private readonly diagnosticCollection: vscode.DiagnosticCollection; private readonly statusDisplay: StatusDisplay; private readonly outputChannel: vscode.OutputChannel; - private codeActions: { - [fileUri: string]: vscode.CodeAction[]; - }; - private readonly codeActionDispose: vscode.Disposable; + private suggestedFixCollection: SuggestedFixCollection; + private codeActionDispose: vscode.Disposable; private cargoProcess?: child_process.ChildProcess; @@ -66,13 +62,14 @@ export class CargoWatchProvider 'Cargo Watch Trace' ); - // Register code actions for rustc's suggested fixes - this.codeActions = {}; + // Track `rustc`'s suggested fixes so we can convert them to code actions + this.suggestedFixCollection = new SuggestedFixCollection(); this.codeActionDispose = vscode.languages.registerCodeActionsProvider( [{ scheme: 'file', language: 'rust' }], - this, + this.suggestedFixCollection, { - providedCodeActionKinds: [vscode.CodeActionKind.QuickFix] + providedCodeActionKinds: + SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS } ); } @@ -156,13 +153,6 @@ export class CargoWatchProvider this.codeActionDispose.dispose(); } - public provideCodeActions( - document: vscode.TextDocument - ): vscode.ProviderResult> { - const documentActions = this.codeActions[document.uri.toString()]; - return documentActions || []; - } - private logInfo(line: string) { if (Server.config.cargoWatchOptions.trace === 'verbose') { this.outputChannel.append(line); @@ -181,7 +171,7 @@ export class CargoWatchProvider private parseLine(line: string) { if (line.startsWith('[Running')) { this.diagnosticCollection.clear(); - this.codeActions = {}; + this.suggestedFixCollection.clear(); this.statusDisplay.show(); } @@ -225,7 +215,7 @@ export class CargoWatchProvider return; } - const { location, diagnostic, codeActions } = mapResult; + const { location, diagnostic, suggestedFixes } = mapResult; const fileUri = location.uri; const diagnostics: vscode.Diagnostic[] = [ @@ -236,7 +226,6 @@ export class CargoWatchProvider const isDuplicate = diagnostics.some(d => areDiagnosticsEqual(d, diagnostic) ); - if (isDuplicate) { return; } @@ -244,29 +233,15 @@ export class CargoWatchProvider diagnostics.push(diagnostic); this.diagnosticCollection!.set(fileUri, diagnostics); - if (codeActions.length) { - const fileUriString = fileUri.toString(); - const existingActions = this.codeActions[fileUriString] || []; - - for (const newAction of codeActions) { - const existingAction = existingActions.find(existing => - areCodeActionsEqual(existing, newAction) + if (suggestedFixes.length) { + for (const suggestedFix of suggestedFixes) { + this.suggestedFixCollection.addSuggestedFixForDiagnostic( + suggestedFix, + diagnostic ); - - if (existingAction) { - if (!existingAction.diagnostics) { - existingAction.diagnostics = []; - } - // This action also applies to this diagnostic - existingAction.diagnostics.push(diagnostic); - } else { - newAction.diagnostics = [diagnostic]; - existingActions.push(newAction); - } } // Have VsCode query us for the code actions - this.codeActions[fileUriString] = existingActions; vscode.commands.executeCommand( 'vscode.executeCodeActionProvider', fileUri, diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts new file mode 100644 index 00000000..6c7f436f --- /dev/null +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts @@ -0,0 +1,133 @@ +import * as assert from 'assert'; +import * as vscode from 'vscode'; + +import { SuggestionApplicability } from '../../../utils/diagnostics/rust'; +import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; + +const location1 = new vscode.Location( + vscode.Uri.file('/file/1'), + new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)) +); + +const location2 = new vscode.Location( + vscode.Uri.file('/file/2'), + new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)) +); + +describe('SuggestedFix', () => { + describe('isEqual', () => { + it('should treat identical instances as equal', () => { + const suggestion1 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + const suggestion2 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + assert(suggestion1.isEqual(suggestion2)); + }); + + it('should treat instances with different titles as inequal', () => { + const suggestion1 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + const suggestion2 = new SuggestedFix( + 'Not the same title!', + location1, + 'With this!' + ); + + assert(!suggestion1.isEqual(suggestion2)); + }); + + it('should treat instances with different replacements as inequal', () => { + const suggestion1 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + const suggestion2 = new SuggestedFix( + 'Replace me!', + location1, + 'With something else!' + ); + + assert(!suggestion1.isEqual(suggestion2)); + }); + + it('should treat instances with different locations as inequal', () => { + const suggestion1 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + const suggestion2 = new SuggestedFix( + 'Replace me!', + location2, + 'With this!' + ); + + assert(!suggestion1.isEqual(suggestion2)); + }); + + it('should treat instances with different applicability as inequal', () => { + const suggestion1 = new SuggestedFix( + 'Replace me!', + location1, + 'With this!', + SuggestionApplicability.MachineApplicable + ); + + const suggestion2 = new SuggestedFix( + 'Replace me!', + location2, + 'With this!', + SuggestionApplicability.HasPlaceholders + ); + + assert(!suggestion1.isEqual(suggestion2)); + }); + }); + + describe('toCodeAction', () => { + it('should map a simple suggestion', () => { + const suggestion = new SuggestedFix( + 'Replace me!', + location1, + 'With this!' + ); + + const codeAction = suggestion.toCodeAction(); + assert.strictEqual(codeAction.kind, vscode.CodeActionKind.QuickFix); + assert.strictEqual(codeAction.title, 'Replace me!'); + assert.strictEqual(codeAction.isPreferred, false); + + const edit = codeAction.edit; + if (!edit) { + return assert.fail('Code Action edit unexpectedly missing'); + } + + const editEntries = edit.entries(); + assert.strictEqual(editEntries.length, 1); + + const [[editUri, textEdits]] = editEntries; + assert.strictEqual(editUri.toString(), location1.uri.toString()); + + assert.strictEqual(textEdits.length, 1); + const [textEdit] = textEdits; + + assert(textEdit.range.isEqual(location1.range)); + assert.strictEqual(textEdit.newText, 'With this!'); + }); + }); +}); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts new file mode 100644 index 00000000..f0328893 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts @@ -0,0 +1,125 @@ +import * as assert from 'assert'; +import * as vscode from 'vscode'; + +import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; +import SuggestedFixCollection from '../../../utils/diagnostics/SuggestedFixCollection'; + +const uri1 = vscode.Uri.file('/file/1'); +const uri2 = vscode.Uri.file('/file/2'); + +const mockDocument1 = ({ + uri: uri1 +} as unknown) as vscode.TextDocument; + +const mockDocument2 = ({ + uri: uri2 +} as unknown) as vscode.TextDocument; + +const range1 = new vscode.Range( + new vscode.Position(1, 2), + new vscode.Position(3, 4) +); +const range2 = new vscode.Range( + new vscode.Position(5, 6), + new vscode.Position(7, 8) +); + +const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); +const diagnostic2 = new vscode.Diagnostic(range2, 'Second diagnostic'); + +// This is a mutable object so return a fresh instance every time +function suggestion1(): SuggestedFix { + return new SuggestedFix( + 'Replace me!', + new vscode.Location(uri1, range1), + 'With this!' + ); +} + +describe('SuggestedFixCollection', () => { + it('should add a suggestion then return it as a code action', () => { + const suggestedFixes = new SuggestedFixCollection(); + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); + + // Specify the document and range that exactly matches + const codeActions = suggestedFixes.provideCodeActions( + mockDocument1, + range1 + ); + + assert.strictEqual(codeActions.length, 1); + const [codeAction] = codeActions; + assert.strictEqual(codeAction.title, suggestion1().title); + + const { diagnostics } = codeAction; + if (!diagnostics) { + return assert.fail('Diagnostics unexpectedly missing'); + } + + assert.strictEqual(diagnostics.length, 1); + assert.strictEqual(diagnostics[0], diagnostic1); + }); + + it('should not return code actions for different ranges', () => { + const suggestedFixes = new SuggestedFixCollection(); + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); + + const codeActions = suggestedFixes.provideCodeActions( + mockDocument1, + range2 + ); + + assert(!codeActions || codeActions.length === 0); + }); + + it('should not return code actions for different documents', () => { + const suggestedFixes = new SuggestedFixCollection(); + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); + + const codeActions = suggestedFixes.provideCodeActions( + mockDocument2, + range1 + ); + + assert(!codeActions || codeActions.length === 0); + }); + + it('should not return code actions that have been cleared', () => { + const suggestedFixes = new SuggestedFixCollection(); + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); + suggestedFixes.clear(); + + const codeActions = suggestedFixes.provideCodeActions( + mockDocument1, + range1 + ); + + assert(!codeActions || codeActions.length === 0); + }); + + it('should merge identical suggestions together', () => { + const suggestedFixes = new SuggestedFixCollection(); + + // Add the same suggestion for two diagnostics + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); + suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic2); + + const codeActions = suggestedFixes.provideCodeActions( + mockDocument1, + range1 + ); + + assert.strictEqual(codeActions.length, 1); + const [codeAction] = codeActions; + const { diagnostics } = codeAction; + + if (!diagnostics) { + return assert.fail('Diagnostics unexpectedly missing'); + } + + // We should be associated with both diagnostics + assert.strictEqual(diagnostics.length, 2); + assert.strictEqual(diagnostics[0], diagnostic1); + assert.strictEqual(diagnostics[1], diagnostic2); + }); +}); diff --git a/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts similarity index 77% rename from rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts rename to rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index f27c58fe..b555a481 100644 --- a/rust-analyzer/editors/code/src/test/rust_diagnostics.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -5,14 +5,15 @@ import * as vscode from 'vscode'; import { MappedRustDiagnostic, mapRustDiagnosticToVsCode, - RustDiagnostic -} from '../utils/rust_diagnostics'; + RustDiagnostic, + SuggestionApplicability +} from '../../../utils/diagnostics/rust'; function loadDiagnosticFixture(name: string): RustDiagnostic { const jsonText = fs .readFileSync( // We're actually in our JavaScript output directory, climb out - `${__dirname}/../../src/test/fixtures/rust-diagnostics/${name}.json` + `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json` ) .toString(); @@ -31,7 +32,9 @@ function mapFixtureToVsCode(name: string): MappedRustDiagnostic { describe('mapRustDiagnosticToVsCode', () => { it('should map an incompatible type for trait error', () => { - const { diagnostic, codeActions } = mapFixtureToVsCode('error/E0053'); + const { diagnostic, suggestedFixes } = mapFixtureToVsCode( + 'error/E0053' + ); assert.strictEqual( diagnostic.severity, @@ -52,12 +55,12 @@ describe('mapRustDiagnosticToVsCode', () => { // No related information assert.deepStrictEqual(diagnostic.relatedInformation, []); - // There are no code actions available - assert.strictEqual(codeActions.length, 0); + // There are no suggested fixes + assert.strictEqual(suggestedFixes.length, 0); }); it('should map an unused variable warning', () => { - const { diagnostic, codeActions } = mapFixtureToVsCode( + const { diagnostic, suggestedFixes } = mapFixtureToVsCode( 'warning/unused_variables' ); @@ -81,18 +84,23 @@ describe('mapRustDiagnosticToVsCode', () => { // No related information assert.deepStrictEqual(diagnostic.relatedInformation, []); - // One code action available to prefix the variable - assert.strictEqual(codeActions.length, 1); - const [codeAction] = codeActions; + // One suggested fix available to prefix the variable + assert.strictEqual(suggestedFixes.length, 1); + const [suggestedFix] = suggestedFixes; assert.strictEqual( - codeAction.title, + suggestedFix.title, 'consider prefixing with an underscore: `_foo`' ); - assert(codeAction.isPreferred); + assert.strictEqual( + suggestedFix.applicability, + SuggestionApplicability.MachineApplicable + ); }); it('should map a wrong number of parameters error', () => { - const { diagnostic, codeActions } = mapFixtureToVsCode('error/E0061'); + const { diagnostic, suggestedFixes } = mapFixtureToVsCode( + 'error/E0061' + ); assert.strictEqual( diagnostic.severity, @@ -115,12 +123,12 @@ describe('mapRustDiagnosticToVsCode', () => { const [related] = relatedInformation; assert.strictEqual(related.message, 'defined here'); - // There are no actions available - assert.strictEqual(codeActions.length, 0); + // There are no suggested fixes + assert.strictEqual(suggestedFixes.length, 0); }); it('should map a Clippy copy pass by ref warning', () => { - const { diagnostic, codeActions } = mapFixtureToVsCode( + const { diagnostic, suggestedFixes } = mapFixtureToVsCode( 'clippy/trivially_copy_pass_by_ref' ); @@ -149,14 +157,17 @@ describe('mapRustDiagnosticToVsCode', () => { const [related] = relatedInformation; assert.strictEqual(related.message, 'lint level defined here'); - // One code action available to pass by value - assert.strictEqual(codeActions.length, 1); - const [codeAction] = codeActions; + // One suggested fix to pass by value + assert.strictEqual(suggestedFixes.length, 1); + const [suggestedFix] = suggestedFixes; assert.strictEqual( - codeAction.title, + suggestedFix.title, 'consider passing by value instead: `self`' ); - // Clippy does not mark this as machine applicable - assert.strictEqual(codeAction.isPreferred, false); + // Clippy does not mark this with any applicability + assert.strictEqual( + suggestedFix.applicability, + SuggestionApplicability.Unspecified + ); }); }); diff --git a/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts similarity index 50% rename from rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts rename to rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts index 9c5d812f..542dec1f 100644 --- a/rust-analyzer/editors/code/src/test/vscode_diagnostics.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts @@ -1,12 +1,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { - areCodeActionsEqual, - areDiagnosticsEqual -} from '../utils/vscode_diagnostics'; - -const uri = vscode.Uri.file('/file/1'); +import { areDiagnosticsEqual } from '../../../utils/diagnostics/vscode'; const range1 = new vscode.Range( new vscode.Position(1, 2), @@ -101,82 +96,3 @@ describe('areDiagnosticsEqual', () => { assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); }); }); - -describe('areCodeActionsEqual', () => { - it('should treat identical actions as equal', () => { - const codeAction1 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.QuickFix - ); - - const codeAction2 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.QuickFix - ); - - const edit = new vscode.WorkspaceEdit(); - edit.replace(uri, range1, 'Replace with this'); - codeAction1.edit = edit; - codeAction2.edit = edit; - - assert(areCodeActionsEqual(codeAction1, codeAction2)); - }); - - it('should treat actions with different types as inequal', () => { - const codeAction1 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.Refactor - ); - - const codeAction2 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.QuickFix - ); - - const edit = new vscode.WorkspaceEdit(); - edit.replace(uri, range1, 'Replace with this'); - codeAction1.edit = edit; - codeAction2.edit = edit; - - assert(!areCodeActionsEqual(codeAction1, codeAction2)); - }); - - it('should treat actions with different titles as inequal', () => { - const codeAction1 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.Refactor - ); - - const codeAction2 = new vscode.CodeAction( - 'Do something different!', - vscode.CodeActionKind.Refactor - ); - - const edit = new vscode.WorkspaceEdit(); - edit.replace(uri, range1, 'Replace with this'); - codeAction1.edit = edit; - codeAction2.edit = edit; - - assert(!areCodeActionsEqual(codeAction1, codeAction2)); - }); - - it('should treat actions with different edits as inequal', () => { - const codeAction1 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.Refactor - ); - const edit1 = new vscode.WorkspaceEdit(); - edit1.replace(uri, range1, 'Replace with this'); - codeAction1.edit = edit1; - - const codeAction2 = new vscode.CodeAction( - 'Fix me!', - vscode.CodeActionKind.Refactor - ); - const edit2 = new vscode.WorkspaceEdit(); - edit2.replace(uri, range1, 'Replace with this other thing'); - codeAction2.edit = edit2; - - assert(!areCodeActionsEqual(codeAction1, codeAction2)); - }); -}); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts new file mode 100644 index 00000000..b1be2a22 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts @@ -0,0 +1,67 @@ +import * as vscode from 'vscode'; + +import { SuggestionApplicability } from './rust'; + +/** + * Model object for text replacements suggested by the Rust compiler + * + * This is an intermediate form between the raw `rustc` JSON and a + * `vscode.CodeAction`. It's optimised for the use-cases of + * `SuggestedFixCollection`. + */ +export default class SuggestedFix { + public readonly title: string; + public readonly location: vscode.Location; + public readonly replacement: string; + public readonly applicability: SuggestionApplicability; + + /** + * Diagnostics this suggested fix could resolve + */ + public diagnostics: vscode.Diagnostic[]; + + constructor( + title: string, + location: vscode.Location, + replacement: string, + applicability: SuggestionApplicability = SuggestionApplicability.Unspecified + ) { + this.title = title; + this.location = location; + this.replacement = replacement; + this.applicability = applicability; + this.diagnostics = []; + } + + /** + * Determines if this suggested fix is equivalent to another instance + */ + public isEqual(other: SuggestedFix): boolean { + return ( + this.title === other.title && + this.location.range.isEqual(other.location.range) && + this.replacement === other.replacement && + this.applicability === other.applicability + ); + } + + /** + * Converts this suggested fix to a VS Code Quick Fix code action + */ + public toCodeAction(): vscode.CodeAction { + const codeAction = new vscode.CodeAction( + this.title, + vscode.CodeActionKind.QuickFix + ); + + const edit = new vscode.WorkspaceEdit(); + edit.replace(this.location.uri, this.location.range, this.replacement); + codeAction.edit = edit; + + codeAction.isPreferred = + this.applicability === SuggestionApplicability.MachineApplicable; + + codeAction.diagnostics = [...this.diagnostics]; + return codeAction; + } +} diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts new file mode 100644 index 00000000..3b0bf746 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts @@ -0,0 +1,74 @@ +import * as vscode from 'vscode'; +import SuggestedFix from './SuggestedFix'; + +/** + * Collection of suggested fixes across multiple documents + * + * This stores `SuggestedFix` model objects and returns them via the + * `vscode.CodeActionProvider` interface. + */ +export default class SuggestedFixCollection + implements vscode.CodeActionProvider { + public static PROVIDED_CODE_ACTION_KINDS = [vscode.CodeActionKind.QuickFix]; + + private suggestedFixes: Map; + + constructor() { + this.suggestedFixes = new Map(); + } + + /** + * Clears all suggested fixes across all documents + */ + public clear(): void { + this.suggestedFixes = new Map(); + } + + /** + * Adds a suggested fix for the given diagnostic + * + * Some suggested fixes will appear in multiple diagnostics. For example, + * forgetting a `mut` on a variable will suggest changing the delaration on + * every mutable usage site. If the suggested fix has already been added + * this method will instead associate the existing fix with the new + * diagnostic. + */ + public addSuggestedFixForDiagnostic( + suggestedFix: SuggestedFix, + diagnostic: vscode.Diagnostic + ): void { + const fileUriString = suggestedFix.location.uri.toString(); + const fileSuggestions = this.suggestedFixes.get(fileUriString) || []; + + const existingSuggestion = fileSuggestions.find(s => + s.isEqual(suggestedFix) + ); + + if (existingSuggestion) { + // The existing suggestion also applies to this new diagnostic + existingSuggestion.diagnostics.push(diagnostic); + } else { + // We haven't seen this suggestion before + suggestedFix.diagnostics.push(diagnostic); + fileSuggestions.push(suggestedFix); + } + + this.suggestedFixes.set(fileUriString, fileSuggestions); + } + + /** + * Filters suggested fixes by their document and range and converts them to + * code actions + */ + public provideCodeActions( + document: vscode.TextDocument, + range: vscode.Range + ): vscode.CodeAction[] { + const documentUriString = document.uri.toString(); + + const suggestedFixes = this.suggestedFixes.get(documentUriString); + return (suggestedFixes || []) + .filter(({ location }) => location.range.intersection(range)) + .map(suggestedEdit => suggestedEdit.toCodeAction()); + } +} diff --git a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts similarity index 85% rename from rust-analyzer/editors/code/src/utils/rust_diagnostics.ts rename to rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index 3c524cb3..d16576eb 100644 --- a/rust-analyzer/editors/code/src/utils/rust_diagnostics.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -1,6 +1,15 @@ import * as path from 'path'; import * as vscode from 'vscode'; +import SuggestedFix from './SuggestedFix'; + +export enum SuggestionApplicability { + MachineApplicable = 'MachineApplicable', + HasPlaceholders = 'HasPlaceholders', + MaybeIncorrect = 'MaybeIncorrect', + Unspecified = 'Unspecified' +} + // Reference: // https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs export interface RustDiagnosticSpan { @@ -12,11 +21,7 @@ export interface RustDiagnosticSpan { file_name: string; label?: string; suggested_replacement?: string; - suggestion_applicability?: - | 'MachineApplicable' - | 'HasPlaceholders' - | 'MaybeIncorrect' - | 'Unspecified'; + suggestion_applicability?: SuggestionApplicability; } export interface RustDiagnostic { @@ -33,12 +38,12 @@ export interface RustDiagnostic { export interface MappedRustDiagnostic { location: vscode.Location; diagnostic: vscode.Diagnostic; - codeActions: vscode.CodeAction[]; + suggestedFixes: SuggestedFix[]; } interface MappedRustChildDiagnostic { related?: vscode.DiagnosticRelatedInformation; - codeAction?: vscode.CodeAction; + suggestedFix?: SuggestedFix; messageLine?: string; } @@ -130,24 +135,19 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { // We need to distinguish `null` from an empty string if (span && typeof span.suggested_replacement === 'string') { - const edit = new vscode.WorkspaceEdit(); - edit.replace(location.uri, location.range, span.suggested_replacement); - - // Include our replacement in the label unless it's empty + // Include our replacement in the title unless it's empty const title = span.suggested_replacement ? `${rd.message}: \`${span.suggested_replacement}\`` : rd.message; - const codeAction = new vscode.CodeAction( - title, - vscode.CodeActionKind.QuickFix - ); - - codeAction.edit = edit; - codeAction.isPreferred = - span.suggestion_applicability === 'MachineApplicable'; - - return { codeAction }; + return { + suggestedFix: new SuggestedFix( + title, + location, + span.suggested_replacement, + span.suggestion_applicability + ) + }; } else { const related = new vscode.DiagnosticRelatedInformation( location, @@ -165,7 +165,7 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { * * 1. Creating a `vscode.Diagnostic` with the root message and primary span. * 2. Adding any labelled secondary spans to `relatedInformation` - * 3. Categorising child diagnostics as either Quick Fix actions, + * 3. Categorising child diagnostics as either `SuggestedFix`es, * `relatedInformation` or additional message lines. * * If the diagnostic has no primary span this will return `undefined` @@ -173,8 +173,6 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { export function mapRustDiagnosticToVsCode( rd: RustDiagnostic ): MappedRustDiagnostic | undefined { - const codeActions = []; - const primarySpan = rd.spans.find(s => s.is_primary); if (!primarySpan) { return; @@ -208,16 +206,17 @@ export function mapRustDiagnosticToVsCode( } } + const suggestedFixes = []; for (const child of rd.children) { - const { related, codeAction, messageLine } = mapRustChildDiagnostic( + const { related, suggestedFix, messageLine } = mapRustChildDiagnostic( child ); if (related) { vd.relatedInformation.push(related); } - if (codeAction) { - codeActions.push(codeAction); + if (suggestedFix) { + suggestedFixes.push(suggestedFix); } if (messageLine) { vd.message += `\n${messageLine}`; @@ -231,6 +230,6 @@ export function mapRustDiagnosticToVsCode( return { location, diagnostic: vd, - codeActions + suggestedFixes }; } diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts b/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts new file mode 100644 index 00000000..d8b85b72 --- /dev/null +++ b/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts @@ -0,0 +1,14 @@ +import * as vscode from 'vscode'; + +/** Compares two `vscode.Diagnostic`s for equality */ +export function areDiagnosticsEqual( + left: vscode.Diagnostic, + right: vscode.Diagnostic +): boolean { + return ( + left.source === right.source && + left.severity === right.severity && + left.range.isEqual(right.range) && + left.message === right.message + ); +} diff --git a/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts b/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts deleted file mode 100644 index 9d763c8d..00000000 --- a/rust-analyzer/editors/code/src/utils/vscode_diagnostics.ts +++ /dev/null @@ -1,73 +0,0 @@ -import * as vscode from 'vscode'; - -/** Compares two `vscode.Diagnostic`s for equality */ -export function areDiagnosticsEqual( - left: vscode.Diagnostic, - right: vscode.Diagnostic -): boolean { - return ( - left.source === right.source && - left.severity === right.severity && - left.range.isEqual(right.range) && - left.message === right.message - ); -} - -/** Compares two `vscode.TextEdit`s for equality */ -function areTextEditsEqual( - left: vscode.TextEdit, - right: vscode.TextEdit -): boolean { - if (!left.range.isEqual(right.range)) { - return false; - } - - if (left.newText !== right.newText) { - return false; - } - - return true; -} - -/** Compares two `vscode.CodeAction`s for equality */ -export function areCodeActionsEqual( - left: vscode.CodeAction, - right: vscode.CodeAction -): boolean { - if ( - left.kind !== right.kind || - left.title !== right.title || - !left.edit || - !right.edit - ) { - return false; - } - - const leftEditEntries = left.edit.entries(); - const rightEditEntries = right.edit.entries(); - - if (leftEditEntries.length !== rightEditEntries.length) { - return false; - } - - for (let i = 0; i < leftEditEntries.length; i++) { - const [leftUri, leftEdits] = leftEditEntries[i]; - const [rightUri, rightEdits] = rightEditEntries[i]; - - if (leftUri.toString() !== rightUri.toString()) { - return false; - } - - if (leftEdits.length !== rightEdits.length) { - return false; - } - - for (let j = 0; j < leftEdits.length; j++) { - if (!areTextEditsEqual(leftEdits[j], rightEdits[j])) { - return false; - } - } - } - - return true; -} From 3b3184f3ad93aba5683bceb4d0b5aa600386fa4d Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Sat, 29 Jun 2019 18:00:22 +1000 Subject: [PATCH 132/819] Add noUnusedLocals to VsCode tsconfig `tslint` doesn't catch this because TypeScript has had this check builtin since 2.9. However, it's disabled by default so right now nothing is checking for unused variables. --- rust-analyzer/editors/code/src/config.ts | 1 - rust-analyzer/editors/code/tsconfig.json | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 10e98d75..3f1b482e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; -import { strict } from 'assert'; import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index ef93c52b..9ad2e967 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -6,7 +6,8 @@ "lib": ["es6"], "sourceMap": true, "rootDir": "src", - "strict": true + "strict": true, + "noUnusedLocals": true }, "exclude": ["node_modules", ".vscode-test"] } From c919ccd5a23150c4774dea78f7c1157a71f5c3ca Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Sat, 29 Jun 2019 19:46:20 +1000 Subject: [PATCH 133/819] Comment on the key of `suggestedFixes` This isn't immediately obvious without looking at the users of the map --- .../code/src/utils/diagnostics/SuggestedFixCollection.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts index 3b0bf746..132ce12f 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts @@ -11,6 +11,9 @@ export default class SuggestedFixCollection implements vscode.CodeActionProvider { public static PROVIDED_CODE_ACTION_KINDS = [vscode.CodeActionKind.QuickFix]; + /** + * Map of document URI strings to suggested fixes + */ private suggestedFixes: Map; constructor() { From bc269a17530280a5cd99d5af2e32a7e6f7bf7f8e Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Sun, 30 Jun 2019 06:56:46 +1000 Subject: [PATCH 134/819] Run VS Code tests on CI This is actually much faster than I expected; it takes about 13 seconds to download VS Code and run the unit tests. This means the VS Code tests are still significantly faster than the Rust ones. If this ends up being unreliable we can always remove it later or move it to a separate optional job. We also need to ignore the `.vscode-test` directory when running `prettier` or it will get upset about some temporary JSON files VS Code creates. --- rust-analyzer/editors/code/.prettierignore | 2 ++ rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/.prettierignore diff --git a/rust-analyzer/editors/code/.prettierignore b/rust-analyzer/editors/code/.prettierignore new file mode 100644 index 00000000..3798f2d1 --- /dev/null +++ b/rust-analyzer/editors/code/.prettierignore @@ -0,0 +1,2 @@ +node_modules/ +.vscode-test/ diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6e2dd049..52972031 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "lint": "tslint --project .", "test": "node node_modules/vscode/bin/test", "prettier": "prettier **/*.{json,ts}", - "travis": "npm run compile && npm run lint && npm run prettier -- --list-different" + "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --list-different" }, "prettier": { "tabWidth": 4, From 5b9710b197ca6f4239c400fb6958915a524b8640 Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Sun, 30 Jun 2019 10:49:07 +1000 Subject: [PATCH 135/819] Include primary span label in VS Code diagnostics In most cases the primary label span repeats information found elsewhere in the diagnostic. For example, with E0061: ``` { "message": "this function takes 2 parameters but 3 parameters were supplied", "spans": [{"label": "expected 2 parameters"}] } ``` However, with some mismatched type errors (E0308) the expected type only appears in the primary span's label, e.g.: ``` { "message": "mismatched types", "spans": [{"label": "expected usize, found u32"}] } ``` I initially added the primary span label to the message unconditionally. However, for most error types the child diagnostics repeat the primary span label with more detail. `rustc` also renders the duplicate text but because the span label and child diagnostics appear in visually distinct places it's not as confusing. This takes a heuristic approach where it will only add the primary span label if there are no child message lines. --- .../rust-diagnostics/error/E0308.json | 33 +++++++++++++++++++ .../src/test/utils/diagnotics/rust.test.ts | 29 +++++++++++++++- .../code/src/utils/diagnostics/rust.ts | 9 +++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json new file mode 100644 index 00000000..fb23824a --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json @@ -0,0 +1,33 @@ +{ + "message": "mismatched types", + "code": { + "code": "E0308", + "explanation": "\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n" + }, + "level": "error", + "spans": [ + { + "file_name": "runtime/compiler_support.rs", + "byte_start": 1589, + "byte_end": 1594, + "line_start": 48, + "line_end": 48, + "column_start": 65, + "column_end": 70, + "is_primary": true, + "text": [ + { + "text": " let layout = alloc::Layout::from_size_align_unchecked(size, align);", + "highlight_start": 65, + "highlight_end": 70 + } + ], + "label": "expected usize, found u32", + "suggested_replacement": null, + "suggestion_applicability": null, + "expansion": null + } + ], + "children": [], + "rendered": "error[E0308]: mismatched types\n --> runtime/compiler_support.rs:48:65\n |\n48 | let layout = alloc::Layout::from_size_align_unchecked(size, align);\n | ^^^^^ expected usize, found u32\n\n" +} diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index b555a481..7fb003fe 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -108,7 +108,10 @@ describe('mapRustDiagnosticToVsCode', () => { ); assert.strictEqual( diagnostic.message, - 'this function takes 2 parameters but 3 parameters were supplied' + [ + 'this function takes 2 parameters but 3 parameters were supplied', + 'expected 2 parameters' + ].join('\n') ); assert.strictEqual(diagnostic.code, 'E0061'); assert.strictEqual(diagnostic.source, 'rustc'); @@ -170,4 +173,28 @@ describe('mapRustDiagnosticToVsCode', () => { SuggestionApplicability.Unspecified ); }); + + it('should map a mismatched type error', () => { + const { diagnostic, suggestedFixes } = mapFixtureToVsCode( + 'error/E0308' + ); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Error + ); + assert.strictEqual( + diagnostic.message, + ['mismatched types', 'expected usize, found u32'].join('\n') + ); + assert.strictEqual(diagnostic.code, 'E0308'); + assert.strictEqual(diagnostic.source, 'rustc'); + assert.strictEqual(diagnostic.tags, undefined); + + // No related information + assert.deepStrictEqual(diagnostic.relatedInformation, []); + + // There are no suggested fixes + assert.strictEqual(suggestedFixes.length, 0); + }); }); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index d16576eb..c07be455 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -182,6 +182,7 @@ export function mapRustDiagnosticToVsCode( const secondarySpans = rd.spans.filter(s => !s.is_primary); const severity = mapLevelToSeverity(rd.level); + let primarySpanLabel = primarySpan.label; const vd = new vscode.Diagnostic(location.range, rd.message, severity); @@ -220,9 +221,17 @@ export function mapRustDiagnosticToVsCode( } if (messageLine) { vd.message += `\n${messageLine}`; + + // These secondary messages usually duplicate the content of the + // primary span label. + primarySpanLabel = undefined; } } + if (primarySpanLabel) { + vd.message += `\n${primarySpanLabel}`; + } + if (isUnusedOrUnnecessary(rd)) { vd.tags = [vscode.DiagnosticTag.Unnecessary]; } From 50d46a51b0761965de035dd6e38fe48f848e46af Mon Sep 17 00:00:00 2001 From: Ryan Cumming Date: Sun, 30 Jun 2019 12:13:56 +1000 Subject: [PATCH 136/819] Consider unreachable code to be unnecessary in VSC This adds `unreachable_code` to the list of diagnostic codes we map to `Unnecessary` in Visual Studio Code. This is consistent with what the TypeScript language server does. --- rust-analyzer/editors/code/src/utils/diagnostics/rust.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index d16576eb..5e2d6b6f 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -103,6 +103,7 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { return [ 'dead_code', 'unknown_lints', + 'unreachable_code', 'unused_attributes', 'unused_imports', 'unused_macros', From 44f538522863910477823aa5abaed56e3e60bb7b Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 3 Jul 2019 09:55:48 -0400 Subject: [PATCH 137/819] Update vsce to latest --- rust-analyzer/editors/code/package-lock.json | 81 ++++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 6b3a12f9..b3666f30 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -39,7 +39,8 @@ "@types/seedrandom": { "version": "2.4.28", "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", - "integrity": "sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==" + "integrity": "sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==", + "dev": true }, "agent-base": { "version": "4.2.1", @@ -113,6 +114,18 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, + "azure-devops-node-api": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", + "integrity": "sha512-pMfGJ6gAQ7LRKTHgiRF+8iaUUeGAI0c8puLaqHLc7B8AR7W6GJLozK9RFeUHFjEGybC9/EB3r67WPd7e46zQ8w==", + "dev": true, + "requires": { + "os": "0.1.1", + "tunnel": "0.0.4", + "typed-rest-client": "1.2.0", + "underscore": "1.8.3" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -289,6 +302,12 @@ "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", "dev": true }, + "didyoumean": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", + "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "dev": true + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -805,6 +824,12 @@ "wrappy": "1" } }, + "os": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", + "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=", + "dev": true + }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -887,12 +912,6 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, - "q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", - "dev": true - }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", @@ -915,9 +934,9 @@ } }, "readable-stream": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", - "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -1177,21 +1196,13 @@ "dev": true }, "typed-rest-client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-0.9.0.tgz", - "integrity": "sha1-92jMDcP06VDwbgSCXDaz54NKofI=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", + "integrity": "sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==", "dev": true, "requires": { "tunnel": "0.0.4", "underscore": "1.8.3" - }, - "dependencies": { - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - } } }, "typescript": { @@ -1207,9 +1218,9 @@ "dev": true }, "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, "uri-js": { @@ -1261,15 +1272,17 @@ } }, "vsce": { - "version": "1.59.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.59.0.tgz", - "integrity": "sha512-tkB97885k5ce25Brbe9AZTCAXAkBh7oa5EOzY0BCJQ51W/mfRaQuCluCd9gZpWdgiU4AbPvwxtoVKKsenlSt8w==", + "version": "1.64.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.64.0.tgz", + "integrity": "sha512-t3R7QTe2nAXQZs2kD+nA8GjdlX8pAQlnzxaNTG2976i5cyQ8r+ZsMNa/f9PDt7bhjcQM+u/fL+LkNuw+hwoy2A==", "dev": true, "requires": { + "azure-devops-node-api": "^7.2.0", "chalk": "^2.4.2", "cheerio": "^1.0.0-rc.1", "commander": "^2.8.1", "denodeify": "^1.2.1", + "didyoumean": "^1.2.1", "glob": "^7.0.6", "lodash": "^4.17.10", "markdown-it": "^8.3.1", @@ -1280,8 +1293,8 @@ "read": "^1.0.7", "semver": "^5.1.0", "tmp": "0.0.29", + "typed-rest-client": "1.2.0", "url-join": "^1.1.0", - "vso-node-api": "6.1.2-preview", "yauzl": "^2.3.1", "yazl": "^2.2.2" } @@ -1339,18 +1352,6 @@ "https-proxy-agent": "^2.2.1" } }, - "vso-node-api": { - "version": "6.1.2-preview", - "resolved": "https://registry.npmjs.org/vso-node-api/-/vso-node-api-6.1.2-preview.tgz", - "integrity": "sha1-qrNUbfJFHs2JTgcbuZtd8Zxfp48=", - "dev": true, - "requires": { - "q": "^1.0.1", - "tunnel": "0.0.4", - "typed-rest-client": "^0.9.0", - "underscore": "^1.8.3" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 52972031..052f0b3b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -44,7 +44,7 @@ "tslint": "^5.16.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.4.4", - "vsce": "^1.59.0", + "vsce": "^1.64.0", "vscode": "^1.1.33" }, "activationEvents": [ From 0c0b2406bf8cd1de5d40818700aba7a63eb96216 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2019 23:44:16 +0000 Subject: [PATCH 138/819] Bump lodash from 4.17.11 to 4.17.14 in /editors/code Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.14) Signed-off-by: dependabot[bot] --- rust-analyzer/editors/code/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b3666f30..b924b247 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -658,9 +658,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", "dev": true }, "markdown-it": { From d31dfb716c639b99432c5cd5995abea792a704ee Mon Sep 17 00:00:00 2001 From: Ekaterina Babshukova Date: Thu, 18 Jul 2019 18:49:32 +0300 Subject: [PATCH 139/819] highlight mutable variables differently --- rust-analyzer/editors/code/package.json | 9 +++++++++ rust-analyzer/editors/code/src/highlighting.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 052f0b3b..86076753 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -432,6 +432,15 @@ "highContrast": "#4EC9B0" } }, + { + "id": "ralsp.variable.mut", + "description": "Color for mutable variables", + "defaults": { + "dark": "#4e65c9", + "light": "#263199", + "highContrast": "#4e65c9" + } + }, { "id": "ralsp.module", "description": "Color for modules", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 52a0bd4b..f3ed6636 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -56,6 +56,7 @@ export class Highlighter { colorContrib('literal'), colorContrib('macro'), colorContrib('variable'), + colorContrib('variable.mut'), colorContrib('field'), colorContrib('module') ]; From 1e313c98125903544d54fa01f6e062bde344114a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 14:43:36 +0300 Subject: [PATCH 140/819] underline mutable bindings --- rust-analyzer/editors/code/package.json | 6 +- .../editors/code/src/highlighting.ts | 61 +++++++++++-------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 86076753..2ed32106 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -436,9 +436,9 @@ "id": "ralsp.variable.mut", "description": "Color for mutable variables", "defaults": { - "dark": "#4e65c9", - "light": "#263199", - "highContrast": "#4e65c9" + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" } }, { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index f3ed6636..d21d8a06 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -28,12 +28,14 @@ export class Highlighter { string, vscode.TextEditorDecorationType > { - const colorContrib = ( - tag: string + const decoration = ( + tag: string, + textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { const color = new vscode.ThemeColor('ralsp.' + tag); const decor = vscode.window.createTextEditorDecorationType({ - color + color, + textDecoration }); return [tag, decor]; }; @@ -41,24 +43,24 @@ export class Highlighter { const decorations: Iterable< [string, vscode.TextEditorDecorationType] > = [ - colorContrib('comment'), - colorContrib('string'), - colorContrib('keyword'), - colorContrib('keyword.control'), - colorContrib('keyword.unsafe'), - colorContrib('function'), - colorContrib('parameter'), - colorContrib('constant'), - colorContrib('type'), - colorContrib('builtin'), - colorContrib('text'), - colorContrib('attribute'), - colorContrib('literal'), - colorContrib('macro'), - colorContrib('variable'), - colorContrib('variable.mut'), - colorContrib('field'), - colorContrib('module') + decoration('comment'), + decoration('string'), + decoration('keyword'), + decoration('keyword.control'), + decoration('keyword.unsafe'), + decoration('function'), + decoration('parameter'), + decoration('constant'), + decoration('type'), + decoration('builtin'), + decoration('text'), + decoration('attribute'), + decoration('literal'), + decoration('macro'), + decoration('variable'), + decoration('variable.mut', 'underline'), + decoration('field'), + decoration('module') ]; return new Map(decorations); @@ -92,7 +94,10 @@ export class Highlighter { } const byTag: Map = new Map(); - const colorfulIdents: Map = new Map(); + const colorfulIdents: Map< + string, + [vscode.Range[], boolean] + > = new Map(); const rainbowTime = Server.config.rainbowHighlightingOn; for (const tag of this.decorations.keys()) { @@ -106,10 +111,11 @@ export class Highlighter { if (rainbowTime && d.bindingHash) { if (!colorfulIdents.has(d.bindingHash)) { - colorfulIdents.set(d.bindingHash, []); + const mut = d.tag.endsWith('.mut'); + colorfulIdents.set(d.bindingHash, [[], mut]); } colorfulIdents - .get(d.bindingHash)! + .get(d.bindingHash)![0] .push( Server.client.protocol2CodeConverter.asRange(d.range) ); @@ -130,10 +136,11 @@ export class Highlighter { editor.setDecorations(dec, ranges); } - for (const [hash, ranges] of colorfulIdents.entries()) { + for (const [hash, [ranges, mut]] of colorfulIdents.entries()) { + const textDecoration = mut ? 'underline' : undefined; const dec = vscode.window.createTextEditorDecorationType({ - light: { color: fancify(hash, 'light') }, - dark: { color: fancify(hash, 'dark') } + light: { color: fancify(hash, 'light'), textDecoration }, + dark: { color: fancify(hash, 'dark'), textDecoration } }); editor.setDecorations(dec, ranges); } From 0a652f5854286a54e5c3adc142bbc9ffabe63ac1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 21 Jul 2019 19:08:05 +0300 Subject: [PATCH 141/819] Remove obsolete keybinding --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2ed32106..ea74ab85 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -140,11 +140,6 @@ "key": "ctrl+shift+m", "when": "editorTextFocus && editorLangId == rust" }, - { - "command": "rust-analyzer.extendSelection", - "key": "shift+alt+right", - "when": "editorTextFocus && editorLangId == rust" - }, { "command": "rust-analyzer.joinLines", "key": "ctrl+shift+j", From ace18d433dc84697bb82d26ac3b2f12c92d67027 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 25 Jul 2019 12:17:27 +0300 Subject: [PATCH 142/819] :arrow_up: npm deps --- rust-analyzer/editors/code/package-lock.json | 18 +++++++++--------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b924b247..fd4397e3 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -649,18 +649,18 @@ } }, "linkify-it": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.1.0.tgz", - "integrity": "sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", + "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", "dev": true, "requires": { "uc.micro": "^1.0.1" } }, "lodash": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", - "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, "markdown-it": { @@ -1272,9 +1272,9 @@ } }, "vsce": { - "version": "1.64.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.64.0.tgz", - "integrity": "sha512-t3R7QTe2nAXQZs2kD+nA8GjdlX8pAQlnzxaNTG2976i5cyQ8r+ZsMNa/f9PDt7bhjcQM+u/fL+LkNuw+hwoy2A==", + "version": "1.66.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.66.0.tgz", + "integrity": "sha512-Zf4+WD4PhEcOr7jkU08SI9lwFqDhmhk73YOCGQ/tNLaBy+PnnX4eSdqj9LdzDLuI2dsyomJLXzDSNgxuaInxCQ==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ea74ab85..ae720705 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -44,7 +44,7 @@ "tslint": "^5.16.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.4.4", - "vsce": "^1.64.0", + "vsce": "^1.66.0", "vscode": "^1.1.33" }, "activationEvents": [ From ac6f34bccec0f40aacd371b18dcd1b0428c84524 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 25 Jul 2019 13:05:34 +0300 Subject: [PATCH 143/819] try to show exact prettier problem --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ae720705..fd30c794 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "lint": "tslint --project .", "test": "node node_modules/vscode/bin/test", "prettier": "prettier **/*.{json,ts}", - "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --list-different" + "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --check" }, "prettier": { "tabWidth": 4, From 22263bdb57c0f3041c1d1196b7489222582c5e4b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 23 Jul 2019 16:38:21 +0300 Subject: [PATCH 144/819] Show type decorators --- rust-analyzer/editors/code/package.json | 14 ++ .../editors/code/src/commands/index.ts | 4 +- .../editors/code/src/commands/inlay_hints.ts | 142 ++++++++++++++++++ rust-analyzer/editors/code/src/config.ts | 5 + rust-analyzer/editors/code/src/extension.ts | 11 ++ 5 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/src/commands/inlay_hints.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fd30c794..060a3a24 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -238,6 +238,11 @@ "type": "number", "default": null, "description": "Number of syntax trees rust-analyzer keeps in memory" + }, + "rust-analyzer.displayInlayHints": { + "type": "boolean", + "default": true, + "description": "Display additional type information in the editor" } } }, @@ -444,6 +449,15 @@ "light": "#000000", "highContrast": "#FFFFFF" } + }, + { + "id": "ralsp.inlayHint", + "description": "Color for inlay hints", + "defaults": { + "dark": "#A0A0A0F0", + "light": "#747474", + "highContrast": "#BEBEBE" + } } ] } diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 19465849..d17f702e 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -6,6 +6,7 @@ import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; +import * as inlayHints from './inlay_hints'; export { analyzerStatus, @@ -15,5 +16,6 @@ export { parentModule, runnables, syntaxTree, - onEnter + onEnter, + inlayHints, }; diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts new file mode 100644 index 00000000..2780e932 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -0,0 +1,142 @@ +import * as vscode from 'vscode'; +import { DecorationOptions, Range, TextDocumentChangeEvent, TextDocumentContentChangeEvent, TextEditor } from 'vscode'; +import { TextDocumentIdentifier } from 'vscode-languageclient'; +import { Server } from '../server'; + +interface InlayHintsParams { + textDocument: TextDocumentIdentifier; +} + +interface InlayHint { + range: Range, + kind: string, + label: string, +} + +const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ + after: { + color: new vscode.ThemeColor('ralsp.inlayHint'), + }, +}); + +export class HintsUpdater { + private currentDecorations = new Map(); + private displayHints = true; + + public async loadHints(editor: vscode.TextEditor | undefined): Promise { + if (this.displayHints && editor !== undefined) { + await this.updateDecorationsFromServer(editor.document.uri.toString(), editor); + } + } + + public dropHints(document: vscode.TextDocument) { + if (this.displayHints) { + this.currentDecorations.delete(document.uri.toString()); + } + } + + public async toggleHintsDisplay(displayHints: boolean): Promise { + if (this.displayHints !== displayHints) { + this.displayHints = displayHints; + this.currentDecorations.clear(); + + if (displayHints) { + return this.updateHints(); + } else { + const editor = vscode.window.activeTextEditor; + if (editor != null) { + return editor.setDecorations(typeHintDecorationType, []) + } + } + } + } + + public async updateHints(cause?: TextDocumentChangeEvent): Promise { + if (!this.displayHints) { + return; + } + const editor = vscode.window.activeTextEditor; + if (editor == null) { + return; + } + const document = cause == null ? editor.document : cause.document; + if (document.languageId !== 'rust') { + return; + } + + const documentUri = document.uri.toString(); + const documentDecorators = this.currentDecorations.get(documentUri) || []; + + if (documentDecorators.length > 0) { + // FIXME a dbg! in the handlers.rs of the server causes + // an endless storm of events with `cause.contentChanges` with the dbg messages, why? + const changesFromFile = cause !== undefined ? cause.contentChanges.filter(changeEvent => this.isEventInFile(document.lineCount, changeEvent)) : []; + if (changesFromFile.length === 0) { + return; + } + + const firstShiftedLine = this.getFirstShiftedLine(changesFromFile); + if (firstShiftedLine !== null) { + const unchangedDecorations = documentDecorators.filter(decoration => decoration.range.start.line < firstShiftedLine); + if (unchangedDecorations.length !== documentDecorators.length) { + await editor.setDecorations(typeHintDecorationType, unchangedDecorations); + } + } + } + return await this.updateDecorationsFromServer(documentUri, editor); + } + + private isEventInFile(documentLineCount: number, event: TextDocumentContentChangeEvent): boolean { + const eventText = event.text; + if (eventText.length === 0) { + return event.range.start.line <= documentLineCount || event.range.end.line <= documentLineCount; + } else { + return event.range.start.line <= documentLineCount && event.range.end.line <= documentLineCount; + } + } + + private getFirstShiftedLine(changeEvents: TextDocumentContentChangeEvent[]): number | null { + let topmostUnshiftedLine: number | null = null; + + changeEvents + .filter(event => this.isShiftingChange(event)) + .forEach(event => { + const shiftedLineNumber = event.range.start.line; + if (topmostUnshiftedLine === null || topmostUnshiftedLine > shiftedLineNumber) { + topmostUnshiftedLine = shiftedLineNumber; + } + }); + + return topmostUnshiftedLine; + } + + private isShiftingChange(event: TextDocumentContentChangeEvent) { + const eventText = event.text; + if (eventText.length === 0) { + return !event.range.isSingleLine; + } else { + return eventText.indexOf('\n') >= 0 || eventText.indexOf('\r') >= 0; + } + } + + private async updateDecorationsFromServer(documentUri: string, editor: TextEditor): Promise { + const newHints = await this.queryHints(documentUri) || []; + const newDecorations = newHints.map(hint => ( + { + range: hint.range, + renderOptions: { after: { contentText: `: ${hint.label}` } }, + } + )); + this.currentDecorations.set(documentUri, newDecorations); + return editor.setDecorations(typeHintDecorationType, newDecorations); + } + + private async queryHints(documentUri: string): Promise { + const request: InlayHintsParams = { textDocument: { uri: documentUri } }; + const client = Server.client; + return client.onReady().then(() => client.sendRequest( + 'rust-analyzer/inlayHints', + request + )); + } +} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 3f1b482e..4d58a1a9 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -21,6 +21,7 @@ export class Config { public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; public lruCapacity: null | number = null; + public displayInlayHints = true; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -123,5 +124,9 @@ export class Config { if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } + + if (config.has('displayInlayHints')) { + this.displayInlayHints = config.get('displayInlayHints') as boolean; + } } } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index c8c3004a..a0b89738 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { CargoWatchProvider } from './commands/cargo_watch'; +import { HintsUpdater } from './commands/inlay_hints'; import { interactivelyStartCargoWatch, startCargoWatch @@ -147,6 +148,16 @@ export function activate(context: vscode.ExtensionContext) { // Start the language server, finally! startServer(); + + if (Server.config.displayInlayHints) { + const hintsUpdater = new HintsUpdater(); + hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { + vscode.window.onDidChangeActiveTextEditor(editor => hintsUpdater.loadHints(editor)); + vscode.workspace.onDidChangeTextDocument(e => hintsUpdater.updateHints(e)); + vscode.workspace.onDidCloseTextDocument(document => hintsUpdater.dropHints(document)); + vscode.workspace.onDidChangeConfiguration(_ => hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints)); + }); + } } export function deactivate(): Thenable { From 8becc540341cdeb4cdb5cfbd071cf65310a03d75 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 24 Jul 2019 17:15:12 +0300 Subject: [PATCH 145/819] Simplify the hints display --- .../editors/code/src/commands/inlay_hints.ts | 59 ++----------------- rust-analyzer/editors/code/src/extension.ts | 1 - 2 files changed, 6 insertions(+), 54 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 2780e932..cc6620d3 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { DecorationOptions, Range, TextDocumentChangeEvent, TextDocumentContentChangeEvent, TextEditor } from 'vscode'; +import { Range, TextDocumentChangeEvent, TextDocumentContentChangeEvent, TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; @@ -20,7 +20,6 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ }); export class HintsUpdater { - private currentDecorations = new Map(); private displayHints = true; public async loadHints(editor: vscode.TextEditor | undefined): Promise { @@ -29,16 +28,9 @@ export class HintsUpdater { } } - public dropHints(document: vscode.TextDocument) { - if (this.displayHints) { - this.currentDecorations.delete(document.uri.toString()); - } - } - public async toggleHintsDisplay(displayHints: boolean): Promise { if (this.displayHints !== displayHints) { this.displayHints = displayHints; - this.currentDecorations.clear(); if (displayHints) { return this.updateHints(); @@ -64,26 +56,12 @@ export class HintsUpdater { return; } - const documentUri = document.uri.toString(); - const documentDecorators = this.currentDecorations.get(documentUri) || []; - - if (documentDecorators.length > 0) { - // FIXME a dbg! in the handlers.rs of the server causes - // an endless storm of events with `cause.contentChanges` with the dbg messages, why? - const changesFromFile = cause !== undefined ? cause.contentChanges.filter(changeEvent => this.isEventInFile(document.lineCount, changeEvent)) : []; - if (changesFromFile.length === 0) { - return; - } - - const firstShiftedLine = this.getFirstShiftedLine(changesFromFile); - if (firstShiftedLine !== null) { - const unchangedDecorations = documentDecorators.filter(decoration => decoration.range.start.line < firstShiftedLine); - if (unchangedDecorations.length !== documentDecorators.length) { - await editor.setDecorations(typeHintDecorationType, unchangedDecorations); - } - } + // If the dbg! macro is used in the lsp-server, an endless stream of events with `cause.contentChanges` with the dbg messages. + // Should not be a real situation, but better to filter such things out. + if (cause !== undefined && cause.contentChanges.filter(changeEvent => this.isEventInFile(document.lineCount, changeEvent)).length === 0) { + return; } - return await this.updateDecorationsFromServer(documentUri, editor); + return await this.updateDecorationsFromServer(document.uri.toString(), editor); } private isEventInFile(documentLineCount: number, event: TextDocumentContentChangeEvent): boolean { @@ -95,30 +73,6 @@ export class HintsUpdater { } } - private getFirstShiftedLine(changeEvents: TextDocumentContentChangeEvent[]): number | null { - let topmostUnshiftedLine: number | null = null; - - changeEvents - .filter(event => this.isShiftingChange(event)) - .forEach(event => { - const shiftedLineNumber = event.range.start.line; - if (topmostUnshiftedLine === null || topmostUnshiftedLine > shiftedLineNumber) { - topmostUnshiftedLine = shiftedLineNumber; - } - }); - - return topmostUnshiftedLine; - } - - private isShiftingChange(event: TextDocumentContentChangeEvent) { - const eventText = event.text; - if (eventText.length === 0) { - return !event.range.isSingleLine; - } else { - return eventText.indexOf('\n') >= 0 || eventText.indexOf('\r') >= 0; - } - } - private async updateDecorationsFromServer(documentUri: string, editor: TextEditor): Promise { const newHints = await this.queryHints(documentUri) || []; const newDecorations = newHints.map(hint => ( @@ -127,7 +81,6 @@ export class HintsUpdater { renderOptions: { after: { contentText: `: ${hint.label}` } }, } )); - this.currentDecorations.set(documentUri, newDecorations); return editor.setDecorations(typeHintDecorationType, newDecorations); } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index a0b89738..3965b881 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -154,7 +154,6 @@ export function activate(context: vscode.ExtensionContext) { hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { vscode.window.onDidChangeActiveTextEditor(editor => hintsUpdater.loadHints(editor)); vscode.workspace.onDidChangeTextDocument(e => hintsUpdater.updateHints(e)); - vscode.workspace.onDidCloseTextDocument(document => hintsUpdater.dropHints(document)); vscode.workspace.onDidChangeConfiguration(_ => hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints)); }); } From 87ec49a9aeda1392970517d5def6fc82afec18cb Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 24 Jul 2019 19:52:26 +0300 Subject: [PATCH 146/819] Fix linter issues --- .../editors/code/src/commands/index.ts | 4 +- .../editors/code/src/commands/inlay_hints.ts | 88 +++++++++++++------ rust-analyzer/editors/code/src/extension.ts | 12 ++- 3 files changed, 72 insertions(+), 32 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index d17f702e..c194bd2e 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,12 +1,12 @@ import * as analyzerStatus from './analyzer_status'; import * as applySourceChange from './apply_source_change'; +import * as inlayHints from './inlay_hints'; import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; -import * as inlayHints from './inlay_hints'; export { analyzerStatus, @@ -17,5 +17,5 @@ export { runnables, syntaxTree, onEnter, - inlayHints, + inlayHints }; diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index cc6620d3..056d7c8e 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -1,5 +1,10 @@ import * as vscode from 'vscode'; -import { Range, TextDocumentChangeEvent, TextDocumentContentChangeEvent, TextEditor } from 'vscode'; +import { + Range, + TextDocumentChangeEvent, + TextDocumentContentChangeEvent, + TextEditor +} from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; @@ -8,23 +13,28 @@ interface InlayHintsParams { } interface InlayHint { - range: Range, - kind: string, - label: string, + range: Range; + kind: string; + label: string; } const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { - color: new vscode.ThemeColor('ralsp.inlayHint'), - }, + color: new vscode.ThemeColor('ralsp.inlayHint') + } }); export class HintsUpdater { private displayHints = true; - public async loadHints(editor: vscode.TextEditor | undefined): Promise { + public async loadHints( + editor: vscode.TextEditor | undefined + ): Promise { if (this.displayHints && editor !== undefined) { - await this.updateDecorationsFromServer(editor.document.uri.toString(), editor); + await this.updateDecorationsFromServer( + editor.document.uri.toString(), + editor + ); } } @@ -37,7 +47,7 @@ export class HintsUpdater { } else { const editor = vscode.window.activeTextEditor; if (editor != null) { - return editor.setDecorations(typeHintDecorationType, []) + return editor.setDecorations(typeHintDecorationType, []); } } } @@ -58,38 +68,62 @@ export class HintsUpdater { // If the dbg! macro is used in the lsp-server, an endless stream of events with `cause.contentChanges` with the dbg messages. // Should not be a real situation, but better to filter such things out. - if (cause !== undefined && cause.contentChanges.filter(changeEvent => this.isEventInFile(document.lineCount, changeEvent)).length === 0) { + if ( + cause !== undefined && + cause.contentChanges.filter(changeEvent => + this.isEventInFile(document.lineCount, changeEvent) + ).length === 0 + ) { return; } - return await this.updateDecorationsFromServer(document.uri.toString(), editor); + return await this.updateDecorationsFromServer( + document.uri.toString(), + editor + ); } - private isEventInFile(documentLineCount: number, event: TextDocumentContentChangeEvent): boolean { + private isEventInFile( + documentLineCount: number, + event: TextDocumentContentChangeEvent + ): boolean { const eventText = event.text; if (eventText.length === 0) { - return event.range.start.line <= documentLineCount || event.range.end.line <= documentLineCount; + return ( + event.range.start.line <= documentLineCount || + event.range.end.line <= documentLineCount + ); } else { - return event.range.start.line <= documentLineCount && event.range.end.line <= documentLineCount; + return ( + event.range.start.line <= documentLineCount && + event.range.end.line <= documentLineCount + ); } } - private async updateDecorationsFromServer(documentUri: string, editor: TextEditor): Promise { - const newHints = await this.queryHints(documentUri) || []; - const newDecorations = newHints.map(hint => ( - { - range: hint.range, - renderOptions: { after: { contentText: `: ${hint.label}` } }, - } - )); + private async updateDecorationsFromServer( + documentUri: string, + editor: TextEditor + ): Promise { + const newHints = (await this.queryHints(documentUri)) || []; + const newDecorations = newHints.map(hint => ({ + range: hint.range, + renderOptions: { after: { contentText: `: ${hint.label}` } } + })); return editor.setDecorations(typeHintDecorationType, newDecorations); } private async queryHints(documentUri: string): Promise { - const request: InlayHintsParams = { textDocument: { uri: documentUri } }; + const request: InlayHintsParams = { + textDocument: { uri: documentUri } + }; const client = Server.client; - return client.onReady().then(() => client.sendRequest( - 'rust-analyzer/inlayHints', - request - )); + return client + .onReady() + .then(() => + client.sendRequest( + 'rust-analyzer/inlayHints', + request + ) + ); } } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 3965b881..2ec3a2b3 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -152,9 +152,15 @@ export function activate(context: vscode.ExtensionContext) { if (Server.config.displayInlayHints) { const hintsUpdater = new HintsUpdater(); hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { - vscode.window.onDidChangeActiveTextEditor(editor => hintsUpdater.loadHints(editor)); - vscode.workspace.onDidChangeTextDocument(e => hintsUpdater.updateHints(e)); - vscode.workspace.onDidChangeConfiguration(_ => hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints)); + vscode.window.onDidChangeActiveTextEditor(editor => + hintsUpdater.loadHints(editor) + ); + vscode.workspace.onDidChangeTextDocument(e => + hintsUpdater.updateHints(e) + ); + vscode.workspace.onDidChangeConfiguration(_ => + hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints) + ); }); } } From 872ba3ddb6f42421b5ecebb2b60e75b1245c5c14 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 24 Jul 2019 23:30:18 +0300 Subject: [PATCH 147/819] Remove unnecessary hacks --- .../editors/code/src/commands/inlay_hints.ts | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 056d7c8e..0ce3edcb 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -2,7 +2,6 @@ import * as vscode from 'vscode'; import { Range, TextDocumentChangeEvent, - TextDocumentContentChangeEvent, TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; @@ -66,40 +65,12 @@ export class HintsUpdater { return; } - // If the dbg! macro is used in the lsp-server, an endless stream of events with `cause.contentChanges` with the dbg messages. - // Should not be a real situation, but better to filter such things out. - if ( - cause !== undefined && - cause.contentChanges.filter(changeEvent => - this.isEventInFile(document.lineCount, changeEvent) - ).length === 0 - ) { - return; - } return await this.updateDecorationsFromServer( document.uri.toString(), editor ); } - private isEventInFile( - documentLineCount: number, - event: TextDocumentContentChangeEvent - ): boolean { - const eventText = event.text; - if (eventText.length === 0) { - return ( - event.range.start.line <= documentLineCount || - event.range.end.line <= documentLineCount - ); - } else { - return ( - event.range.start.line <= documentLineCount && - event.range.end.line <= documentLineCount - ); - } - } - private async updateDecorationsFromServer( documentUri: string, editor: TextEditor From 71dd9531ace8fd7001daa90da817f1ea1a2a5860 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 25 Jul 2019 15:17:37 +0300 Subject: [PATCH 148/819] Code review fixes --- .../editors/code/src/commands/inlay_hints.ts | 14 +++++++------- rust-analyzer/editors/code/src/extension.ts | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 0ce3edcb..ba996616 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -1,9 +1,5 @@ import * as vscode from 'vscode'; -import { - Range, - TextDocumentChangeEvent, - TextEditor -} from 'vscode'; +import { Range, TextDocumentChangeEvent, TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; @@ -29,7 +25,7 @@ export class HintsUpdater { public async loadHints( editor: vscode.TextEditor | undefined ): Promise { - if (this.displayHints && editor !== undefined) { + if (this.displayHints && editor !== undefined && this.isRustDocument(editor.document)) { await this.updateDecorationsFromServer( editor.document.uri.toString(), editor @@ -61,7 +57,7 @@ export class HintsUpdater { return; } const document = cause == null ? editor.document : cause.document; - if (document.languageId !== 'rust') { + if (!this.isRustDocument(document)) { return; } @@ -71,6 +67,10 @@ export class HintsUpdater { ); } + private isRustDocument(document: vscode.TextDocument): boolean { + return document && document.languageId === 'rust'; + } + private async updateDecorationsFromServer( documentUri: string, editor: TextEditor diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 2ec3a2b3..9bee7539 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -152,15 +152,15 @@ export function activate(context: vscode.ExtensionContext) { if (Server.config.displayInlayHints) { const hintsUpdater = new HintsUpdater(); hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { - vscode.window.onDidChangeActiveTextEditor(editor => + disposeOnDeactivation(vscode.window.onDidChangeActiveTextEditor(editor => hintsUpdater.loadHints(editor) - ); - vscode.workspace.onDidChangeTextDocument(e => + )); + disposeOnDeactivation(vscode.workspace.onDidChangeTextDocument(e => hintsUpdater.updateHints(e) - ); - vscode.workspace.onDidChangeConfiguration(_ => + )); + disposeOnDeactivation(vscode.workspace.onDidChangeConfiguration(_ => hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints) - ); + )); }); } } From dd2db9998a002056e5e193cbc5dee40000dc5fbd Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 25 Jul 2019 15:54:20 +0300 Subject: [PATCH 149/819] npm run fix --- .../editors/code/src/commands/inlay_hints.ts | 6 ++++- rust-analyzer/editors/code/src/extension.ts | 26 ++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index ba996616..8154af8d 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -25,7 +25,11 @@ export class HintsUpdater { public async loadHints( editor: vscode.TextEditor | undefined ): Promise { - if (this.displayHints && editor !== undefined && this.isRustDocument(editor.document)) { + if ( + this.displayHints && + editor !== undefined && + this.isRustDocument(editor.document) + ) { await this.updateDecorationsFromServer( editor.document.uri.toString(), editor diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 9bee7539..c6efc2e7 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -152,15 +152,23 @@ export function activate(context: vscode.ExtensionContext) { if (Server.config.displayInlayHints) { const hintsUpdater = new HintsUpdater(); hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { - disposeOnDeactivation(vscode.window.onDidChangeActiveTextEditor(editor => - hintsUpdater.loadHints(editor) - )); - disposeOnDeactivation(vscode.workspace.onDidChangeTextDocument(e => - hintsUpdater.updateHints(e) - )); - disposeOnDeactivation(vscode.workspace.onDidChangeConfiguration(_ => - hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints) - )); + disposeOnDeactivation( + vscode.window.onDidChangeActiveTextEditor(editor => + hintsUpdater.loadHints(editor) + ) + ); + disposeOnDeactivation( + vscode.workspace.onDidChangeTextDocument(e => + hintsUpdater.updateHints(e) + ) + ); + disposeOnDeactivation( + vscode.workspace.onDidChangeConfiguration(_ => + hintsUpdater.toggleHintsDisplay( + Server.config.displayInlayHints + ) + ) + ); }); } } From 420832451f55fa7c91033d81521b5bbe31b8f3d0 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 29 Jul 2019 10:19:35 +0300 Subject: [PATCH 150/819] Ignore cancelled inlay hints responses --- .../editors/code/src/commands/inlay_hints.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 8154af8d..34f7ccdd 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -79,12 +79,14 @@ export class HintsUpdater { documentUri: string, editor: TextEditor ): Promise { - const newHints = (await this.queryHints(documentUri)) || []; - const newDecorations = newHints.map(hint => ({ - range: hint.range, - renderOptions: { after: { contentText: `: ${hint.label}` } } - })); - return editor.setDecorations(typeHintDecorationType, newDecorations); + const newHints = await this.queryHints(documentUri); + if (newHints != null) { + const newDecorations = newHints.map(hint => ({ + range: hint.range, + renderOptions: { after: { contentText: `: ${hint.label}` } } + })); + return editor.setDecorations(typeHintDecorationType, newDecorations); + } } private async queryHints(documentUri: string): Promise { From feff1d400824b6be5db884bcd32c06a0f082a92d Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 29 Jul 2019 11:19:13 +0300 Subject: [PATCH 151/819] Style fixes --- rust-analyzer/editors/code/src/commands/inlay_hints.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 34f7ccdd..3ba9da48 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -85,7 +85,10 @@ export class HintsUpdater { range: hint.range, renderOptions: { after: { contentText: `: ${hint.label}` } } })); - return editor.setDecorations(typeHintDecorationType, newDecorations); + return editor.setDecorations( + typeHintDecorationType, + newDecorations + ); } } From 5e26da5c6e5f557cc7afde3d21472278602b76bc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 29 Jul 2019 11:22:56 +0300 Subject: [PATCH 152/819] :arrow_up: npm --- rust-analyzer/editors/code/package-lock.json | 197 +++++++++---------- rust-analyzer/editors/code/package.json | 12 +- 2 files changed, 99 insertions(+), 110 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index fd4397e3..56cac1b4 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -5,18 +5,18 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", "dev": true, "requires": { "@babel/highlight": "^7.0.0" } }, "@babel/highlight": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", - "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", "dev": true, "requires": { "chalk": "^2.0.0", @@ -25,15 +25,15 @@ } }, "@types/mocha": { - "version": "5.2.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", - "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", "dev": true }, "@types/node": { - "version": "10.14.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.5.tgz", - "integrity": "sha512-Ja7d4s0qyGFxjGeDq5S7Si25OFibSAHUi6i17UWnwNnpitADN7hah9q0Tl25gxuV5R1u2Bx+np6w4LHXfHyj/g==", + "version": "10.14.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz", + "integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==", "dev": true }, "@types/seedrandom": { @@ -43,18 +43,18 @@ "dev": true }, "agent-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", - "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", "dev": true, "requires": { "es6-promisify": "^5.0.0" } }, "ajv": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", - "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -158,9 +158,9 @@ } }, "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, "buffer-crc32": { @@ -228,9 +228,9 @@ "dev": true }, "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "requires": { "delayed-stream": "~1.0.0" @@ -372,9 +372,9 @@ "dev": true }, "es6-promise": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", - "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==", + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", "dev": true }, "es6-promisify": { @@ -484,9 +484,9 @@ } }, "growl": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, "har-schema": { @@ -553,12 +553,12 @@ } }, "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", + "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", "dev": true, "requires": { - "agent-base": "^4.1.0", + "agent-base": "^4.3.0", "debug": "^3.1.0" } }, @@ -728,33 +728,28 @@ } }, "mocha": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "requires": { - "browser-stdout": "1.3.0", - "commander": "2.11.0", + "browser-stdout": "1.3.1", + "commander": "2.15.1", "debug": "3.1.0", - "diff": "3.3.1", + "diff": "3.5.0", "escape-string-regexp": "1.0.5", "glob": "7.1.2", - "growl": "1.10.3", + "growl": "1.10.5", "he": "1.1.1", + "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "4.4.0" + "supports-color": "5.4.0" }, "dependencies": { "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, "glob": { @@ -771,19 +766,13 @@ "path-is-absolute": "^1.0.0" } }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "^3.0.0" } } } @@ -895,15 +884,15 @@ "dev": true }, "prettier": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz", - "integrity": "sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==", + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", + "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", "dev": true }, "psl": { - "version": "1.1.31", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", - "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz", + "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==", "dev": true }, "punycode": { @@ -1133,15 +1122,15 @@ } }, "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, "tslint": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz", - "integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz", + "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1150,7 +1139,7 @@ "commander": "^2.12.1", "diff": "^3.2.0", "glob": "^7.1.1", - "js-yaml": "^3.13.0", + "js-yaml": "^3.13.1", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "resolve": "^1.3.2", @@ -1206,9 +1195,9 @@ } }, "typescript": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.4.tgz", - "integrity": "sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "dev": true }, "uc.micro": { @@ -1239,12 +1228,12 @@ "dev": true }, "url-parse": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.6.tgz", - "integrity": "sha512-/B8AD9iQ01seoXmXf9z/MjLZQIdOoYl/+gvsQF6+mpnxaTfG9P7srYaiqaDMyKkR36XMXfhqSHss5MyFAO8lew==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", + "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", "dev": true, "requires": { - "querystringify": "^2.0.0", + "querystringify": "^2.1.1", "requires-port": "^1.0.0" } }, @@ -1300,52 +1289,52 @@ } }, "vscode": { - "version": "1.1.33", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.33.tgz", - "integrity": "sha512-sXedp2oF6y4ZvqrrFiZpeMzaCLSWV+PpYkIxjG/iYquNZ9KrLL2LujltGxPLvzn49xu2sZkyC+avVNFgcJD1Iw==", + "version": "1.1.35", + "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.35.tgz", + "integrity": "sha512-xPnxzQU40LOS2yPyzWW+WKpTV6qA3z16TcgpZ9O38UWLA157Zz4GxUx5H7Gd07pxzw0GqvusbF4D+5GBgNxvEQ==", "dev": true, "requires": { "glob": "^7.1.2", - "mocha": "^4.0.1", + "mocha": "^5.2.0", "request": "^2.88.0", "semver": "^5.4.1", "source-map-support": "^0.5.0", "url-parse": "^1.4.4", - "vscode-test": "^0.1.4" + "vscode-test": "^0.4.1" } }, "vscode-jsonrpc": { - "version": "4.1.0-next.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.1.tgz", - "integrity": "sha512-FzNkvHmg3GXpzZAlnGnpdRbQQX6LDRb0bvc+oxxjMUwIJ66kTO/DyeE2bwU0fsiOEGfsJTCzvjESVl368jZ0/g==" + "version": "4.1.0-next.2", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.2.tgz", + "integrity": "sha512-GsBLjP9DxQ42yl1mW9GEIlnSc0+R8mfzhaebwmmTPEJjezD5SPoAo3DFrIAFZha9yvQ1nzZfZlhtVpGQmgxtXg==" }, "vscode-languageclient": { - "version": "5.3.0-next.4", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.4.tgz", - "integrity": "sha512-RODuzXErVpJRSgHv+Xei8fwQtZ/iZOWPCqlLl07NTtkzgTAepJf9r4EioZVuTviGJ5DEJ9xs0bjrit8shKtW6Q==", + "version": "5.3.0-next.6", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.6.tgz", + "integrity": "sha512-DxT8+gkenjCjJV6ArcP75/AQfx6HP6m6kHIbacPCpffMeoE1YMLKj6ZixA9J87yr0fMtBmqumLmDeGe7MIF2bw==", "requires": { "semver": "^5.5.0", - "vscode-languageserver-protocol": "3.15.0-next.4" + "vscode-languageserver-protocol": "^3.15.0-next.6" } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.4", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.4.tgz", - "integrity": "sha512-4AgisQ8GWa3irdRu3/UNr3brcSSm0oobmoV1eSOnV7JM32lYyXDnSKB7RuTTXvaAjD/0xQJLEGhkyGHS5gbywA==", + "version": "3.15.0-next.6", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.6.tgz", + "integrity": "sha512-/yDpYlWyNs26mM23mT73xmOFsh1iRfgZfBdHmfAxwDKwpQKLoOSqVidtYfxlK/pD3IEKGcAVnT4WXTsguxxAMQ==", "requires": { - "vscode-jsonrpc": "^4.1.0-next.1", - "vscode-languageserver-types": "3.15.0-next.1" + "vscode-jsonrpc": "^4.1.0-next.2", + "vscode-languageserver-types": "^3.15.0-next.2" } }, "vscode-languageserver-types": { - "version": "3.15.0-next.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.1.tgz", - "integrity": "sha512-R0kzmaI8gOGEoU7b9huYQAzgZzRQ/5Q8HKjsIUdfz0MjXcBZ4tr1ik1So1p1O5kGrI1VTCd22Fw/wI7ECGoIPw==" + "version": "3.15.0-next.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.2.tgz", + "integrity": "sha512-2JkrMWWUi2rlVLSo9OFR2PIGUzdiowEM8NgNYiwLKnXTjpwpjjIrJbNNxDik7Rv4oo9KtikcFQZKXbrKilL/MQ==" }, "vscode-test": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.1.5.tgz", - "integrity": "sha512-s+lbF1Dtasc0yXVB9iQTexBe2JK6HJAUJe3fWezHKIjq+xRw5ZwCMEMBaonFIPy7s95qg2HPTRDR5W4h4kbxGw==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.4.3.tgz", + "integrity": "sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 060a3a24..78b1e6b9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -36,16 +36,16 @@ "vscode-languageclient": "^5.3.0-next.4" }, "devDependencies": { - "@types/mocha": "^5.2.6", - "@types/node": "^10.14.5", + "@types/mocha": "^5.2.7", + "@types/node": "^10.14.13", "@types/seedrandom": "^2.4.28", - "prettier": "^1.17.0", + "prettier": "^1.18.2", "shx": "^0.3.1", - "tslint": "^5.16.0", + "tslint": "^5.18.0", "tslint-config-prettier": "^1.18.0", - "typescript": "^3.4.4", + "typescript": "^3.5.3", "vsce": "^1.66.0", - "vscode": "^1.1.33" + "vscode": "^1.1.35" }, "activationEvents": [ "onLanguage:rust", From babfc94c8d0e7ea5a7530e6561f5eebb042b07ed Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 29 Jul 2019 11:39:40 +0300 Subject: [PATCH 153/819] show prettier diff on CI --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 060a3a24..6c8f04e9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "lint": "tslint --project .", "test": "node node_modules/vscode/bin/test", "prettier": "prettier **/*.{json,ts}", - "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --check" + "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code" }, "prettier": { "tabWidth": 4, From c6aeb60339eaa0406708373df80c420b28c075ba Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 5 Aug 2019 00:23:58 +0300 Subject: [PATCH 154/819] Query less hints on file open --- .../editors/code/src/commands/inlay_hints.ts | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 3ba9da48..5af3a69b 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -21,32 +21,36 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ export class HintsUpdater { private displayHints = true; + private drawnDecorations = new Map(); - public async loadHints( - editor: vscode.TextEditor | undefined - ): Promise { - if ( - this.displayHints && - editor !== undefined && - this.isRustDocument(editor.document) - ) { - await this.updateDecorationsFromServer( - editor.document.uri.toString(), - editor - ); + public async loadHints(editor?: vscode.TextEditor): Promise { + if (this.displayHints) { + const documentUri = this.getEditorDocumentUri(editor); + if (documentUri !== null) { + const latestDecorations = this.drawnDecorations.get(documentUri); + if (latestDecorations === undefined) { + await this.updateDecorationsFromServer( + documentUri, + editor! + ); + } else { + await editor!.setDecorations(typeHintDecorationType, latestDecorations); + } + } } } public async toggleHintsDisplay(displayHints: boolean): Promise { if (this.displayHints !== displayHints) { this.displayHints = displayHints; + this.drawnDecorations.clear(); if (displayHints) { return this.updateHints(); } else { const editor = vscode.window.activeTextEditor; - if (editor != null) { - return editor.setDecorations(typeHintDecorationType, []); + if (this.getEditorDocumentUri(editor) !== null) { + return editor!.setDecorations(typeHintDecorationType, []); } } } @@ -85,10 +89,15 @@ export class HintsUpdater { range: hint.range, renderOptions: { after: { contentText: `: ${hint.label}` } } })); - return editor.setDecorations( - typeHintDecorationType, - newDecorations - ); + + this.drawnDecorations.set(documentUri, newDecorations); + + if (this.getEditorDocumentUri(vscode.window.activeTextEditor) === documentUri) { + return editor.setDecorations( + typeHintDecorationType, + newDecorations + ); + } } } @@ -106,4 +115,11 @@ export class HintsUpdater { ) ); } + + private getEditorDocumentUri(editor?: vscode.TextEditor): string | null { + if (editor && this.isRustDocument(editor.document)) { + return editor.document.uri.toString(); + } + return null; + } } From 629aee38de70a6a16b95e81e68f3178352bbe698 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 5 Aug 2019 00:47:14 +0300 Subject: [PATCH 155/819] Style and test fixes --- .../editors/code/src/commands/inlay_hints.ts | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 5af3a69b..11a2cfac 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -27,14 +27,19 @@ export class HintsUpdater { if (this.displayHints) { const documentUri = this.getEditorDocumentUri(editor); if (documentUri !== null) { - const latestDecorations = this.drawnDecorations.get(documentUri); + const latestDecorations = this.drawnDecorations.get( + documentUri + ); if (latestDecorations === undefined) { await this.updateDecorationsFromServer( documentUri, editor! ); } else { - await editor!.setDecorations(typeHintDecorationType, latestDecorations); + await editor!.setDecorations( + typeHintDecorationType, + latestDecorations + ); } } } @@ -48,9 +53,12 @@ export class HintsUpdater { if (displayHints) { return this.updateHints(); } else { - const editor = vscode.window.activeTextEditor; - if (this.getEditorDocumentUri(editor) !== null) { - return editor!.setDecorations(typeHintDecorationType, []); + const currentEditor = vscode.window.activeTextEditor; + if (this.getEditorDocumentUri(currentEditor) !== null) { + return currentEditor!.setDecorations( + typeHintDecorationType, + [] + ); } } } @@ -92,7 +100,10 @@ export class HintsUpdater { this.drawnDecorations.set(documentUri, newDecorations); - if (this.getEditorDocumentUri(vscode.window.activeTextEditor) === documentUri) { + if ( + this.getEditorDocumentUri(vscode.window.activeTextEditor) === + documentUri + ) { return editor.setDecorations( typeHintDecorationType, newDecorations From a72a70e58387899e5d50aaebe878035819c3c3b5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 5 Aug 2019 11:07:27 +0300 Subject: [PATCH 156/819] Use WeakMap to avoid memory leaks --- .../editors/code/src/commands/inlay_hints.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 11a2cfac..aad28d56 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -21,7 +21,10 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ export class HintsUpdater { private displayHints = true; - private drawnDecorations = new Map(); + private drawnDecorations = new WeakMap< + vscode.Uri, + vscode.DecorationOptions[] + >(); public async loadHints(editor?: vscode.TextEditor): Promise { if (this.displayHints) { @@ -48,7 +51,7 @@ export class HintsUpdater { public async toggleHintsDisplay(displayHints: boolean): Promise { if (this.displayHints !== displayHints) { this.displayHints = displayHints; - this.drawnDecorations.clear(); + this.drawnDecorations = new WeakMap(); if (displayHints) { return this.updateHints(); @@ -77,10 +80,7 @@ export class HintsUpdater { return; } - return await this.updateDecorationsFromServer( - document.uri.toString(), - editor - ); + return await this.updateDecorationsFromServer(document.uri, editor); } private isRustDocument(document: vscode.TextDocument): boolean { @@ -88,10 +88,10 @@ export class HintsUpdater { } private async updateDecorationsFromServer( - documentUri: string, + documentUri: vscode.Uri, editor: TextEditor ): Promise { - const newHints = await this.queryHints(documentUri); + const newHints = await this.queryHints(documentUri.toString()); if (newHints != null) { const newDecorations = newHints.map(hint => ({ range: hint.range, @@ -127,9 +127,11 @@ export class HintsUpdater { ); } - private getEditorDocumentUri(editor?: vscode.TextEditor): string | null { + private getEditorDocumentUri( + editor?: vscode.TextEditor + ): vscode.Uri | null { if (editor && this.isRustDocument(editor.document)) { - return editor.document.uri.toString(); + return editor.document.uri; } return null; } From 4c7225d58e69c7236a5e17a8aba6f20189ea0977 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 5 Aug 2019 13:31:00 +0300 Subject: [PATCH 157/819] Cache decorations before the first change only --- .../editors/code/src/commands/inlay_hints.ts | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index aad28d56..d6d1f61f 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -21,8 +21,8 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ export class HintsUpdater { private displayHints = true; - private drawnDecorations = new WeakMap< - vscode.Uri, + private decorationsSinceLastChange = new Map< + string, vscode.DecorationOptions[] >(); @@ -30,8 +30,8 @@ export class HintsUpdater { if (this.displayHints) { const documentUri = this.getEditorDocumentUri(editor); if (documentUri !== null) { - const latestDecorations = this.drawnDecorations.get( - documentUri + const latestDecorations = this.decorationsSinceLastChange.get( + documentUri.toString() ); if (latestDecorations === undefined) { await this.updateDecorationsFromServer( @@ -51,7 +51,7 @@ export class HintsUpdater { public async toggleHintsDisplay(displayHints: boolean): Promise { if (this.displayHints !== displayHints) { this.displayHints = displayHints; - this.drawnDecorations = new WeakMap(); + this.decorationsSinceLastChange.clear(); if (displayHints) { return this.updateHints(); @@ -72,14 +72,15 @@ export class HintsUpdater { return; } const editor = vscode.window.activeTextEditor; - if (editor == null) { + if (editor === undefined) { return; } - const document = cause == null ? editor.document : cause.document; + const document = cause === undefined ? editor.document : cause.document; if (!this.isRustDocument(document)) { return; } + this.decorationsSinceLastChange.clear(); return await this.updateDecorationsFromServer(document.uri, editor); } @@ -92,23 +93,23 @@ export class HintsUpdater { editor: TextEditor ): Promise { const newHints = await this.queryHints(documentUri.toString()); - if (newHints != null) { + if ( + newHints !== null && + this.getEditorDocumentUri(vscode.window.activeTextEditor) === + documentUri + ) { const newDecorations = newHints.map(hint => ({ range: hint.range, renderOptions: { after: { contentText: `: ${hint.label}` } } })); - - this.drawnDecorations.set(documentUri, newDecorations); - - if ( - this.getEditorDocumentUri(vscode.window.activeTextEditor) === - documentUri - ) { - return editor.setDecorations( - typeHintDecorationType, - newDecorations - ); - } + this.decorationsSinceLastChange.set( + documentUri.toString(), + newDecorations + ); + return editor.setDecorations( + typeHintDecorationType, + newDecorations + ); } } From ff2041d5d833776db664a1f68740f792063513a2 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 5 Aug 2019 22:31:12 +0300 Subject: [PATCH 158/819] Avoid shared mutable state --- .../editors/code/src/commands/inlay_hints.ts | 106 +++++++----------- rust-analyzer/editors/code/src/extension.ts | 20 +++- 2 files changed, 55 insertions(+), 71 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index d6d1f61f..5393a2bc 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -21,67 +21,57 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ export class HintsUpdater { private displayHints = true; - private decorationsSinceLastChange = new Map< - string, - vscode.DecorationOptions[] - >(); - - public async loadHints(editor?: vscode.TextEditor): Promise { - if (this.displayHints) { - const documentUri = this.getEditorDocumentUri(editor); - if (documentUri !== null) { - const latestDecorations = this.decorationsSinceLastChange.get( - documentUri.toString() - ); - if (latestDecorations === undefined) { - await this.updateDecorationsFromServer( - documentUri, - editor! - ); - } else { - await editor!.setDecorations( - typeHintDecorationType, - latestDecorations - ); - } - } - } - } public async toggleHintsDisplay(displayHints: boolean): Promise { if (this.displayHints !== displayHints) { this.displayHints = displayHints; - this.decorationsSinceLastChange.clear(); - - if (displayHints) { - return this.updateHints(); - } else { - const currentEditor = vscode.window.activeTextEditor; - if (this.getEditorDocumentUri(currentEditor) !== null) { - return currentEditor!.setDecorations( - typeHintDecorationType, - [] - ); - } - } + return this.refreshVisibleEditorsHints( + displayHints ? undefined : [] + ); } } - public async updateHints(cause?: TextDocumentChangeEvent): Promise { + public async refreshHintsForVisibleEditors( + cause?: TextDocumentChangeEvent + ): Promise { if (!this.displayHints) { return; } - const editor = vscode.window.activeTextEditor; - if (editor === undefined) { + if ( + cause !== undefined && + (cause.contentChanges.length === 0 || + !this.isRustDocument(cause.document)) + ) { return; } - const document = cause === undefined ? editor.document : cause.document; - if (!this.isRustDocument(document)) { - return; + return this.refreshVisibleEditorsHints(); + } + + private async refreshVisibleEditorsHints( + newDecorations?: vscode.DecorationOptions[] + ) { + const promises: Array> = []; + + for (const rustEditor of vscode.window.visibleTextEditors.filter( + editor => this.isRustDocument(editor.document) + )) { + if (newDecorations !== undefined) { + promises.push( + Promise.resolve( + rustEditor.setDecorations( + typeHintDecorationType, + newDecorations + ) + ) + ); + } else { + promises.push(this.updateDecorationsFromServer(rustEditor)); + } } - this.decorationsSinceLastChange.clear(); - return await this.updateDecorationsFromServer(document.uri, editor); + for (const promise of promises) { + await promise; + } } private isRustDocument(document: vscode.TextDocument): boolean { @@ -89,23 +79,14 @@ export class HintsUpdater { } private async updateDecorationsFromServer( - documentUri: vscode.Uri, editor: TextEditor ): Promise { - const newHints = await this.queryHints(documentUri.toString()); - if ( - newHints !== null && - this.getEditorDocumentUri(vscode.window.activeTextEditor) === - documentUri - ) { + const newHints = await this.queryHints(editor.document.uri.toString()); + if (newHints !== null) { const newDecorations = newHints.map(hint => ({ range: hint.range, renderOptions: { after: { contentText: `: ${hint.label}` } } })); - this.decorationsSinceLastChange.set( - documentUri.toString(), - newDecorations - ); return editor.setDecorations( typeHintDecorationType, newDecorations @@ -127,13 +108,4 @@ export class HintsUpdater { ) ); } - - private getEditorDocumentUri( - editor?: vscode.TextEditor - ): vscode.Uri | null { - if (editor && this.isRustDocument(editor.document)) { - return editor.document.uri; - } - return null; - } } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index c6efc2e7..39fe6efd 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -151,15 +151,27 @@ export function activate(context: vscode.ExtensionContext) { if (Server.config.displayInlayHints) { const hintsUpdater = new HintsUpdater(); - hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { + hintsUpdater.refreshHintsForVisibleEditors().then(() => { + // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() + // so update the hints once when the focus changes to guarantee their presence + let editorChangeDisposable: vscode.Disposable | null = null; + editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( + _ => { + if (editorChangeDisposable !== null) { + editorChangeDisposable.dispose(); + } + return hintsUpdater.refreshHintsForVisibleEditors(); + } + ); + disposeOnDeactivation( - vscode.window.onDidChangeActiveTextEditor(editor => - hintsUpdater.loadHints(editor) + vscode.window.onDidChangeVisibleTextEditors(_ => + hintsUpdater.refreshHintsForVisibleEditors() ) ); disposeOnDeactivation( vscode.workspace.onDidChangeTextDocument(e => - hintsUpdater.updateHints(e) + hintsUpdater.refreshHintsForVisibleEditors(e) ) ); disposeOnDeactivation( From 6021d24f2488c9c9e0df44eee26adc22eb2aa018 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 6 Aug 2019 13:34:28 +0200 Subject: [PATCH 159/819] allow to exclude certain files and directories --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 4 ++++ rust-analyzer/editors/code/src/server.ts | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 808dc5dc..48ab886b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -197,6 +197,11 @@ ], "description": "Whether to run `cargo watch` on startup" }, + "rust-analyzer.excludeGlobs": { + "type": "array", + "default": "[]", + "description": "Paths to exclude from analysis" + }, "rust-analyzer.cargo-watch.arguments": { "type": "string", "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 4d58a1a9..4df6b50e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -22,6 +22,7 @@ export class Config { public showWorkspaceLoadedNotification = true; public lruCapacity: null | number = null; public displayInlayHints = true; + public excludeGlobs = []; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -128,5 +129,8 @@ export class Config { if (config.has('displayInlayHints')) { this.displayInlayHints = config.get('displayInlayHints') as boolean; } + if (config.has('excludeGlobs')) { + this.excludeGlobs = config.get('excludeGlobs') || []; + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 7029142f..2b4c25c2 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -36,7 +36,8 @@ export class Server { publishDecorations: true, showWorkspaceLoaded: Server.config.showWorkspaceLoadedNotification, - lruCapacity: Server.config.lruCapacity + lruCapacity: Server.config.lruCapacity, + excludeGlobs: Server.config.excludeGlobs }, traceOutputChannel }; From eb36233a1898e26200632d8b542c39d977c5975d Mon Sep 17 00:00:00 2001 From: xfoxfu Date: Mon, 19 Aug 2019 10:48:39 +0800 Subject: [PATCH 160/819] fix #1424 resolve "~" in raLspServerPath --- rust-analyzer/editors/code/src/server.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 2b4c25c2..3273d874 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,9 +1,17 @@ +import { homedir } from 'os'; import * as lc from 'vscode-languageclient'; import { window, workspace } from 'vscode'; import { Config } from './config'; import { Highlighter } from './highlighting'; +function expandPathResolving(path: string) { + if (path.startsWith('~/')) { + return path.replace('~', homedir()); + } + return path; +} + export class Server { public static highlighter = new Highlighter(); public static config = new Config(); @@ -20,7 +28,7 @@ export class Server { } const run: lc.Executable = { - command: this.config.raLspServerPath, + command: expandPathResolving(this.config.raLspServerPath), options: { cwd: folder } }; const serverOptions: lc.ServerOptions = { From 026ade573affab1a3d3c8a45b3fc3d289dc927f9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 21 Aug 2019 17:30:58 +0300 Subject: [PATCH 161/819] fix default for the exlude key --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 48ab886b..98faf538 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -199,7 +199,7 @@ }, "rust-analyzer.excludeGlobs": { "type": "array", - "default": "[]", + "default": [], "description": "Paths to exclude from analysis" }, "rust-analyzer.cargo-watch.arguments": { From c1f2d0437af12083f63c8c22a67af7bd23294651 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 22 Aug 2019 14:44:16 +0300 Subject: [PATCH 162/819] implement feature flags --- rust-analyzer/editors/code/package.json | 8 ++++---- rust-analyzer/editors/code/src/config.ts | 4 ++++ rust-analyzer/editors/code/src/server.ts | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 98faf538..95ec6cff 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -165,10 +165,10 @@ "default": false, "description": "When highlighting Rust code, use a unique color per identifier" }, - "rust-analyzer.showWorkspaceLoadedNotification": { - "type": "boolean", - "default": true, - "description": "Show notification when workspace was loaded" + "rust-analyzer.featureFlags": { + "type": "object", + "default": {}, + "description": "Fine grained feature flags to disable annoying features" }, "rust-analyzer.enableEnhancedTyping": { "type": "boolean", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 4df6b50e..570ddca4 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,6 +23,7 @@ export class Config { public lruCapacity: null | number = null; public displayInlayHints = true; public excludeGlobs = []; + public featureFlags = {}; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -132,5 +133,8 @@ export class Config { if (config.has('excludeGlobs')) { this.excludeGlobs = config.get('excludeGlobs') || []; } + if (config.has('featureFlags')) { + this.featureFlags = config.get('featureFlags') || {}; + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 3273d874..0d2a99c7 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -45,7 +45,8 @@ export class Server { showWorkspaceLoaded: Server.config.showWorkspaceLoadedNotification, lruCapacity: Server.config.lruCapacity, - excludeGlobs: Server.config.excludeGlobs + excludeGlobs: Server.config.excludeGlobs, + featureFlags: Server.config.featureFlags }, traceOutputChannel }; From f71879ac784172dce4e3cab9bb86930961b4a341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sun, 25 Aug 2019 17:50:46 +0200 Subject: [PATCH 163/819] Switch to `@types/vscode` and `vscode-test` The old `vscode` package is outdated and it is recommened to switch to these two new packages. This also solves a problem of a missing `.d.ts` for `vscode` in Nixos. --- rust-analyzer/editors/code/package-lock.json | 1146 +++++++++++------ rust-analyzer/editors/code/package.json | 11 +- rust-analyzer/editors/code/src/test/index.ts | 22 - .../editors/code/src/test/runTest.ts | 22 + .../editors/code/src/test/utils/index.ts | 49 + .../code/src/utils/diagnostics/rust.ts | 2 +- 6 files changed, 802 insertions(+), 450 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/test/index.ts create mode 100644 rust-analyzer/editors/code/src/test/runTest.ts create mode 100644 rust-analyzer/editors/code/src/test/utils/index.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 56cac1b4..5ffd8b0b 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -24,6 +24,29 @@ "js-tokens": "^4.0.0" } }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "@types/mocha": { "version": "5.2.7", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", @@ -42,6 +65,12 @@ "integrity": "sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==", "dev": true }, + "@types/vscode": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.37.0.tgz", + "integrity": "sha512-PRfeuqYuzk3vjf+puzxltIUWC+AhEGYpFX29/37w30DQSQnpf5AgMVf7GDBAdmTbWTBou+EMFz/Ne6XCM/KxzQ==", + "dev": true + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -51,17 +80,17 @@ "es6-promisify": "^5.0.0" } }, - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, "ansi-styles": { "version": "3.2.1", @@ -81,39 +110,6 @@ "sprintf-js": "~1.0.2" } }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", - "dev": true - }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -132,15 +128,6 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -169,22 +156,16 @@ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", "dev": true }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, "chalk": { @@ -212,6 +193,23 @@ "parse5": "^3.0.1" } }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -227,15 +225,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", @@ -248,11 +237,18 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } }, "css-select": { "version": "1.2.0", @@ -272,15 +268,6 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -290,12 +277,21 @@ "ms": "2.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", @@ -349,14 +345,19 @@ "domelementtype": "1" } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" + "once": "^1.4.0" } }, "entities": { @@ -365,6 +366,31 @@ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, + "es-abstract": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", + "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-keys": "^1.0.12" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "es6-object-assign": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", @@ -404,29 +430,20 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } }, "fd-slicer": { "version": "1.1.0", @@ -437,21 +454,22 @@ "pend": "~1.2.0" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" + "is-buffer": "~2.0.3" } }, "fs.realpath": { @@ -460,19 +478,31 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "requires": { - "assert-plus": "^1.0.0" + "pump": "^3.0.0" } }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -489,20 +519,13 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" + "function-bind": "^1.1.1" } }, "has-flag": { @@ -511,10 +534,16 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "htmlparser2": { @@ -541,17 +570,6 @@ "debug": "3.1.0" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "https-proxy-agent": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", @@ -584,16 +602,64 @@ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", "dev": true }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "dev": true + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "js-tokens": { @@ -612,40 +678,13 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "dev": true, "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" + "invert-kv": "^2.0.0" } }, "linkify-it": { @@ -657,12 +696,40 @@ "uc.micro": "^1.0.1" } }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, "markdown-it": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", @@ -682,27 +749,29 @@ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "dev": true, - "requires": { - "mime-db": "1.40.0" - } - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -728,34 +797,49 @@ } }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", + "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", "dev": true, "requires": { + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", + "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "find-up": "3.0.0", + "glob": "7.1.3", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.1", + "node-environment-flags": "1.0.5", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.2.2", + "yargs-parser": "13.0.0", + "yargs-unparser": "1.5.0" }, "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } }, "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -766,10 +850,16 @@ "path-is-absolute": "^1.0.0" } }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -789,6 +879,31 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-environment-flags": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", + "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -798,12 +913,40 @@ "boolbase": "~1.0.0" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -825,6 +968,17 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -841,6 +995,48 @@ "os-tmpdir": "^1.0.0" } }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "parse-semver": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", @@ -859,12 +1055,24 @@ "@types/node": "*" } }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -877,41 +1085,21 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, "prettier": { "version": "1.18.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", "dev": true }, - "psl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz", - "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "querystringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", - "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", - "dev": true + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } }, "read": { "version": "1.0.7", @@ -942,38 +1130,16 @@ "resolve": "^1.1.6" } }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "resolve": { @@ -985,18 +1151,21 @@ "path-parse": "^1.0.6" } }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "seedrandom": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.1.tgz", @@ -1007,6 +1176,27 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "shelljs": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", @@ -1037,43 +1227,26 @@ } } }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "string_decoder": { @@ -1085,6 +1258,27 @@ "safe-buffer": "~5.1.0" } }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -1103,24 +1297,6 @@ "os-tmpdir": "~1.0.1" } }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - } - } - }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -1169,21 +1345,6 @@ "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, "typed-rest-client": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", @@ -1212,54 +1373,18 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", "dev": true }, - "url-parse": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "vsce": { "version": "1.66.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.66.0.tgz", @@ -1288,21 +1413,6 @@ "yazl": "^2.2.2" } }, - "vscode": { - "version": "1.1.35", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.35.tgz", - "integrity": "sha512-xPnxzQU40LOS2yPyzWW+WKpTV6qA3z16TcgpZ9O38UWLA157Zz4GxUx5H7Gd07pxzw0GqvusbF4D+5GBgNxvEQ==", - "dev": true, - "requires": { - "glob": "^7.1.2", - "mocha": "^5.2.0", - "request": "^2.88.0", - "semver": "^5.4.1", - "source-map-support": "^0.5.0", - "url-parse": "^1.4.4", - "vscode-test": "^0.4.1" - } - }, "vscode-jsonrpc": { "version": "4.1.0-next.2", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.2.tgz", @@ -1332,13 +1442,85 @@ "integrity": "sha512-2JkrMWWUi2rlVLSo9OFR2PIGUzdiowEM8NgNYiwLKnXTjpwpjjIrJbNNxDik7Rv4oo9KtikcFQZKXbrKilL/MQ==" }, "vscode-test": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.4.3.tgz", - "integrity": "sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.2.0.tgz", + "integrity": "sha512-aowqgc8gZe0eflzVUXsBjBrlsJ8eC35kfgfSEeHu9PKA1vQKm/3rVK43TlbxGue8hKtZBElNAJ5QuYklR/vLJA==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1" + "https-proxy-agent": "^2.2.1", + "rimraf": "^2.6.3" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } } }, "wrappy": { @@ -1347,6 +1529,124 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", + "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "os-locale": "^3.1.0", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", + "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", + "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.11", + "yargs": "^12.0.5" + }, + "dependencies": { + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 95ec6cff..e2bc72f3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,18 +13,17 @@ "Other" ], "engines": { - "vscode": "^1.33.0" + "vscode": "^1.36.0" }, "scripts": { "vscode:prepublish": "npm run compile", "package": "vsce package", "compile": "tsc -p ./ && shx cp src/utils/terminateProcess.sh out/utils/terminateProcess.sh", "watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install", "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", - "test": "node node_modules/vscode/bin/test", "prettier": "prettier **/*.{json,ts}", + "test": "node ./out/test/runTest.js", "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code" }, "prettier": { @@ -39,13 +38,17 @@ "@types/mocha": "^5.2.7", "@types/node": "^10.14.13", "@types/seedrandom": "^2.4.28", + "@types/glob": "^7.1.1", + "@types/vscode": "^1.36.0", + "glob": "^7.1.4", + "mocha": "^6.2.0", "prettier": "^1.18.2", "shx": "^0.3.1", "tslint": "^5.18.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.5.3", "vsce": "^1.66.0", - "vscode": "^1.1.35" + "vscode-test": "^1.2.0" }, "activationEvents": [ "onLanguage:rust", diff --git a/rust-analyzer/editors/code/src/test/index.ts b/rust-analyzer/editors/code/src/test/index.ts deleted file mode 100644 index 6e565c25..00000000 --- a/rust-analyzer/editors/code/src/test/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -// -// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING -// -// This file is providing the test runner to use when running extension tests. -// By default the test runner in use is Mocha based. -// -// You can provide your own test runner if you want to override it by exporting -// a function run(testRoot: string, clb: (error:Error) => void) that the extension -// host can call to run the tests. The test runner is expected to use console.log -// to report the results back to the caller. When the tests are finished, return -// a possible error to the callback or null if none. - -import * as testRunner from 'vscode/lib/testrunner'; - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure({ - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true // colored output from test results -}); - -module.exports = testRunner; diff --git a/rust-analyzer/editors/code/src/test/runTest.ts b/rust-analyzer/editors/code/src/test/runTest.ts new file mode 100644 index 00000000..d880d47d --- /dev/null +++ b/rust-analyzer/editors/code/src/test/runTest.ts @@ -0,0 +1,22 @@ +import * as path from 'path'; + +import { runTests } from 'vscode-test'; + +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // The path to the extension test runner script + // Passed to --extensionTestsPath + const extensionTestsPath = path.resolve(__dirname, './utils/index'); + + // Download VS Code, unzip it and run the integration test + await runTests({ extensionDevelopmentPath, extensionTestsPath }); + } catch (err) { + process.exit(1); + } +} + +main(); diff --git a/rust-analyzer/editors/code/src/test/utils/index.ts b/rust-analyzer/editors/code/src/test/utils/index.ts new file mode 100644 index 00000000..16715a28 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/utils/index.ts @@ -0,0 +1,49 @@ +// +// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING +// +// This file is providing the test runner to use when running extension tests. +// By default the test runner in use is Mocha based. +// +// You can provide your own test runner if you want to override it by exporting +// a function run(testRoot: string, clb: (error:Error) => void) that the extension +// host can call to run the tests. The test runner is expected to use console.log +// to report the results back to the caller. When the tests are finished, return +// a possible error to the callback or null if none. + +import * as glob from 'glob'; +import * as Mocha from 'mocha'; +import * as path from 'path'; + +export function run(): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: 'bdd' + }); + mocha.useColors(true); + + const testsRoot = __dirname; + + return new Promise((c, e) => { + glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { + if (err) { + return e(err); + } + + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + e(err); + } + }); + }); +} diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index bfb494a3..1fb1f7b6 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -64,7 +64,7 @@ function mapLevelToSeverity(s: string): vscode.DiagnosticSeverity { * Converts a Rust span to a VsCode location */ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { - const fileName = path.join(vscode.workspace.rootPath!, span.file_name); + const fileName = path.join(vscode.workspace.rootPath || '', span.file_name); const fileUri = vscode.Uri.file(fileName); const range = new vscode.Range( From 4d3c2e603cdbbe38ac3a65643452a1fc3d1a586a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Sep 2019 16:25:24 +0300 Subject: [PATCH 164/819] add option to disable notify --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 4 ++++ rust-analyzer/editors/code/src/server.ts | 1 + 3 files changed, 10 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e2bc72f3..7a48d679 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -205,6 +205,11 @@ "default": [], "description": "Paths to exclude from analysis" }, + "rust-analyzer.useClientWatching": { + "type": "boolean", + "default": false, + "description": "client provided file watching instead of notify watching." + }, "rust-analyzer.cargo-watch.arguments": { "type": "string", "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 570ddca4..a4581485 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,6 +23,7 @@ export class Config { public lruCapacity: null | number = null; public displayInlayHints = true; public excludeGlobs = []; + public useClientWatching = false; public featureFlags = {}; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', @@ -133,6 +134,9 @@ export class Config { if (config.has('excludeGlobs')) { this.excludeGlobs = config.get('excludeGlobs') || []; } + if (config.has('useClientWatching')) { + this.useClientWatching = config.get('useClientWatching') || false; + } if (config.has('featureFlags')) { this.featureFlags = config.get('featureFlags') || {}; } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 0d2a99c7..ff50fcd9 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -46,6 +46,7 @@ export class Server { Server.config.showWorkspaceLoadedNotification, lruCapacity: Server.config.lruCapacity, excludeGlobs: Server.config.excludeGlobs, + useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags }, traceOutputChannel From 111d3acd822f4422b68c51dc1012f5f67c20bf9b Mon Sep 17 00:00:00 2001 From: Lucas Spits Date: Mon, 9 Sep 2019 20:24:31 +0200 Subject: [PATCH 165/819] Replace watcher file existence check with vscode.fs version --- .../editors/code/src/commands/cargo_watch.ts | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 4c3c10c8..00b24dbc 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -1,5 +1,4 @@ import * as child_process from 'child_process'; -import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; @@ -15,23 +14,23 @@ import { import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection'; import { areDiagnosticsEqual } from '../utils/diagnostics/vscode'; -export function registerCargoWatchProvider( +export async function registerCargoWatchProvider( subscriptions: vscode.Disposable[] -): CargoWatchProvider | undefined { +): Promise { let cargoExists = false; - const cargoTomlFile = path.join(vscode.workspace.rootPath!, 'Cargo.toml'); + // Check if the working directory is valid cargo root path - try { - if (fs.existsSync(cargoTomlFile)) { - cargoExists = true; - } - } catch (err) { - cargoExists = false; + const cargoTomlPath = path.join(vscode.workspace.rootPath!, 'Cargo.toml'); + const cargoTomlUri = vscode.Uri.file(cargoTomlPath); + const cargoTomlFileInfo = await vscode.workspace.fs.stat(cargoTomlUri); + + if (cargoTomlFileInfo) { + cargoExists = true; } if (!cargoExists) { vscode.window.showErrorMessage( - `Couldn\'t find \'Cargo.toml\' in ${cargoTomlFile}` + `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}` ); return; } From 5b5253573f5cf4376cb321381b9203116cc172fc Mon Sep 17 00:00:00 2001 From: Lucas Spits Date: Tue, 10 Sep 2019 08:49:23 +0200 Subject: [PATCH 166/819] Update minimal required vscode version to 1.37 --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7a48d679..38824acb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.36.0" + "vscode": "^1.37.0" }, "scripts": { "vscode:prepublish": "npm run compile", From 12c5e42d6e2ddc4a6684cc89d56ad7f180004c63 Mon Sep 17 00:00:00 2001 From: JasperDeSutter Date: Mon, 23 Sep 2019 23:25:16 +0200 Subject: [PATCH 167/819] add rollup bundler for vscode extension --- rust-analyzer/editors/code/.gitignore | 1 + rust-analyzer/editors/code/.vscodeignore | 6 +- rust-analyzer/editors/code/package-lock.json | 190 +++++++++++++++++-- rust-analyzer/editors/code/package.json | 12 +- rust-analyzer/editors/code/rollup.config.js | 27 +++ 5 files changed, 214 insertions(+), 22 deletions(-) create mode 100644 rust-analyzer/editors/code/rollup.config.js diff --git a/rust-analyzer/editors/code/.gitignore b/rust-analyzer/editors/code/.gitignore index 5fe00fea..d8a45ea8 100644 --- a/rust-analyzer/editors/code/.gitignore +++ b/rust-analyzer/editors/code/.gitignore @@ -2,3 +2,4 @@ out node_modules .vscode-test/ *.vsix +bundle diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index 85571789..f9e72b66 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -1,9 +1,9 @@ .vscode/** .vscode-test/** -out/test/** -out/**/*.map +out/** src/** .gitignore tsconfig.json vsc-extension-quickstart.md -tslint.json \ No newline at end of file +tslint.json +node_modules/** diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5ffd8b0b..e4b706ce 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -24,6 +24,12 @@ "js-tokens": "^4.0.0" } }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -59,6 +65,15 @@ "integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==", "dev": true }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/seedrandom": { "version": "2.4.28", "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", @@ -71,6 +86,12 @@ "integrity": "sha512-PRfeuqYuzk3vjf+puzxltIUWC+AhEGYpFX29/37w30DQSQnpf5AgMVf7GDBAdmTbWTBou+EMFz/Ne6XCM/KxzQ==", "dev": true }, + "acorn": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz", + "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==", + "dev": true + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -424,6 +445,12 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -632,6 +659,21 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-reference": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz", + "integrity": "sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==", + "dev": true, + "requires": { + "@types/estree": "0.0.39" + } + }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -721,6 +763,15 @@ "chalk": "^2.0.1" } }, + "magic-string": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz", + "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -1160,6 +1211,109 @@ "glob": "^7.1.3" } }, + "rollup": { + "version": "1.21.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.4.tgz", + "integrity": "sha512-Pl512XVCmVzgcBz5h/3Li4oTaoDcmpuFZ+kdhS/wLreALz//WuDAMfomD3QEYl84NkDu6Z6wV9twlcREb4qQsw==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "@types/node": "^12.7.5", + "acorn": "^7.0.0" + }, + "dependencies": { + "@types/node": { + "version": "12.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz", + "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==", + "dev": true + } + } + }, + "rollup-plugin-commonjs": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", + "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0", + "rollup-pluginutils": "^2.8.1" + }, + "dependencies": { + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "rollup-plugin-node-resolve": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", + "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", + "dev": true, + "requires": { + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.11.1", + "rollup-pluginutils": "^2.8.1" + }, + "dependencies": { + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "rollup-plugin-typescript": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", + "integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==", + "dev": true, + "requires": { + "resolve": "^1.10.0", + "rollup-pluginutils": "^2.5.0" + }, + "dependencies": { + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -1233,6 +1387,12 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "sourcemap-codec": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", + "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -1414,32 +1574,32 @@ } }, "vscode-jsonrpc": { - "version": "4.1.0-next.2", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.2.tgz", - "integrity": "sha512-GsBLjP9DxQ42yl1mW9GEIlnSc0+R8mfzhaebwmmTPEJjezD5SPoAo3DFrIAFZha9yvQ1nzZfZlhtVpGQmgxtXg==" + "version": "4.1.0-next.3", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.3.tgz", + "integrity": "sha512-Z6oxBiMks2+UADV1QHXVooSakjyhI+eHTnXzDyVvVMmegvSfkXk2w6mPEdSkaNHFBdtWW7n20H1yw2nA3A17mg==" }, "vscode-languageclient": { - "version": "5.3.0-next.6", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.6.tgz", - "integrity": "sha512-DxT8+gkenjCjJV6ArcP75/AQfx6HP6m6kHIbacPCpffMeoE1YMLKj6ZixA9J87yr0fMtBmqumLmDeGe7MIF2bw==", + "version": "5.3.0-next.4", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.4.tgz", + "integrity": "sha512-RODuzXErVpJRSgHv+Xei8fwQtZ/iZOWPCqlLl07NTtkzgTAepJf9r4EioZVuTviGJ5DEJ9xs0bjrit8shKtW6Q==", "requires": { "semver": "^5.5.0", - "vscode-languageserver-protocol": "^3.15.0-next.6" + "vscode-languageserver-protocol": "3.15.0-next.4" } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.6", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.6.tgz", - "integrity": "sha512-/yDpYlWyNs26mM23mT73xmOFsh1iRfgZfBdHmfAxwDKwpQKLoOSqVidtYfxlK/pD3IEKGcAVnT4WXTsguxxAMQ==", + "version": "3.15.0-next.4", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.4.tgz", + "integrity": "sha512-4AgisQ8GWa3irdRu3/UNr3brcSSm0oobmoV1eSOnV7JM32lYyXDnSKB7RuTTXvaAjD/0xQJLEGhkyGHS5gbywA==", "requires": { - "vscode-jsonrpc": "^4.1.0-next.2", - "vscode-languageserver-types": "^3.15.0-next.2" + "vscode-jsonrpc": "^4.1.0-next.1", + "vscode-languageserver-types": "3.15.0-next.1" } }, "vscode-languageserver-types": { - "version": "3.15.0-next.2", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.2.tgz", - "integrity": "sha512-2JkrMWWUi2rlVLSo9OFR2PIGUzdiowEM8NgNYiwLKnXTjpwpjjIrJbNNxDik7Rv4oo9KtikcFQZKXbrKilL/MQ==" + "version": "3.15.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.1.tgz", + "integrity": "sha512-R0kzmaI8gOGEoU7b9huYQAzgZzRQ/5Q8HKjsIUdfz0MjXcBZ4tr1ik1So1p1O5kGrI1VTCd22Fw/wI7ECGoIPw==" }, "vscode-test": { "version": "1.2.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 38824acb..b9982c62 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,12 +18,12 @@ "scripts": { "vscode:prepublish": "npm run compile", "package": "vsce package", - "compile": "tsc -p ./ && shx cp src/utils/terminateProcess.sh out/utils/terminateProcess.sh", + "compile": "rollup -c && shx cp src/utils/terminateProcess.sh bundle/terminateProcess.sh", "watch": "tsc -watch -p ./", "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", "prettier": "prettier **/*.{json,ts}", - "test": "node ./out/test/runTest.js", + "test": "tsc -p . && node ./out/test/runTest.js", "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code" }, "prettier": { @@ -35,14 +35,18 @@ "vscode-languageclient": "^5.3.0-next.4" }, "devDependencies": { + "@types/glob": "^7.1.1", "@types/mocha": "^5.2.7", "@types/node": "^10.14.13", "@types/seedrandom": "^2.4.28", - "@types/glob": "^7.1.1", "@types/vscode": "^1.36.0", "glob": "^7.1.4", "mocha": "^6.2.0", "prettier": "^1.18.2", + "rollup": "^1.21.4", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-typescript": "^1.0.1", "shx": "^0.3.1", "tslint": "^5.18.0", "tslint-config-prettier": "^1.18.0", @@ -56,7 +60,7 @@ "onCommand:rust-analyzer.collectGarbage", "workspaceContains:**/Cargo.toml" ], - "main": "./out/extension", + "main": "./bundle/extension", "contributes": { "taskDefinitions": [ { diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js new file mode 100644 index 00000000..a023b8c3 --- /dev/null +++ b/rust-analyzer/editors/code/rollup.config.js @@ -0,0 +1,27 @@ +import typescript from 'rollup-plugin-typescript'; +import resolve from 'rollup-plugin-node-resolve'; +import commonjs from 'rollup-plugin-commonjs'; +import nodeBuiltins from 'builtin-modules'; + +export default { + input: './src/extension.ts', + plugins: [ + typescript(), + resolve(), + commonjs({ + namedExports: { + // squelch missing import warnings + 'vscode-languageclient': [ 'CreateFile', 'RenameFile' ] + } + }), + ], + // keep these as require() calls, bundle the rest + external: [ + ...nodeBuiltins, + 'vscode', + ], + output: { + file: './bundle/extension.js', + format: 'cjs', + } +}; From fb8020275587eaf7eae8c0a63958dc30a01d92a7 Mon Sep 17 00:00:00 2001 From: arsdragonfly Date: Fri, 27 Sep 2019 16:17:02 -0400 Subject: [PATCH 168/819] Support the new deprecated tag --- .../code/src/utils/diagnostics/rust.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index 1fb1f7b6..a66b5231 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -111,6 +111,19 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { ].includes(rd.code.code); } +/** + * Determines if diagnostic is related to deprecated code + */ +function isDeprecated(rd: RustDiagnostic): boolean { + if (!rd.code) { + return false; + } + + return [ + 'deprecated', + ].includes(rd.code.code); +} + /** * Converts a Rust child diagnostic to a VsCode related information * @@ -233,8 +246,14 @@ export function mapRustDiagnosticToVsCode( vd.message += `\n${primarySpanLabel}`; } + vd.tags = [] + if (isUnusedOrUnnecessary(rd)) { - vd.tags = [vscode.DiagnosticTag.Unnecessary]; + vd.tags.push(vscode.DiagnosticTag.Unnecessary); + } + + if (isDeprecated(rd)) { + vd.tags.push(vscode.DiagnosticTag.Deprecated); } return { From 907fc6f7ef0b5372c3cfc18e7310467899463720 Mon Sep 17 00:00:00 2001 From: arsdragonfly Date: Fri, 27 Sep 2019 17:33:14 -0400 Subject: [PATCH 169/819] Fix tests --- .../editors/code/src/test/utils/diagnotics/rust.test.ts | 8 ++++---- rust-analyzer/editors/code/src/utils/diagnostics/rust.ts | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index 7fb003fe..327d1504 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -50,7 +50,7 @@ describe('mapRustDiagnosticToVsCode', () => { ].join('\n') ); assert.strictEqual(diagnostic.code, 'E0053'); - assert.strictEqual(diagnostic.tags, undefined); + assert.deepStrictEqual(diagnostic.tags, []); // No related information assert.deepStrictEqual(diagnostic.relatedInformation, []); @@ -115,7 +115,7 @@ describe('mapRustDiagnosticToVsCode', () => { ); assert.strictEqual(diagnostic.code, 'E0061'); assert.strictEqual(diagnostic.source, 'rustc'); - assert.strictEqual(diagnostic.tags, undefined); + assert.deepStrictEqual(diagnostic.tags, []); // One related information for the original definition const relatedInformation = diagnostic.relatedInformation; @@ -149,7 +149,7 @@ describe('mapRustDiagnosticToVsCode', () => { ].join('\n') ); assert.strictEqual(diagnostic.code, 'trivially_copy_pass_by_ref'); - assert.strictEqual(diagnostic.tags, undefined); + assert.deepStrictEqual(diagnostic.tags, []); // One related information for the lint definition const relatedInformation = diagnostic.relatedInformation; @@ -189,7 +189,7 @@ describe('mapRustDiagnosticToVsCode', () => { ); assert.strictEqual(diagnostic.code, 'E0308'); assert.strictEqual(diagnostic.source, 'rustc'); - assert.strictEqual(diagnostic.tags, undefined); + assert.deepStrictEqual(diagnostic.tags, []); // No related information assert.deepStrictEqual(diagnostic.relatedInformation, []); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index a66b5231..cd02ee46 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -213,6 +213,7 @@ export function mapRustDiagnosticToVsCode( vd.source = source; vd.code = code; vd.relatedInformation = []; + vd.tags = []; for (const secondarySpan of secondarySpans) { const related = mapSecondarySpanToRelated(secondarySpan); @@ -246,8 +247,6 @@ export function mapRustDiagnosticToVsCode( vd.message += `\n${primarySpanLabel}`; } - vd.tags = [] - if (isUnusedOrUnnecessary(rd)) { vd.tags.push(vscode.DiagnosticTag.Unnecessary); } From e25c7320cb3c9eb048cb141d589e0595012ec2c1 Mon Sep 17 00:00:00 2001 From: arsdragonfly Date: Fri, 27 Sep 2019 20:02:51 -0400 Subject: [PATCH 170/819] Fix --- rust-analyzer/editors/code/src/utils/diagnostics/rust.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index cd02ee46..0550d037 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -119,9 +119,7 @@ function isDeprecated(rd: RustDiagnostic): boolean { return false; } - return [ - 'deprecated', - ].includes(rd.code.code); + return ['deprecated'].includes(rd.code.code); } /** From 7f3ba3565d0e334320616dc450176fb0643fc161 Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Thu, 10 Oct 2019 13:26:17 +0200 Subject: [PATCH 171/819] Truncate hints longer than 20 characters --- .../editors/code/src/commands/inlay_hints.ts | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 5393a2bc..3157c04c 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -13,6 +13,8 @@ interface InlayHint { label: string; } +const maxHintLength = 20; + const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { color: new vscode.ThemeColor('ralsp.inlayHint') @@ -83,10 +85,20 @@ export class HintsUpdater { ): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints !== null) { - const newDecorations = newHints.map(hint => ({ - range: hint.range, - renderOptions: { after: { contentText: `: ${hint.label}` } } - })); + const newDecorations = newHints.map(hint => { + let label = hint.label.substring(0, maxHintLength); + if (hint.label.length > maxHintLength) { + label += '…'; + } + return { + range: this.truncateHint(hint.range), + renderOptions: { + after: { + contentText: `: ${label}` + } + } + }; + }); return editor.setDecorations( typeHintDecorationType, newDecorations @@ -94,6 +106,18 @@ export class HintsUpdater { } } + private truncateHint(range: Range): Range { + if (!range.isSingleLine) { + return range; + } + const maxEnd = new vscode.Position( + range.start.line, + range.start.character + maxHintLength + ); + const end = range.end.isAfter(maxEnd) ? maxEnd : range.end; + return new Range(range.start, end); + } + private async queryHints(documentUri: string): Promise { const request: InlayHintsParams = { textDocument: { uri: documentUri } From ef373ee9743c90328ceb75261ddae42dee332a2d Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 10 Oct 2019 10:10:50 -0400 Subject: [PATCH 172/819] engine.vscode and @types/vscode should match --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9982c62..30855f9c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,7 +39,7 @@ "@types/mocha": "^5.2.7", "@types/node": "^10.14.13", "@types/seedrandom": "^2.4.28", - "@types/vscode": "^1.36.0", + "@types/vscode": "^1.37.0", "glob": "^7.1.4", "mocha": "^6.2.0", "prettier": "^1.18.2", From e8ef2b0eca526b5a2a83423b3a45376109331b80 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 10 Oct 2019 10:19:05 -0400 Subject: [PATCH 173/819] Bump rollup and vsce --- rust-analyzer/editors/code/package-lock.json | 46 ++++++++------------ rust-analyzer/editors/code/package.json | 4 +- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e4b706ce..e6bcbfa6 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -87,9 +87,9 @@ "dev": true }, "acorn": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz", - "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", "dev": true }, "agent-base": { @@ -1212,22 +1212,14 @@ } }, "rollup": { - "version": "1.21.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.4.tgz", - "integrity": "sha512-Pl512XVCmVzgcBz5h/3Li4oTaoDcmpuFZ+kdhS/wLreALz//WuDAMfomD3QEYl84NkDu6Z6wV9twlcREb4qQsw==", + "version": "1.23.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.23.1.tgz", + "integrity": "sha512-95C1GZQpr/NIA0kMUQmSjuMDQ45oZfPgDBcN0yZwBG7Kee//m7H68vgIyg+SPuyrTZ5PrXfyLK80OzXeKG5dAA==", "dev": true, "requires": { - "@types/estree": "0.0.39", - "@types/node": "^12.7.5", - "acorn": "^7.0.0" - }, - "dependencies": { - "@types/node": { - "version": "12.7.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz", - "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==", - "dev": true - } + "@types/estree": "*", + "@types/node": "*", + "acorn": "^7.1.0" } }, "rollup-plugin-commonjs": { @@ -1315,9 +1307,9 @@ } }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, "seedrandom": { @@ -1410,12 +1402,12 @@ } }, "string_decoder": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", - "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "~5.2.0" } }, "strip-ansi": { @@ -1546,9 +1538,9 @@ "dev": true }, "vsce": { - "version": "1.66.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.66.0.tgz", - "integrity": "sha512-Zf4+WD4PhEcOr7jkU08SI9lwFqDhmhk73YOCGQ/tNLaBy+PnnX4eSdqj9LdzDLuI2dsyomJLXzDSNgxuaInxCQ==", + "version": "1.67.1", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.67.1.tgz", + "integrity": "sha512-Y/0fnfaLs2cCfytTGmy4Cp1bf9BaxHO7020YePdUwxjAlPlZ9+lm74M9yEFEWXTIug0L0sMax1WMz0TnozIqxg==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9982c62..b6a0c21a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -43,7 +43,7 @@ "glob": "^7.1.4", "mocha": "^6.2.0", "prettier": "^1.18.2", - "rollup": "^1.21.4", + "rollup": "^1.23.1", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-typescript": "^1.0.1", @@ -51,7 +51,7 @@ "tslint": "^5.18.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.5.3", - "vsce": "^1.66.0", + "vsce": "^1.67.0", "vscode-test": "^1.2.0" }, "activationEvents": [ From f65c36c7a490d8f6687e95b5e4a64390aa95df22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 17 Oct 2019 17:27:59 +0300 Subject: [PATCH 174/819] Add rust-analyzer.showWorkspaceLoadedNotification to package.json --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4f4116c3..6649f5b7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -224,6 +224,11 @@ "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", "default": "check" }, + "rust-analyzer.showWorkspaceLoadedNotification": { + "type": "boolean", + "description": "Controls whether rust-analyzer displays a notification when a project is loaded.", + "default": false + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", From 42ff8589b94e52705b45952271c9e892c27b7b6c Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Thu, 17 Oct 2019 15:22:39 +0200 Subject: [PATCH 175/819] Adds config option for cargo-watch `--ignore` flag --- rust-analyzer/editors/code/package.json | 5 +++++ .../editors/code/src/commands/cargo_watch.ts | 7 ++++++- rust-analyzer/editors/code/src/config.ts | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6649f5b7..5ae05011 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -224,6 +224,11 @@ "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", "default": "check" }, + "rust-analyzer.cargo-watch.ignore": { + "type": "array", + "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", + "default": [] + }, "rust-analyzer.showWorkspaceLoadedNotification": { "type": "boolean", "description": "Controls whether rust-analyzer displays a notification when a project is loaded.", diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 00b24dbc..59d4ba97 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -93,10 +93,15 @@ export class CargoWatchProvider implements vscode.Disposable { args = '"' + args + '"'; } + const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce( + (flags, pattern) => [...flags, '--ignore', pattern], + [] as string[] + ); + // Start the cargo watch with json message this.cargoProcess = child_process.spawn( 'cargo', - ['watch', '-x', args], + ['watch', '-x', args, ...ignoreFlags], { stdio: ['ignore', 'pipe', 'pipe'], cwd: vscode.workspace.rootPath, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index a4581485..49bdf7d7 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -12,6 +12,7 @@ export interface CargoWatchOptions { arguments: string; command: string; trace: CargoWatchTraceOptions; + ignore: string[]; } export class Config { @@ -29,7 +30,8 @@ export class Config { enableOnStartup: 'ask', trace: 'off', arguments: '', - command: '' + command: '', + ignore: [] }; private prevEnhancedTyping: null | boolean = null; @@ -124,6 +126,13 @@ export class Config { ); } + if (config.has('cargo-watch.ignore')) { + this.cargoWatchOptions.ignore = config.get( + 'cargo-watch.ignore', + [] + ); + } + if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } From 0fd27131becad7993ddd4083a9e6fd0845eab107 Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Fri, 18 Oct 2019 13:40:03 +0200 Subject: [PATCH 176/819] Make inlay hint length configurable --- rust-analyzer/editors/code/package.json | 5 +++ .../editors/code/src/commands/inlay_hints.ts | 40 ++++++++++++------- rust-analyzer/editors/code/src/config.ts | 6 +++ 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9982c62..35211bcc 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -260,6 +260,11 @@ "type": "boolean", "default": true, "description": "Display additional type information in the editor" + }, + "rust-analyzer.maxInlayHintLength": { + "type": "number", + "default": 20, + "description": "Maximum length for inlay hints" } } }, diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 3157c04c..454a464d 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -13,8 +13,6 @@ interface InlayHint { label: string; } -const maxHintLength = 20; - const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { color: new vscode.ThemeColor('ralsp.inlayHint') @@ -86,12 +84,12 @@ export class HintsUpdater { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints !== null) { const newDecorations = newHints.map(hint => { - let label = hint.label.substring(0, maxHintLength); - if (hint.label.length > maxHintLength) { - label += '…'; - } + const [label, range] = this.truncateHint( + hint.label, + hint.range + ); return { - range: this.truncateHint(hint.range), + range, renderOptions: { after: { contentText: `: ${label}` @@ -106,16 +104,30 @@ export class HintsUpdater { } } - private truncateHint(range: Range): Range { - if (!range.isSingleLine) { - return range; + private truncateHint( + label: string, + range: vscode.Range + ): [string, vscode.Range] { + if (!Server.config.maxInlayHintLength) { + return [label, range]; + } + + let newLabel = label.substring(0, Server.config.maxInlayHintLength); + if (label.length > Server.config.maxInlayHintLength) { + newLabel += '…'; } - const maxEnd = new vscode.Position( + + range = new vscode.Range( range.start.line, - range.start.character + maxHintLength + range.start.character, + range.end.line, + Math.min( + range.start.character + Server.config.maxInlayHintLength, + range.end.character + ) ); - const end = range.end.isAfter(maxEnd) ? maxEnd : range.end; - return new Range(range.start, end); + + return [newLabel, range]; } private async queryHints(documentUri: string): Promise { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index a4581485..2578bc6d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -22,6 +22,7 @@ export class Config { public showWorkspaceLoadedNotification = true; public lruCapacity: null | number = null; public displayInlayHints = true; + public maxInlayHintLength: null | number = null; public excludeGlobs = []; public useClientWatching = false; public featureFlags = {}; @@ -131,6 +132,11 @@ export class Config { if (config.has('displayInlayHints')) { this.displayInlayHints = config.get('displayInlayHints') as boolean; } + if (config.has('maxInlayHintLength')) { + this.maxInlayHintLength = config.get( + 'maxInlayHintLength' + ) as number; + } if (config.has('excludeGlobs')) { this.excludeGlobs = config.get('excludeGlobs') || []; } From 2e62270ff69b712b083dc2e3679c5f922f4f31ba Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Wed, 23 Oct 2019 13:11:40 +0200 Subject: [PATCH 177/819] Do not truncate the range --- .../editors/code/src/commands/inlay_hints.ts | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 454a464d..ffaaaebc 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -83,20 +83,14 @@ export class HintsUpdater { ): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints !== null) { - const newDecorations = newHints.map(hint => { - const [label, range] = this.truncateHint( - hint.label, - hint.range - ); - return { - range, - renderOptions: { - after: { - contentText: `: ${label}` - } + const newDecorations = newHints.map(hint => ({ + range: hint.range, + renderOptions: { + after: { + contentText: `: ${this.truncateHint(hint.label)}` } - }; - }); + } + })); return editor.setDecorations( typeHintDecorationType, newDecorations @@ -104,30 +98,16 @@ export class HintsUpdater { } } - private truncateHint( - label: string, - range: vscode.Range - ): [string, vscode.Range] { + private truncateHint(label: string): string { if (!Server.config.maxInlayHintLength) { - return [label, range]; + return label; } let newLabel = label.substring(0, Server.config.maxInlayHintLength); if (label.length > Server.config.maxInlayHintLength) { newLabel += '…'; } - - range = new vscode.Range( - range.start.line, - range.start.character, - range.end.line, - Math.min( - range.start.character + Server.config.maxInlayHintLength, - range.end.character - ) - ); - - return [newLabel, range]; + return newLabel; } private async queryHints(documentUri: string): Promise { From d8e70e0056724a7d4a0f63668b74966a4902416f Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 24 Oct 2019 17:25:23 +0200 Subject: [PATCH 178/819] Proof of concept theming and 'tokenColorCustomizations' support. --- rust-analyzer/editors/code/package-lock.json | 11 +- rust-analyzer/editors/code/package.json | 3 +- rust-analyzer/editors/code/src/config.ts | 6 +- rust-analyzer/editors/code/src/extension.ts | 10 +- .../editors/code/src/highlighting.ts | 94 +++++++++--- rust-analyzer/editors/code/src/scopes.ts | 142 ++++++++++++++++++ 6 files changed, 231 insertions(+), 35 deletions(-) create mode 100644 rust-analyzer/editors/code/src/scopes.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e6bcbfa6..a632c739 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -598,9 +598,9 @@ } }, "https-proxy-agent": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", - "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.3.tgz", + "integrity": "sha512-Ytgnz23gm2DVftnzqRRz2dOXZbGd2uiajSw/95bPp6v53zPRspQjLm/AfBgqbJ2qfeRXWIOMVLpp86+/5yX39Q==", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -720,6 +720,11 @@ "esprima": "^4.0.0" } }, + "jsonc-parser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.1.1.tgz", + "integrity": "sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g==" + }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4b719aad..46b8cd47 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -32,7 +32,8 @@ }, "dependencies": { "seedrandom": "^3.0.1", - "vscode-languageclient": "^5.3.0-next.4" + "vscode-languageclient": "^5.3.0-next.4", + "jsonc-parser": "^2.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 331936b5..9f8c810b 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; - +import * as scopes from './scopes'; import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -46,7 +46,11 @@ export class Config { public userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); + + Server.highlighter.removeHighlights(); + scopes.load() if (config.has('highlightingOn')) { + this.highlightingOn = config.get('highlightingOn') as boolean; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 39fe6efd..1e1bc1a6 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -91,11 +91,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d21d8a06..4b961170 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,6 +1,8 @@ import seedrandom = require('seedrandom'); import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as scopes from './scopes' + import { Server } from './server'; @@ -23,6 +25,37 @@ function fancify(seed: string, shade: 'light' | 'dark') { return `hsl(${h},${s}%,${l}%)`; } +function createDecorationFromTextmate(themeStyle: scopes.TextMateRuleSettings): vscode.TextEditorDecorationType { + const options: vscode.DecorationRenderOptions = {} + options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen + if (themeStyle.foreground) { + options.color = themeStyle.foreground + } + if (themeStyle.background) { + options.backgroundColor = themeStyle.background + } + if (themeStyle.fontStyle) { + const parts: string[] = themeStyle.fontStyle.split(' ') + parts.forEach((part) => { + switch (part) { + case 'italic': + options.fontStyle = 'italic' + break + case 'bold': + options.fontWeight = 'bold' + + break + case 'underline': + options.textDecoration = 'underline' + break + default: + break + } + }) + } + return vscode.window.createTextEditorDecorationType(options) +} + export class Highlighter { private static initDecorations(): Map< string, @@ -32,36 +65,44 @@ export class Highlighter { tag: string, textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const color = new vscode.ThemeColor('ralsp.' + tag); - const decor = vscode.window.createTextEditorDecorationType({ - color, - textDecoration - }); - return [tag, decor]; + const scope = scopes.find(tag) + + if (scope) { + const decor = createDecorationFromTextmate(scope); + return [tag, decor]; + } + else { + const color = new vscode.ThemeColor('ralsp.' + tag); + const decor = vscode.window.createTextEditorDecorationType({ + color, + textDecoration + }); + return [tag, decor]; + } }; const decorations: Iterable< [string, vscode.TextEditorDecorationType] > = [ - decoration('comment'), - decoration('string'), - decoration('keyword'), - decoration('keyword.control'), - decoration('keyword.unsafe'), - decoration('function'), - decoration('parameter'), - decoration('constant'), - decoration('type'), - decoration('builtin'), - decoration('text'), - decoration('attribute'), - decoration('literal'), - decoration('macro'), - decoration('variable'), - decoration('variable.mut', 'underline'), - decoration('field'), - decoration('module') - ]; + decoration('comment'), + decoration('string'), + decoration('keyword'), + decoration('keyword.control'), + decoration('keyword.unsafe'), + decoration('function'), + decoration('parameter'), + decoration('constant'), + decoration('type'), + decoration('builtin'), + decoration('text'), + decoration('attribute'), + decoration('literal'), + decoration('macro'), + decoration('variable'), + decoration('variable.mut', 'underline'), + decoration('field'), + decoration('module') + ]; return new Map(decorations); } @@ -89,6 +130,8 @@ export class Highlighter { // // Note: decoration objects need to be kept around so we can dispose them // if the user disables syntax highlighting + + if (this.decorations == null) { this.decorations = Highlighter.initDecorations(); } @@ -133,6 +176,7 @@ export class Highlighter { tag ) as vscode.TextEditorDecorationType; const ranges = byTag.get(tag)!; + editor.setDecorations(dec, ranges); } diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts new file mode 100644 index 00000000..19d30982 --- /dev/null +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -0,0 +1,142 @@ +import * as fs from 'fs' +import * as jsonc from 'jsonc-parser' +import * as path from 'path' +import * as vscode from 'vscode' + + + +export interface TextMateRule { + scope: string | string[] + settings: TextMateRuleSettings +} + +export interface TextMateRuleSettings { + foreground: string | undefined + background: string | undefined + fontStyle: string | undefined +} + +// Current theme colors +const colors = new Map() + +export function find(scope: string): TextMateRuleSettings | undefined { + return colors.get(scope) +} + +// Load all textmate scopes in the currently active theme +export function load() { + // Remove any previous theme + colors.clear() + // Find out current color theme + const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme') + + if (typeof themeName !== 'string') { + console.warn('workbench.colorTheme is', themeName) + return + } + // Try to load colors from that theme + try { + loadThemeNamed(themeName) + } catch (e) { + console.warn('failed to load theme', themeName, e) + } +} + +// Find current theme on disk +function loadThemeNamed(themeName: string) { + for (const extension of vscode.extensions.all) { + const extensionPath: string = extension.extensionPath + const extensionPackageJsonPath: string = path.join(extensionPath, 'package.json') + if (!checkFileExists(extensionPackageJsonPath)) { + continue + } + const packageJsonText: string = readFileText(extensionPackageJsonPath) + const packageJson: any = jsonc.parse(packageJsonText) + if (packageJson.contributes && packageJson.contributes.themes) { + for (const theme of packageJson.contributes.themes) { + const id = theme.id || theme.label + if (id === themeName) { + const themeRelativePath: string = theme.path + const themeFullPath: string = path.join(extensionPath, themeRelativePath) + loadThemeFile(themeFullPath) + } + } + } + + const customization: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + if (customization && customization.textMateRules) { + loadColors(customization.textMateRules) + } + } +} + +function loadThemeFile(themePath: string) { + if (checkFileExists(themePath)) { + const themeContentText: string = readFileText(themePath) + const themeContent: any = jsonc.parse(themeContentText) + + if (themeContent && themeContent.tokenColors) { + loadColors(themeContent.tokenColors) + if (themeContent.include) { + // parse included theme file + const includedThemePath: string = path.join(path.dirname(themePath), themeContent.include) + loadThemeFile(includedThemePath) + } + } + } +} +function mergeRuleSettings(defaultRule: TextMateRuleSettings, override: TextMateRuleSettings): TextMateRuleSettings { + const mergedRule = defaultRule; + if (override.background) { + mergedRule.background = override.background + } + if (override.foreground) { + mergedRule.foreground = override.foreground + } + if (override.background) { + mergedRule.fontStyle = override.fontStyle + } + return mergedRule; +} + +function loadColors(textMateRules: TextMateRule[]): void { + for (const rule of textMateRules) { + + if (typeof rule.scope === 'string') { + const existingRule = colors.get(rule.scope); + if (existingRule) { + colors.set(rule.scope, mergeRuleSettings(existingRule, rule.settings)) + } + else { + colors.set(rule.scope, rule.settings) + } + } else if (rule.scope instanceof Array) { + for (const scope of rule.scope) { + const existingRule = colors.get(scope); + if (existingRule) { + colors.set(scope, mergeRuleSettings(existingRule, rule.settings)) + } + else { + colors.set(scope, rule.settings) + } + } + } + } +} + +function checkFileExists(filePath: string): boolean { + + const stats = fs.statSync(filePath); + if (stats && stats.isFile()) { + return true; + } else { + console.warn('no such file', filePath) + return false; + } + + +} + +function readFileText(filePath: string, encoding: string = 'utf8'): string { + return fs.readFileSync(filePath, encoding); +} \ No newline at end of file From d7302b51805bbc4eebcbeabad0784516e69a5365 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 24 Oct 2019 17:56:59 +0200 Subject: [PATCH 179/819] Only loading `tokenColorCustomizations` once. --- rust-analyzer/editors/code/src/scopes.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 19d30982..c38f6bb5 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -63,10 +63,10 @@ function loadThemeNamed(themeName: string) { } } - const customization: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - if (customization && customization.textMateRules) { - loadColors(customization.textMateRules) - } + } + const customization: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + if (customization && customization.textMateRules) { + loadColors(customization.textMateRules) } } From fc21a43c35cf1ed68f3d9a8ebe9b48a0b693180c Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 24 Oct 2019 17:59:55 +0200 Subject: [PATCH 180/819] Fixing linting issues, but also hides failures. Has to be a better approach to error handling. --- rust-analyzer/editors/code/src/scopes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index c38f6bb5..a099696a 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -31,14 +31,14 @@ export function load() { const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme') if (typeof themeName !== 'string') { - console.warn('workbench.colorTheme is', themeName) + // console.warn('workbench.colorTheme is', themeName) return } // Try to load colors from that theme try { loadThemeNamed(themeName) } catch (e) { - console.warn('failed to load theme', themeName, e) + // console.warn('failed to load theme', themeName, e) } } @@ -130,7 +130,7 @@ function checkFileExists(filePath: string): boolean { if (stats && stats.isFile()) { return true; } else { - console.warn('no such file', filePath) + // console.warn('no such file', filePath) return false; } From f5b0f77ae681f52b753a692da82fd1b8d9b4e801 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 24 Oct 2019 18:33:36 +0200 Subject: [PATCH 181/819] Making it clear we're using default settings. --- rust-analyzer/editors/code/src/scopes.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index a099696a..607b8b2d 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -85,17 +85,13 @@ function loadThemeFile(themePath: string) { } } } -function mergeRuleSettings(defaultRule: TextMateRuleSettings, override: TextMateRuleSettings): TextMateRuleSettings { - const mergedRule = defaultRule; - if (override.background) { - mergedRule.background = override.background - } - if (override.foreground) { - mergedRule.foreground = override.foreground - } - if (override.background) { - mergedRule.fontStyle = override.fontStyle - } +function mergeRuleSettings(defaultSetting: TextMateRuleSettings, override: TextMateRuleSettings): TextMateRuleSettings { + const mergedRule = defaultSetting; + + mergedRule.background = override.background || defaultSetting.background + mergedRule.foreground = override.foreground || defaultSetting.foreground + mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground; + return mergedRule; } From 5d3d29bcc322790a506fa2c4b70ab9a7d95affca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Oct 2019 09:00:30 +0300 Subject: [PATCH 182/819] document feature flags --- rust-analyzer/editors/code/package.json | 5 ----- rust-analyzer/editors/code/src/config.ts | 7 ------- rust-analyzer/editors/code/src/server.ts | 2 -- 3 files changed, 14 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4b719aad..ee997e58 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -229,11 +229,6 @@ "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", "default": [] }, - "rust-analyzer.showWorkspaceLoadedNotification": { - "type": "boolean", - "description": "Controls whether rust-analyzer displays a notification when a project is loaded.", - "default": false - }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 331936b5..95c3f42e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -20,7 +20,6 @@ export class Config { public rainbowHighlightingOn = false; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; - public showWorkspaceLoadedNotification = true; public lruCapacity: null | number = null; public displayInlayHints = true; public maxInlayHintLength: null | number = null; @@ -56,12 +55,6 @@ export class Config { ) as boolean; } - if (config.has('showWorkspaceLoadedNotification')) { - this.showWorkspaceLoadedNotification = config.get( - 'showWorkspaceLoadedNotification' - ) as boolean; - } - if (!this.highlightingOn && Server) { Server.highlighter.removeHighlights(); } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index ff50fcd9..a3ef21a1 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -42,8 +42,6 @@ export class Server { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { publishDecorations: true, - showWorkspaceLoaded: - Server.config.showWorkspaceLoadedNotification, lruCapacity: Server.config.lruCapacity, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, From b3de7f39216a59fcec942412400d2d5e827f2afd Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sat, 26 Oct 2019 16:29:49 +0200 Subject: [PATCH 183/819] Refactor how themes are found in packages without relying on parsing JSONC. However, there is still an issue where themes could have been defined in JSONC - but so far with testing very few of them actually do. The issue was in loading packages and now we're letting VSCode tackle that. Fix: https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r339015610 --- rust-analyzer/editors/code/package.json | 5 ++-- rust-analyzer/editors/code/src/scopes.ts | 38 +++++++++++------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 46b8cd47..b7ea9fa6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -32,8 +32,7 @@ }, "dependencies": { "seedrandom": "^3.0.1", - "vscode-languageclient": "^5.3.0-next.4", - "jsonc-parser": "^2.1.0" + "vscode-languageclient": "^5.3.0-next.4" }, "devDependencies": { "@types/glob": "^7.1.1", @@ -494,4 +493,4 @@ } ] } -} +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 607b8b2d..c9c01ba1 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -1,5 +1,4 @@ import * as fs from 'fs' -import * as jsonc from 'jsonc-parser' import * as path from 'path' import * as vscode from 'vscode' @@ -44,26 +43,21 @@ export function load() { // Find current theme on disk function loadThemeNamed(themeName: string) { - for (const extension of vscode.extensions.all) { - const extensionPath: string = extension.extensionPath - const extensionPackageJsonPath: string = path.join(extensionPath, 'package.json') - if (!checkFileExists(extensionPackageJsonPath)) { - continue - } - const packageJsonText: string = readFileText(extensionPackageJsonPath) - const packageJson: any = jsonc.parse(packageJsonText) - if (packageJson.contributes && packageJson.contributes.themes) { - for (const theme of packageJson.contributes.themes) { - const id = theme.id || theme.label - if (id === themeName) { - const themeRelativePath: string = theme.path - const themeFullPath: string = path.join(extensionPath, themeRelativePath) - loadThemeFile(themeFullPath) - } - } - } - } + const themePaths = vscode.extensions.all + .filter(extension => extension.extensionKind === vscode.ExtensionKind.UI) + .filter(extension => extension.packageJSON.contributes) + .filter(extension => extension.packageJSON.contributes.themes) + .reduce((list, extension) => { + const paths = extension.packageJSON.contributes.themes + .filter((element: any) => (element.id || element.label) === themeName) + .map((element: any) => path.join(extension.extensionPath, element.path)) + return list.concat(paths) + }, Array()); + + + themePaths.forEach(loadThemeFile); + const customization: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); if (customization && customization.textMateRules) { loadColors(customization.textMateRules) @@ -71,9 +65,11 @@ function loadThemeNamed(themeName: string) { } function loadThemeFile(themePath: string) { + if (checkFileExists(themePath)) { const themeContentText: string = readFileText(themePath) - const themeContent: any = jsonc.parse(themeContentText) + + const themeContent: any = JSON.parse(themeContentText) if (themeContent && themeContent.tokenColors) { loadColors(themeContent.tokenColors) From 4b8e8b7c6a4fae724046a46f205b7996e2c5bb7d Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 27 Oct 2019 17:57:11 +0100 Subject: [PATCH 184/819] Introducing a Scopes Mapper to map from RA scopes to TextMate scopes with fallbacks. Current scopes defined: ``` ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], ['type', ['entity.name.type']], ['builtin', ['variable.language', 'support.type', 'support.type']], ['text', ['string', 'string.quoted', 'string.regexp']], ['attribute', ['keyword']], ['literal', ['string', 'string.quoted', 'string.regexp']], ['macro', ['support.other']], ['variable.mut', ['variable']], ['field', ['variable.object.property']], ['module', ['entity.name.section']] ``` Need to complement with further fallbacks as some themes fail. --- rust-analyzer/editors/code/src/config.ts | 2 + .../editors/code/src/highlighting.ts | 11 +++-- rust-analyzer/editors/code/src/scopes.ts | 18 ++++---- .../editors/code/src/scopes_mapper.ts | 42 +++++++++++++++++++ 4 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 rust-analyzer/editors/code/src/scopes_mapper.ts diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 9f8c810b..a3fe3909 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as scopes from './scopes'; +import * as scopesMapper from './scopes_mapper'; import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -49,6 +50,7 @@ export class Config { Server.highlighter.removeHighlights(); scopes.load() + scopesMapper.load() if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4b961170..bc19fae2 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -2,7 +2,7 @@ import seedrandom = require('seedrandom'); import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as scopes from './scopes' - +import * as scopesMapper from './scopes_mapper'; import { Server } from './server'; @@ -65,10 +65,13 @@ export class Highlighter { tag: string, textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const scope = scopes.find(tag) - if (scope) { - const decor = createDecorationFromTextmate(scope); + const foundRule = scopesMapper.toRule(tag, scopes.find) || scopes.find(tag) + + + + if (foundRule) { + const decor = createDecorationFromTextmate(foundRule); return [tag, decor]; } else { diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index c9c01ba1..470ee716 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -16,16 +16,16 @@ export interface TextMateRuleSettings { } // Current theme colors -const colors = new Map() +const rules = new Map() export function find(scope: string): TextMateRuleSettings | undefined { - return colors.get(scope) + return rules.get(scope) } // Load all textmate scopes in the currently active theme export function load() { // Remove any previous theme - colors.clear() + rules.clear() // Find out current color theme const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme') @@ -95,21 +95,21 @@ function loadColors(textMateRules: TextMateRule[]): void { for (const rule of textMateRules) { if (typeof rule.scope === 'string') { - const existingRule = colors.get(rule.scope); + const existingRule = rules.get(rule.scope); if (existingRule) { - colors.set(rule.scope, mergeRuleSettings(existingRule, rule.settings)) + rules.set(rule.scope, mergeRuleSettings(existingRule, rule.settings)) } else { - colors.set(rule.scope, rule.settings) + rules.set(rule.scope, rule.settings) } } else if (rule.scope instanceof Array) { for (const scope of rule.scope) { - const existingRule = colors.get(scope); + const existingRule = rules.get(scope); if (existingRule) { - colors.set(scope, mergeRuleSettings(existingRule, rule.settings)) + rules.set(scope, mergeRuleSettings(existingRule, rule.settings)) } else { - colors.set(scope, rule.settings) + rules.set(scope, rule.settings) } } } diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts new file mode 100644 index 00000000..995adae2 --- /dev/null +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -0,0 +1,42 @@ +import * as vscode from 'vscode' +import { TextMateRuleSettings } from './scopes' + + + + +let mappings = new Map() + + +const defaultMapping = new Map([ + ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']], + ['function', ['entity.name.function']], + ['parameter', ['variable.parameter']], + ['type', ['entity.name.type']], + ['builtin', ['variable.language', 'support.type', 'support.type']], + ['text', ['string', 'string.quoted', 'string.regexp']], + ['attribute', ['keyword']], + ['literal', ['string', 'string.quoted', 'string.regexp']], + ['macro', ['support.other']], + ['variable.mut', ['variable']], + ['field', ['variable.object.property']], + ['module', ['entity.name.section']] +] +) +function find(scope: string): string[] { + return mappings.get(scope) || [] +} + +export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { + return find(scope).map(intoRule).find(rule => rule !== null) +} + + +export function load() { + const configuration = vscode.workspace + .getConfiguration('rust-analyzer') + .get('scopeMappings') as Map | undefined || new Map() + + mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())]); + + +} \ No newline at end of file From a2f69639d9b680813e879f38da2e9412e14706c3 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 27 Oct 2019 23:11:22 +0100 Subject: [PATCH 185/819] Adding all the decorators from RA to map. Useful for more granular control. --- rust-analyzer/editors/code/src/scopes_mapper.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 995adae2..5c3cb8f6 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -8,15 +8,21 @@ let mappings = new Map() const defaultMapping = new Map([ + ['comment', ['comment']], + ['string', ['string']], + ['keyword', ['keyword']], + ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], + ['constant', ['constant', 'variable']], ['type', ['entity.name.type']], ['builtin', ['variable.language', 'support.type', 'support.type']], ['text', ['string', 'string.quoted', 'string.regexp']], ['attribute', ['keyword']], ['literal', ['string', 'string.quoted', 'string.regexp']], ['macro', ['support.other']], + ['variable', ['variable']], ['variable.mut', ['variable']], ['field', ['variable.object.property']], ['module', ['entity.name.section']] From b8e5300b2730d8156d0ef2187e29ce652e9299a9 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 27 Oct 2019 23:49:41 +0100 Subject: [PATCH 186/819] Adding debugging to figure out missing scopes from theme. --- rust-analyzer/editors/code/src/highlighting.ts | 9 ++++----- rust-analyzer/editors/code/src/scopes_mapper.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index bc19fae2..b7dffaff 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -66,15 +66,14 @@ export class Highlighter { textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const foundRule = scopesMapper.toRule(tag, scopes.find) || scopes.find(tag) + const rule = scopesMapper.toRule(tag, scopes.find) - - - if (foundRule) { - const decor = createDecorationFromTextmate(foundRule); + if (rule) { + const decor = createDecorationFromTextmate(rule); return [tag, decor]; } else { + console.log('Missing theme for: ' + tag); const color = new vscode.ThemeColor('ralsp.' + tag); const decor = vscode.window.createTextEditorDecorationType({ color, diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 5c3cb8f6..4534d8a3 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -8,11 +8,11 @@ let mappings = new Map() const defaultMapping = new Map([ - ['comment', ['comment']], + ['comment', ['comment', 'comment.block', 'comment.line', 'comment.block.documentation']], ['string', ['string']], ['keyword', ['keyword']], ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], - ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']], + ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], ['constant', ['constant', 'variable']], @@ -23,9 +23,9 @@ const defaultMapping = new Map([ ['literal', ['string', 'string.quoted', 'string.regexp']], ['macro', ['support.other']], ['variable', ['variable']], - ['variable.mut', ['variable']], - ['field', ['variable.object.property']], - ['module', ['entity.name.section']] + ['variable.mut', ['variable', 'storage.modifier']], + ['field', ['variable.object.property', 'meta.field.declaration', 'meta.definition.property', 'variable.other',]], + ['module', ['entity.name.section', 'entity.other']] ] ) function find(scope: string): string[] { @@ -33,7 +33,7 @@ function find(scope: string): string[] { } export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { - return find(scope).map(intoRule).find(rule => rule !== null) + return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; } From 71a05d39f12381524fa35e92300625380d381ef7 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 27 Oct 2019 23:58:14 +0100 Subject: [PATCH 187/819] Remove `jsonc-parser` since vscode can load the package. Might need it later for loading certain themes, but seems to work without for now. --- rust-analyzer/editors/code/package-lock.json | 5 ----- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index a632c739..9c55c257 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -720,11 +720,6 @@ "esprima": "^4.0.0" } }, - "jsonc-parser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.1.1.tgz", - "integrity": "sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g==" - }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b7ea9fa6..4b719aad 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -493,4 +493,4 @@ } ] } -} \ No newline at end of file +} From 350b254a3a2447f4f7f28e452e6f640b2d70a32f Mon Sep 17 00:00:00 2001 From: krk Date: Wed, 30 Oct 2019 21:44:06 +0100 Subject: [PATCH 188/819] Add link to the vscode VIM extension compatibility warning. --- rust-analyzer/editors/code/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 39fe6efd..c06928d1 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -45,7 +45,7 @@ export function activate(context: vscode.ExtensionContext) { }); } catch (_) { vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility with VIM extension' + 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings' ); } } From 99ed19e8bade70a8d6806d1f8b9dc06b996c1b94 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 31 Oct 2019 10:36:54 +0100 Subject: [PATCH 189/819] Adding better debugging for testing themes missing tags and which scopes didn't map. Since this file is no longer being pushed upstream, double down on monads. --- .../editors/code/src/highlighting.ts | 5 +- rust-analyzer/editors/code/src/scopes.ts | 87 ++++++++++--------- .../editors/code/src/scopes_mapper.ts | 11 ++- 3 files changed, 58 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index b7dffaff..dad99254 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -73,7 +73,10 @@ export class Highlighter { return [tag, decor]; } else { - console.log('Missing theme for: ' + tag); + console.log(' '); + console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:') + console.log(scopesMapper.find(tag)) + console.log(' '); const color = new vscode.ThemeColor('ralsp.' + tag); const decor = vscode.window.createTextEditorDecorationType({ color, diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 470ee716..76cbbd84 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -41,61 +41,72 @@ export function load() { } } +function filterThemeExtensions(extension: vscode.Extension): boolean { + return extension.extensionKind === vscode.ExtensionKind.UI && + extension.packageJSON.contributes && + extension.packageJSON.contributes.themes +} + + + // Find current theme on disk function loadThemeNamed(themeName: string) { const themePaths = vscode.extensions.all - .filter(extension => extension.extensionKind === vscode.ExtensionKind.UI) - .filter(extension => extension.packageJSON.contributes) - .filter(extension => extension.packageJSON.contributes.themes) + .filter(filterThemeExtensions) .reduce((list, extension) => { const paths = extension.packageJSON.contributes.themes .filter((element: any) => (element.id || element.label) === themeName) .map((element: any) => path.join(extension.extensionPath, element.path)) return list.concat(paths) - }, Array()); + }, Array()) - themePaths.forEach(loadThemeFile); + themePaths.forEach(loadThemeFile) - const customization: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - if (customization && customization.textMateRules) { - loadColors(customization.textMateRules) - } -} + const tokenColorCustomizations: [any] = [vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations')] -function loadThemeFile(themePath: string) { + tokenColorCustomizations + .filter(custom => custom && custom.textMateRules) + .map(custom => custom.textMateRules) + .forEach(loadColors) - if (checkFileExists(themePath)) { - const themeContentText: string = readFileText(themePath) +} - const themeContent: any = JSON.parse(themeContentText) - if (themeContent && themeContent.tokenColors) { - loadColors(themeContent.tokenColors) - if (themeContent.include) { - // parse included theme file - const includedThemePath: string = path.join(path.dirname(themePath), themeContent.include) - loadThemeFile(includedThemePath) - } - } - } +function loadThemeFile(themePath: string) { + const themeContent = [themePath] + .filter(isFile) + .map(readFileText) + .map(parseJSON) + .filter(theme => theme) + + themeContent + .filter(theme => theme.tokenColors) + .map(theme => theme.tokenColors) + .forEach(loadColors) + + themeContent + .filter(theme => theme.include) + .map(theme => path.join(path.dirname(themePath), theme.include)) + .forEach(loadThemeFile) } + function mergeRuleSettings(defaultSetting: TextMateRuleSettings, override: TextMateRuleSettings): TextMateRuleSettings { - const mergedRule = defaultSetting; + const mergedRule = defaultSetting mergedRule.background = override.background || defaultSetting.background mergedRule.foreground = override.foreground || defaultSetting.foreground - mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground; + mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground - return mergedRule; + return mergedRule } function loadColors(textMateRules: TextMateRule[]): void { for (const rule of textMateRules) { if (typeof rule.scope === 'string') { - const existingRule = rules.get(rule.scope); + const existingRule = rules.get(rule.scope) if (existingRule) { rules.set(rule.scope, mergeRuleSettings(existingRule, rule.settings)) } @@ -104,7 +115,7 @@ function loadColors(textMateRules: TextMateRule[]): void { } } else if (rule.scope instanceof Array) { for (const scope of rule.scope) { - const existingRule = rules.get(scope); + const existingRule = rules.get(scope) if (existingRule) { rules.set(scope, mergeRuleSettings(existingRule, rule.settings)) } @@ -116,19 +127,15 @@ function loadColors(textMateRules: TextMateRule[]): void { } } -function checkFileExists(filePath: string): boolean { - - const stats = fs.statSync(filePath); - if (stats && stats.isFile()) { - return true; - } else { - // console.warn('no such file', filePath) - return false; - } - +function isFile(filePath: string): boolean { + return [filePath].map(fs.statSync).every(stat => stat.isFile()) +} +function readFileText(filePath: string): string { + return fs.readFileSync(filePath, 'utf8') } -function readFileText(filePath: string, encoding: string = 'utf8'): string { - return fs.readFileSync(filePath, encoding); +// Might need to replace with JSONC if a theme contains comments. +function parseJSON(content: string): any { + return JSON.parse(content) } \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 4534d8a3..19a4213d 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -28,21 +28,24 @@ const defaultMapping = new Map([ ['module', ['entity.name.section', 'entity.other']] ] ) -function find(scope: string): string[] { + +// Temporary exported for debugging for now. +export function find(scope: string): string[] { return mappings.get(scope) || [] } export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { - return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; + return find(scope).map(intoRule).filter(rule => rule !== undefined)[0] } export function load() { const configuration = vscode.workspace .getConfiguration('rust-analyzer') - .get('scopeMappings') as Map | undefined || new Map() + .get('scopeMappings') as Map | undefined + || new Map() - mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())]); + mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())]) } \ No newline at end of file From 27c4dcdef2b0af2d770e774464015cd704773b5e Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Thu, 31 Oct 2019 11:26:39 +0100 Subject: [PATCH 190/819] Making loadColors more readable by monading all the things. --- rust-analyzer/editors/code/src/scopes.ts | 39 ++++++++++-------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 76cbbd84..5d439593 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -55,10 +55,10 @@ function loadThemeNamed(themeName: string) { const themePaths = vscode.extensions.all .filter(filterThemeExtensions) .reduce((list, extension) => { - const paths = extension.packageJSON.contributes.themes + return extension.packageJSON.contributes.themes .filter((element: any) => (element.id || element.label) === themeName) .map((element: any) => path.join(extension.extensionPath, element.path)) - return list.concat(paths) + .concat(list) }, Array()) @@ -92,7 +92,8 @@ function loadThemeFile(themePath: string) { .forEach(loadThemeFile) } -function mergeRuleSettings(defaultSetting: TextMateRuleSettings, override: TextMateRuleSettings): TextMateRuleSettings { +function mergeRuleSettings(defaultSetting: TextMateRuleSettings | undefined, override: TextMateRuleSettings): TextMateRuleSettings { + if (defaultSetting === undefined) { return override } const mergedRule = defaultSetting mergedRule.background = override.background || defaultSetting.background @@ -102,29 +103,21 @@ function mergeRuleSettings(defaultSetting: TextMateRuleSettings, override: TextM return mergedRule } -function loadColors(textMateRules: TextMateRule[]): void { - for (const rule of textMateRules) { +function updateRules(scope: string, updatedSettings: TextMateRuleSettings): void { + [rules.get(scope)] + .map(settings => mergeRuleSettings(settings, updatedSettings)) + .forEach(settings => rules.set(scope, settings)) +} +function loadColors(textMateRules: TextMateRule[]): void { + textMateRules.forEach(rule => { if (typeof rule.scope === 'string') { - const existingRule = rules.get(rule.scope) - if (existingRule) { - rules.set(rule.scope, mergeRuleSettings(existingRule, rule.settings)) - } - else { - rules.set(rule.scope, rule.settings) - } - } else if (rule.scope instanceof Array) { - for (const scope of rule.scope) { - const existingRule = rules.get(scope) - if (existingRule) { - rules.set(scope, mergeRuleSettings(existingRule, rule.settings)) - } - else { - rules.set(scope, rule.settings) - } - } + updateRules(rule.scope, rule.settings) } - } + else if (rule.scope instanceof Array) { + rule.scope.forEach(scope => updateRules(scope, rule.settings)) + } + }) } function isFile(filePath: string): boolean { From b82ea14b2e90f2e1538b525f7c29d39cb3dc7e4d Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Mon, 4 Nov 2019 23:59:11 +0100 Subject: [PATCH 191/819] * Adding scope mapping configuration manifest in `package.json` * Loading configurable scope mappings from settings. * Updating Readme with `rust-analyzer.scopeMappings`. `rust-analyzer.scopeMappings` -- a scheme backed JSON object to tweak Rust Analyzer scopes to TextMate scopes. ```jsonc { //Will autocomplete keys to available RA scopes. "keyword.unsafe": ["keyword", "keyword.control"], //Values are string | TextMateScope | [string | TextMateScope] "comments": "comment.block" } ``` --- rust-analyzer/editors/code/package.json | 64 ++++++++++++++++++- rust-analyzer/editors/code/src/config.ts | 11 ++-- .../editors/code/src/highlighting.ts | 32 +++++----- rust-analyzer/editors/code/src/scopes.ts | 64 +++++++++---------- .../editors/code/src/scopes_mapper.ts | 35 ++++++---- 5 files changed, 140 insertions(+), 66 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ee997e58..35f2f1e6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -167,6 +167,68 @@ "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "rust-analyzer.scopeMappings": { + "type": "object", + "definitions": {}, + "properties": { + "comment": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "string": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "keyword": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "keyword.control": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "keyword.unsafe": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "function": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "parameter": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "constant": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "type": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "builtin": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "text": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "attribute": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "literal": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "macro": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "variable": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "variable.mut": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "field": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + }, + "module": { + "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" + } + }, + "additionalProperties": false, + "description": "Mapping Rust Analyzer scopes to TextMateRule scopes list." + }, "rust-analyzer.rainbowHighlightingOn": { "type": "boolean", "default": false, @@ -488,4 +550,4 @@ } ] } -} +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 12823f31..234a390a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -48,11 +48,13 @@ export class Config { const config = vscode.workspace.getConfiguration('rust-analyzer'); Server.highlighter.removeHighlights(); - scopes.load() - scopesMapper.load() - if (config.has('highlightingOn')) { + if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; + if (this.highlightingOn) { + scopes.load(); + scopesMapper.load(); + } } if (config.has('rainbowHighlightingOn')) { @@ -61,9 +63,6 @@ export class Config { ) as boolean; } - if (!this.highlightingOn && Server) { - Server.highlighter.removeHighlights(); - } if (config.has('enableEnhancedTyping')) { this.enableEnhancedTyping = config.get( diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index dad99254..1c67e5dc 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,7 +1,7 @@ import seedrandom = require('seedrandom'); import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as scopes from './scopes' +import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; import { Server } from './server'; @@ -25,35 +25,35 @@ function fancify(seed: string, shade: 'light' | 'dark') { return `hsl(${h},${s}%,${l}%)`; } + function createDecorationFromTextmate(themeStyle: scopes.TextMateRuleSettings): vscode.TextEditorDecorationType { - const options: vscode.DecorationRenderOptions = {} - options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen + const options: vscode.DecorationRenderOptions = {}; + options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; if (themeStyle.foreground) { - options.color = themeStyle.foreground + options.color = themeStyle.foreground; } if (themeStyle.background) { - options.backgroundColor = themeStyle.background + options.backgroundColor = themeStyle.background; } if (themeStyle.fontStyle) { - const parts: string[] = themeStyle.fontStyle.split(' ') + const parts: string[] = themeStyle.fontStyle.split(' '); parts.forEach((part) => { switch (part) { case 'italic': - options.fontStyle = 'italic' - break + options.fontStyle = 'italic'; + break; case 'bold': - options.fontWeight = 'bold' - - break + options.fontWeight = 'bold'; + break; case 'underline': - options.textDecoration = 'underline' - break + options.textDecoration = 'underline'; + break; default: - break + break; } }) } - return vscode.window.createTextEditorDecorationType(options) + return vscode.window.createTextEditorDecorationType(options); } export class Highlighter { @@ -66,7 +66,7 @@ export class Highlighter { textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, scopes.find) + const rule = scopesMapper.toRule(tag, scopes.find); if (rule) { const decor = createDecorationFromTextmate(rule); diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 5d439593..a6138fad 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -1,41 +1,41 @@ -import * as fs from 'fs' -import * as path from 'path' -import * as vscode from 'vscode' +import * as fs from 'fs'; +import * as path from 'path'; +import * as vscode from 'vscode'; export interface TextMateRule { - scope: string | string[] - settings: TextMateRuleSettings + scope: string | string[]; + settings: TextMateRuleSettings; } export interface TextMateRuleSettings { - foreground: string | undefined - background: string | undefined - fontStyle: string | undefined + foreground: string | undefined; + background: string | undefined; + fontStyle: string | undefined; } // Current theme colors -const rules = new Map() +const rules = new Map(); export function find(scope: string): TextMateRuleSettings | undefined { - return rules.get(scope) + return rules.get(scope); } // Load all textmate scopes in the currently active theme export function load() { // Remove any previous theme - rules.clear() + rules.clear(); // Find out current color theme - const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme') + const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme'); if (typeof themeName !== 'string') { // console.warn('workbench.colorTheme is', themeName) - return + return; } // Try to load colors from that theme try { - loadThemeNamed(themeName) + loadThemeNamed(themeName); } catch (e) { // console.warn('failed to load theme', themeName, e) } @@ -44,7 +44,7 @@ export function load() { function filterThemeExtensions(extension: vscode.Extension): boolean { return extension.extensionKind === vscode.ExtensionKind.UI && extension.packageJSON.contributes && - extension.packageJSON.contributes.themes + extension.packageJSON.contributes.themes; } @@ -59,17 +59,17 @@ function loadThemeNamed(themeName: string) { .filter((element: any) => (element.id || element.label) === themeName) .map((element: any) => path.join(extension.extensionPath, element.path)) .concat(list) - }, Array()) + }, Array()); - themePaths.forEach(loadThemeFile) + themePaths.forEach(loadThemeFile); const tokenColorCustomizations: [any] = [vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations')] tokenColorCustomizations .filter(custom => custom && custom.textMateRules) .map(custom => custom.textMateRules) - .forEach(loadColors) + .forEach(loadColors); } @@ -79,26 +79,26 @@ function loadThemeFile(themePath: string) { .filter(isFile) .map(readFileText) .map(parseJSON) - .filter(theme => theme) + .filter(theme => theme); themeContent .filter(theme => theme.tokenColors) .map(theme => theme.tokenColors) - .forEach(loadColors) + .forEach(loadColors); themeContent .filter(theme => theme.include) .map(theme => path.join(path.dirname(themePath), theme.include)) - .forEach(loadThemeFile) + .forEach(loadThemeFile); } function mergeRuleSettings(defaultSetting: TextMateRuleSettings | undefined, override: TextMateRuleSettings): TextMateRuleSettings { - if (defaultSetting === undefined) { return override } - const mergedRule = defaultSetting + if (defaultSetting === undefined) { return override; } + const mergedRule = defaultSetting; - mergedRule.background = override.background || defaultSetting.background - mergedRule.foreground = override.foreground || defaultSetting.foreground - mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground + mergedRule.background = override.background || defaultSetting.background; + mergedRule.foreground = override.foreground || defaultSetting.foreground; + mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground; return mergedRule } @@ -106,29 +106,29 @@ function mergeRuleSettings(defaultSetting: TextMateRuleSettings | undefined, ove function updateRules(scope: string, updatedSettings: TextMateRuleSettings): void { [rules.get(scope)] .map(settings => mergeRuleSettings(settings, updatedSettings)) - .forEach(settings => rules.set(scope, settings)) + .forEach(settings => rules.set(scope, settings)); } function loadColors(textMateRules: TextMateRule[]): void { textMateRules.forEach(rule => { if (typeof rule.scope === 'string') { - updateRules(rule.scope, rule.settings) + updateRules(rule.scope, rule.settings); } else if (rule.scope instanceof Array) { - rule.scope.forEach(scope => updateRules(scope, rule.settings)) + rule.scope.forEach(scope => updateRules(scope, rule.settings)); } }) } function isFile(filePath: string): boolean { - return [filePath].map(fs.statSync).every(stat => stat.isFile()) + return [filePath].map(fs.statSync).every(stat => stat.isFile()); } function readFileText(filePath: string): string { - return fs.readFileSync(filePath, 'utf8') + return fs.readFileSync(filePath, 'utf8'); } // Might need to replace with JSONC if a theme contains comments. function parseJSON(content: string): any { - return JSON.parse(content) + return JSON.parse(content); } \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 19a4213d..7056a8e2 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -1,10 +1,9 @@ -import * as vscode from 'vscode' -import { TextMateRuleSettings } from './scopes' +import * as vscode from 'vscode'; +import { TextMateRuleSettings } from './scopes'; - -let mappings = new Map() +let mappings = new Map(); const defaultMapping = new Map([ @@ -27,25 +26,39 @@ const defaultMapping = new Map([ ['field', ['variable.object.property', 'meta.field.declaration', 'meta.definition.property', 'variable.other',]], ['module', ['entity.name.section', 'entity.other']] ] -) +); // Temporary exported for debugging for now. export function find(scope: string): string[] { - return mappings.get(scope) || [] + return mappings.get(scope) || []; } export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { - return find(scope).map(intoRule).filter(rule => rule !== undefined)[0] + return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; +} + + +function isString(value: any): value is string { + return typeof value === 'string'; +} + +function isArrayOfString(value: any): value is string[] { + return Array.isArray(value) && value.every(item => isString(item)); } export function load() { - const configuration = vscode.workspace + const rawConfig: { [key: string]: any } = vscode.workspace .getConfiguration('rust-analyzer') - .get('scopeMappings') as Map | undefined - || new Map() + .get('scopeMappings') + || {}; - mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())]) + mappings = Object + .entries(rawConfig) + .filter(([_, value]) => isString(value) || isArrayOfString(value)) + .reduce((list, [key, value]: [string, string | string[]]) => { + return list.set(key, isString(value) ? [value] : value); + }, defaultMapping); } \ No newline at end of file From 49d50e617b32fdf631a400e85355085a586b2027 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 5 Nov 2019 00:11:43 +0100 Subject: [PATCH 192/819] Logging fallback tag in case scopes are missing. --- rust-analyzer/editors/code/src/highlighting.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 1c67e5dc..b184437f 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -73,11 +73,13 @@ export class Highlighter { return [tag, decor]; } else { + const fallBackTag = 'ralsp.' + tag; console.log(' '); - console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:') - console.log(scopesMapper.find(tag)) + console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); + console.log(scopesMapper.find(tag)); + console.log('Falling back to values defiend in: ' + fallBackTag); console.log(' '); - const color = new vscode.ThemeColor('ralsp.' + tag); + const color = new vscode.ThemeColor(fallBackTag); const decor = vscode.window.createTextEditorDecorationType({ color, textDecoration From e240d490b7028cde0f74dab598ad5d5694b00742 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 5 Nov 2019 00:16:31 +0100 Subject: [PATCH 193/819] Remove new line. --- rust-analyzer/editors/code/src/scopes_mapper.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 7056a8e2..dfb8bf21 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -58,7 +58,6 @@ export function load() { .filter(([_, value]) => isString(value) || isArrayOfString(value)) .reduce((list, [key, value]: [string, string | string[]]) => { return list.set(key, isString(value) ? [value] : value); - }, defaultMapping); } \ No newline at end of file From d419a00558ad8bc47291dd9e13032d9c1d340ea4 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 5 Nov 2019 00:26:49 +0100 Subject: [PATCH 194/819] Fix typo. --- rust-analyzer/editors/code/src/highlighting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index b184437f..3f509e8e 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -77,7 +77,7 @@ export class Highlighter { console.log(' '); console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); console.log(scopesMapper.find(tag)); - console.log('Falling back to values defiend in: ' + fallBackTag); + console.log('Falling back to values defined in: ' + fallBackTag); console.log(' '); const color = new vscode.ThemeColor(fallBackTag); const decor = vscode.window.createTextEditorDecorationType({ From 00ea20b96207f520f2411ed6401d7404357dc290 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 5 Nov 2019 14:22:09 +0100 Subject: [PATCH 195/819] See if this satisfies the CI. --- rust-analyzer/editors/code/src/highlighting.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 3f509e8e..ee39ca64 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -74,11 +74,11 @@ export class Highlighter { } else { const fallBackTag = 'ralsp.' + tag; - console.log(' '); - console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); - console.log(scopesMapper.find(tag)); - console.log('Falling back to values defined in: ' + fallBackTag); - console.log(' '); + // console.log(' '); + // console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); + // console.log(scopesMapper.find(tag)); + // console.log('Falling back to values defined in: ' + fallBackTag); + // console.log(' '); const color = new vscode.ThemeColor(fallBackTag); const decor = vscode.window.createTextEditorDecorationType({ color, From 951384a522b932f9740eeb85daddfc1148aa1417 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sat, 9 Nov 2019 17:23:30 +0100 Subject: [PATCH 196/819] Vscode wasn't running the linter automatically so ran `npm run fix` - wonder if it's related to `tslint` being deprecated. --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 5 +- rust-analyzer/editors/code/src/extension.ts | 10 +-- .../editors/code/src/highlighting.ts | 81 +++++++------------ rust-analyzer/editors/code/src/scopes.ts | 60 ++++++++------ .../editors/code/src/scopes_mapper.ts | 58 ++++++++----- 6 files changed, 110 insertions(+), 106 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 35f2f1e6..5c5be34d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -550,4 +550,4 @@ } ] } -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 234a390a..4cedbea4 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -46,14 +46,14 @@ export class Config { public userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); - + Server.highlighter.removeHighlights(); if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; if (this.highlightingOn) { scopes.load(); - scopesMapper.load(); + scopesMapper.load(); } } @@ -63,7 +63,6 @@ export class Config { ) as boolean; } - if (config.has('enableEnhancedTyping')) { this.enableEnhancedTyping = config.get( 'enableEnhancedTyping' diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 07a5c59e..c06928d1 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -91,11 +91,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index ee39ca64..14199dbe 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -25,35 +25,15 @@ function fancify(seed: string, shade: 'light' | 'dark') { return `hsl(${h},${s}%,${l}%)`; } - -function createDecorationFromTextmate(themeStyle: scopes.TextMateRuleSettings): vscode.TextEditorDecorationType { - const options: vscode.DecorationRenderOptions = {}; - options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; - if (themeStyle.foreground) { - options.color = themeStyle.foreground; - } - if (themeStyle.background) { - options.backgroundColor = themeStyle.background; - } - if (themeStyle.fontStyle) { - const parts: string[] = themeStyle.fontStyle.split(' '); - parts.forEach((part) => { - switch (part) { - case 'italic': - options.fontStyle = 'italic'; - break; - case 'bold': - options.fontWeight = 'bold'; - break; - case 'underline': - options.textDecoration = 'underline'; - break; - default: - break; - } - }) - } - return vscode.window.createTextEditorDecorationType(options); +function createDecorationFromTextmate( + themeStyle: scopes.TextMateRuleSettings +): vscode.TextEditorDecorationType { + const decorationOptions: vscode.DecorationRenderOptions = {}; + decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; + decorationOptions.color = themeStyle.foreground; + decorationOptions.backgroundColor = themeStyle.background; + decorationOptions.fontStyle = themeStyle.fontStyle; + return vscode.window.createTextEditorDecorationType(decorationOptions); } export class Highlighter { @@ -65,14 +45,12 @@ export class Highlighter { tag: string, textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, scopes.find); if (rule) { const decor = createDecorationFromTextmate(rule); return [tag, decor]; - } - else { + } else { const fallBackTag = 'ralsp.' + tag; // console.log(' '); // console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); @@ -91,25 +69,25 @@ export class Highlighter { const decorations: Iterable< [string, vscode.TextEditorDecorationType] > = [ - decoration('comment'), - decoration('string'), - decoration('keyword'), - decoration('keyword.control'), - decoration('keyword.unsafe'), - decoration('function'), - decoration('parameter'), - decoration('constant'), - decoration('type'), - decoration('builtin'), - decoration('text'), - decoration('attribute'), - decoration('literal'), - decoration('macro'), - decoration('variable'), - decoration('variable.mut', 'underline'), - decoration('field'), - decoration('module') - ]; + decoration('comment'), + decoration('string'), + decoration('keyword'), + decoration('keyword.control'), + decoration('keyword.unsafe'), + decoration('function'), + decoration('parameter'), + decoration('constant'), + decoration('type'), + decoration('builtin'), + decoration('text'), + decoration('attribute'), + decoration('literal'), + decoration('macro'), + decoration('variable'), + decoration('variable.mut', 'underline'), + decoration('field'), + decoration('module') + ]; return new Map(decorations); } @@ -138,7 +116,6 @@ export class Highlighter { // Note: decoration objects need to be kept around so we can dispose them // if the user disables syntax highlighting - if (this.decorations == null) { this.decorations = Highlighter.initDecorations(); } diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index a6138fad..98099872 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -2,8 +2,6 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; - - export interface TextMateRule { scope: string | string[]; settings: TextMateRuleSettings; @@ -27,7 +25,9 @@ export function load() { // Remove any previous theme rules.clear(); // Find out current color theme - const themeName = vscode.workspace.getConfiguration('workbench').get('colorTheme'); + const themeName = vscode.workspace + .getConfiguration('workbench') + .get('colorTheme'); if (typeof themeName !== 'string') { // console.warn('workbench.colorTheme is', themeName) @@ -42,38 +42,43 @@ export function load() { } function filterThemeExtensions(extension: vscode.Extension): boolean { - return extension.extensionKind === vscode.ExtensionKind.UI && + return ( + extension.extensionKind === vscode.ExtensionKind.UI && extension.packageJSON.contributes && - extension.packageJSON.contributes.themes; + extension.packageJSON.contributes.themes + ); } - - // Find current theme on disk function loadThemeNamed(themeName: string) { - const themePaths = vscode.extensions.all .filter(filterThemeExtensions) .reduce((list, extension) => { return extension.packageJSON.contributes.themes - .filter((element: any) => (element.id || element.label) === themeName) - .map((element: any) => path.join(extension.extensionPath, element.path)) - .concat(list) + .filter( + (element: any) => + (element.id || element.label) === themeName + ) + .map((element: any) => + path.join(extension.extensionPath, element.path) + ) + .concat(list); }, Array()); - themePaths.forEach(loadThemeFile); - const tokenColorCustomizations: [any] = [vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations')] + const tokenColorCustomizations: [any] = [ + vscode.workspace + .getConfiguration('editor') + .get('tokenColorCustomizations') + ]; tokenColorCustomizations .filter(custom => custom && custom.textMateRules) .map(custom => custom.textMateRules) .forEach(loadColors); - } - function loadThemeFile(themePath: string) { const themeContent = [themePath] .filter(isFile) @@ -92,18 +97,26 @@ function loadThemeFile(themePath: string) { .forEach(loadThemeFile); } -function mergeRuleSettings(defaultSetting: TextMateRuleSettings | undefined, override: TextMateRuleSettings): TextMateRuleSettings { - if (defaultSetting === undefined) { return override; } +function mergeRuleSettings( + defaultSetting: TextMateRuleSettings | undefined, + override: TextMateRuleSettings +): TextMateRuleSettings { + if (defaultSetting === undefined) { + return override; + } const mergedRule = defaultSetting; mergedRule.background = override.background || defaultSetting.background; mergedRule.foreground = override.foreground || defaultSetting.foreground; mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground; - return mergedRule + return mergedRule; } -function updateRules(scope: string, updatedSettings: TextMateRuleSettings): void { +function updateRules( + scope: string, + updatedSettings: TextMateRuleSettings +): void { [rules.get(scope)] .map(settings => mergeRuleSettings(settings, updatedSettings)) .forEach(settings => rules.set(scope, settings)); @@ -113,11 +126,10 @@ function loadColors(textMateRules: TextMateRule[]): void { textMateRules.forEach(rule => { if (typeof rule.scope === 'string') { updateRules(rule.scope, rule.settings); - } - else if (rule.scope instanceof Array) { + } else if (rule.scope instanceof Array) { rule.scope.forEach(scope => updateRules(scope, rule.settings)); } - }) + }); } function isFile(filePath: string): boolean { @@ -128,7 +140,7 @@ function readFileText(filePath: string): string { return fs.readFileSync(filePath, 'utf8'); } -// Might need to replace with JSONC if a theme contains comments. +// Might need to replace with JSONC if a theme contains comments. function parseJSON(content: string): any { return JSON.parse(content); -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index dfb8bf21..85c791ff 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -1,17 +1,25 @@ import * as vscode from 'vscode'; import { TextMateRuleSettings } from './scopes'; - - let mappings = new Map(); - const defaultMapping = new Map([ - ['comment', ['comment', 'comment.block', 'comment.line', 'comment.block.documentation']], + [ + 'comment', + [ + 'comment', + 'comment.block', + 'comment.line', + 'comment.block.documentation' + ] + ], ['string', ['string']], ['keyword', ['keyword']], ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], - ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']], + [ + 'keyword.unsafe', + ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'] + ], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], ['constant', ['constant', 'variable']], @@ -23,21 +31,32 @@ const defaultMapping = new Map([ ['macro', ['support.other']], ['variable', ['variable']], ['variable.mut', ['variable', 'storage.modifier']], - ['field', ['variable.object.property', 'meta.field.declaration', 'meta.definition.property', 'variable.other',]], + [ + 'field', + [ + 'variable.object.property', + 'meta.field.declaration', + 'meta.definition.property', + 'variable.other' + ] + ], ['module', ['entity.name.section', 'entity.other']] -] -); +]); -// Temporary exported for debugging for now. +// Temporary exported for debugging for now. export function find(scope: string): string[] { return mappings.get(scope) || []; } -export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { - return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; +export function toRule( + scope: string, + intoRule: (scope: string) => TextMateRuleSettings | undefined +): TextMateRuleSettings | undefined { + return find(scope) + .map(intoRule) + .filter(rule => rule !== undefined)[0]; } - function isString(value: any): value is string { return typeof value === 'string'; } @@ -46,18 +65,15 @@ function isArrayOfString(value: any): value is string[] { return Array.isArray(value) && value.every(item => isString(item)); } - export function load() { - const rawConfig: { [key: string]: any } = vscode.workspace - .getConfiguration('rust-analyzer') - .get('scopeMappings') - || {}; + const rawConfig: { [key: string]: any } = + vscode.workspace + .getConfiguration('rust-analyzer') + .get('scopeMappings') || {}; - mappings = Object - .entries(rawConfig) + mappings = Object.entries(rawConfig) .filter(([_, value]) => isString(value) || isArrayOfString(value)) .reduce((list, [key, value]: [string, string | string[]]) => { return list.set(key, isString(value) ? [value] : value); }, defaultMapping); - -} \ No newline at end of file +} From 2e27567b078cbfb10b589ea16c70320708c46ce7 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 10 Nov 2019 22:30:53 +0100 Subject: [PATCH 197/819] Probably a better approach to check for values before assigning lest we replace something. --- .../editors/code/src/highlighting.ts | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 14199dbe..0a38c9ef 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -30,9 +30,33 @@ function createDecorationFromTextmate( ): vscode.TextEditorDecorationType { const decorationOptions: vscode.DecorationRenderOptions = {}; decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; - decorationOptions.color = themeStyle.foreground; - decorationOptions.backgroundColor = themeStyle.background; - decorationOptions.fontStyle = themeStyle.fontStyle; + + if (themeStyle.foreground) { + decorationOptions.color = themeStyle.foreground; + } + + if (themeStyle.background) { + decorationOptions.backgroundColor = themeStyle.background; + } + + if (themeStyle.fontStyle) { + const parts: string[] = themeStyle.fontStyle.split(' '); + parts.forEach(part => { + switch (part) { + case 'italic': + decorationOptions.fontStyle = 'italic'; + break; + case 'bold': + decorationOptions.fontWeight = 'bold'; + break; + case 'underline': + decorationOptions.textDecoration = 'underline'; + break; + default: + break; + } + }); + } return vscode.window.createTextEditorDecorationType(decorationOptions); } From 9c8a92d8c1ab06415300731af256563c51238672 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 16 Nov 2019 02:49:44 +0800 Subject: [PATCH 198/819] Handle errors when `cargo watch` fails --- rust-analyzer/editors/code/src/commands/runnables.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 26372c1e..39e542fb 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -201,6 +201,11 @@ export async function startCargoWatch( ); return; } + } else if (stderr !== '') { + vscode.window.showErrorMessage( + `Couldn't run \`cargo watch\`: ${stderr}` + ); + return; } const provider = await registerCargoWatchProvider(context.subscriptions); From ce0e79c28822015dfdb0229da46d9d21a03f2cd5 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 16 Nov 2019 03:44:38 +0800 Subject: [PATCH 199/819] Check exit code of `cargo watch` --- rust-analyzer/editors/code/src/commands/runnables.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 39e542fb..93171bc7 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -161,7 +161,7 @@ export async function startCargoWatch( ): Promise { const execPromise = util.promisify(child_process.exec); - const { stderr } = await execPromise('cargo watch --version').catch(e => e); + const { stderr, code = 0 } = await execPromise('cargo watch --version').catch(e => e); if (stderr.includes('no such subcommand: `watch`')) { const msg = @@ -201,9 +201,9 @@ export async function startCargoWatch( ); return; } - } else if (stderr !== '') { + } else if (code !== 0) { vscode.window.showErrorMessage( - `Couldn't run \`cargo watch\`: ${stderr}` + `\`cargo watch\` failed with ${code}: ${stderr}` ); return; } From 1fd0d805cb3488d2ffc722e2cf4abb8d7763b775 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 16 Nov 2019 18:52:47 +0800 Subject: [PATCH 200/819] Fix format --- rust-analyzer/editors/code/src/commands/runnables.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 93171bc7..ac59bf60 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -161,7 +161,9 @@ export async function startCargoWatch( ): Promise { const execPromise = util.promisify(child_process.exec); - const { stderr, code = 0 } = await execPromise('cargo watch --version').catch(e => e); + const { stderr, code = 0 } = await execPromise( + 'cargo watch --version' + ).catch(e => e); if (stderr.includes('no such subcommand: `watch`')) { const msg = From 25f453660897e815a4617bae00bfef47dc0130da Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Mon, 18 Nov 2019 02:37:18 +0100 Subject: [PATCH 201/819] Readding jsonc parser because of https://github.com/rust-analyzer/rust-analyzer/pull/2061\#discussion_r344783715 --- rust-analyzer/editors/code/package-lock.json | 5 +++++ rust-analyzer/editors/code/package.json | 3 ++- rust-analyzer/editors/code/src/scopes.ts | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 9c55c257..a41497a2 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -720,6 +720,11 @@ "esprima": "^4.0.0" } }, + "jsonc-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", + "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" + }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5c5be34d..fbf675d4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -32,7 +32,8 @@ }, "dependencies": { "seedrandom": "^3.0.1", - "vscode-languageclient": "^5.3.0-next.4" + "vscode-languageclient": "^5.3.0-next.4", + "jsonc-parser": "^2.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 98099872..8f288d76 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -1,4 +1,5 @@ import * as fs from 'fs'; +import * as jsonc from 'jsonc-parser'; import * as path from 'path'; import * as vscode from 'vscode'; @@ -140,7 +141,6 @@ function readFileText(filePath: string): string { return fs.readFileSync(filePath, 'utf8'); } -// Might need to replace with JSONC if a theme contains comments. function parseJSON(content: string): any { - return JSON.parse(content); + return jsonc.parse(content); } From a0e594204f9d3f311bd3de76590673048b36b1f8 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 18 Nov 2019 02:47:50 +0800 Subject: [PATCH 202/819] Add recursive expand in vscode --- .../editors/code/src/commands/expand_macro.ts | 45 +++++++++++++++++++ .../editors/code/src/commands/index.ts | 2 + rust-analyzer/editors/code/src/extension.ts | 20 ++++++--- 3 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 rust-analyzer/editors/code/src/commands/expand_macro.ts diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts new file mode 100644 index 00000000..bf192319 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -0,0 +1,45 @@ +import * as vscode from 'vscode'; +import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; +import { Server } from '../server'; + +type ExpandMacroResult = [string, string] + +function code_format([name, text]: [string, string]): vscode.MarkdownString { + const markdown = new vscode.MarkdownString(`#### Recursive expansion of ${name}! macro`); + markdown.appendCodeblock(text, 'rust'); + return markdown; +} + +export class ExpandMacroHoverProvider implements vscode.HoverProvider { + public provideHover( + document: vscode.TextDocument, + position: vscode.Position, + token: vscode.CancellationToken, + ): Thenable | null { + async function handle() { + const request: MacroExpandParams = { + textDocument: { uri: document.uri.toString() }, + position, + }; + const result = await Server.client.sendRequest( + 'rust-analyzer/expandMacro', + request + ); + if (result != null) { + const formated = code_format(result); + return new vscode.Hover(formated); + } + + return null; + }; + + return handle(); + } +} + + +interface MacroExpandParams { + textDocument: TextDocumentIdentifier; + position: Position; +} + diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index c194bd2e..2ade6d33 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,5 +1,6 @@ import * as analyzerStatus from './analyzer_status'; import * as applySourceChange from './apply_source_change'; +import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; import * as joinLines from './join_lines'; import * as matchingBrace from './matching_brace'; @@ -11,6 +12,7 @@ import * as syntaxTree from './syntaxTree'; export { analyzerStatus, applySourceChange, + expandMacro, joinLines, matchingBrace, parentModule, diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index c06928d1..1dfa6046 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { CargoWatchProvider } from './commands/cargo_watch'; +import { ExpandMacroHoverProvider } from './commands/expand_macro' import { HintsUpdater } from './commands/inlay_hints'; import { interactivelyStartCargoWatch, @@ -91,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode @@ -121,6 +122,15 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); + const expandMacroContentProvider = new ExpandMacroHoverProvider(); + + disposeOnDeactivation( + vscode.languages.registerHoverProvider( + 'rust', + expandMacroContentProvider + ) + ); + const startServer = () => Server.start(allNotifications); const reloadCommand = () => reloadServer(startServer); From 73ecc8bd780618f2b16a85b54c88812e954a51aa Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 18 Nov 2019 03:39:11 +0800 Subject: [PATCH 203/819] Fix npm formatting --- .../editors/code/src/commands/expand_macro.ts | 16 ++++++++-------- rust-analyzer/editors/code/src/extension.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index bf192319..d024a70e 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -2,11 +2,13 @@ import * as vscode from 'vscode'; import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -type ExpandMacroResult = [string, string] +type ExpandMacroResult = [string, string]; function code_format([name, text]: [string, string]): vscode.MarkdownString { - const markdown = new vscode.MarkdownString(`#### Recursive expansion of ${name}! macro`); - markdown.appendCodeblock(text, 'rust'); + const markdown = new vscode.MarkdownString( + `#### Recursive expansion of ${name}! macro` + ); + markdown.appendCodeblock(text, 'rust'); return markdown; } @@ -14,12 +16,12 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider { public provideHover( document: vscode.TextDocument, position: vscode.Position, - token: vscode.CancellationToken, + token: vscode.CancellationToken ): Thenable | null { async function handle() { const request: MacroExpandParams = { textDocument: { uri: document.uri.toString() }, - position, + position }; const result = await Server.client.sendRequest( 'rust-analyzer/expandMacro', @@ -31,15 +33,13 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider { } return null; - }; + } return handle(); } } - interface MacroExpandParams { textDocument: TextDocumentIdentifier; position: Position; } - diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 1dfa6046..8654b603 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { CargoWatchProvider } from './commands/cargo_watch'; -import { ExpandMacroHoverProvider } from './commands/expand_macro' +import { ExpandMacroHoverProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; import { interactivelyStartCargoWatch, @@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) { const allNotifications: Iterable< [string, lc.GenericNotificationHandler] > = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode From e8ad1f0060a6107b3628799c4ad0d57bc2b1a52d Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 19 Nov 2019 22:56:48 +0800 Subject: [PATCH 204/819] Change return type of expand_macro --- .../editors/code/src/commands/expand_macro.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index d024a70e..3fc3e039 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -2,13 +2,16 @@ import * as vscode from 'vscode'; import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -type ExpandMacroResult = [string, string]; +interface ExpandedMacro { + name: string, + expansion: string, +} -function code_format([name, text]: [string, string]): vscode.MarkdownString { +function code_format(expanded: ExpandedMacro): vscode.MarkdownString { const markdown = new vscode.MarkdownString( - `#### Recursive expansion of ${name}! macro` + `#### Recursive expansion of ${expanded.name}! macro` ); - markdown.appendCodeblock(text, 'rust'); + markdown.appendCodeblock(expanded.expansion, 'rust'); return markdown; } @@ -23,7 +26,7 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider { textDocument: { uri: document.uri.toString() }, position }; - const result = await Server.client.sendRequest( + const result = await Server.client.sendRequest( 'rust-analyzer/expandMacro', request ); From 4e35112b0616be2f69ea08397ea7f8e4273f9faf Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 18 Nov 2019 18:02:28 +0100 Subject: [PATCH 205/819] Move type inlay hint truncation to language server This commit implements a general truncation framework for HirFormatter that keeps track of how much has been output so far. This information can then be used to perform truncation inside the language server, instead of relying on the client. Initial support is implemented for truncating types hints using the maxInlayHintLength server config option. The existing solution in the VSCode extension has been removed in favor of letting the server truncate type hints. --- .../editors/code/src/commands/inlay_hints.ts | 14 +------------- rust-analyzer/editors/code/src/server.ts | 1 + 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index ffaaaebc..0dbdd94f 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -87,7 +87,7 @@ export class HintsUpdater { range: hint.range, renderOptions: { after: { - contentText: `: ${this.truncateHint(hint.label)}` + contentText: `: ${hint.label}` } } })); @@ -98,18 +98,6 @@ export class HintsUpdater { } } - private truncateHint(label: string): string { - if (!Server.config.maxInlayHintLength) { - return label; - } - - let newLabel = label.substring(0, Server.config.maxInlayHintLength); - if (label.length > Server.config.maxInlayHintLength) { - newLabel += '…'; - } - return newLabel; - } - private async queryHints(documentUri: string): Promise { const request: InlayHintsParams = { textDocument: { uri: documentUri } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index a3ef21a1..7907b70b 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -43,6 +43,7 @@ export class Server { initializationOptions: { publishDecorations: true, lruCapacity: Server.config.lruCapacity, + maxInlayHintLength: Server.config.maxInlayHintLength, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags From f566d208ffe58baf3721974562f49c5a9123fade Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 20 Nov 2019 01:06:10 +0800 Subject: [PATCH 206/819] Use DocumentProvider instead of Hover --- rust-analyzer/editors/code/package.json | 5 ++ .../editors/code/src/commands/expand_macro.ts | 81 +++++++++++++------ rust-analyzer/editors/code/src/extension.ts | 22 ++--- 3 files changed, 75 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ee997e58..94887674 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -90,6 +90,11 @@ "title": "Show Syntax Tree", "category": "Rust Analyzer" }, + { + "command": "rust-analyzer.expandMacro", + "title": "Expand macro recursively", + "category": "Rust Analyzer" + }, { "command": "rust-analyzer.matchingBrace", "title": "Find matching brace", diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 3fc3e039..1fa2cf73 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -2,47 +2,82 @@ import * as vscode from 'vscode'; import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -interface ExpandedMacro { - name: string, - expansion: string, -} +export const expandMacroUri = vscode.Uri.parse( + 'rust-analyzer://expandMacro/[EXPANSION].rs' +); -function code_format(expanded: ExpandedMacro): vscode.MarkdownString { - const markdown = new vscode.MarkdownString( - `#### Recursive expansion of ${expanded.name}! macro` - ); - markdown.appendCodeblock(expanded.expansion, 'rust'); - return markdown; -} +export class ExpandMacroContentProvider + implements vscode.TextDocumentContentProvider { + public eventEmitter = new vscode.EventEmitter(); -export class ExpandMacroHoverProvider implements vscode.HoverProvider { - public provideHover( - document: vscode.TextDocument, - position: vscode.Position, - token: vscode.CancellationToken - ): Thenable | null { + public provideTextDocumentContent( + uri: vscode.Uri + ): vscode.ProviderResult { async function handle() { + const editor = vscode.window.activeTextEditor; + if (editor == null) { + return ''; + } + + const position = editor.selection.active; const request: MacroExpandParams = { - textDocument: { uri: document.uri.toString() }, + textDocument: { uri: editor.document.uri.toString() }, position }; - const result = await Server.client.sendRequest( + const expanded = await Server.client.sendRequest( 'rust-analyzer/expandMacro', request ); - if (result != null) { - const formated = code_format(result); - return new vscode.Hover(formated); + + if (expanded == null) { + return 'Not available'; } - return null; + return code_format(expanded); } return handle(); } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } +} + +// Opens the virtual file that will show the syntax tree +// +// The contents of the file come from the `TextDocumentContentProvider` +export function createHandle(provider: ExpandMacroContentProvider) { + return async () => { + const uri = expandMacroUri; + + const document = await vscode.workspace.openTextDocument(uri); + + provider.eventEmitter.fire(uri); + + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true + ); + }; } interface MacroExpandParams { textDocument: TextDocumentIdentifier; position: Position; } + +interface ExpandedMacro { + name: string; + expansion: string; +} + +function code_format(expanded: ExpandedMacro): string { + let result = `// Recursive expansion of ${expanded.name}! macro\n`; + result += '='.repeat(result.length); + result += '\n\n'; + result += expanded.expansion; + + return result; +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 8654b603..683497df 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { CargoWatchProvider } from './commands/cargo_watch'; -import { ExpandMacroHoverProvider } from './commands/expand_macro'; +import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; import { interactivelyStartCargoWatch, @@ -98,6 +98,7 @@ export function activate(context: vscode.ExtensionContext) { ] ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); + const expandMacroContentProvider = new ExpandMacroContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( @@ -110,11 +111,21 @@ export function activate(context: vscode.ExtensionContext) { syntaxTreeContentProvider ) ); + disposeOnDeactivation( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer', + expandMacroContentProvider + ) + ); registerCommand( 'rust-analyzer.syntaxTree', commands.syntaxTree.createHandle(syntaxTreeContentProvider) ); + registerCommand( + 'rust-analyzer.expandMacro', + commands.expandMacro.createHandle(expandMacroContentProvider) + ); vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(syntaxTreeContentProvider), @@ -122,15 +133,6 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); - const expandMacroContentProvider = new ExpandMacroHoverProvider(); - - disposeOnDeactivation( - vscode.languages.registerHoverProvider( - 'rust', - expandMacroContentProvider - ) - ); - const startServer = () => Server.start(allNotifications); const reloadCommand = () => reloadServer(startServer); From 8c163dfeef027de4d36f99ebbb8d11608fb6b550 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 20 Nov 2019 01:22:28 +0800 Subject: [PATCH 207/819] Minor fix for outpu text formating --- rust-analyzer/editors/code/src/commands/expand_macro.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 1fa2cf73..34e0c8fb 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -75,7 +75,7 @@ interface ExpandedMacro { function code_format(expanded: ExpandedMacro): string { let result = `// Recursive expansion of ${expanded.name}! macro\n`; - result += '='.repeat(result.length); + result += '// ' + '='.repeat(result.length - 3); result += '\n\n'; result += expanded.expansion; From 9858a22aa02e110ffda6cd2582e9796dbf9f6f22 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 27 Nov 2019 21:32:33 +0300 Subject: [PATCH 208/819] rename ra_ide_api -> ra_ide --- rust-analyzer/editors/code/src/utils/terminateProcess.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 rust-analyzer/editors/code/src/utils/terminateProcess.sh diff --git a/rust-analyzer/editors/code/src/utils/terminateProcess.sh b/rust-analyzer/editors/code/src/utils/terminateProcess.sh old mode 100755 new mode 100644 From b505a3826005b89ced3455b0351846cefa9276f1 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 6 Dec 2019 11:41:51 +0800 Subject: [PATCH 209/819] Fix npm vulnerability warning --- rust-analyzer/editors/code/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e6bcbfa6..2ceac60a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -598,9 +598,9 @@ } }, "https-proxy-agent": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", - "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { "agent-base": "^4.3.0", From 29bba80cd51239eec1647fc25dc6552b5e791020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 8 Dec 2019 14:41:44 +0200 Subject: [PATCH 210/819] Code: check whether the LSP binary is in PATH --- rust-analyzer/editors/code/package-lock.json | 5 +++++ rust-analyzer/editors/code/package.json | 1 + rust-analyzer/editors/code/src/extension.ts | 12 ++++++++---- rust-analyzer/editors/code/src/server.ts | 11 +++++++++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 2ceac60a..099aaaaa 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -763,6 +763,11 @@ "chalk": "^2.0.1" } }, + "lookpath": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.0.3.tgz", + "integrity": "sha512-XIdgzlX26g10XnzyZdO/4obybEmfGnZyWQZ2DgmmEfVB79X+n3lhUoIzMe501C6s7RmCpAo66OPegWc+CsxYMg==" + }, "magic-string": { "version": "0.25.3", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 94887674..5dea8fac 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -31,6 +31,7 @@ "singleQuote": true }, "dependencies": { + "lookpath": "^1.0.3", "seedrandom": "^3.0.1", "vscode-languageclient": "^5.3.0-next.4" }, diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 683497df..6637c3bf 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -14,7 +14,7 @@ import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; -export function activate(context: vscode.ExtensionContext) { +export async function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); } @@ -159,7 +159,11 @@ export function activate(context: vscode.ExtensionContext) { }); // Start the language server, finally! - startServer(); + try { + await startServer(); + } catch (e) { + vscode.window.showErrorMessage(e.message); + } if (Server.config.displayInlayHints) { const hintsUpdater = new HintsUpdater(); @@ -204,10 +208,10 @@ export function deactivate(): Thenable { return Server.client.stop(); } -async function reloadServer(startServer: () => void) { +async function reloadServer(startServer: () => Promise) { if (Server.client != null) { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await Server.client.stop(); - startServer(); + await startServer(); } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 7907b70b..e717ab29 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,3 +1,4 @@ +import { lookpath } from 'lookpath'; import { homedir } from 'os'; import * as lc from 'vscode-languageclient'; @@ -17,7 +18,7 @@ export class Server { public static config = new Config(); public static client: lc.LanguageClient; - public static start( + public static async start( notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> ) { // '.' Is the fallback if no folder is open @@ -27,8 +28,14 @@ export class Server { folder = workspace.workspaceFolders[0].uri.fsPath.toString(); } + const command = expandPathResolving(this.config.raLspServerPath); + if (!(await lookpath(command))) { + throw new Error( + `Cannot find rust-analyzer server \`${command}\` in PATH.` + ); + } const run: lc.Executable = { - command: expandPathResolving(this.config.raLspServerPath), + command, options: { cwd: folder } }; const serverOptions: lc.ServerOptions = { From 9a4fb20d1989ad09ca23a8fc44b04de8e245f0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 8 Dec 2019 20:27:50 +0200 Subject: [PATCH 211/819] Code: bump deps --- rust-analyzer/editors/code/package-lock.json | 631 +++++++----------- rust-analyzer/editors/code/package.json | 26 +- rust-analyzer/editors/code/src/extension.ts | 7 +- .../editors/code/src/highlighting.ts | 7 +- 4 files changed, 253 insertions(+), 418 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 099aaaaa..4e8ed704 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -60,9 +60,9 @@ "dev": true }, "@types/node": { - "version": "10.14.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz", - "integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==", + "version": "10.17.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.6.tgz", + "integrity": "sha512-0a2X6cgN3RdPBL2MIlR6Lt0KlM7fOFsutuXcdglcOq6WvLnYXgPQSh0Mx6tO1KCAE8MxbHSOSTWDoUxRq+l3DA==", "dev": true }, "@types/resolve": { @@ -81,9 +81,9 @@ "dev": true }, "@types/vscode": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.37.0.tgz", - "integrity": "sha512-PRfeuqYuzk3vjf+puzxltIUWC+AhEGYpFX29/37w30DQSQnpf5AgMVf7GDBAdmTbWTBou+EMFz/Ne6XCM/KxzQ==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.40.0.tgz", + "integrity": "sha512-5kEIxL3qVRkwhlMerxO7XuMffa+0LBl+iG2TcRa0NsdoeSFLkt/9hJ02jsi/Kvc6y8OVF2N2P2IHP5S4lWf/5w==", "dev": true }, "acorn": { @@ -198,6 +198,17 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "cheerio": { @@ -215,22 +226,44 @@ } }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -247,9 +280,9 @@ "dev": true }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "concat-map": { @@ -258,19 +291,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -290,12 +310,12 @@ "dev": true }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "decamelize": { @@ -372,15 +392,6 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -388,23 +399,27 @@ "dev": true }, "es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.3.tgz", + "integrity": "sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", + "has-symbols": "^1.0.1", "is-callable": "^1.1.4", "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "string.prototype.trimleft": "^2.1.0", + "string.prototype.trimright": "^2.1.0" } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -452,26 +467,11 @@ "dev": true }, "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -517,19 +517,10 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -562,9 +553,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, "he": { @@ -595,6 +586,23 @@ "requires": { "agent-base": "4", "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } } }, "https-proxy-agent": { @@ -618,9 +626,9 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "interpret": { @@ -629,16 +637,10 @@ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", "dev": true }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", "dev": true }, "is-callable": { @@ -683,19 +685,13 @@ "has": "^1.0.1" } }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" } }, "isexe": { @@ -720,15 +716,6 @@ "esprima": "^4.0.0" } }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -777,15 +764,6 @@ "sourcemap-codec": "^1.4.4" } }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, "markdown-it": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", @@ -805,29 +783,12 @@ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - } - }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -853,9 +814,9 @@ } }, "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", + "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -878,20 +839,11 @@ "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" + "yargs": "13.3.0", + "yargs-parser": "13.1.1", + "yargs-unparser": "1.6.0" }, "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -905,28 +857,13 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, "mute-stream": { @@ -935,12 +872,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, "node-environment-flags": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", @@ -951,15 +882,6 @@ "semver": "^5.7.0" } }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -969,10 +891,10 @@ "boolbase": "~1.0.0" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", "dev": true }, "object-keys": { @@ -1024,17 +946,6 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -1051,24 +962,6 @@ "os-tmpdir": "^1.0.0" } }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, "p-limit": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", @@ -1123,12 +1016,6 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -1142,21 +1029,11 @@ "dev": true }, "prettier": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", - "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", "dev": true }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -1217,9 +1094,9 @@ } }, "rollup": { - "version": "1.23.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.23.1.tgz", - "integrity": "sha512-95C1GZQpr/NIA0kMUQmSjuMDQ45oZfPgDBcN0yZwBG7Kee//m7H68vgIyg+SPuyrTZ5PrXfyLK80OzXeKG5dAA==", + "version": "1.27.9", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.9.tgz", + "integrity": "sha512-8AfW4cJTPZfG6EXWwT/ujL4owUsDI1Xl8J1t+hvK4wDX81F5I4IbwP9gvGbHzxnV19fnU4rRABZQwZSX9J402Q==", "dev": true, "requires": { "@types/estree": "*", @@ -1318,14 +1195,15 @@ "dev": true }, "seedrandom": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.1.tgz", - "integrity": "sha512-1/02Y/rUeU1CJBAGLebiC5Lbo5FnB22gQbIFFYTLkwvp1xdABZJH1sn4ZT1MzXmPpzv+Rf/Lu2NcsLJiK4rcDg==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true }, "set-blocking": { "version": "2.0.0", @@ -1333,21 +1211,6 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, "shelljs": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", @@ -1378,12 +1241,6 @@ } } }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, "sourcemap-codec": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", @@ -1406,6 +1263,26 @@ "strip-ansi": "^4.0.0" } }, + "string.prototype.trimleft": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", + "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", + "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1424,12 +1301,6 @@ "ansi-regex": "^3.0.0" } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -1437,9 +1308,9 @@ "dev": true }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -1461,16 +1332,16 @@ "dev": true }, "tslint": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz", - "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==", + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", "chalk": "^2.3.0", "commander": "^2.12.1", - "diff": "^3.2.0", + "diff": "^4.0.1", "glob": "^7.1.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", @@ -1479,6 +1350,14 @@ "semver": "^5.3.0", "tslib": "^1.8.0", "tsutils": "^2.29.0" + }, + "dependencies": { + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", + "dev": true + } } }, "tslint-config-prettier": { @@ -1513,9 +1392,9 @@ } }, "typescript": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", - "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", + "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", "dev": true }, "uc.micro": { @@ -1543,9 +1422,9 @@ "dev": true }, "vsce": { - "version": "1.67.1", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.67.1.tgz", - "integrity": "sha512-Y/0fnfaLs2cCfytTGmy4Cp1bf9BaxHO7020YePdUwxjAlPlZ9+lm74M9yEFEWXTIug0L0sMax1WMz0TnozIqxg==", + "version": "1.70.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.70.0.tgz", + "integrity": "sha512-mBTbVrWL348jODwfmaR+yXrlzb8EABGCT067C4shKOXriWiuMQi4/uCbFm6TUBcfnzTYLJv+DKa0VnKU8yEAjA==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", @@ -1571,41 +1450,48 @@ } }, "vscode-jsonrpc": { - "version": "4.1.0-next.3", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.1.0-next.3.tgz", - "integrity": "sha512-Z6oxBiMks2+UADV1QHXVooSakjyhI+eHTnXzDyVvVMmegvSfkXk2w6mPEdSkaNHFBdtWW7n20H1yw2nA3A17mg==" + "version": "5.0.0-next.5", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.5.tgz", + "integrity": "sha512-k9akfglxWgr0dtLNscq2uBq48XJwnhf4EaDxn05KQowRwR0DkNML0zeYqFRLtXZe6x5vpL5ppyu4o6GqL+23YQ==" }, "vscode-languageclient": { - "version": "5.3.0-next.4", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.3.0-next.4.tgz", - "integrity": "sha512-RODuzXErVpJRSgHv+Xei8fwQtZ/iZOWPCqlLl07NTtkzgTAepJf9r4EioZVuTviGJ5DEJ9xs0bjrit8shKtW6Q==", + "version": "6.0.0-next.8", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.8.tgz", + "integrity": "sha512-452jskmuT7YKYnPd5uh7aELK4M25OITcnBq4ylPIyUtE5LQRgA9N9pR9NrviTTX/Hh6q6VGzm70OK9SpMO/zcA==", "requires": { - "semver": "^5.5.0", - "vscode-languageserver-protocol": "3.15.0-next.4" + "semver": "^6.3.0", + "vscode-languageserver-protocol": "^3.15.0-next.13" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.4", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.4.tgz", - "integrity": "sha512-4AgisQ8GWa3irdRu3/UNr3brcSSm0oobmoV1eSOnV7JM32lYyXDnSKB7RuTTXvaAjD/0xQJLEGhkyGHS5gbywA==", + "version": "3.15.0-next.13", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.13.tgz", + "integrity": "sha512-2UGxOKc5VHav15n3zY5dtaOXGL/JuV0K2Mem/n6lhF8i3vaqIAnKv004SPU0flYHXIfCcQM7kCL+nwWVJ1K1qw==", "requires": { - "vscode-jsonrpc": "^4.1.0-next.1", - "vscode-languageserver-types": "3.15.0-next.1" + "vscode-jsonrpc": "^5.0.0-next.5", + "vscode-languageserver-types": "^3.15.0-next.9" } }, "vscode-languageserver-types": { - "version": "3.15.0-next.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.1.tgz", - "integrity": "sha512-R0kzmaI8gOGEoU7b9huYQAzgZzRQ/5Q8HKjsIUdfz0MjXcBZ4tr1ik1So1p1O5kGrI1VTCd22Fw/wI7ECGoIPw==" + "version": "3.15.0-next.9", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz", + "integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==" }, "vscode-test": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.2.0.tgz", - "integrity": "sha512-aowqgc8gZe0eflzVUXsBjBrlsJ8eC35kfgfSEeHu9PKA1vQKm/3rVK43TlbxGue8hKtZBElNAJ5QuYklR/vLJA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.2.3.tgz", + "integrity": "sha512-mKRTNso33NaUULiPBFg6zRjyntjcCpIgkrogyPQuKlvoQREQR8jLKN5UD4L5rkTSD+oBhcKtaLR2/g34FexURw==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1", + "https-proxy-agent": "^2.2.4", "rimraf": "^2.6.3" } }, @@ -1634,48 +1520,40 @@ } }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" }, "dependencies": { "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^4.1.0" } } } @@ -1693,22 +1571,21 @@ "dev": true }, "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", "dev": true, "requires": { - "cliui": "^4.0.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.1" }, "dependencies": { "ansi-regex": { @@ -1740,9 +1617,9 @@ } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -1750,58 +1627,14 @@ } }, "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" - }, - "dependencies": { - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "lodash": "^4.17.15", + "yargs": "^13.3.0" } }, "yauzl": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5dea8fac..84a45945 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.37.0" + "vscode": "^1.40.0" }, "scripts": { "vscode:prepublish": "npm run compile", @@ -32,28 +32,28 @@ }, "dependencies": { "lookpath": "^1.0.3", - "seedrandom": "^3.0.1", - "vscode-languageclient": "^5.3.0-next.4" + "seedrandom": "^3.0.5", + "vscode-languageclient": "^6.0.0-next.8" }, "devDependencies": { "@types/glob": "^7.1.1", "@types/mocha": "^5.2.7", - "@types/node": "^10.14.13", + "@types/node": "^10.17.6", "@types/seedrandom": "^2.4.28", - "@types/vscode": "^1.37.0", - "glob": "^7.1.4", - "mocha": "^6.2.0", - "prettier": "^1.18.2", - "rollup": "^1.23.1", + "@types/vscode": "^1.40.0", + "glob": "^7.1.6", + "mocha": "^6.2.2", + "prettier": "^1.19.1", + "rollup": "^1.27.9", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-typescript": "^1.0.1", "shx": "^0.3.1", - "tslint": "^5.18.0", + "tslint": "^5.20.1", "tslint-config-prettier": "^1.18.0", - "typescript": "^3.5.3", - "vsce": "^1.67.0", - "vscode-test": "^1.2.0" + "typescript": "^3.7.3", + "vsce": "^1.70.0", + "vscode-test": "^1.2.3" }, "activationEvents": [ "onLanguage:rust", diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 6637c3bf..a78aa3b4 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -89,9 +89,10 @@ export async function activate(context: vscode.ExtensionContext) { } // Notifications are events triggered by the language server - const allNotifications: Iterable< - [string, lc.GenericNotificationHandler] - > = [ + const allNotifications: Iterable<[ + string, + lc.GenericNotificationHandler + ]> = [ [ 'rust-analyzer/publishDecorations', notifications.publishDecorations.handle diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d21d8a06..48f2a254 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -40,9 +40,10 @@ export class Highlighter { return [tag, decor]; }; - const decorations: Iterable< - [string, vscode.TextEditorDecorationType] - > = [ + const decorations: Iterable<[ + string, + vscode.TextEditorDecorationType + ]> = [ decoration('comment'), decoration('string'), decoration('keyword'), From 854568323fa3130c7de88ab23d32e96c13b9d2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 8 Dec 2019 21:08:46 +0200 Subject: [PATCH 212/819] Code: don't check for ra_lsp_server on Windows --- rust-analyzer/editors/code/src/server.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index e717ab29..b346c082 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,5 +1,5 @@ import { lookpath } from 'lookpath'; -import { homedir } from 'os'; +import { homedir, platform } from 'os'; import * as lc from 'vscode-languageclient'; import { window, workspace } from 'vscode'; @@ -29,10 +29,14 @@ export class Server { } const command = expandPathResolving(this.config.raLspServerPath); - if (!(await lookpath(command))) { - throw new Error( - `Cannot find rust-analyzer server \`${command}\` in PATH.` - ); + // FIXME: remove check when the following issue is fixed: + // https://github.com/otiai10/lookpath/issues/4 + if (platform() !== 'win32') { + if (!(await lookpath(command))) { + throw new Error( + `Cannot find rust-analyzer server \`${command}\` in PATH.` + ); + } } const run: lc.Executable = { command, From 692c622fc5b6394b80e4afa8d9403ac61a0aa7b3 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 9 Dec 2019 03:58:43 +0800 Subject: [PATCH 213/819] Add rollup sourcemap and fix launch.json --- rust-analyzer/editors/code/package-lock.json | 53 ++++++++++++++++++++ rust-analyzer/editors/code/package.json | 1 + rust-analyzer/editors/code/rollup.config.js | 3 ++ 3 files changed, 57 insertions(+) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 4e8ed704..b1baa437 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -131,6 +131,12 @@ "sprintf-js": "~1.0.2" } }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -324,6 +330,12 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1084,6 +1096,12 @@ "path-parse": "^1.0.6" } }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -1158,6 +1176,16 @@ } } }, + "rollup-plugin-sourcemaps": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz", + "integrity": "sha1-YhJaqUCHqt97g+9N+vYptHMTXoc=", + "dev": true, + "requires": { + "rollup-pluginutils": "^2.0.1", + "source-map-resolve": "^0.5.0" + } + }, "rollup-plugin-typescript": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", @@ -1241,6 +1269,25 @@ } } }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, "sourcemap-codec": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", @@ -1409,6 +1456,12 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 84a45945..ae2049c5 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -48,6 +48,7 @@ "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-typescript": "^1.0.1", + "rollup-plugin-sourcemaps": "^0.4.2", "shx": "^0.3.1", "tslint": "^5.20.1", "tslint-config-prettier": "^1.18.0", diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index a023b8c3..1b222bbe 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -1,12 +1,14 @@ import typescript from 'rollup-plugin-typescript'; import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; +import sourcemaps from 'rollup-plugin-sourcemaps' import nodeBuiltins from 'builtin-modules'; export default { input: './src/extension.ts', plugins: [ typescript(), + sourcemaps(), resolve(), commonjs({ namedExports: { @@ -22,6 +24,7 @@ export default { ], output: { file: './bundle/extension.js', + sourcemap: true, format: 'cjs', } }; From 7075a612893a535d0c30d9a5474903f803165827 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 9 Dec 2019 18:05:49 +0100 Subject: [PATCH 214/819] Allow disabling sysroot Might be helpful for debugging --- rust-analyzer/editors/code/src/config.ts | 5 +++++ rust-analyzer/editors/code/src/server.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 95c3f42e..fb9e55dd 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -26,6 +26,8 @@ export class Config { public excludeGlobs = []; public useClientWatching = false; public featureFlags = {}; + // for internal use + public withSysroot: null | boolean = null; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -148,5 +150,8 @@ export class Config { if (config.has('featureFlags')) { this.featureFlags = config.get('featureFlags') || {}; } + if (config.has('withSysroot')) { + this.withSysroot = config.get('withSysroot') || false; + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index b346c082..e767b6f1 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -57,7 +57,8 @@ export class Server { maxInlayHintLength: Server.config.maxInlayHintLength, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, - featureFlags: Server.config.featureFlags + featureFlags: Server.config.featureFlags, + withSysroot: Server.config.withSysroot }, traceOutputChannel }; From 22440b90dcff838907c5bf27646630445becb091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 9 Dec 2019 20:57:55 +0200 Subject: [PATCH 215/819] Code: enable prettier trailing commas --- rust-analyzer/editors/code/package.json | 3 +- .../code/src/commands/analyzer_status.ts | 14 ++--- .../code/src/commands/apply_source_change.ts | 8 +-- .../editors/code/src/commands/cargo_watch.ts | 34 +++++------ .../editors/code/src/commands/expand_macro.ts | 10 ++-- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/inlay_hints.ts | 34 +++++------ .../editors/code/src/commands/join_lines.ts | 6 +- .../code/src/commands/matching_brace.ts | 6 +- .../editors/code/src/commands/on_enter.ts | 8 +-- .../code/src/commands/parent_module.ts | 6 +- .../editors/code/src/commands/runnables.ts | 36 ++++++------ .../editors/code/src/commands/syntaxTree.ts | 10 ++-- .../editors/code/src/commands/watch_status.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 22 ++++---- .../src/events/change_active_text_editor.ts | 6 +- .../code/src/events/change_text_document.ts | 2 +- rust-analyzer/editors/code/src/extension.ts | 56 +++++++++---------- .../editors/code/src/highlighting.ts | 16 +++--- .../src/notifications/publish_decorations.ts | 2 +- rust-analyzer/editors/code/src/server.ts | 22 ++++---- .../utils/diagnotics/SuggestedFix.test.ts | 26 ++++----- .../diagnotics/SuggestedFixCollection.test.ts | 20 +++---- .../src/test/utils/diagnotics/rust.test.ts | 52 ++++++++--------- .../src/test/utils/diagnotics/vscode.test.ts | 24 ++++---- .../editors/code/src/test/utils/index.ts | 2 +- .../src/utils/diagnostics/SuggestedFix.ts | 4 +- .../diagnostics/SuggestedFixCollection.ts | 6 +- .../code/src/utils/diagnostics/rust.ts | 20 +++---- .../code/src/utils/diagnostics/vscode.ts | 2 +- .../editors/code/src/utils/processes.ts | 4 +- 31 files changed, 233 insertions(+), 232 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ae2049c5..7bc08ec3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,8 +27,9 @@ "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code" }, "prettier": { + "singleQuote": true, "tabWidth": 4, - "singleQuote": true + "trailingComma": "all" }, "dependencies": { "lookpath": "^1.0.3", diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 63f82c92..9e4ce0eb 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -9,7 +9,7 @@ export class TextDocumentContentProvider public syntaxTree: string = 'Not available'; public provideTextDocumentContent( - uri: vscode.Uri + uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; if (editor == null) { @@ -17,7 +17,7 @@ export class TextDocumentContentProvider } return Server.client.sendRequest( 'rust-analyzer/analyzerStatus', - null + null, ); } @@ -35,8 +35,8 @@ export function makeCommand(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer-status', - textDocumentContentProvider - ) + textDocumentContentProvider, + ), ); context.subscriptions.push({ @@ -44,21 +44,21 @@ export function makeCommand(context: vscode.ExtensionContext) { if (poller != null) { clearInterval(poller); } - } + }, }); return async function handle() { if (poller == null) { poller = setInterval( () => textDocumentContentProvider.eventEmitter.fire(statusUri), - 1000 + 1000, ); } const document = await vscode.workspace.openTextDocument(statusUri); return vscode.window.showTextDocument( document, vscode.ViewColumn.Two, - true + true, ); }; } diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/commands/apply_source_change.ts index dcd074b8..8167398b 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/commands/apply_source_change.ts @@ -11,7 +11,7 @@ export interface SourceChange { export async function handle(change: SourceChange) { const wsEdit = Server.client.protocol2CodeConverter.asWorkspaceEdit( - change.workspaceEdit + change.workspaceEdit, ); let created; let moved; @@ -33,10 +33,10 @@ export async function handle(change: SourceChange) { await vscode.window.showTextDocument(doc); } else if (toReveal) { const uri = Server.client.protocol2CodeConverter.asUri( - toReveal.textDocument.uri + toReveal.textDocument.uri, ); const position = Server.client.protocol2CodeConverter.asPosition( - toReveal.position + toReveal.position, ); const editor = vscode.window.activeTextEditor; if (!editor || editor.document.uri.toString() !== uri.toString()) { @@ -48,7 +48,7 @@ export async function handle(change: SourceChange) { editor.selection = new vscode.Selection(position, position); editor.revealRange( new vscode.Range(position, position), - vscode.TextEditorRevealType.Default + vscode.TextEditorRevealType.Default, ); } } diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 59d4ba97..512362eb 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -9,13 +9,13 @@ import { StatusDisplay } from './watch_status'; import { mapRustDiagnosticToVsCode, - RustDiagnostic + RustDiagnostic, } from '../utils/diagnostics/rust'; import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection'; import { areDiagnosticsEqual } from '../utils/diagnostics/vscode'; export async function registerCargoWatchProvider( - subscriptions: vscode.Disposable[] + subscriptions: vscode.Disposable[], ): Promise { let cargoExists = false; @@ -30,7 +30,7 @@ export async function registerCargoWatchProvider( if (!cargoExists) { vscode.window.showErrorMessage( - `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}` + `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}`, ); return; } @@ -52,13 +52,13 @@ export class CargoWatchProvider implements vscode.Disposable { constructor() { this.diagnosticCollection = vscode.languages.createDiagnosticCollection( - 'rustc' + 'rustc', ); this.statusDisplay = new StatusDisplay( - Server.config.cargoWatchOptions.command + Server.config.cargoWatchOptions.command, ); this.outputChannel = vscode.window.createOutputChannel( - 'Cargo Watch Trace' + 'Cargo Watch Trace', ); // Track `rustc`'s suggested fixes so we can convert them to code actions @@ -68,15 +68,15 @@ export class CargoWatchProvider implements vscode.Disposable { this.suggestedFixCollection, { providedCodeActionKinds: - SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS - } + SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS, + }, ); } public start() { if (this.cargoProcess) { vscode.window.showInformationMessage( - 'Cargo Watch is already running' + 'Cargo Watch is already running', ); return; } @@ -95,7 +95,7 @@ export class CargoWatchProvider implements vscode.Disposable { const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce( (flags, pattern) => [...flags, '--ignore', pattern], - [] as string[] + [] as string[], ); // Start the cargo watch with json message @@ -105,8 +105,8 @@ export class CargoWatchProvider implements vscode.Disposable { { stdio: ['ignore', 'pipe', 'pipe'], cwd: vscode.workspace.rootPath, - windowsVerbatimArguments: true - } + windowsVerbatimArguments: true, + }, ); const stdoutData = new LineBuffer(); @@ -130,7 +130,7 @@ export class CargoWatchProvider implements vscode.Disposable { this.cargoProcess.on('error', (err: Error) => { this.logError( - 'Error on cargo-watch process : {\n' + err.message + '}\n' + 'Error on cargo-watch process : {\n' + err.message + '}\n', ); }); @@ -223,12 +223,12 @@ export class CargoWatchProvider implements vscode.Disposable { const fileUri = location.uri; const diagnostics: vscode.Diagnostic[] = [ - ...(this.diagnosticCollection!.get(fileUri) || []) + ...(this.diagnosticCollection!.get(fileUri) || []), ]; // If we're building multiple targets it's possible we've already seen this diagnostic const isDuplicate = diagnostics.some(d => - areDiagnosticsEqual(d, diagnostic) + areDiagnosticsEqual(d, diagnostic), ); if (isDuplicate) { return; @@ -241,7 +241,7 @@ export class CargoWatchProvider implements vscode.Disposable { for (const suggestedFix of suggestedFixes) { this.suggestedFixCollection.addSuggestedFixForDiagnostic( suggestedFix, - diagnostic + diagnostic, ); } @@ -249,7 +249,7 @@ export class CargoWatchProvider implements vscode.Disposable { vscode.commands.executeCommand( 'vscode.executeCodeActionProvider', fileUri, - diagnostic.range + diagnostic.range, ); } } diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 34e0c8fb..84289802 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -3,7 +3,7 @@ import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; export const expandMacroUri = vscode.Uri.parse( - 'rust-analyzer://expandMacro/[EXPANSION].rs' + 'rust-analyzer://expandMacro/[EXPANSION].rs', ); export class ExpandMacroContentProvider @@ -11,7 +11,7 @@ export class ExpandMacroContentProvider public eventEmitter = new vscode.EventEmitter(); public provideTextDocumentContent( - uri: vscode.Uri + uri: vscode.Uri, ): vscode.ProviderResult { async function handle() { const editor = vscode.window.activeTextEditor; @@ -22,11 +22,11 @@ export class ExpandMacroContentProvider const position = editor.selection.active; const request: MacroExpandParams = { textDocument: { uri: editor.document.uri.toString() }, - position + position, }; const expanded = await Server.client.sendRequest( 'rust-analyzer/expandMacro', - request + request, ); if (expanded == null) { @@ -58,7 +58,7 @@ export function createHandle(provider: ExpandMacroContentProvider) { return vscode.window.showTextDocument( document, vscode.ViewColumn.Two, - true + true, ); }; } diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 2ade6d33..13a69675 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -19,5 +19,5 @@ export { runnables, syntaxTree, onEnter, - inlayHints + inlayHints, }; diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index 0dbdd94f..ac7dcce6 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -15,8 +15,8 @@ interface InlayHint { const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { - color: new vscode.ThemeColor('ralsp.inlayHint') - } + color: new vscode.ThemeColor('ralsp.inlayHint'), + }, }); export class HintsUpdater { @@ -26,13 +26,13 @@ export class HintsUpdater { if (this.displayHints !== displayHints) { this.displayHints = displayHints; return this.refreshVisibleEditorsHints( - displayHints ? undefined : [] + displayHints ? undefined : [], ); } } public async refreshHintsForVisibleEditors( - cause?: TextDocumentChangeEvent + cause?: TextDocumentChangeEvent, ): Promise { if (!this.displayHints) { return; @@ -48,21 +48,21 @@ export class HintsUpdater { } private async refreshVisibleEditorsHints( - newDecorations?: vscode.DecorationOptions[] + newDecorations?: vscode.DecorationOptions[], ) { const promises: Array> = []; for (const rustEditor of vscode.window.visibleTextEditors.filter( - editor => this.isRustDocument(editor.document) + editor => this.isRustDocument(editor.document), )) { if (newDecorations !== undefined) { promises.push( Promise.resolve( rustEditor.setDecorations( typeHintDecorationType, - newDecorations - ) - ) + newDecorations, + ), + ), ); } else { promises.push(this.updateDecorationsFromServer(rustEditor)); @@ -79,7 +79,7 @@ export class HintsUpdater { } private async updateDecorationsFromServer( - editor: TextEditor + editor: TextEditor, ): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints !== null) { @@ -87,20 +87,20 @@ export class HintsUpdater { range: hint.range, renderOptions: { after: { - contentText: `: ${hint.label}` - } - } + contentText: `: ${hint.label}`, + }, + }, })); return editor.setDecorations( typeHintDecorationType, - newDecorations + newDecorations, ); } } private async queryHints(documentUri: string): Promise { const request: InlayHintsParams = { - textDocument: { uri: documentUri } + textDocument: { uri: documentUri }, }; const client = Server.client; return client @@ -108,8 +108,8 @@ export class HintsUpdater { .then(() => client.sendRequest( 'rust-analyzer/inlayHints', - request - ) + request, + ), ); } } diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 0d4b12f4..134ddc80 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -4,7 +4,7 @@ import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; import { handle as applySourceChange, - SourceChange + SourceChange, } from './apply_source_change'; interface JoinLinesParams { @@ -19,11 +19,11 @@ export async function handle() { } const request: JoinLinesParams = { range: Server.client.code2ProtocolConverter.asRange(editor.selection), - textDocument: { uri: editor.document.uri.toString() } + textDocument: { uri: editor.document.uri.toString() }, }; const change = await Server.client.sendRequest( 'rust-analyzer/joinLines', - request + request, ); await applySourceChange(change); } diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index d86faf40..364208cc 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -17,15 +17,15 @@ export async function handle() { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map(s => { return Server.client.code2ProtocolConverter.asPosition(s.active); - }) + }), }; const response = await Server.client.sendRequest( 'rust-analyzer/findMatchingBrace', - request + request, ); editor.selections = editor.selections.map((sel, idx) => { const active = Server.client.protocol2CodeConverter.asPosition( - response[idx] + response[idx], ); const anchor = sel.isEmpty ? active : sel.anchor; return new vscode.Selection(anchor, active); diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 16dcb70c..772c64b3 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import { Server } from '../server'; import { handle as applySourceChange, - SourceChange + SourceChange, } from './apply_source_change'; export async function handle(event: { text: string }): Promise { @@ -18,12 +18,12 @@ export async function handle(event: { text: string }): Promise { const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active - ) + editor.selection.active, + ), }; const change = await Server.client.sendRequest( 'rust-analyzer/onEnter', - request + request, ); if (!change) { return false; diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 9d30b7b5..ad49e1bd 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -11,12 +11,12 @@ export async function handle() { const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active - ) + editor.selection.active, + ), }; const response = await Server.client.sendRequest( 'rust-analyzer/parentModule', - request + request, ); const loc = response[0]; if (loc == null) { diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index ac59bf60..9b1c6643 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -46,17 +46,17 @@ function createTask(spec: Runnable): vscode.Task { label: spec.label, command: spec.bin, args: spec.args, - env: spec.env + env: spec.env, }; const execOption: vscode.ShellExecutionOptions = { cwd: spec.cwd || '.', - env: definition.env + env: definition.env, }; const exec = new vscode.ShellExecution( definition.command, definition.args, - execOption + execOption, ); const f = vscode.workspace.workspaceFolders![0]; @@ -66,7 +66,7 @@ function createTask(spec: Runnable): vscode.Task { definition.label, TASK_SOURCE, exec, - ['$rustc'] + ['$rustc'], ); t.presentationOptions.clear = true; return t; @@ -79,17 +79,17 @@ export async function handle() { return; } const textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString() + uri: editor.document.uri.toString(), }; const params: RunnablesParams = { textDocument, position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active - ) + editor.selection.active, + ), }; const runnables = await Server.client.sendRequest( 'rust-analyzer/runnables', - params + params, ); const items: RunnableQuickPick[] = []; if (prevRunnable) { @@ -124,7 +124,7 @@ export async function handleSingle(runnable: Runnable) { task.presentationOptions = { reveal: vscode.TaskRevealKind.Always, panel: vscode.TaskPanelKind.Dedicated, - clear: true + clear: true, }; return vscode.tasks.executeTask(task); @@ -136,7 +136,7 @@ export async function handleSingle(runnable: Runnable) { * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ export async function interactivelyStartCargoWatch( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): Promise { if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { return; @@ -146,7 +146,7 @@ export async function interactivelyStartCargoWatch( const watch = await vscode.window.showInformationMessage( 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', 'yes', - 'no' + 'no', ); if (watch !== 'yes') { return; @@ -157,12 +157,12 @@ export async function interactivelyStartCargoWatch( } export async function startCargoWatch( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): Promise { const execPromise = util.promisify(child_process.exec); const { stderr, code = 0 } = await execPromise( - 'cargo watch --version' + 'cargo watch --version', ).catch(e => e); if (stderr.includes('no such subcommand: `watch`')) { @@ -171,7 +171,7 @@ export async function startCargoWatch( const install = await vscode.window.showInformationMessage( msg, 'yes', - 'no' + 'no', ); if (install !== 'yes') { return; @@ -192,20 +192,20 @@ export async function startCargoWatch( label, bin: 'cargo', args: ['install', 'cargo-watch'], - env: {} - }) + env: {}, + }), ); await taskFinished; const output = await execPromise('cargo watch --version').catch(e => e); if (output.stderr !== '') { vscode.window.showErrorMessage( - `Couldn't install \`cargo-\`watch: ${output.stderr}` + `Couldn't install \`cargo-\`watch: ${output.stderr}`, ); return; } } else if (code !== 0) { vscode.window.showErrorMessage( - `\`cargo watch\` failed with ${code}: ${stderr}` + `\`cargo watch\` failed with ${code}: ${stderr}`, ); return; } diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts index 2f50fe14..89a80550 100644 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ b/rust-analyzer/editors/code/src/commands/syntaxTree.ts @@ -11,7 +11,7 @@ export class SyntaxTreeContentProvider public syntaxTree: string = 'Not available'; public provideTextDocumentContent( - uri: vscode.Uri + uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; if (editor == null) { @@ -25,17 +25,17 @@ export class SyntaxTreeContentProvider range = editor.selection.isEmpty ? undefined : Server.client.code2ProtocolConverter.asRange( - editor.selection + editor.selection, ); } const request: SyntaxTreeParams = { textDocument: { uri: editor.document.uri.toString() }, - range + range, }; return Server.client.sendRequest( 'rust-analyzer/syntaxTree', - request + request, ); } @@ -70,7 +70,7 @@ export function createHandle(provider: SyntaxTreeContentProvider) { return vscode.window.showTextDocument( document, vscode.ViewColumn.Two, - true + true, ); }; } diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 6c1f9041..8d64394c 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -13,7 +13,7 @@ export class StatusDisplay implements vscode.Disposable { constructor(command: string) { this.statusBarItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, - 10 + 10, ); this.command = command; this.statusBarItem.hide(); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index fb9e55dd..2d3b6a54 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -33,14 +33,14 @@ export class Config { trace: 'off', arguments: '', command: '', - ignore: [] + ignore: [], }; private prevEnhancedTyping: null | boolean = null; constructor() { vscode.workspace.onDidChangeConfiguration(_ => - this.userConfigChanged() + this.userConfigChanged(), ); this.userConfigChanged(); } @@ -53,7 +53,7 @@ export class Config { if (config.has('rainbowHighlightingOn')) { this.rainbowHighlightingOn = config.get( - 'rainbowHighlightingOn' + 'rainbowHighlightingOn', ) as boolean; } @@ -63,7 +63,7 @@ export class Config { if (config.has('enableEnhancedTyping')) { this.enableEnhancedTyping = config.get( - 'enableEnhancedTyping' + 'enableEnhancedTyping', ) as boolean; if (this.prevEnhancedTyping === null) { @@ -78,12 +78,12 @@ export class Config { vscode.window .showInformationMessage( 'Changing enhanced typing setting requires a reload', - reloadAction + reloadAction, ) .then(selectedAction => { if (selectedAction === reloadAction) { vscode.commands.executeCommand( - 'workbench.action.reloadWindow' + 'workbench.action.reloadWindow', ); } }); @@ -104,28 +104,28 @@ export class Config { if (config.has('trace.cargo-watch')) { this.cargoWatchOptions.trace = config.get( 'trace.cargo-watch', - 'off' + 'off', ); } if (config.has('cargo-watch.arguments')) { this.cargoWatchOptions.arguments = config.get( 'cargo-watch.arguments', - '' + '', ); } if (config.has('cargo-watch.command')) { this.cargoWatchOptions.command = config.get( 'cargo-watch.command', - '' + '', ); } if (config.has('cargo-watch.ignore')) { this.cargoWatchOptions.ignore = config.get( 'cargo-watch.ignore', - [] + [], ); } @@ -138,7 +138,7 @@ export class Config { } if (config.has('maxInlayHintLength')) { this.maxInlayHintLength = config.get( - 'maxInlayHintLength' + 'maxInlayHintLength', ) as number; } if (config.has('excludeGlobs')) { diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index 64be5622..74b91bd4 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -3,7 +3,7 @@ import { TextDocumentIdentifier } from 'vscode-languageclient'; import { SyntaxTreeContentProvider, - syntaxTreeUri + syntaxTreeUri, } from '../commands/syntaxTree'; import { Decoration } from '../highlighting'; import { Server } from '../server'; @@ -21,11 +21,11 @@ export function makeHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { } const params: TextDocumentIdentifier = { - uri: editor.document.uri.toString() + uri: editor.document.uri.toString(), }; const decorations = await Server.client.sendRequest( 'rust-analyzer/decorationsRequest', - params + params, ); Server.highlighter.setHighlights(editor, decorations); }; diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts index 89488bc6..2e998e88 100644 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ b/rust-analyzer/editors/code/src/events/change_text_document.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import { SyntaxTreeContentProvider, - syntaxTreeUri + syntaxTreeUri, } from '../commands/syntaxTree'; export function createHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index a78aa3b4..815f3692 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -7,7 +7,7 @@ import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; import { interactivelyStartCargoWatch, - startCargoWatch + startCargoWatch, } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; @@ -24,7 +24,7 @@ export async function activate(context: vscode.ExtensionContext) { } function overrideCommand( name: string, - f: (...args: any[]) => Promise + f: (...args: any[]) => Promise, ) { const defaultCmd = `default:${name}`; const original = (...args: any[]) => @@ -46,7 +46,7 @@ export async function activate(context: vscode.ExtensionContext) { }); } catch (_) { vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings' + 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', ); } } @@ -54,14 +54,14 @@ export async function activate(context: vscode.ExtensionContext) { // Commands are requests from vscode to the language server registerCommand( 'rust-analyzer.analyzerStatus', - commands.analyzerStatus.makeCommand(context) + commands.analyzerStatus.makeCommand(context), ); registerCommand('rust-analyzer.collectGarbage', () => - Server.client.sendRequest('rust-analyzer/collectGarbage', null) + Server.client.sendRequest('rust-analyzer/collectGarbage', null), ); registerCommand( 'rust-analyzer.matchingBrace', - commands.matchingBrace.handle + commands.matchingBrace.handle, ); registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); @@ -70,7 +70,7 @@ export async function activate(context: vscode.ExtensionContext) { registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); registerCommand( 'rust-analyzer.applySourceChange', - commands.applySourceChange.handle + commands.applySourceChange.handle, ); registerCommand( 'rust-analyzer.showReferences', @@ -79,9 +79,9 @@ export async function activate(context: vscode.ExtensionContext) { 'editor.action.showReferences', vscode.Uri.parse(uri), Server.client.protocol2CodeConverter.asPosition(position), - locations.map(Server.client.protocol2CodeConverter.asLocation) + locations.map(Server.client.protocol2CodeConverter.asLocation), ); - } + }, ); if (Server.config.enableEnhancedTyping) { @@ -91,47 +91,47 @@ export async function activate(context: vscode.ExtensionContext) { // Notifications are events triggered by the language server const allNotifications: Iterable<[ string, - lc.GenericNotificationHandler + lc.GenericNotificationHandler, ]> = [ [ 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle - ] + notifications.publishDecorations.handle, + ], ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( - events.changeActiveTextEditor.makeHandler(syntaxTreeContentProvider) + events.changeActiveTextEditor.makeHandler(syntaxTreeContentProvider), ); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', - syntaxTreeContentProvider - ) + syntaxTreeContentProvider, + ), ); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', - expandMacroContentProvider - ) + expandMacroContentProvider, + ), ); registerCommand( 'rust-analyzer.syntaxTree', - commands.syntaxTree.createHandle(syntaxTreeContentProvider) + commands.syntaxTree.createHandle(syntaxTreeContentProvider), ); registerCommand( 'rust-analyzer.expandMacro', - commands.expandMacro.createHandle(expandMacroContentProvider) + commands.expandMacro.createHandle(expandMacroContentProvider), ); vscode.workspace.onDidChangeTextDocument( events.changeTextDocument.createHandler(syntaxTreeContentProvider), null, - context.subscriptions + context.subscriptions, ); const startServer = () => Server.start(allNotifications); @@ -178,25 +178,25 @@ export async function activate(context: vscode.ExtensionContext) { editorChangeDisposable.dispose(); } return hintsUpdater.refreshHintsForVisibleEditors(); - } + }, ); disposeOnDeactivation( vscode.window.onDidChangeVisibleTextEditors(_ => - hintsUpdater.refreshHintsForVisibleEditors() - ) + hintsUpdater.refreshHintsForVisibleEditors(), + ), ); disposeOnDeactivation( vscode.workspace.onDidChangeTextDocument(e => - hintsUpdater.refreshHintsForVisibleEditors(e) - ) + hintsUpdater.refreshHintsForVisibleEditors(e), + ), ); disposeOnDeactivation( vscode.workspace.onDidChangeConfiguration(_ => hintsUpdater.toggleHintsDisplay( - Server.config.displayInlayHints - ) - ) + Server.config.displayInlayHints, + ), + ), ); }); } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 48f2a254..6d50a2f2 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -30,19 +30,19 @@ export class Highlighter { > { const decoration = ( tag: string, - textDecoration?: string + textDecoration?: string, ): [string, vscode.TextEditorDecorationType] => { const color = new vscode.ThemeColor('ralsp.' + tag); const decor = vscode.window.createTextEditorDecorationType({ color, - textDecoration + textDecoration, }); return [tag, decor]; }; const decorations: Iterable<[ string, - vscode.TextEditorDecorationType + vscode.TextEditorDecorationType, ]> = [ decoration('comment'), decoration('string'), @@ -61,7 +61,7 @@ export class Highlighter { decoration('variable'), decoration('variable.mut', 'underline'), decoration('field'), - decoration('module') + decoration('module'), ]; return new Map(decorations); @@ -118,20 +118,20 @@ export class Highlighter { colorfulIdents .get(d.bindingHash)![0] .push( - Server.client.protocol2CodeConverter.asRange(d.range) + Server.client.protocol2CodeConverter.asRange(d.range), ); } else { byTag .get(d.tag)! .push( - Server.client.protocol2CodeConverter.asRange(d.range) + Server.client.protocol2CodeConverter.asRange(d.range), ); } } for (const tag of byTag.keys()) { const dec = this.decorations.get( - tag + tag, ) as vscode.TextEditorDecorationType; const ranges = byTag.get(tag)!; editor.setDecorations(dec, ranges); @@ -141,7 +141,7 @@ export class Highlighter { const textDecoration = mut ? 'underline' : undefined; const dec = vscode.window.createTextEditorDecorationType({ light: { color: fancify(hash, 'light'), textDecoration }, - dark: { color: fancify(hash, 'dark'), textDecoration } + dark: { color: fancify(hash, 'dark'), textDecoration }, }); editor.setDecorations(dec, ranges); } diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index 3180019b..00ffb777 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -10,7 +10,7 @@ export interface PublishDecorationsParams { export function handle(params: PublishDecorationsParams) { const targetEditor = vscode.window.visibleTextEditors.find( - editor => editor.document.uri.toString() === params.uri + editor => editor.document.uri.toString() === params.uri, ); if (!Server.config.highlightingOn || !targetEditor) { return; diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index e767b6f1..2fe45f1e 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -19,7 +19,7 @@ export class Server { public static client: lc.LanguageClient; public static async start( - notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> + notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>, ) { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. @@ -34,20 +34,20 @@ export class Server { if (platform() !== 'win32') { if (!(await lookpath(command))) { throw new Error( - `Cannot find rust-analyzer server \`${command}\` in PATH.` + `Cannot find rust-analyzer server \`${command}\` in PATH.`, ); } } const run: lc.Executable = { command, - options: { cwd: folder } + options: { cwd: folder }, }; const serverOptions: lc.ServerOptions = { run, - debug: run + debug: run, }; const traceOutputChannel = window.createOutputChannel( - 'Rust Analyzer Language Server Trace' + 'Rust Analyzer Language Server Trace', ); const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], @@ -58,16 +58,16 @@ export class Server { excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, - withSysroot: Server.config.withSysroot + withSysroot: Server.config.withSysroot, }, - traceOutputChannel + traceOutputChannel, }; Server.client = new lc.LanguageClient( 'rust-analyzer', 'Rust Analyzer Language Server', serverOptions, - clientOptions + clientOptions, ); // HACK: This is an awful way of filtering out the decorations notifications // However, pending proper support, this is the most effecitve approach @@ -80,10 +80,10 @@ export class Server { if (typeof messageOrDataObject === 'string') { if ( messageOrDataObject.includes( - 'rust-analyzer/publishDecorations' + 'rust-analyzer/publishDecorations', ) || messageOrDataObject.includes( - 'rust-analyzer/decorationsRequest' + 'rust-analyzer/decorationsRequest', ) ) { // Don't log publish decorations requests @@ -95,7 +95,7 @@ export class Server { // @ts-ignore Server.client.logObjectTrace(messageOrDataObject); } - } + }, }; Server.client.registerProposedFeatures(); Server.client.onReady().then(() => { diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts index 6c7f436f..96ec8c61 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts @@ -6,12 +6,12 @@ import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; const location1 = new vscode.Location( vscode.Uri.file('/file/1'), - new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)) + new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)), ); const location2 = new vscode.Location( vscode.Uri.file('/file/2'), - new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)) + new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)), ); describe('SuggestedFix', () => { @@ -20,13 +20,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); assert(suggestion1.isEqual(suggestion2)); @@ -36,13 +36,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Not the same title!', location1, - 'With this!' + 'With this!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -52,13 +52,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location1, - 'With something else!' + 'With something else!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -68,13 +68,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location2, - 'With this!' + 'With this!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -85,14 +85,14 @@ describe('SuggestedFix', () => { 'Replace me!', location1, 'With this!', - SuggestionApplicability.MachineApplicable + SuggestionApplicability.MachineApplicable, ); const suggestion2 = new SuggestedFix( 'Replace me!', location2, 'With this!', - SuggestionApplicability.HasPlaceholders + SuggestionApplicability.HasPlaceholders, ); assert(!suggestion1.isEqual(suggestion2)); @@ -104,7 +104,7 @@ describe('SuggestedFix', () => { const suggestion = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const codeAction = suggestion.toCodeAction(); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts index f0328893..4c1467b5 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts @@ -8,20 +8,20 @@ const uri1 = vscode.Uri.file('/file/1'); const uri2 = vscode.Uri.file('/file/2'); const mockDocument1 = ({ - uri: uri1 + uri: uri1, } as unknown) as vscode.TextDocument; const mockDocument2 = ({ - uri: uri2 + uri: uri2, } as unknown) as vscode.TextDocument; const range1 = new vscode.Range( new vscode.Position(1, 2), - new vscode.Position(3, 4) + new vscode.Position(3, 4), ); const range2 = new vscode.Range( new vscode.Position(5, 6), - new vscode.Position(7, 8) + new vscode.Position(7, 8), ); const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); @@ -32,7 +32,7 @@ function suggestion1(): SuggestedFix { return new SuggestedFix( 'Replace me!', new vscode.Location(uri1, range1), - 'With this!' + 'With this!', ); } @@ -44,7 +44,7 @@ describe('SuggestedFixCollection', () => { // Specify the document and range that exactly matches const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert.strictEqual(codeActions.length, 1); @@ -66,7 +66,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range2 + range2, ); assert(!codeActions || codeActions.length === 0); @@ -78,7 +78,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument2, - range1 + range1, ); assert(!codeActions || codeActions.length === 0); @@ -91,7 +91,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert(!codeActions || codeActions.length === 0); @@ -106,7 +106,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert.strictEqual(codeActions.length, 1); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index 327d1504..cee59061 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -6,14 +6,14 @@ import { MappedRustDiagnostic, mapRustDiagnosticToVsCode, RustDiagnostic, - SuggestionApplicability + SuggestionApplicability, } from '../../../utils/diagnostics/rust'; function loadDiagnosticFixture(name: string): RustDiagnostic { const jsonText = fs .readFileSync( // We're actually in our JavaScript output directory, climb out - `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json` + `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json`, ) .toString(); @@ -33,12 +33,12 @@ function mapFixtureToVsCode(name: string): MappedRustDiagnostic { describe('mapRustDiagnosticToVsCode', () => { it('should map an incompatible type for trait error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0053' + 'error/E0053', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual(diagnostic.source, 'rustc'); assert.strictEqual( @@ -46,8 +46,8 @@ describe('mapRustDiagnosticToVsCode', () => { [ `method \`next\` has an incompatible type for trait`, `expected type \`fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>\``, - ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\`` - ].join('\n') + ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\``, + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0053'); assert.deepStrictEqual(diagnostic.tags, []); @@ -61,24 +61,24 @@ describe('mapRustDiagnosticToVsCode', () => { it('should map an unused variable warning', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'warning/unused_variables' + 'warning/unused_variables', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); assert.strictEqual( diagnostic.message, [ 'unused variable: `foo`', - '#[warn(unused_variables)] on by default' - ].join('\n') + '#[warn(unused_variables)] on by default', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'unused_variables'); assert.strictEqual(diagnostic.source, 'rustc'); assert.deepStrictEqual(diagnostic.tags, [ - vscode.DiagnosticTag.Unnecessary + vscode.DiagnosticTag.Unnecessary, ]); // No related information @@ -89,29 +89,29 @@ describe('mapRustDiagnosticToVsCode', () => { const [suggestedFix] = suggestedFixes; assert.strictEqual( suggestedFix.title, - 'consider prefixing with an underscore: `_foo`' + 'consider prefixing with an underscore: `_foo`', ); assert.strictEqual( suggestedFix.applicability, - SuggestionApplicability.MachineApplicable + SuggestionApplicability.MachineApplicable, ); }); it('should map a wrong number of parameters error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0061' + 'error/E0061', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual( diagnostic.message, [ 'this function takes 2 parameters but 3 parameters were supplied', - 'expected 2 parameters' - ].join('\n') + 'expected 2 parameters', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0061'); assert.strictEqual(diagnostic.source, 'rustc'); @@ -132,12 +132,12 @@ describe('mapRustDiagnosticToVsCode', () => { it('should map a Clippy copy pass by ref warning', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'clippy/trivially_copy_pass_by_ref' + 'clippy/trivially_copy_pass_by_ref', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); assert.strictEqual(diagnostic.source, 'clippy'); assert.strictEqual( @@ -145,8 +145,8 @@ describe('mapRustDiagnosticToVsCode', () => { [ 'this argument is passed by reference, but would be more efficient if passed by value', '#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]', - 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref' - ].join('\n') + 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'trivially_copy_pass_by_ref'); assert.deepStrictEqual(diagnostic.tags, []); @@ -165,27 +165,27 @@ describe('mapRustDiagnosticToVsCode', () => { const [suggestedFix] = suggestedFixes; assert.strictEqual( suggestedFix.title, - 'consider passing by value instead: `self`' + 'consider passing by value instead: `self`', ); // Clippy does not mark this with any applicability assert.strictEqual( suggestedFix.applicability, - SuggestionApplicability.Unspecified + SuggestionApplicability.Unspecified, ); }); it('should map a mismatched type error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0308' + 'error/E0308', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual( diagnostic.message, - ['mismatched types', 'expected usize, found u32'].join('\n') + ['mismatched types', 'expected usize, found u32'].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0308'); assert.strictEqual(diagnostic.source, 'rustc'); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts index 542dec1f..4944dd03 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts @@ -5,12 +5,12 @@ import { areDiagnosticsEqual } from '../../../utils/diagnostics/vscode'; const range1 = new vscode.Range( new vscode.Position(1, 2), - new vscode.Position(3, 4) + new vscode.Position(3, 4), ); const range2 = new vscode.Range( new vscode.Position(5, 6), - new vscode.Position(7, 8) + new vscode.Position(7, 8), ); describe('areDiagnosticsEqual', () => { @@ -18,13 +18,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -34,14 +34,14 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); diagnostic1.source = 'rustc'; const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); diagnostic2.source = 'clippy'; @@ -52,13 +52,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range2, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -68,13 +68,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Goodbye!, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -84,13 +84,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); diff --git a/rust-analyzer/editors/code/src/test/utils/index.ts b/rust-analyzer/editors/code/src/test/utils/index.ts index 16715a28..9927daaf 100644 --- a/rust-analyzer/editors/code/src/test/utils/index.ts +++ b/rust-analyzer/editors/code/src/test/utils/index.ts @@ -17,7 +17,7 @@ import * as path from 'path'; export function run(): Promise { // Create the mocha test const mocha = new Mocha({ - ui: 'bdd' + ui: 'bdd', }); mocha.useColors(true); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts index b1be2a22..6e660bb6 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts @@ -24,7 +24,7 @@ export default class SuggestedFix { title: string, location: vscode.Location, replacement: string, - applicability: SuggestionApplicability = SuggestionApplicability.Unspecified + applicability: SuggestionApplicability = SuggestionApplicability.Unspecified, ) { this.title = title; this.location = location; @@ -51,7 +51,7 @@ export default class SuggestedFix { public toCodeAction(): vscode.CodeAction { const codeAction = new vscode.CodeAction( this.title, - vscode.CodeActionKind.QuickFix + vscode.CodeActionKind.QuickFix, ); const edit = new vscode.WorkspaceEdit(); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts index 132ce12f..57c9856c 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts @@ -38,13 +38,13 @@ export default class SuggestedFixCollection */ public addSuggestedFixForDiagnostic( suggestedFix: SuggestedFix, - diagnostic: vscode.Diagnostic + diagnostic: vscode.Diagnostic, ): void { const fileUriString = suggestedFix.location.uri.toString(); const fileSuggestions = this.suggestedFixes.get(fileUriString) || []; const existingSuggestion = fileSuggestions.find(s => - s.isEqual(suggestedFix) + s.isEqual(suggestedFix), ); if (existingSuggestion) { @@ -65,7 +65,7 @@ export default class SuggestedFixCollection */ public provideCodeActions( document: vscode.TextDocument, - range: vscode.Range + range: vscode.Range, ): vscode.CodeAction[] { const documentUriString = document.uri.toString(); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index 0550d037..b6efc0f5 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -7,7 +7,7 @@ export enum SuggestionApplicability { MachineApplicable = 'MachineApplicable', HasPlaceholders = 'HasPlaceholders', MaybeIncorrect = 'MaybeIncorrect', - Unspecified = 'Unspecified' + Unspecified = 'Unspecified', } // Reference: @@ -69,7 +69,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { const range = new vscode.Range( new vscode.Position(span.line_start - 1, span.column_start - 1), - new vscode.Position(span.line_end - 1, span.column_end - 1) + new vscode.Position(span.line_end - 1, span.column_end - 1), ); return new vscode.Location(fileUri, range); @@ -81,7 +81,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { * If the span is unlabelled this will return `undefined`. */ function mapSecondarySpanToRelated( - span: RustDiagnosticSpan + span: RustDiagnosticSpan, ): vscode.DiagnosticRelatedInformation | undefined { if (!span.label) { // Nothing to label this with @@ -107,7 +107,7 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { 'unused_attributes', 'unused_imports', 'unused_macros', - 'unused_variables' + 'unused_variables', ].includes(rd.code.code); } @@ -157,13 +157,13 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { title, location, span.suggested_replacement, - span.suggestion_applicability - ) + span.suggestion_applicability, + ), }; } else { const related = new vscode.DiagnosticRelatedInformation( location, - rd.message + rd.message, ); return { related }; @@ -183,7 +183,7 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { * If the diagnostic has no primary span this will return `undefined` */ export function mapRustDiagnosticToVsCode( - rd: RustDiagnostic + rd: RustDiagnostic, ): MappedRustDiagnostic | undefined { const primarySpan = rd.spans.find(s => s.is_primary); if (!primarySpan) { @@ -223,7 +223,7 @@ export function mapRustDiagnosticToVsCode( const suggestedFixes = []; for (const child of rd.children) { const { related, suggestedFix, messageLine } = mapRustChildDiagnostic( - child + child, ); if (related) { @@ -256,6 +256,6 @@ export function mapRustDiagnosticToVsCode( return { location, diagnostic: vd, - suggestedFixes + suggestedFixes, }; } diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts b/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts index d8b85b72..f4a5450e 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; /** Compares two `vscode.Diagnostic`s for equality */ export function areDiagnosticsEqual( left: vscode.Diagnostic, - right: vscode.Diagnostic + right: vscode.Diagnostic, ): boolean { return ( left.source === right.source && diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts index da8be9eb..a1d6b7ea 100644 --- a/rust-analyzer/editors/code/src/utils/processes.ts +++ b/rust-analyzer/editors/code/src/utils/processes.ts @@ -22,7 +22,7 @@ export function terminate(process: ChildProcess, cwd?: string): boolean { // Ignore stderr since this is otherwise piped to parent.stderr // which might be already closed. const options: any = { - stdio: ['pipe', 'pipe', 'ignore'] + stdio: ['pipe', 'pipe', 'ignore'], }; if (cwd) { options.cwd = cwd; @@ -30,7 +30,7 @@ export function terminate(process: ChildProcess, cwd?: string): boolean { cp.execFileSync( 'taskkill', ['/T', '/F', '/PID', process.pid.toString()], - options + options, ); return true; } catch (err) { From 245bd95f3daff5346c9680945e9d310faf7af75a Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Wed, 11 Dec 2019 22:40:26 +0900 Subject: [PATCH 216/819] Use ES2018 for vscode extension Today's latest vscode v1.40 (Node.jsv12.4/V8 v7.6) supports ES2018 features natively. We don't have to transform codes to ES6. --- rust-analyzer/editors/code/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 9ad2e967..8cb1e903 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "target": "es2018", "outDir": "out", - "lib": ["es6"], + "lib": ["es2018"], "sourceMap": true, "rootDir": "src", "strict": true, From 029639b781c6567cfa1761b7b63eb691637049e7 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Thu, 12 Dec 2019 00:41:16 +0900 Subject: [PATCH 217/819] Enable noUnusedParameters option for vscode extension --- rust-analyzer/editors/code/src/commands/analyzer_status.ts | 2 +- rust-analyzer/editors/code/src/commands/expand_macro.ts | 2 +- rust-analyzer/editors/code/src/commands/runnables.ts | 2 +- rust-analyzer/editors/code/tsconfig.json | 3 ++- rust-analyzer/editors/code/tslint.json | 4 +++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 9e4ce0eb..2777ced2 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -9,7 +9,7 @@ export class TextDocumentContentProvider public syntaxTree: string = 'Not available'; public provideTextDocumentContent( - uri: vscode.Uri, + _uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; if (editor == null) { diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 84289802..17c78280 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -11,7 +11,7 @@ export class ExpandMacroContentProvider public eventEmitter = new vscode.EventEmitter(); public provideTextDocumentContent( - uri: vscode.Uri, + _uri: vscode.Uri, ): vscode.ProviderResult { async function handle() { const editor = vscode.window.activeTextEditor; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 9b1c6643..c81d7ce0 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -178,7 +178,7 @@ export async function startCargoWatch( } const label = 'install-cargo-watch'; - const taskFinished = new Promise((resolve, reject) => { + const taskFinished = new Promise((resolve, _reject) => { const disposable = vscode.tasks.onDidEndTask(({ execution }) => { if (execution.task.name === label) { disposable.dispose(); diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 8cb1e903..9ddf5634 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -7,7 +7,8 @@ "sourceMap": true, "rootDir": "src", "strict": true, - "noUnusedLocals": true + "noUnusedLocals": true, + "noUnusedParameters": true }, "exclude": ["node_modules", ".vscode-test"] } diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index bdeb4895..b69c5574 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -4,6 +4,8 @@ "rules": { "quotemark": [true, "single"], "interface-name": false, - "object-literal-sort-keys": false + "object-literal-sort-keys": false, + // Allow `_bar` to sort with tsc's `noUnusedParameters` option + "variable-name": [true, "allow-leading-underscore"] } } From 31cb61c90d5d2e80cdab8a9a5cd590d9c57414c5 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Thu, 12 Dec 2019 00:49:54 +0900 Subject: [PATCH 218/819] Enable noImplicitReturns option for vscode extension --- .../editors/code/src/commands/runnables.ts | 14 ++++++++------ .../src/test/utils/diagnotics/SuggestedFix.test.ts | 3 ++- .../diagnotics/SuggestedFixCollection.test.ts | 6 ++++-- .../code/src/test/utils/diagnotics/rust.test.ts | 6 ++++-- rust-analyzer/editors/code/tsconfig.json | 3 ++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c81d7ce0..cf980e25 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -73,7 +73,7 @@ function createTask(spec: Runnable): vscode.Task { } let prevRunnable: RunnableQuickPick | undefined; -export async function handle() { +export async function handle(): Promise { const editor = vscode.window.activeTextEditor; if (editor == null || editor.document.languageId !== 'rust') { return; @@ -105,12 +105,14 @@ export async function handle() { items.push(new RunnableQuickPick(r)); } const item = await vscode.window.showQuickPick(items); - if (item) { - item.detail = 'rerun'; - prevRunnable = item; - const task = createTask(item.runnable); - return await vscode.tasks.executeTask(task); + if (!item) { + return; } + + item.detail = 'rerun'; + prevRunnable = item; + const task = createTask(item.runnable); + return await vscode.tasks.executeTask(task); } export async function handleSingle(runnable: Runnable) { diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts index 96ec8c61..2b25eb70 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts @@ -114,7 +114,8 @@ describe('SuggestedFix', () => { const edit = codeAction.edit; if (!edit) { - return assert.fail('Code Action edit unexpectedly missing'); + assert.fail('Code Action edit unexpectedly missing'); + return; } const editEntries = edit.entries(); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts index 4c1467b5..ef09013f 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts @@ -53,7 +53,8 @@ describe('SuggestedFixCollection', () => { const { diagnostics } = codeAction; if (!diagnostics) { - return assert.fail('Diagnostics unexpectedly missing'); + assert.fail('Diagnostics unexpectedly missing'); + return; } assert.strictEqual(diagnostics.length, 1); @@ -114,7 +115,8 @@ describe('SuggestedFixCollection', () => { const { diagnostics } = codeAction; if (!diagnostics) { - return assert.fail('Diagnostics unexpectedly missing'); + assert.fail('Diagnostics unexpectedly missing'); + return; } // We should be associated with both diagnostics diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index cee59061..0222dbba 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -120,7 +120,8 @@ describe('mapRustDiagnosticToVsCode', () => { // One related information for the original definition const relatedInformation = diagnostic.relatedInformation; if (!relatedInformation) { - return assert.fail('Related information unexpectedly undefined'); + assert.fail('Related information unexpectedly undefined'); + return; } assert.strictEqual(relatedInformation.length, 1); const [related] = relatedInformation; @@ -154,7 +155,8 @@ describe('mapRustDiagnosticToVsCode', () => { // One related information for the lint definition const relatedInformation = diagnostic.relatedInformation; if (!relatedInformation) { - return assert.fail('Related information unexpectedly undefined'); + assert.fail('Related information unexpectedly undefined'); + return; } assert.strictEqual(relatedInformation.length, 1); const [related] = relatedInformation; diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 9ddf5634..f0fd2354 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -8,7 +8,8 @@ "rootDir": "src", "strict": true, "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "noImplicitReturns": true }, "exclude": ["node_modules", ".vscode-test"] } From fa28eb7165a9845e6ba1d1c9a78a30be96497f69 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Thu, 12 Dec 2019 00:51:28 +0900 Subject: [PATCH 219/819] Enable noFallthroughCasesInSwitch option for vscode extension --- rust-analyzer/editors/code/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index f0fd2354..5e11c377 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -9,7 +9,8 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noImplicitReturns": true + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true }, "exclude": ["node_modules", ".vscode-test"] } From a1f657c0e981025c751205a350ae7709d2c24e5f Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 13 Dec 2019 18:16:34 +0800 Subject: [PATCH 220/819] Support setting cargo features --- rust-analyzer/editors/code/package.json | 15 +++++ rust-analyzer/editors/code/src/config.ts | 70 +++++++++++++++++++----- rust-analyzer/editors/code/src/server.ts | 1 + 3 files changed, 73 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7bc08ec3..8ed95fda 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -278,6 +278,21 @@ "type": "number", "default": 20, "description": "Maximum length for inlay hints" + }, + "rust-analyzer.cargoFeatures.noDefaultFeatures": { + "type": "boolean", + "default": false, + "description": "Do not activate the `default` feature" + }, + "rust-analyzer.cargoFeatures.allFeatures": { + "type": "boolean", + "default": false, + "description": "Activate all available features" + }, + "rust-analyzer.cargoFeatures.features": { + "type": "array", + "default": [], + "description": "List of features to activate" } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 2d3b6a54..6d709f7a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -15,6 +15,12 @@ export interface CargoWatchOptions { ignore: string[]; } +export interface CargoFeatures { + noDefaultFeatures: boolean; + allFeatures: boolean; + features: string[]; +} + export class Config { public highlightingOn = true; public rainbowHighlightingOn = false; @@ -35,8 +41,14 @@ export class Config { command: '', ignore: [], }; + public cargoFeatures: CargoFeatures = { + noDefaultFeatures: false, + allFeatures: false, + features: [], + }; private prevEnhancedTyping: null | boolean = null; + private prevCargoFeatures: null | CargoFeatures = null; constructor() { vscode.workspace.onDidChangeConfiguration(_ => @@ -47,6 +59,8 @@ export class Config { public userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); + let requireReloadMessage = null; + if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; } @@ -74,19 +88,7 @@ export class Config { } if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { - const reloadAction = 'Reload now'; - vscode.window - .showInformationMessage( - 'Changing enhanced typing setting requires a reload', - reloadAction, - ) - .then(selectedAction => { - if (selectedAction === reloadAction) { - vscode.commands.executeCommand( - 'workbench.action.reloadWindow', - ); - } - }); + requireReloadMessage = 'Changing enhanced typing setting requires a reload'; this.prevEnhancedTyping = this.enableEnhancedTyping; } @@ -153,5 +155,47 @@ export class Config { if (config.has('withSysroot')) { this.withSysroot = config.get('withSysroot') || false; } + + if (config.has('cargoFeatures.noDefaultFeatures')) { + this.cargoFeatures.noDefaultFeatures = config.get( + 'cargoFeatures.noDefaultFeatures', + false, + ); + } + if (config.has('cargoFeatures.allFeatures')) { + this.cargoFeatures.allFeatures = config.get( + 'cargoFeatures.allFeatures', + false, + ); + } + if (config.has('cargoFeatures.features')) { + this.cargoFeatures.features = config.get( + 'cargoFeatures.features', + [], + ); + } + + if (this.prevCargoFeatures !== null && ( + this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures || + this.cargoFeatures.noDefaultFeatures !== this.prevCargoFeatures.noDefaultFeatures || + this.cargoFeatures.features.length !== this.prevCargoFeatures.features.length || + this.cargoFeatures.features.some((v, i) => v !== this.prevCargoFeatures!.features[i]) + )) { + requireReloadMessage = 'Changing cargo features requires a reload'; + } + this.prevCargoFeatures = { ...this.cargoFeatures }; + + if (requireReloadMessage !== null) { + const reloadAction = 'Reload now'; + vscode.window + .showInformationMessage(requireReloadMessage, reloadAction) + .then(selectedAction => { + if (selectedAction === reloadAction) { + vscode.commands.executeCommand( + 'workbench.action.reloadWindow', + ); + } + }); + } } } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 2fe45f1e..5ace1d0f 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -59,6 +59,7 @@ export class Server { useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, withSysroot: Server.config.withSysroot, + cargoFeatures: Server.config.cargoFeatures, }, traceOutputChannel, }; From 55d1328dcb1bdaec437bb5db0bbcc13bfa0778b5 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 14 Dec 2019 00:48:47 +0800 Subject: [PATCH 221/819] Enable `allFeatures` by default and fix lints --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 25 +++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8ed95fda..e3bb07be 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -286,7 +286,7 @@ }, "rust-analyzer.cargoFeatures.allFeatures": { "type": "boolean", - "default": false, + "default": true, "description": "Activate all available features" }, "rust-analyzer.cargoFeatures.features": { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 6d709f7a..defdfeb9 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -43,7 +43,7 @@ export class Config { }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, - allFeatures: false, + allFeatures: true, features: [], }; @@ -88,7 +88,8 @@ export class Config { } if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { - requireReloadMessage = 'Changing enhanced typing setting requires a reload'; + requireReloadMessage = + 'Changing enhanced typing setting requires a reload'; this.prevEnhancedTyping = this.enableEnhancedTyping; } @@ -165,7 +166,7 @@ export class Config { if (config.has('cargoFeatures.allFeatures')) { this.cargoFeatures.allFeatures = config.get( 'cargoFeatures.allFeatures', - false, + true, ); } if (config.has('cargoFeatures.features')) { @@ -175,12 +176,18 @@ export class Config { ); } - if (this.prevCargoFeatures !== null && ( - this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures || - this.cargoFeatures.noDefaultFeatures !== this.prevCargoFeatures.noDefaultFeatures || - this.cargoFeatures.features.length !== this.prevCargoFeatures.features.length || - this.cargoFeatures.features.some((v, i) => v !== this.prevCargoFeatures!.features[i]) - )) { + if ( + this.prevCargoFeatures !== null && + (this.cargoFeatures.allFeatures !== + this.prevCargoFeatures.allFeatures || + this.cargoFeatures.noDefaultFeatures !== + this.prevCargoFeatures.noDefaultFeatures || + this.cargoFeatures.features.length !== + this.prevCargoFeatures.features.length || + this.cargoFeatures.features.some( + (v, i) => v !== this.prevCargoFeatures!.features[i], + )) + ) { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; From 4d73bca225cf949f5664c40eda3030bccfd8907d Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sat, 14 Dec 2019 13:24:07 +0200 Subject: [PATCH 222/819] added decorations --- rust-analyzer/editors/code/package.json | 56 ++++++++++++++++++- .../editors/code/src/highlighting.ts | 6 ++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7bc08ec3..c24e73d2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -422,6 +422,33 @@ "highContrast": "#B5CEA8" } }, + { + "id": "ralsp.literal.numeric", + "description": "Color for numeric literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, + { + "id": "ralsp.literal.char", + "description": "Color for character literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, + { + "id": "ralsp.literal.byte", + "description": "Color for byte literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, { "id": "ralsp.macro", "description": "Color for macros", @@ -442,7 +469,34 @@ }, { "id": "ralsp.type", - "description": "Color for types", + "description": "Color for other types (traits, aliases..)", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.builtin", + "description": "Color for built-in types (&str, bool, u16, u32)", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.self", + "description": "Color for `Self` param type", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.param", + "description": "Color for type parameters", "defaults": { "dark": "#4EC9B0", "light": "#267F99", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 6d50a2f2..2c8a98aa 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -53,10 +53,16 @@ export class Highlighter { decoration('parameter'), decoration('constant'), decoration('type'), + decoration('type.self'), + decoration('type.generic'), + decoration('type.param'), decoration('builtin'), decoration('text'), decoration('attribute'), decoration('literal'), + decoration('literal.numeric'), + decoration('literal.char'), + decoration('literal.byte'), decoration('macro'), decoration('variable'), decoration('variable.mut', 'underline'), From f5b547ac6a30a05b9f5d3aeb8bcda6fe6f7c8e5a Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sat, 14 Dec 2019 13:29:42 +0200 Subject: [PATCH 223/819] removed `type.alias` --- rust-analyzer/editors/code/package.json | 9 +++++++++ rust-analyzer/editors/code/src/highlighting.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c24e73d2..68b3b6e0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -485,6 +485,15 @@ "highContrast": "#4EC9B0" } }, + { + "id": "ralsp.type.lifetime", + "description": "Color for `Self` param type", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, { "id": "ralsp.type.self", "description": "Color for `Self` param type", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 2c8a98aa..d7c0ae13 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -56,6 +56,7 @@ export class Highlighter { decoration('type.self'), decoration('type.generic'), decoration('type.param'), + decoration('type.lifetime'), decoration('builtin'), decoration('text'), decoration('attribute'), From 2ec37eb1ad009b2fdeb70eb8680eb5455a5c9869 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 15:07:33 +0200 Subject: [PATCH 224/819] make drive comparison case-insensitive. --- .../code/src/notifications/publish_decorations.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index 00ffb777..120eabbc 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -10,10 +10,19 @@ export interface PublishDecorationsParams { export function handle(params: PublishDecorationsParams) { const targetEditor = vscode.window.visibleTextEditors.find( - editor => editor.document.uri.toString() === params.uri, + editor => { + const unescapedUri = unescape(editor.document.uri.toString()); + // Unescaped URI should be something like: + // file:///c:/Workspace/ra-test/src/main.rs + // RA server might send it with the drive letter uppercased, so we force only the drive letter to lowercase. + const uriWithLowercasedDrive = params.uri.substr(0, 8) + params.uri[8].toLowerCase() + params.uri.substr(9); + return unescapedUri === uriWithLowercasedDrive + } ); + if (!Server.config.highlightingOn || !targetEditor) { return; } + Server.highlighter.setHighlights(targetEditor, params.decorations); } From ffa8c18c09f45b560eb7d1047ed949c681cb12b9 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 16:51:57 +0200 Subject: [PATCH 225/819] Lowercase drive letters on windows before sending to extension. --- .../editors/code/src/notifications/publish_decorations.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index 120eabbc..4441e2b2 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -15,8 +15,7 @@ export function handle(params: PublishDecorationsParams) { // Unescaped URI should be something like: // file:///c:/Workspace/ra-test/src/main.rs // RA server might send it with the drive letter uppercased, so we force only the drive letter to lowercase. - const uriWithLowercasedDrive = params.uri.substr(0, 8) + params.uri[8].toLowerCase() + params.uri.substr(9); - return unescapedUri === uriWithLowercasedDrive + return unescapedUri === params.uri } ); From ab9e86d50d6817d184b5035038536b023a7007ef Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 16:55:39 +0200 Subject: [PATCH 226/819] fixed comment --- .../editors/code/src/notifications/publish_decorations.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index 4441e2b2..2ccd2d58 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -12,9 +12,8 @@ export function handle(params: PublishDecorationsParams) { const targetEditor = vscode.window.visibleTextEditors.find( editor => { const unescapedUri = unescape(editor.document.uri.toString()); - // Unescaped URI should be something like: + // Unescaped URI looks like: // file:///c:/Workspace/ra-test/src/main.rs - // RA server might send it with the drive letter uppercased, so we force only the drive letter to lowercase. return unescapedUri === params.uri } ); From 2ee91558c7e293ea7fbc4e3ed0aa6d96477b72cc Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 17:10:39 +0200 Subject: [PATCH 227/819] `npm run fix` --- .../code/src/notifications/publish_decorations.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts index 2ccd2d58..f23e286a 100644 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts @@ -9,14 +9,12 @@ export interface PublishDecorationsParams { } export function handle(params: PublishDecorationsParams) { - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape(editor.document.uri.toString()); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri - } - ); + const targetEditor = vscode.window.visibleTextEditors.find(editor => { + const unescapedUri = unescape(editor.document.uri.toString()); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; + }); if (!Server.config.highlightingOn || !targetEditor) { return; From 79d09d80823b266f6719e512433543d987bdfeae Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sun, 15 Dec 2019 17:12:52 +0100 Subject: [PATCH 228/819] Add a rudimentary json regex to get at information like `endLine` --- rust-analyzer/editors/code/package.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 43db61a8..ebb1b4a9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -313,6 +313,18 @@ "column": 3 } ] + }, + { + "name": "rustc-json", + "patterns": [{ + "regexp": "^.*\"message\":{\"message\":\"([^\"]*).*?\"file_name\":\"([^\"]+).*?\"line_start\":(\\d+).*?\"line_end\":(\\d+).*?\"column_start\":(\\d+).*?\"column_end\":(\\d+).*}$", + "message": 1, + "file": 2, + "line": 3, + "endLine": 4, + "column": 5, + "endColumn": 6 + }] } ], "problemMatchers": [ @@ -324,6 +336,14 @@ ], "pattern": "$rustc" }, + { + "name": "rustc-json", + "fileLocation": [ + "relative", + "${workspaceRoot}" + ], + "pattern": "$rustc-json" + }, { "name": "rustc-watch", "fileLocation": [ From a113d4a337ee293c149cc4ac41dd553ecfb01890 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sun, 15 Dec 2019 17:19:41 +0100 Subject: [PATCH 229/819] Properly format json --- rust-analyzer/editors/code/package.json | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ebb1b4a9..9290599c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -316,15 +316,17 @@ }, { "name": "rustc-json", - "patterns": [{ - "regexp": "^.*\"message\":{\"message\":\"([^\"]*).*?\"file_name\":\"([^\"]+).*?\"line_start\":(\\d+).*?\"line_end\":(\\d+).*?\"column_start\":(\\d+).*?\"column_end\":(\\d+).*}$", - "message": 1, - "file": 2, - "line": 3, - "endLine": 4, - "column": 5, - "endColumn": 6 - }] + "patterns": [ + { + "regexp": "^.*\"message\":{\"message\":\"([^\"]*).*?\"file_name\":\"([^\"]+).*?\"line_start\":(\\d+).*?\"line_end\":(\\d+).*?\"column_start\":(\\d+).*?\"column_end\":(\\d+).*}$", + "message": 1, + "file": 2, + "line": 3, + "endLine": 4, + "column": 5, + "endColumn": 6 + } + ] } ], "problemMatchers": [ From 9562d6227b5e2cd80ea09fef1ff51e1787d4e8ec Mon Sep 17 00:00:00 2001 From: Vadzim Dambrouski Date: Sun, 15 Dec 2019 23:02:13 +0530 Subject: [PATCH 230/819] Add option to disable all-targets. Can be useful in embedded. --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/commands/cargo_watch.ts | 5 ++++- rust-analyzer/editors/code/src/config.ts | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9290599c..df8e9eec 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,6 +237,11 @@ "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", "default": [] }, + "rust-analyzer.cargo-watch.allTargets": { + "type": "boolean", + "description": "Check all targets and tests (will be passed as `--all-targets`)", + "default": true + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 512362eb..45f1dd49 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -83,7 +83,10 @@ export class CargoWatchProvider implements vscode.Disposable { let args = Server.config.cargoWatchOptions.command + - ' --all-targets --message-format json'; + ' --message-format json'; + if (Server.config.cargoWatchOptions.allTargets) { + args += ' --all-targets'; + } if (Server.config.cargoWatchOptions.command.length > 0) { // Excape the double quote string: args += ' ' + Server.config.cargoWatchOptions.arguments; diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index defdfeb9..a6e0f645 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -13,6 +13,7 @@ export interface CargoWatchOptions { command: string; trace: CargoWatchTraceOptions; ignore: string[]; + allTargets: boolean; } export interface CargoFeatures { @@ -40,6 +41,7 @@ export class Config { arguments: '', command: '', ignore: [], + allTargets: true, }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, @@ -132,6 +134,13 @@ export class Config { ); } + if (config.has('cargo-watch.allTargets')) { + this.cargoWatchOptions.allTargets = config.get( + 'cargo-watch.allTargets', + true, + ); + } + if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } From 4e311d797ccaad9bd23806811f54bb2b7b5b8cb0 Mon Sep 17 00:00:00 2001 From: Vadzim Dambrouski Date: Mon, 16 Dec 2019 09:01:38 +0530 Subject: [PATCH 231/819] Fix formatting --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 45f1dd49..748be535 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -82,8 +82,7 @@ export class CargoWatchProvider implements vscode.Disposable { } let args = - Server.config.cargoWatchOptions.command + - ' --message-format json'; + Server.config.cargoWatchOptions.command + ' --message-format json'; if (Server.config.cargoWatchOptions.allTargets) { args += ' --all-targets'; } From cfc862d8d38754d34aa8b08aa076e0f703d254ff Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Mon, 16 Dec 2019 17:32:46 +0200 Subject: [PATCH 232/819] Fixed a typo thanks @lnicola --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9290599c..d6d47e3a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -524,7 +524,7 @@ }, { "id": "ralsp.type.lifetime", - "description": "Color for `Self` param type", + "description": "Color for lifetimes parameters", "defaults": { "dark": "#4EC9B0", "light": "#267F99", From 5078a7782fea3c52d8a769600cd2071ecd2f618a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 17 Dec 2019 12:41:44 +0100 Subject: [PATCH 233/819] Default to client watching on VS Code --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9290599c..34bc81d5 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -219,7 +219,7 @@ }, "rust-analyzer.useClientWatching": { "type": "boolean", - "default": false, + "default": true, "description": "client provided file watching instead of notify watching." }, "rust-analyzer.cargo-watch.arguments": { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index defdfeb9..df15c817 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -30,7 +30,7 @@ export class Config { public displayInlayHints = true; public maxInlayHintLength: null | number = null; public excludeGlobs = []; - public useClientWatching = false; + public useClientWatching = true; public featureFlags = {}; // for internal use public withSysroot: null | boolean = null; @@ -148,7 +148,7 @@ export class Config { this.excludeGlobs = config.get('excludeGlobs') || []; } if (config.has('useClientWatching')) { - this.useClientWatching = config.get('useClientWatching') || false; + this.useClientWatching = config.get('useClientWatching') || true; } if (config.has('featureFlags')) { this.featureFlags = config.get('featureFlags') || {}; From c413927ab778980d96d45bca78285af33d24aff4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 17 Dec 2019 14:43:37 +0100 Subject: [PATCH 234/819] Fix highlighting token names --- rust-analyzer/editors/code/src/highlighting.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d7c0ae13..e1b0d13e 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -52,12 +52,12 @@ export class Highlighter { decoration('function'), decoration('parameter'), decoration('constant'), - decoration('type'), - decoration('type.self'), + decoration('type.builtin'), decoration('type.generic'), - decoration('type.param'), decoration('type.lifetime'), - decoration('builtin'), + decoration('type.param'), + decoration('type.self'), + decoration('type'), decoration('text'), decoration('attribute'), decoration('literal'), From 143bf4d93ef099a1934064078ca9568ef4ffab1f Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 17 Dec 2019 23:48:26 +0800 Subject: [PATCH 235/819] use pretter settings in ts-lint --- rust-analyzer/editors/code/package-lock.json | 39 ++++++++++++++++++++ rust-analyzer/editors/code/package.json | 3 +- rust-analyzer/editors/code/tslint.json | 8 +++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b1baa437..127cdcfa 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -466,6 +466,16 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint-plugin-prettier": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz", + "integrity": "sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA==", + "dev": true, + "requires": { + "fast-diff": "^1.1.1", + "jest-docblock": "^21.0.0" + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -484,6 +494,12 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -712,6 +728,12 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "jest-docblock": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", + "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -728,6 +750,12 @@ "esprima": "^4.0.0" } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -1413,6 +1441,17 @@ "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", "dev": true }, + "tslint-plugin-prettier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz", + "integrity": "sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw==", + "dev": true, + "requires": { + "eslint-plugin-prettier": "^2.2.0", + "lines-and-columns": "^1.1.6", + "tslib": "^1.7.1" + } + }, "tsutils": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9290599c..ad1ba82e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -48,11 +48,12 @@ "rollup": "^1.27.9", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-typescript": "^1.0.1", "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-typescript": "^1.0.1", "shx": "^0.3.1", "tslint": "^5.20.1", "tslint-config-prettier": "^1.18.0", + "tslint-plugin-prettier": "^2.0.1", "typescript": "^3.7.3", "vsce": "^1.70.0", "vscode-test": "^1.2.3" diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index b69c5574..f06fa5fa 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -1,9 +1,13 @@ { "defaultSeverity": "error", - "extends": ["tslint:recommended", "tslint-config-prettier"], + "extends": [ + "tslint:recommended", + "tslint-config-prettier", + "tslint-plugin-prettier" + ], "rules": { - "quotemark": [true, "single"], "interface-name": false, + "prettier": true, "object-literal-sort-keys": false, // Allow `_bar` to sort with tsc's `noUnusedParameters` option "variable-name": [true, "allow-leading-underscore"] From 7b3d160fb3c866709f8c4269028423bd9fa65785 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 17 Dec 2019 13:50:00 +0800 Subject: [PATCH 236/819] Add macro span handling --- .../code/src/utils/diagnostics/rust.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts index b6efc0f5..1f0c0d3e 100644 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts @@ -10,6 +10,12 @@ export enum SuggestionApplicability { Unspecified = 'Unspecified', } +export interface RustDiagnosticSpanMacroExpansion { + span: RustDiagnosticSpan; + macro_decl_name: string; + def_site_span?: RustDiagnosticSpan; +} + // Reference: // https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs export interface RustDiagnosticSpan { @@ -20,6 +26,7 @@ export interface RustDiagnosticSpan { is_primary: boolean; file_name: string; label?: string; + expansion?: RustDiagnosticSpanMacroExpansion; suggested_replacement?: string; suggestion_applicability?: SuggestionApplicability; } @@ -60,10 +67,41 @@ function mapLevelToSeverity(s: string): vscode.DiagnosticSeverity { return vscode.DiagnosticSeverity.Information; } +/** + * Check whether a file name is from macro invocation + */ +function isFromMacro(fileName: string): boolean { + return fileName.startsWith('<') && fileName.endsWith('>'); +} + +/** + * Converts a Rust macro span to a VsCode location recursively + */ +function mapMacroSpanToLocation( + spanMacro: RustDiagnosticSpanMacroExpansion, +): vscode.Location | undefined { + if (!isFromMacro(spanMacro.span.file_name)) { + return mapSpanToLocation(spanMacro.span); + } + + if (spanMacro.span.expansion) { + return mapMacroSpanToLocation(spanMacro.span.expansion); + } + + return; +} + /** * Converts a Rust span to a VsCode location */ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { + if (isFromMacro(span.file_name) && span.expansion) { + const macroLoc = mapMacroSpanToLocation(span.expansion); + if (macroLoc) { + return macroLoc; + } + } + const fileName = path.join(vscode.workspace.rootPath || '', span.file_name); const fileUri = vscode.Uri.file(fileName); From 422ea46d56f2a07b4b29e42d0247daf6a650cb8f Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 17 Dec 2019 13:50:08 +0800 Subject: [PATCH 237/819] Add tests --- .../rust-diagnostics/error/E0277.json | 261 ++++++++++++++++++ .../src/test/utils/diagnotics/rust.test.ts | 34 +++ 2 files changed, 295 insertions(+) create mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json new file mode 100644 index 00000000..bfef33c7 --- /dev/null +++ b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json @@ -0,0 +1,261 @@ +{ + "rendered": "error[E0277]: can't compare `{integer}` with `&str`\n --> src/main.rs:2:5\n |\n2 | assert_eq!(1, \"love\");\n | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `{integer} == &str`\n |\n = help: the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`\n = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n", + "children": [ + { + "children": [], + "code": null, + "level": "help", + "message": "the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", + "rendered": null, + "spans": [] + } + ], + "code": { + "code": "E0277", + "explanation": "\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func(foo: T) {\n foo.bar();\n}\n\nfn main() {\n // we now call the method with the i32 type, which doesn't implement\n // the Foo trait\n some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n fn bar(&self);\n}\n\nfn some_func(foo: T) {\n foo.bar(); // we can now use this method since i32 implements the\n // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n fn bar(&self) {}\n}\n\nfn main() {\n some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func(foo: T) {\n println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n // implemented for the type `T`\n}\n\nfn main() {\n // We now call the method with the i32 type,\n // which *does* implement the Debug trait.\n some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func(foo: T) {\n println!(\"{:?}\", foo);\n}\n\nfn main() {\n // Calling the method is still fine, as i32 implements Debug.\n some_func(5i32);\n\n // This would fail to compile now:\n // struct WithoutDebug;\n // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n" + }, + "level": "error", + "message": "can't compare `{integer}` with `&str`", + "spans": [ + { + "byte_end": 155, + "byte_start": 153, + "column_end": 33, + "column_start": 31, + "expansion": { + "def_site_span": { + "byte_end": 940, + "byte_start": 0, + "column_end": 6, + "column_start": 1, + "expansion": null, + "file_name": "<::core::macros::assert_eq macros>", + "is_primary": false, + "label": null, + "line_end": 36, + "line_start": 1, + "suggested_replacement": null, + "suggestion_applicability": null, + "text": [ + { + "highlight_end": 35, + "highlight_start": 1, + "text": "($ left : expr, $ right : expr) =>" + }, + { + "highlight_end": 3, + "highlight_start": 1, + "text": "({" + }, + { + "highlight_end": 33, + "highlight_start": 1, + "text": " match (& $ left, & $ right)" + }, + { + "highlight_end": 7, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 34, + "highlight_start": 1, + "text": " (left_val, right_val) =>" + }, + { + "highlight_end": 11, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 46, + "highlight_start": 1, + "text": " if ! (* left_val == * right_val)" + }, + { + "highlight_end": 15, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 25, + "highlight_start": 1, + "text": " panic !" + }, + { + "highlight_end": 57, + "highlight_start": 1, + "text": " (r#\"assertion failed: `(left == right)`" + }, + { + "highlight_end": 16, + "highlight_start": 1, + "text": " left: `{:?}`," + }, + { + "highlight_end": 18, + "highlight_start": 1, + "text": " right: `{:?}`\"#," + }, + { + "highlight_end": 47, + "highlight_start": 1, + "text": " & * left_val, & * right_val)" + }, + { + "highlight_end": 15, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 11, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 7, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 42, + "highlight_start": 1, + "text": " }) ; ($ left : expr, $ right : expr,) =>" + }, + { + "highlight_end": 49, + "highlight_start": 1, + "text": "({ $ crate :: assert_eq ! ($ left, $ right) }) ;" + }, + { + "highlight_end": 53, + "highlight_start": 1, + "text": "($ left : expr, $ right : expr, $ ($ arg : tt) +) =>" + }, + { + "highlight_end": 3, + "highlight_start": 1, + "text": "({" + }, + { + "highlight_end": 37, + "highlight_start": 1, + "text": " match (& ($ left), & ($ right))" + }, + { + "highlight_end": 7, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 34, + "highlight_start": 1, + "text": " (left_val, right_val) =>" + }, + { + "highlight_end": 11, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 46, + "highlight_start": 1, + "text": " if ! (* left_val == * right_val)" + }, + { + "highlight_end": 15, + "highlight_start": 1, + "text": " {" + }, + { + "highlight_end": 25, + "highlight_start": 1, + "text": " panic !" + }, + { + "highlight_end": 57, + "highlight_start": 1, + "text": " (r#\"assertion failed: `(left == right)`" + }, + { + "highlight_end": 16, + "highlight_start": 1, + "text": " left: `{:?}`," + }, + { + "highlight_end": 22, + "highlight_start": 1, + "text": " right: `{:?}`: {}\"#," + }, + { + "highlight_end": 72, + "highlight_start": 1, + "text": " & * left_val, & * right_val, $ crate :: format_args !" + }, + { + "highlight_end": 33, + "highlight_start": 1, + "text": " ($ ($ arg) +))" + }, + { + "highlight_end": 15, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 11, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 7, + "highlight_start": 1, + "text": " }" + }, + { + "highlight_end": 6, + "highlight_start": 1, + "text": " }) ;" + } + ] + }, + "macro_decl_name": "assert_eq!", + "span": { + "byte_end": 38, + "byte_start": 16, + "column_end": 27, + "column_start": 5, + "expansion": null, + "file_name": "src/main.rs", + "is_primary": false, + "label": null, + "line_end": 2, + "line_start": 2, + "suggested_replacement": null, + "suggestion_applicability": null, + "text": [ + { + "highlight_end": 27, + "highlight_start": 5, + "text": " assert_eq!(1, \"love\");" + } + ] + } + }, + "file_name": "<::core::macros::assert_eq macros>", + "is_primary": true, + "label": "no implementation for `{integer} == &str`", + "line_end": 7, + "line_start": 7, + "suggested_replacement": null, + "suggestion_applicability": null, + "text": [ + { + "highlight_end": 33, + "highlight_start": 31, + "text": " if ! (* left_val == * right_val)" + } + ] + } + ] +} diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index 0222dbba..9acd319b 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -199,4 +199,38 @@ describe('mapRustDiagnosticToVsCode', () => { // There are no suggested fixes assert.strictEqual(suggestedFixes.length, 0); }); + + it('should map a macro invocation location to normal file path', () => { + const { location, diagnostic, suggestedFixes } = mapFixtureToVsCode( + 'error/E0277', + ); + + assert.strictEqual( + diagnostic.severity, + vscode.DiagnosticSeverity.Error, + ); + assert.strictEqual( + diagnostic.message, + [ + 'can\'t compare `{integer}` with `&str`', + 'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`', + ].join('\n'), + ); + assert.strictEqual(diagnostic.code, 'E0277'); + assert.strictEqual(diagnostic.source, 'rustc'); + assert.deepStrictEqual(diagnostic.tags, []); + + // No related information + assert.deepStrictEqual(diagnostic.relatedInformation, []); + + // There are no suggested fixes + assert.strictEqual(suggestedFixes.length, 0); + + // The file url should be normal file + // Ignore the first part because it depends on vs workspace location + assert.strictEqual( + true, + location.uri.toString().endsWith('src/main.rs'), + ); + }); }); From c68828bc96253a61dbb2baeb603a9c4163a7d12c Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 17 Dec 2019 21:43:19 +0800 Subject: [PATCH 238/819] Use substr instead of endswith --- .../editors/code/src/test/utils/diagnotics/rust.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts index 9acd319b..358325cc 100644 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -212,7 +212,7 @@ describe('mapRustDiagnosticToVsCode', () => { assert.strictEqual( diagnostic.message, [ - 'can\'t compare `{integer}` with `&str`', + "can't compare `{integer}` with `&str`", 'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`', ].join('\n'), ); @@ -229,8 +229,8 @@ describe('mapRustDiagnosticToVsCode', () => { // The file url should be normal file // Ignore the first part because it depends on vs workspace location assert.strictEqual( - true, - location.uri.toString().endsWith('src/main.rs'), + location.uri.path.substr(-'src/main.rs'.length), + 'src/main.rs', ); }); }); From 7fee8d05cd9bdd424fad4a48c6b46f640abf89a7 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 8 Dec 2019 00:54:18 +0200 Subject: [PATCH 239/819] Omit default parameter types --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 6 ++++++ rust-analyzer/editors/code/src/server.ts | 2 ++ 3 files changed, 13 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f2e8e647..bda0002b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -285,6 +285,11 @@ "default": 20, "description": "Maximum length for inlay hints" }, + "rust-analyzer.showDefaultTypesInInlayHints": { + "type": "boolean", + "default": false, + "description": "Display default types in inlay hints" + }, "rust-analyzer.cargoFeatures.noDefaultFeatures": { "type": "boolean", "default": false, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e131f09d..26bf30e7 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -30,6 +30,7 @@ export class Config { public lruCapacity: null | number = null; public displayInlayHints = true; public maxInlayHintLength: null | number = null; + public showDefaultTypesInInlayHints = false; public excludeGlobs = []; public useClientWatching = true; public featureFlags = {}; @@ -153,6 +154,11 @@ export class Config { 'maxInlayHintLength', ) as number; } + if (config.has('showDefaultTypesInInlayHints')) { + this.showDefaultTypesInInlayHints = config.get( + 'showDefaultTypesInInlayHints', + ) as boolean; + } if (config.has('excludeGlobs')) { this.excludeGlobs = config.get('excludeGlobs') || []; } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 5ace1d0f..e7d1df94 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -55,6 +55,8 @@ export class Server { publishDecorations: true, lruCapacity: Server.config.lruCapacity, maxInlayHintLength: Server.config.maxInlayHintLength, + showDefaultTypesInInlayHints: + Server.config.showDefaultTypesInInlayHints, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, From cee9d14cacc771808f5ffbca1cd9c5e0a7d816d2 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Dec 2019 16:18:09 +0200 Subject: [PATCH 240/819] Do not add any new configuration parameters --- rust-analyzer/editors/code/src/config.ts | 6 ------ rust-analyzer/editors/code/src/server.ts | 2 -- 2 files changed, 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 26bf30e7..e131f09d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -30,7 +30,6 @@ export class Config { public lruCapacity: null | number = null; public displayInlayHints = true; public maxInlayHintLength: null | number = null; - public showDefaultTypesInInlayHints = false; public excludeGlobs = []; public useClientWatching = true; public featureFlags = {}; @@ -154,11 +153,6 @@ export class Config { 'maxInlayHintLength', ) as number; } - if (config.has('showDefaultTypesInInlayHints')) { - this.showDefaultTypesInInlayHints = config.get( - 'showDefaultTypesInInlayHints', - ) as boolean; - } if (config.has('excludeGlobs')) { this.excludeGlobs = config.get('excludeGlobs') || []; } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index e7d1df94..5ace1d0f 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -55,8 +55,6 @@ export class Server { publishDecorations: true, lruCapacity: Server.config.lruCapacity, maxInlayHintLength: Server.config.maxInlayHintLength, - showDefaultTypesInInlayHints: - Server.config.showDefaultTypesInInlayHints, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, From 3bac1e0b2ebc62a36457f4185e42b35734dcb72b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Dec 2019 17:11:07 +0200 Subject: [PATCH 241/819] Remove the setting change reminder --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index bda0002b..f2e8e647 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -285,11 +285,6 @@ "default": 20, "description": "Maximum length for inlay hints" }, - "rust-analyzer.showDefaultTypesInInlayHints": { - "type": "boolean", - "default": false, - "description": "Display default types in inlay hints" - }, "rust-analyzer.cargoFeatures.noDefaultFeatures": { "type": "boolean", "default": false, From f67378556bb0f9a1502b2d59cea77f9940d14f53 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Fri, 20 Dec 2019 13:52:11 -0500 Subject: [PATCH 242/819] Update to latest packages --- rust-analyzer/editors/code/package-lock.json | 50 ++++++++++---------- rust-analyzer/editors/code/package.json | 16 +++---- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 127cdcfa..4c5c1364 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -60,9 +60,9 @@ "dev": true }, "@types/node": { - "version": "10.17.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.6.tgz", - "integrity": "sha512-0a2X6cgN3RdPBL2MIlR6Lt0KlM7fOFsutuXcdglcOq6WvLnYXgPQSh0Mx6tO1KCAE8MxbHSOSTWDoUxRq+l3DA==", + "version": "12.12.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.21.tgz", + "integrity": "sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==", "dev": true }, "@types/resolve": { @@ -81,9 +81,9 @@ "dev": true }, "@types/vscode": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.40.0.tgz", - "integrity": "sha512-5kEIxL3qVRkwhlMerxO7XuMffa+0LBl+iG2TcRa0NsdoeSFLkt/9hJ02jsi/Kvc6y8OVF2N2P2IHP5S4lWf/5w==", + "version": "1.41.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.41.0.tgz", + "integrity": "sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A==", "dev": true }, "acorn": { @@ -791,9 +791,9 @@ } }, "lookpath": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.0.3.tgz", - "integrity": "sha512-XIdgzlX26g10XnzyZdO/4obybEmfGnZyWQZ2DgmmEfVB79X+n3lhUoIzMe501C6s7RmCpAo66OPegWc+CsxYMg==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.0.4.tgz", + "integrity": "sha512-xVFrWlfo7n8VZs1YjBWKkbSIJU7DKE/0Mep62KeT94V1Ui1IY9w5fXfgiCsDIDZkakIYSXSeaW2FLbCqfw9/Cw==" }, "magic-string": { "version": "0.25.3", @@ -1140,9 +1140,9 @@ } }, "rollup": { - "version": "1.27.9", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.9.tgz", - "integrity": "sha512-8AfW4cJTPZfG6EXWwT/ujL4owUsDI1Xl8J1t+hvK4wDX81F5I4IbwP9gvGbHzxnV19fnU4rRABZQwZSX9J402Q==", + "version": "1.27.13", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.13.tgz", + "integrity": "sha512-hDi7M07MpmNSDE8YVwGVFA8L7n8jTLJ4lG65nMAijAyqBe//rtu4JdxjUBE7JqXfdpqxqDTbCDys9WcqdpsQvw==", "dev": true, "requires": { "@types/estree": "*", @@ -1514,9 +1514,9 @@ "dev": true }, "vsce": { - "version": "1.70.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.70.0.tgz", - "integrity": "sha512-mBTbVrWL348jODwfmaR+yXrlzb8EABGCT067C4shKOXriWiuMQi4/uCbFm6TUBcfnzTYLJv+DKa0VnKU8yEAjA==", + "version": "1.71.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", + "integrity": "sha512-7k+LPC4oJYPyyxs0a5nh4A8CleQ6+2EMPiAiX/bDyN+PmwJFm2FFPqLRxdIsIWfFnkW4ZMQBf10+W62dCRd9kQ==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", @@ -1547,12 +1547,12 @@ "integrity": "sha512-k9akfglxWgr0dtLNscq2uBq48XJwnhf4EaDxn05KQowRwR0DkNML0zeYqFRLtXZe6x5vpL5ppyu4o6GqL+23YQ==" }, "vscode-languageclient": { - "version": "6.0.0-next.8", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.8.tgz", - "integrity": "sha512-452jskmuT7YKYnPd5uh7aELK4M25OITcnBq4ylPIyUtE5LQRgA9N9pR9NrviTTX/Hh6q6VGzm70OK9SpMO/zcA==", + "version": "6.0.0-next.9", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.9.tgz", + "integrity": "sha512-NEpeeFM9FKrrRqlBHXGfwpkhtnjruDz3zfFBP+Cymr10qigAEtE/JsODJsIG/ErGqjh3/JXxu8SUOVTGu5oK+w==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.0-next.13" + "vscode-languageserver-protocol": "^3.15.0-next.14" }, "dependencies": { "semver": { @@ -1563,9 +1563,9 @@ } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.13", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.13.tgz", - "integrity": "sha512-2UGxOKc5VHav15n3zY5dtaOXGL/JuV0K2Mem/n6lhF8i3vaqIAnKv004SPU0flYHXIfCcQM7kCL+nwWVJ1K1qw==", + "version": "3.15.0-next.14", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.14.tgz", + "integrity": "sha512-xUwwno6Q6RFd2Z2EWV9D3dQlsKPnHyiZMNWq+EC7JJdp2WH1gRlD+KPX4UGRCnJK0WI5omqHV313IESPwRY5xA==", "requires": { "vscode-jsonrpc": "^5.0.0-next.5", "vscode-languageserver-types": "^3.15.0-next.9" @@ -1577,9 +1577,9 @@ "integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==" }, "vscode-test": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.2.3.tgz", - "integrity": "sha512-mKRTNso33NaUULiPBFg6zRjyntjcCpIgkrogyPQuKlvoQREQR8jLKN5UD4L5rkTSD+oBhcKtaLR2/g34FexURw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.3.0.tgz", + "integrity": "sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f2e8e647..f75fafeb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -13,7 +13,7 @@ "Other" ], "engines": { - "vscode": "^1.40.0" + "vscode": "^1.41.0" }, "scripts": { "vscode:prepublish": "npm run compile", @@ -32,20 +32,20 @@ "trailingComma": "all" }, "dependencies": { - "lookpath": "^1.0.3", + "lookpath": "^1.0.4", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.0.0-next.8" + "vscode-languageclient": "^6.0.0-next.9" }, "devDependencies": { "@types/glob": "^7.1.1", "@types/mocha": "^5.2.7", - "@types/node": "^10.17.6", + "@types/node": "^12.12.21", "@types/seedrandom": "^2.4.28", - "@types/vscode": "^1.40.0", + "@types/vscode": "^1.41.0", "glob": "^7.1.6", "mocha": "^6.2.2", "prettier": "^1.19.1", - "rollup": "^1.27.9", + "rollup": "^1.27.13", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.4.2", @@ -55,8 +55,8 @@ "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", "typescript": "^3.7.3", - "vsce": "^1.70.0", - "vscode-test": "^1.2.3" + "vsce": "^1.71.0", + "vscode-test": "^1.3.0" }, "activationEvents": [ "onLanguage:rust", From 9630c644181c91fff83e3b133162484d0a6fa142 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Fri, 20 Dec 2019 13:52:34 -0500 Subject: [PATCH 243/819] Protect against null as revealed by `npm test` --- rust-analyzer/editors/code/src/commands/cargo_watch.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts index 748be535..ac62bdd4 100644 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ b/rust-analyzer/editors/code/src/commands/cargo_watch.ts @@ -111,8 +111,13 @@ export class CargoWatchProvider implements vscode.Disposable { }, ); + if (!this.cargoProcess) { + vscode.window.showErrorMessage('Cargo Watch failed to start'); + return; + } + const stdoutData = new LineBuffer(); - this.cargoProcess.stdout.on('data', (s: string) => { + this.cargoProcess.stdout?.on('data', (s: string) => { stdoutData.processOutput(s, line => { this.logInfo(line); try { @@ -124,7 +129,7 @@ export class CargoWatchProvider implements vscode.Disposable { }); const stderrData = new LineBuffer(); - this.cargoProcess.stderr.on('data', (s: string) => { + this.cargoProcess.stderr?.on('data', (s: string) => { stderrData.processOutput(s, line => { this.logError('Error on cargo-watch : {\n' + line + '}\n'); }); From 1ba526edbf09993844cb375d7549f411c7895bf1 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 24 Dec 2019 00:04:36 +0100 Subject: [PATCH 244/819] Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r348716036 Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061/files/68a5ff050faf514e9d122212a66703ca8ce66ab7#r361019340 --- rust-analyzer/editors/code/package-lock.json | 5 +++++ rust-analyzer/editors/code/src/highlighting.ts | 4 ++-- rust-analyzer/editors/code/src/scopes.ts | 10 +++++----- rust-analyzer/editors/code/src/scopes_mapper.ts | 17 ++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 4c5c1364..67081f3f 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -750,6 +750,11 @@ "esprima": "^4.0.0" } }, + "jsonc-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", + "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 68eae094..4e224a54 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -26,7 +26,7 @@ function fancify(seed: string, shade: 'light' | 'dark') { } function createDecorationFromTextmate( - themeStyle: scopes.TextMateRuleSettings + themeStyle: scopes.TextMateRuleSettings, ): vscode.TextEditorDecorationType { const decorationOptions: vscode.DecorationRenderOptions = {}; decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; @@ -84,7 +84,7 @@ export class Highlighter { const color = new vscode.ThemeColor(fallBackTag); const decor = vscode.window.createTextEditorDecorationType({ color, - textDecoration + textDecoration, }); return [tag, decor]; } diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 8f288d76..cb250b85 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -58,10 +58,10 @@ function loadThemeNamed(themeName: string) { return extension.packageJSON.contributes.themes .filter( (element: any) => - (element.id || element.label) === themeName + (element.id || element.label) === themeName, ) .map((element: any) => - path.join(extension.extensionPath, element.path) + path.join(extension.extensionPath, element.path), ) .concat(list); }, Array()); @@ -71,7 +71,7 @@ function loadThemeNamed(themeName: string) { const tokenColorCustomizations: [any] = [ vscode.workspace .getConfiguration('editor') - .get('tokenColorCustomizations') + .get('tokenColorCustomizations'), ]; tokenColorCustomizations @@ -100,7 +100,7 @@ function loadThemeFile(themePath: string) { function mergeRuleSettings( defaultSetting: TextMateRuleSettings | undefined, - override: TextMateRuleSettings + override: TextMateRuleSettings, ): TextMateRuleSettings { if (defaultSetting === undefined) { return override; @@ -116,7 +116,7 @@ function mergeRuleSettings( function updateRules( scope: string, - updatedSettings: TextMateRuleSettings + updatedSettings: TextMateRuleSettings, ): void { [rules.get(scope)] .map(settings => mergeRuleSettings(settings, updatedSettings)) diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index 85c791ff..e738fa23 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -10,15 +10,15 @@ const defaultMapping = new Map([ 'comment', 'comment.block', 'comment.line', - 'comment.block.documentation' - ] + 'comment.block.documentation', + ], ], ['string', ['string']], ['keyword', ['keyword']], ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], [ 'keyword.unsafe', - ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'] + ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'], ], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], @@ -28,7 +28,7 @@ const defaultMapping = new Map([ ['text', ['string', 'string.quoted', 'string.regexp']], ['attribute', ['keyword']], ['literal', ['string', 'string.quoted', 'string.regexp']], - ['macro', ['support.other']], + ['macro', ['entity.name.function', 'keyword.other', 'entity.name.macro']], ['variable', ['variable']], ['variable.mut', ['variable', 'storage.modifier']], [ @@ -37,20 +37,19 @@ const defaultMapping = new Map([ 'variable.object.property', 'meta.field.declaration', 'meta.definition.property', - 'variable.other' - ] + 'variable.other', + ], ], - ['module', ['entity.name.section', 'entity.other']] + ['module', ['entity.name.section', 'entity.other']], ]); -// Temporary exported for debugging for now. export function find(scope: string): string[] { return mappings.get(scope) || []; } export function toRule( scope: string, - intoRule: (scope: string) => TextMateRuleSettings | undefined + intoRule: (scope: string) => TextMateRuleSettings | undefined, ): TextMateRuleSettings | undefined { return find(scope) .map(intoRule) From 3a7d8b9e47c174e2c6e08419c272ae4cabe680ab Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 16:44:42 +0100 Subject: [PATCH 245/819] Remove cargo-watch from vscode extension. Still keeps tests around for reference when porting them to rust --- rust-analyzer/editors/code/package.json | 12 +- .../editors/code/src/commands/cargo_watch.ts | 264 ------------------ .../editors/code/src/commands/runnables.ts | 91 ------ rust-analyzer/editors/code/src/extension.ts | 25 -- .../editors/code/src/utils/processes.ts | 51 ---- .../code/src/utils/terminateProcess.sh | 12 - 6 files changed, 1 insertion(+), 454 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/cargo_watch.ts delete mode 100644 rust-analyzer/editors/code/src/utils/processes.ts delete mode 100644 rust-analyzer/editors/code/src/utils/terminateProcess.sh diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f75fafeb..6cb24a3c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,7 +18,7 @@ "scripts": { "vscode:prepublish": "npm run compile", "package": "vsce package", - "compile": "rollup -c && shx cp src/utils/terminateProcess.sh bundle/terminateProcess.sh", + "compile": "rollup -c", "watch": "tsc -watch -p ./", "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", "lint": "tslint --project .", @@ -133,16 +133,6 @@ "command": "rust-analyzer.reload", "title": "Restart server", "category": "Rust Analyzer" - }, - { - "command": "rust-analyzer.startCargoWatch", - "title": "Start Cargo Watch", - "category": "Rust Analyzer" - }, - { - "command": "rust-analyzer.stopCargoWatch", - "title": "Stop Cargo Watch", - "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/cargo_watch.ts b/rust-analyzer/editors/code/src/commands/cargo_watch.ts deleted file mode 100644 index ac62bdd4..00000000 --- a/rust-analyzer/editors/code/src/commands/cargo_watch.ts +++ /dev/null @@ -1,264 +0,0 @@ -import * as child_process from 'child_process'; -import * as path from 'path'; -import * as vscode from 'vscode'; - -import { Server } from '../server'; -import { terminate } from '../utils/processes'; -import { LineBuffer } from './line_buffer'; -import { StatusDisplay } from './watch_status'; - -import { - mapRustDiagnosticToVsCode, - RustDiagnostic, -} from '../utils/diagnostics/rust'; -import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection'; -import { areDiagnosticsEqual } from '../utils/diagnostics/vscode'; - -export async function registerCargoWatchProvider( - subscriptions: vscode.Disposable[], -): Promise { - let cargoExists = false; - - // Check if the working directory is valid cargo root path - const cargoTomlPath = path.join(vscode.workspace.rootPath!, 'Cargo.toml'); - const cargoTomlUri = vscode.Uri.file(cargoTomlPath); - const cargoTomlFileInfo = await vscode.workspace.fs.stat(cargoTomlUri); - - if (cargoTomlFileInfo) { - cargoExists = true; - } - - if (!cargoExists) { - vscode.window.showErrorMessage( - `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}`, - ); - return; - } - - const provider = new CargoWatchProvider(); - subscriptions.push(provider); - return provider; -} - -export class CargoWatchProvider implements vscode.Disposable { - private readonly diagnosticCollection: vscode.DiagnosticCollection; - private readonly statusDisplay: StatusDisplay; - private readonly outputChannel: vscode.OutputChannel; - - private suggestedFixCollection: SuggestedFixCollection; - private codeActionDispose: vscode.Disposable; - - private cargoProcess?: child_process.ChildProcess; - - constructor() { - this.diagnosticCollection = vscode.languages.createDiagnosticCollection( - 'rustc', - ); - this.statusDisplay = new StatusDisplay( - Server.config.cargoWatchOptions.command, - ); - this.outputChannel = vscode.window.createOutputChannel( - 'Cargo Watch Trace', - ); - - // Track `rustc`'s suggested fixes so we can convert them to code actions - this.suggestedFixCollection = new SuggestedFixCollection(); - this.codeActionDispose = vscode.languages.registerCodeActionsProvider( - [{ scheme: 'file', language: 'rust' }], - this.suggestedFixCollection, - { - providedCodeActionKinds: - SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS, - }, - ); - } - - public start() { - if (this.cargoProcess) { - vscode.window.showInformationMessage( - 'Cargo Watch is already running', - ); - return; - } - - let args = - Server.config.cargoWatchOptions.command + ' --message-format json'; - if (Server.config.cargoWatchOptions.allTargets) { - args += ' --all-targets'; - } - if (Server.config.cargoWatchOptions.command.length > 0) { - // Excape the double quote string: - args += ' ' + Server.config.cargoWatchOptions.arguments; - } - // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes - if (process.platform === 'win32') { - args = '"' + args + '"'; - } - - const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce( - (flags, pattern) => [...flags, '--ignore', pattern], - [] as string[], - ); - - // Start the cargo watch with json message - this.cargoProcess = child_process.spawn( - 'cargo', - ['watch', '-x', args, ...ignoreFlags], - { - stdio: ['ignore', 'pipe', 'pipe'], - cwd: vscode.workspace.rootPath, - windowsVerbatimArguments: true, - }, - ); - - if (!this.cargoProcess) { - vscode.window.showErrorMessage('Cargo Watch failed to start'); - return; - } - - const stdoutData = new LineBuffer(); - this.cargoProcess.stdout?.on('data', (s: string) => { - stdoutData.processOutput(s, line => { - this.logInfo(line); - try { - this.parseLine(line); - } catch (err) { - this.logError(`Failed to parse: ${err}, content : ${line}`); - } - }); - }); - - const stderrData = new LineBuffer(); - this.cargoProcess.stderr?.on('data', (s: string) => { - stderrData.processOutput(s, line => { - this.logError('Error on cargo-watch : {\n' + line + '}\n'); - }); - }); - - this.cargoProcess.on('error', (err: Error) => { - this.logError( - 'Error on cargo-watch process : {\n' + err.message + '}\n', - ); - }); - - this.logInfo('cargo-watch started.'); - } - - public stop() { - if (this.cargoProcess) { - this.cargoProcess.kill(); - terminate(this.cargoProcess); - this.cargoProcess = undefined; - } else { - vscode.window.showInformationMessage('Cargo Watch is not running'); - } - } - - public dispose(): void { - this.stop(); - - this.diagnosticCollection.clear(); - this.diagnosticCollection.dispose(); - this.outputChannel.dispose(); - this.statusDisplay.dispose(); - this.codeActionDispose.dispose(); - } - - private logInfo(line: string) { - if (Server.config.cargoWatchOptions.trace === 'verbose') { - this.outputChannel.append(line); - } - } - - private logError(line: string) { - if ( - Server.config.cargoWatchOptions.trace === 'error' || - Server.config.cargoWatchOptions.trace === 'verbose' - ) { - this.outputChannel.append(line); - } - } - - private parseLine(line: string) { - if (line.startsWith('[Running')) { - this.diagnosticCollection.clear(); - this.suggestedFixCollection.clear(); - this.statusDisplay.show(); - } - - if (line.startsWith('[Finished running')) { - this.statusDisplay.hide(); - } - - interface CargoArtifact { - reason: string; - package_id: string; - } - - // https://github.com/rust-lang/cargo/blob/master/src/cargo/util/machine_message.rs - interface CargoMessage { - reason: string; - package_id: string; - message: RustDiagnostic; - } - - // cargo-watch itself output non json format - // Ignore these lines - let data: CargoMessage; - try { - data = JSON.parse(line.trim()); - } catch (error) { - this.logError(`Fail to parse to json : { ${error} }`); - return; - } - - if (data.reason === 'compiler-artifact') { - const msg = data as CargoArtifact; - - // The format of the package_id is "{name} {version} ({source_id})", - // https://github.com/rust-lang/cargo/blob/37ad03f86e895bb80b474c1c088322634f4725f5/src/cargo/core/package_id.rs#L53 - this.statusDisplay.packageName = msg.package_id.split(' ')[0]; - } else if (data.reason === 'compiler-message') { - const msg = data.message as RustDiagnostic; - - const mapResult = mapRustDiagnosticToVsCode(msg); - if (!mapResult) { - return; - } - - const { location, diagnostic, suggestedFixes } = mapResult; - const fileUri = location.uri; - - const diagnostics: vscode.Diagnostic[] = [ - ...(this.diagnosticCollection!.get(fileUri) || []), - ]; - - // If we're building multiple targets it's possible we've already seen this diagnostic - const isDuplicate = diagnostics.some(d => - areDiagnosticsEqual(d, diagnostic), - ); - if (isDuplicate) { - return; - } - - diagnostics.push(diagnostic); - this.diagnosticCollection!.set(fileUri, diagnostics); - - if (suggestedFixes.length) { - for (const suggestedFix of suggestedFixes) { - this.suggestedFixCollection.addSuggestedFixForDiagnostic( - suggestedFix, - diagnostic, - ); - } - - // Have VsCode query us for the code actions - vscode.commands.executeCommand( - 'vscode.executeCodeActionProvider', - fileUri, - diagnostic.range, - ); - } - } - } -} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index cf980e25..7728541d 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,11 +1,7 @@ -import * as child_process from 'child_process'; - -import * as util from 'util'; import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from '../server'; -import { CargoWatchProvider, registerCargoWatchProvider } from './cargo_watch'; interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; @@ -131,90 +127,3 @@ export async function handleSingle(runnable: Runnable) { return vscode.tasks.executeTask(task); } - -/** - * Interactively asks the user whether we should run `cargo check` in order to - * provide inline diagnostics; the user is met with a series of dialog boxes - * that, when accepted, allow us to `cargo install cargo-watch` and then run it. - */ -export async function interactivelyStartCargoWatch( - context: vscode.ExtensionContext, -): Promise { - if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { - return; - } - - if (Server.config.cargoWatchOptions.enableOnStartup === 'ask') { - const watch = await vscode.window.showInformationMessage( - 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', - 'yes', - 'no', - ); - if (watch !== 'yes') { - return; - } - } - - return startCargoWatch(context); -} - -export async function startCargoWatch( - context: vscode.ExtensionContext, -): Promise { - const execPromise = util.promisify(child_process.exec); - - const { stderr, code = 0 } = await execPromise( - 'cargo watch --version', - ).catch(e => e); - - if (stderr.includes('no such subcommand: `watch`')) { - const msg = - 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; - const install = await vscode.window.showInformationMessage( - msg, - 'yes', - 'no', - ); - if (install !== 'yes') { - return; - } - - const label = 'install-cargo-watch'; - const taskFinished = new Promise((resolve, _reject) => { - const disposable = vscode.tasks.onDidEndTask(({ execution }) => { - if (execution.task.name === label) { - disposable.dispose(); - resolve(); - } - }); - }); - - vscode.tasks.executeTask( - createTask({ - label, - bin: 'cargo', - args: ['install', 'cargo-watch'], - env: {}, - }), - ); - await taskFinished; - const output = await execPromise('cargo watch --version').catch(e => e); - if (output.stderr !== '') { - vscode.window.showErrorMessage( - `Couldn't install \`cargo-\`watch: ${output.stderr}`, - ); - return; - } - } else if (code !== 0) { - vscode.window.showErrorMessage( - `\`cargo watch\` failed with ${code}: ${stderr}`, - ); - return; - } - - const provider = await registerCargoWatchProvider(context.subscriptions); - if (provider) { - provider.start(); - } - return provider; -} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 815f3692..72a4d4bf 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -2,13 +2,8 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { CargoWatchProvider } from './commands/cargo_watch'; import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; -import { - interactivelyStartCargoWatch, - startCargoWatch, -} from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; @@ -139,26 +134,6 @@ export async function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); - // Executing `cargo watch` provides us with inline diagnostics on save - let provider: CargoWatchProvider | undefined; - interactivelyStartCargoWatch(context).then(p => { - provider = p; - }); - registerCommand('rust-analyzer.startCargoWatch', () => { - if (provider) { - provider.start(); - } else { - startCargoWatch(context).then(p => { - provider = p; - }); - } - }); - registerCommand('rust-analyzer.stopCargoWatch', () => { - if (provider) { - provider.stop(); - } - }); - // Start the language server, finally! try { await startServer(); diff --git a/rust-analyzer/editors/code/src/utils/processes.ts b/rust-analyzer/editors/code/src/utils/processes.ts deleted file mode 100644 index a1d6b7ea..00000000 --- a/rust-analyzer/editors/code/src/utils/processes.ts +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -import * as cp from 'child_process'; -import ChildProcess = cp.ChildProcess; - -import { join } from 'path'; - -const isWindows = process.platform === 'win32'; -const isMacintosh = process.platform === 'darwin'; -const isLinux = process.platform === 'linux'; - -// this is very complex, but is basically copy-pased from VSCode implementation here: -// https://github.com/Microsoft/vscode-languageserver-node/blob/dbfd37e35953ad0ee14c4eeced8cfbc41697b47e/client/src/utils/processes.ts#L15 - -// And see discussion at -// https://github.com/rust-analyzer/rust-analyzer/pull/1079#issuecomment-478908109 - -export function terminate(process: ChildProcess, cwd?: string): boolean { - if (isWindows) { - try { - // This we run in Atom execFileSync is available. - // Ignore stderr since this is otherwise piped to parent.stderr - // which might be already closed. - const options: any = { - stdio: ['pipe', 'pipe', 'ignore'], - }; - if (cwd) { - options.cwd = cwd; - } - cp.execFileSync( - 'taskkill', - ['/T', '/F', '/PID', process.pid.toString()], - options, - ); - return true; - } catch (err) { - return false; - } - } else if (isLinux || isMacintosh) { - try { - const cmd = join(__dirname, 'terminateProcess.sh'); - const result = cp.spawnSync(cmd, [process.pid.toString()]); - return result.error ? false : true; - } catch (err) { - return false; - } - } else { - process.kill('SIGKILL'); - return true; - } -} diff --git a/rust-analyzer/editors/code/src/utils/terminateProcess.sh b/rust-analyzer/editors/code/src/utils/terminateProcess.sh deleted file mode 100644 index 2ec9e1c2..00000000 --- a/rust-analyzer/editors/code/src/utils/terminateProcess.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -terminateTree() { - for cpid in $(pgrep -P $1); do - terminateTree $cpid - done - kill -9 $1 > /dev/null 2>&1 -} - -for pid in $*; do - terminateTree $pid -done \ No newline at end of file From 3f5983fbbbda586c7483740764ab7be0566eb225 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 16:50:38 +0100 Subject: [PATCH 246/819] Configuration plumbing for cargo watcher --- rust-analyzer/editors/code/package.json | 40 ++++------------ rust-analyzer/editors/code/src/config.ts | 59 ++++++------------------ rust-analyzer/editors/code/src/server.ts | 3 ++ 3 files changed, 28 insertions(+), 74 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6cb24a3c..5f412339 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -188,20 +188,10 @@ "default": "ra_lsp_server", "description": "Path to ra_lsp_server executable" }, - "rust-analyzer.enableCargoWatchOnStartup": { - "type": "string", - "default": "ask", - "enum": [ - "ask", - "enabled", - "disabled" - ], - "enumDescriptions": [ - "Asks each time whether to run `cargo watch`", - "`cargo watch` is always started", - "Don't start `cargo watch`" - ], - "description": "Whether to run `cargo watch` on startup" + "rust-analyzer.enableCargoCheck": { + "type": "boolean", + "default": true, + "description": "Run `cargo check` for diagnostics on save" }, "rust-analyzer.excludeGlobs": { "type": "array", @@ -213,25 +203,15 @@ "default": true, "description": "client provided file watching instead of notify watching." }, - "rust-analyzer.cargo-watch.arguments": { - "type": "string", - "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", - "default": "" - }, - "rust-analyzer.cargo-watch.command": { - "type": "string", - "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", - "default": "check" - }, - "rust-analyzer.cargo-watch.ignore": { + "rust-analyzer.cargo-check.arguments": { "type": "array", - "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", + "description": "`cargo-check` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo check --features=\"shumway,pdf\"` )", "default": [] }, - "rust-analyzer.cargo-watch.allTargets": { - "type": "boolean", - "description": "Check all targets and tests (will be passed as `--all-targets`)", - "default": true + "rust-analyzer.cargo-check.command": { + "type": "string", + "description": "`cargo-check` command. (e.g: `clippy` will run as `cargo clippy` )", + "default": "check" }, "rust-analyzer.trace.server": { "type": "string", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e131f09d..96532e2c 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -4,16 +4,10 @@ import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; -export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; -export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; - -export interface CargoWatchOptions { - enableOnStartup: CargoWatchStartupOptions; - arguments: string; - command: string; - trace: CargoWatchTraceOptions; - ignore: string[]; - allTargets: boolean; +export interface CargoCheckOptions { + enabled: boolean; + arguments: string[]; + command: null | string; } export interface CargoFeatures { @@ -35,13 +29,10 @@ export class Config { public featureFlags = {}; // for internal use public withSysroot: null | boolean = null; - public cargoWatchOptions: CargoWatchOptions = { - enableOnStartup: 'ask', - trace: 'off', - arguments: '', - command: '', - ignore: [], - allTargets: true, + public cargoCheckOptions: CargoCheckOptions = { + enabled: true, + arguments: [], + command: null, }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, @@ -100,47 +91,27 @@ export class Config { RA_LSP_DEBUG || (config.get('raLspServerPath') as string); } - if (config.has('enableCargoWatchOnStartup')) { - this.cargoWatchOptions.enableOnStartup = config.get< - CargoWatchStartupOptions - >('enableCargoWatchOnStartup', 'ask'); - } - - if (config.has('trace.cargo-watch')) { - this.cargoWatchOptions.trace = config.get( - 'trace.cargo-watch', - 'off', + if (config.has('enableCargoCheck')) { + this.cargoCheckOptions.enabled = config.get( + 'enableCargoCheck', + true, ); } if (config.has('cargo-watch.arguments')) { - this.cargoWatchOptions.arguments = config.get( + this.cargoCheckOptions.arguments = config.get( 'cargo-watch.arguments', - '', + [], ); } if (config.has('cargo-watch.command')) { - this.cargoWatchOptions.command = config.get( + this.cargoCheckOptions.command = config.get( 'cargo-watch.command', '', ); } - if (config.has('cargo-watch.ignore')) { - this.cargoWatchOptions.ignore = config.get( - 'cargo-watch.ignore', - [], - ); - } - - if (config.has('cargo-watch.allTargets')) { - this.cargoWatchOptions.allTargets = config.get( - 'cargo-watch.allTargets', - true, - ); - } - if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 5ace1d0f..409d3b4b 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -55,6 +55,9 @@ export class Server { publishDecorations: true, lruCapacity: Server.config.lruCapacity, maxInlayHintLength: Server.config.maxInlayHintLength, + cargoCheckEnable: Server.config.cargoCheckOptions.enabled, + cargoCheckCommand: Server.config.cargoCheckOptions.command, + cargoCheckArgs: Server.config.cargoCheckOptions.arguments, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, From 7a24c46652b0c363151836bdc501ea9270e2b86d Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 17:34:51 +0100 Subject: [PATCH 247/819] Remove cargo watch supporting code and tests from vscode extension --- .../clippy/trivially_copy_pass_by_ref.json | 110 ------- .../rust-diagnostics/error/E0053.json | 42 --- .../rust-diagnostics/error/E0061.json | 114 ------- .../rust-diagnostics/error/E0277.json | 261 --------------- .../rust-diagnostics/error/E0308.json | 33 -- .../warning/unused_variables.json | 72 ----- .../utils/diagnotics/SuggestedFix.test.ts | 134 -------- .../diagnotics/SuggestedFixCollection.test.ts | 127 -------- .../src/test/utils/diagnotics/rust.test.ts | 236 -------------- .../src/test/utils/diagnotics/vscode.test.ts | 98 ------ .../src/utils/diagnostics/SuggestedFix.ts | 67 ---- .../diagnostics/SuggestedFixCollection.ts | 77 ----- .../code/src/utils/diagnostics/rust.ts | 299 ------------------ .../code/src/utils/diagnostics/vscode.ts | 14 - 14 files changed, 1684 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json delete mode 100644 rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json delete mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts delete mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts delete mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts delete mode 100644 rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts delete mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts delete mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts delete mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/rust.ts delete mode 100644 rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json deleted file mode 100644 index d874e99b..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/clippy/trivially_copy_pass_by_ref.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "message": "this argument is passed by reference, but would be more efficient if passed by value", - "code": { - "code": "clippy::trivially_copy_pass_by_ref", - "explanation": null - }, - "level": "warning", - "spans": [ - { - "file_name": "compiler/mir/tagset.rs", - "byte_start": 941, - "byte_end": 946, - "line_start": 42, - "line_end": 42, - "column_start": 24, - "column_end": 29, - "is_primary": true, - "text": [ - { - "text": " pub fn is_disjoint(&self, other: Self) -> bool {", - "highlight_start": 24, - "highlight_end": 29 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "lint level defined here", - "code": null, - "level": "note", - "spans": [ - { - "file_name": "compiler/lib.rs", - "byte_start": 8, - "byte_end": 19, - "line_start": 1, - "line_end": 1, - "column_start": 9, - "column_end": 20, - "is_primary": true, - "text": [ - { - "text": "#![warn(clippy::all)]", - "highlight_start": 9, - "highlight_end": 20 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [], - "rendered": null - }, - { - "message": "#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]", - "code": null, - "level": "note", - "spans": [], - "children": [], - "rendered": null - }, - { - "message": "for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref", - "code": null, - "level": "help", - "spans": [], - "children": [], - "rendered": null - }, - { - "message": "consider passing by value instead", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "compiler/mir/tagset.rs", - "byte_start": 941, - "byte_end": 946, - "line_start": 42, - "line_end": 42, - "column_start": 24, - "column_end": 29, - "is_primary": true, - "text": [ - { - "text": " pub fn is_disjoint(&self, other: Self) -> bool {", - "highlight_start": 24, - "highlight_end": 29 - } - ], - "label": null, - "suggested_replacement": "self", - "suggestion_applicability": "Unspecified", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "warning: this argument is passed by reference, but would be more efficient if passed by value\n --> compiler/mir/tagset.rs:42:24\n |\n42 | pub fn is_disjoint(&self, other: Self) -> bool {\n | ^^^^^ help: consider passing by value instead: `self`\n |\nnote: lint level defined here\n --> compiler/lib.rs:1:9\n |\n1 | #![warn(clippy::all)]\n | ^^^^^^^^^^^\n = note: #[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref\n\n" -} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json deleted file mode 100644 index ea5c976d..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0053.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "message": "method `next` has an incompatible type for trait", - "code": { - "code": "E0053", - "explanation": "\nThe parameters of any trait method must match between a trait implementation\nand the trait definition.\n\nHere are a couple examples of this error:\n\n```compile_fail,E0053\ntrait Foo {\n fn foo(x: u16);\n fn bar(&self);\n}\n\nstruct Bar;\n\nimpl Foo for Bar {\n // error, expected u16, found i16\n fn foo(x: i16) { }\n\n // error, types differ in mutability\n fn bar(&mut self) { }\n}\n```\n" - }, - "level": "error", - "spans": [ - { - "file_name": "compiler/ty/list_iter.rs", - "byte_start": 1307, - "byte_end": 1350, - "line_start": 52, - "line_end": 52, - "column_start": 5, - "column_end": 48, - "is_primary": true, - "text": [ - { - "text": " fn next(&self) -> Option<&'list ty::Ref> {", - "highlight_start": 5, - "highlight_end": 48 - } - ], - "label": "types differ in mutability", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>`", - "code": null, - "level": "note", - "spans": [], - "children": [], - "rendered": null - } - ], - "rendered": "error[E0053]: method `next` has an incompatible type for trait\n --> compiler/ty/list_iter.rs:52:5\n |\n52 | fn next(&self) -> Option<&'list ty::Ref> {\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability\n |\n = note: expected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>`\n\n" -} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json deleted file mode 100644 index 3154d109..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0061.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "message": "this function takes 2 parameters but 3 parameters were supplied", - "code": { - "code": "E0061", - "explanation": "\nThe number of arguments passed to a function must match the number of arguments\nspecified in the function signature.\n\nFor example, a function like:\n\n```\nfn f(a: u16, b: &str) {}\n```\n\nMust always be called with exactly two arguments, e.g., `f(2, \"test\")`.\n\nNote that Rust does not have a notion of optional function arguments or\nvariadic functions (except for its C-FFI).\n" - }, - "level": "error", - "spans": [ - { - "file_name": "compiler/ty/select.rs", - "byte_start": 8787, - "byte_end": 9241, - "line_start": 219, - "line_end": 231, - "column_start": 5, - "column_end": 6, - "is_primary": false, - "text": [ - { - "text": " pub fn add_evidence(", - "highlight_start": 5, - "highlight_end": 25 - }, - { - "text": " &mut self,", - "highlight_start": 1, - "highlight_end": 19 - }, - { - "text": " target_poly: &ty::Ref,", - "highlight_start": 1, - "highlight_end": 41 - }, - { - "text": " evidence_poly: &ty::Ref,", - "highlight_start": 1, - "highlight_end": 43 - }, - { - "text": " ) {", - "highlight_start": 1, - "highlight_end": 8 - }, - { - "text": " match target_poly {", - "highlight_start": 1, - "highlight_end": 28 - }, - { - "text": " ty::Ref::Var(tvar, _) => self.add_var_evidence(tvar, evidence_poly),", - "highlight_start": 1, - "highlight_end": 81 - }, - { - "text": " ty::Ref::Fixed(target_ty) => {", - "highlight_start": 1, - "highlight_end": 43 - }, - { - "text": " let evidence_ty = evidence_poly.resolve_to_ty();", - "highlight_start": 1, - "highlight_end": 65 - }, - { - "text": " self.add_evidence_ty(target_ty, evidence_poly, evidence_ty)", - "highlight_start": 1, - "highlight_end": 76 - }, - { - "text": " }", - "highlight_start": 1, - "highlight_end": 14 - }, - { - "text": " }", - "highlight_start": 1, - "highlight_end": 10 - }, - { - "text": " }", - "highlight_start": 1, - "highlight_end": 6 - } - ], - "label": "defined here", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - }, - { - "file_name": "compiler/ty/select.rs", - "byte_start": 4045, - "byte_end": 4057, - "line_start": 104, - "line_end": 104, - "column_start": 18, - "column_end": 30, - "is_primary": true, - "text": [ - { - "text": " self.add_evidence(target_fixed, evidence_fixed, false);", - "highlight_start": 18, - "highlight_end": 30 - } - ], - "label": "expected 2 parameters", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [], - "rendered": "error[E0061]: this function takes 2 parameters but 3 parameters were supplied\n --> compiler/ty/select.rs:104:18\n |\n104 | self.add_evidence(target_fixed, evidence_fixed, false);\n | ^^^^^^^^^^^^ expected 2 parameters\n...\n219 | / pub fn add_evidence(\n220 | | &mut self,\n221 | | target_poly: &ty::Ref,\n222 | | evidence_poly: &ty::Ref,\n... |\n230 | | }\n231 | | }\n | |_____- defined here\n\n" -} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json deleted file mode 100644 index bfef33c7..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0277.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "rendered": "error[E0277]: can't compare `{integer}` with `&str`\n --> src/main.rs:2:5\n |\n2 | assert_eq!(1, \"love\");\n | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `{integer} == &str`\n |\n = help: the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`\n = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n", - "children": [ - { - "children": [], - "code": null, - "level": "help", - "message": "the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", - "rendered": null, - "spans": [] - } - ], - "code": { - "code": "E0277", - "explanation": "\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func(foo: T) {\n foo.bar();\n}\n\nfn main() {\n // we now call the method with the i32 type, which doesn't implement\n // the Foo trait\n some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n fn bar(&self);\n}\n\nfn some_func(foo: T) {\n foo.bar(); // we can now use this method since i32 implements the\n // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n fn bar(&self) {}\n}\n\nfn main() {\n some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func(foo: T) {\n println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n // implemented for the type `T`\n}\n\nfn main() {\n // We now call the method with the i32 type,\n // which *does* implement the Debug trait.\n some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func(foo: T) {\n println!(\"{:?}\", foo);\n}\n\nfn main() {\n // Calling the method is still fine, as i32 implements Debug.\n some_func(5i32);\n\n // This would fail to compile now:\n // struct WithoutDebug;\n // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n" - }, - "level": "error", - "message": "can't compare `{integer}` with `&str`", - "spans": [ - { - "byte_end": 155, - "byte_start": 153, - "column_end": 33, - "column_start": 31, - "expansion": { - "def_site_span": { - "byte_end": 940, - "byte_start": 0, - "column_end": 6, - "column_start": 1, - "expansion": null, - "file_name": "<::core::macros::assert_eq macros>", - "is_primary": false, - "label": null, - "line_end": 36, - "line_start": 1, - "suggested_replacement": null, - "suggestion_applicability": null, - "text": [ - { - "highlight_end": 35, - "highlight_start": 1, - "text": "($ left : expr, $ right : expr) =>" - }, - { - "highlight_end": 3, - "highlight_start": 1, - "text": "({" - }, - { - "highlight_end": 33, - "highlight_start": 1, - "text": " match (& $ left, & $ right)" - }, - { - "highlight_end": 7, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 34, - "highlight_start": 1, - "text": " (left_val, right_val) =>" - }, - { - "highlight_end": 11, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 46, - "highlight_start": 1, - "text": " if ! (* left_val == * right_val)" - }, - { - "highlight_end": 15, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 25, - "highlight_start": 1, - "text": " panic !" - }, - { - "highlight_end": 57, - "highlight_start": 1, - "text": " (r#\"assertion failed: `(left == right)`" - }, - { - "highlight_end": 16, - "highlight_start": 1, - "text": " left: `{:?}`," - }, - { - "highlight_end": 18, - "highlight_start": 1, - "text": " right: `{:?}`\"#," - }, - { - "highlight_end": 47, - "highlight_start": 1, - "text": " & * left_val, & * right_val)" - }, - { - "highlight_end": 15, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 11, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 7, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 42, - "highlight_start": 1, - "text": " }) ; ($ left : expr, $ right : expr,) =>" - }, - { - "highlight_end": 49, - "highlight_start": 1, - "text": "({ $ crate :: assert_eq ! ($ left, $ right) }) ;" - }, - { - "highlight_end": 53, - "highlight_start": 1, - "text": "($ left : expr, $ right : expr, $ ($ arg : tt) +) =>" - }, - { - "highlight_end": 3, - "highlight_start": 1, - "text": "({" - }, - { - "highlight_end": 37, - "highlight_start": 1, - "text": " match (& ($ left), & ($ right))" - }, - { - "highlight_end": 7, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 34, - "highlight_start": 1, - "text": " (left_val, right_val) =>" - }, - { - "highlight_end": 11, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 46, - "highlight_start": 1, - "text": " if ! (* left_val == * right_val)" - }, - { - "highlight_end": 15, - "highlight_start": 1, - "text": " {" - }, - { - "highlight_end": 25, - "highlight_start": 1, - "text": " panic !" - }, - { - "highlight_end": 57, - "highlight_start": 1, - "text": " (r#\"assertion failed: `(left == right)`" - }, - { - "highlight_end": 16, - "highlight_start": 1, - "text": " left: `{:?}`," - }, - { - "highlight_end": 22, - "highlight_start": 1, - "text": " right: `{:?}`: {}\"#," - }, - { - "highlight_end": 72, - "highlight_start": 1, - "text": " & * left_val, & * right_val, $ crate :: format_args !" - }, - { - "highlight_end": 33, - "highlight_start": 1, - "text": " ($ ($ arg) +))" - }, - { - "highlight_end": 15, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 11, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 7, - "highlight_start": 1, - "text": " }" - }, - { - "highlight_end": 6, - "highlight_start": 1, - "text": " }) ;" - } - ] - }, - "macro_decl_name": "assert_eq!", - "span": { - "byte_end": 38, - "byte_start": 16, - "column_end": 27, - "column_start": 5, - "expansion": null, - "file_name": "src/main.rs", - "is_primary": false, - "label": null, - "line_end": 2, - "line_start": 2, - "suggested_replacement": null, - "suggestion_applicability": null, - "text": [ - { - "highlight_end": 27, - "highlight_start": 5, - "text": " assert_eq!(1, \"love\");" - } - ] - } - }, - "file_name": "<::core::macros::assert_eq macros>", - "is_primary": true, - "label": "no implementation for `{integer} == &str`", - "line_end": 7, - "line_start": 7, - "suggested_replacement": null, - "suggestion_applicability": null, - "text": [ - { - "highlight_end": 33, - "highlight_start": 31, - "text": " if ! (* left_val == * right_val)" - } - ] - } - ] -} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json deleted file mode 100644 index fb23824a..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/error/E0308.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "message": "mismatched types", - "code": { - "code": "E0308", - "explanation": "\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n" - }, - "level": "error", - "spans": [ - { - "file_name": "runtime/compiler_support.rs", - "byte_start": 1589, - "byte_end": 1594, - "line_start": 48, - "line_end": 48, - "column_start": 65, - "column_end": 70, - "is_primary": true, - "text": [ - { - "text": " let layout = alloc::Layout::from_size_align_unchecked(size, align);", - "highlight_start": 65, - "highlight_end": 70 - } - ], - "label": "expected usize, found u32", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [], - "rendered": "error[E0308]: mismatched types\n --> runtime/compiler_support.rs:48:65\n |\n48 | let layout = alloc::Layout::from_size_align_unchecked(size, align);\n | ^^^^^ expected usize, found u32\n\n" -} diff --git a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json b/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json deleted file mode 100644 index d1e2be72..00000000 --- a/rust-analyzer/editors/code/src/test/fixtures/rust-diagnostics/warning/unused_variables.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "message": "unused variable: `foo`", - "code": { - "code": "unused_variables", - "explanation": null - }, - "level": "warning", - "spans": [ - { - "file_name": "driver/subcommand/repl.rs", - "byte_start": 9228, - "byte_end": 9231, - "line_start": 291, - "line_end": 291, - "column_start": 9, - "column_end": 12, - "is_primary": true, - "text": [ - { - "text": " let foo = 42;", - "highlight_start": 9, - "highlight_end": 12 - } - ], - "label": null, - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "#[warn(unused_variables)] on by default", - "code": null, - "level": "note", - "spans": [], - "children": [], - "rendered": null - }, - { - "message": "consider prefixing with an underscore", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "driver/subcommand/repl.rs", - "byte_start": 9228, - "byte_end": 9231, - "line_start": 291, - "line_end": 291, - "column_start": 9, - "column_end": 12, - "is_primary": true, - "text": [ - { - "text": " let foo = 42;", - "highlight_start": 9, - "highlight_end": 12 - } - ], - "label": null, - "suggested_replacement": "_foo", - "suggestion_applicability": "MachineApplicable", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "warning: unused variable: `foo`\n --> driver/subcommand/repl.rs:291:9\n |\n291 | let foo = 42;\n | ^^^ help: consider prefixing with an underscore: `_foo`\n |\n = note: #[warn(unused_variables)] on by default\n\n" -} diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts deleted file mode 100644 index 2b25eb70..00000000 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as assert from 'assert'; -import * as vscode from 'vscode'; - -import { SuggestionApplicability } from '../../../utils/diagnostics/rust'; -import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; - -const location1 = new vscode.Location( - vscode.Uri.file('/file/1'), - new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)), -); - -const location2 = new vscode.Location( - vscode.Uri.file('/file/2'), - new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)), -); - -describe('SuggestedFix', () => { - describe('isEqual', () => { - it('should treat identical instances as equal', () => { - const suggestion1 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - const suggestion2 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - assert(suggestion1.isEqual(suggestion2)); - }); - - it('should treat instances with different titles as inequal', () => { - const suggestion1 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - const suggestion2 = new SuggestedFix( - 'Not the same title!', - location1, - 'With this!', - ); - - assert(!suggestion1.isEqual(suggestion2)); - }); - - it('should treat instances with different replacements as inequal', () => { - const suggestion1 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - const suggestion2 = new SuggestedFix( - 'Replace me!', - location1, - 'With something else!', - ); - - assert(!suggestion1.isEqual(suggestion2)); - }); - - it('should treat instances with different locations as inequal', () => { - const suggestion1 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - const suggestion2 = new SuggestedFix( - 'Replace me!', - location2, - 'With this!', - ); - - assert(!suggestion1.isEqual(suggestion2)); - }); - - it('should treat instances with different applicability as inequal', () => { - const suggestion1 = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - SuggestionApplicability.MachineApplicable, - ); - - const suggestion2 = new SuggestedFix( - 'Replace me!', - location2, - 'With this!', - SuggestionApplicability.HasPlaceholders, - ); - - assert(!suggestion1.isEqual(suggestion2)); - }); - }); - - describe('toCodeAction', () => { - it('should map a simple suggestion', () => { - const suggestion = new SuggestedFix( - 'Replace me!', - location1, - 'With this!', - ); - - const codeAction = suggestion.toCodeAction(); - assert.strictEqual(codeAction.kind, vscode.CodeActionKind.QuickFix); - assert.strictEqual(codeAction.title, 'Replace me!'); - assert.strictEqual(codeAction.isPreferred, false); - - const edit = codeAction.edit; - if (!edit) { - assert.fail('Code Action edit unexpectedly missing'); - return; - } - - const editEntries = edit.entries(); - assert.strictEqual(editEntries.length, 1); - - const [[editUri, textEdits]] = editEntries; - assert.strictEqual(editUri.toString(), location1.uri.toString()); - - assert.strictEqual(textEdits.length, 1); - const [textEdit] = textEdits; - - assert(textEdit.range.isEqual(location1.range)); - assert.strictEqual(textEdit.newText, 'With this!'); - }); - }); -}); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts deleted file mode 100644 index ef09013f..00000000 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as assert from 'assert'; -import * as vscode from 'vscode'; - -import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; -import SuggestedFixCollection from '../../../utils/diagnostics/SuggestedFixCollection'; - -const uri1 = vscode.Uri.file('/file/1'); -const uri2 = vscode.Uri.file('/file/2'); - -const mockDocument1 = ({ - uri: uri1, -} as unknown) as vscode.TextDocument; - -const mockDocument2 = ({ - uri: uri2, -} as unknown) as vscode.TextDocument; - -const range1 = new vscode.Range( - new vscode.Position(1, 2), - new vscode.Position(3, 4), -); -const range2 = new vscode.Range( - new vscode.Position(5, 6), - new vscode.Position(7, 8), -); - -const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); -const diagnostic2 = new vscode.Diagnostic(range2, 'Second diagnostic'); - -// This is a mutable object so return a fresh instance every time -function suggestion1(): SuggestedFix { - return new SuggestedFix( - 'Replace me!', - new vscode.Location(uri1, range1), - 'With this!', - ); -} - -describe('SuggestedFixCollection', () => { - it('should add a suggestion then return it as a code action', () => { - const suggestedFixes = new SuggestedFixCollection(); - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); - - // Specify the document and range that exactly matches - const codeActions = suggestedFixes.provideCodeActions( - mockDocument1, - range1, - ); - - assert.strictEqual(codeActions.length, 1); - const [codeAction] = codeActions; - assert.strictEqual(codeAction.title, suggestion1().title); - - const { diagnostics } = codeAction; - if (!diagnostics) { - assert.fail('Diagnostics unexpectedly missing'); - return; - } - - assert.strictEqual(diagnostics.length, 1); - assert.strictEqual(diagnostics[0], diagnostic1); - }); - - it('should not return code actions for different ranges', () => { - const suggestedFixes = new SuggestedFixCollection(); - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); - - const codeActions = suggestedFixes.provideCodeActions( - mockDocument1, - range2, - ); - - assert(!codeActions || codeActions.length === 0); - }); - - it('should not return code actions for different documents', () => { - const suggestedFixes = new SuggestedFixCollection(); - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); - - const codeActions = suggestedFixes.provideCodeActions( - mockDocument2, - range1, - ); - - assert(!codeActions || codeActions.length === 0); - }); - - it('should not return code actions that have been cleared', () => { - const suggestedFixes = new SuggestedFixCollection(); - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); - suggestedFixes.clear(); - - const codeActions = suggestedFixes.provideCodeActions( - mockDocument1, - range1, - ); - - assert(!codeActions || codeActions.length === 0); - }); - - it('should merge identical suggestions together', () => { - const suggestedFixes = new SuggestedFixCollection(); - - // Add the same suggestion for two diagnostics - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic1); - suggestedFixes.addSuggestedFixForDiagnostic(suggestion1(), diagnostic2); - - const codeActions = suggestedFixes.provideCodeActions( - mockDocument1, - range1, - ); - - assert.strictEqual(codeActions.length, 1); - const [codeAction] = codeActions; - const { diagnostics } = codeAction; - - if (!diagnostics) { - assert.fail('Diagnostics unexpectedly missing'); - return; - } - - // We should be associated with both diagnostics - assert.strictEqual(diagnostics.length, 2); - assert.strictEqual(diagnostics[0], diagnostic1); - assert.strictEqual(diagnostics[1], diagnostic2); - }); -}); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts deleted file mode 100644 index 358325cc..00000000 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/rust.test.ts +++ /dev/null @@ -1,236 +0,0 @@ -import * as assert from 'assert'; -import * as fs from 'fs'; -import * as vscode from 'vscode'; - -import { - MappedRustDiagnostic, - mapRustDiagnosticToVsCode, - RustDiagnostic, - SuggestionApplicability, -} from '../../../utils/diagnostics/rust'; - -function loadDiagnosticFixture(name: string): RustDiagnostic { - const jsonText = fs - .readFileSync( - // We're actually in our JavaScript output directory, climb out - `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json`, - ) - .toString(); - - return JSON.parse(jsonText); -} - -function mapFixtureToVsCode(name: string): MappedRustDiagnostic { - const rd = loadDiagnosticFixture(name); - const mapResult = mapRustDiagnosticToVsCode(rd); - - if (!mapResult) { - return assert.fail('Mapping unexpectedly failed'); - } - return mapResult; -} - -describe('mapRustDiagnosticToVsCode', () => { - it('should map an incompatible type for trait error', () => { - const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0053', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Error, - ); - assert.strictEqual(diagnostic.source, 'rustc'); - assert.strictEqual( - diagnostic.message, - [ - `method \`next\` has an incompatible type for trait`, - `expected type \`fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>\``, - ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\``, - ].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'E0053'); - assert.deepStrictEqual(diagnostic.tags, []); - - // No related information - assert.deepStrictEqual(diagnostic.relatedInformation, []); - - // There are no suggested fixes - assert.strictEqual(suggestedFixes.length, 0); - }); - - it('should map an unused variable warning', () => { - const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'warning/unused_variables', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Warning, - ); - assert.strictEqual( - diagnostic.message, - [ - 'unused variable: `foo`', - '#[warn(unused_variables)] on by default', - ].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'unused_variables'); - assert.strictEqual(diagnostic.source, 'rustc'); - assert.deepStrictEqual(diagnostic.tags, [ - vscode.DiagnosticTag.Unnecessary, - ]); - - // No related information - assert.deepStrictEqual(diagnostic.relatedInformation, []); - - // One suggested fix available to prefix the variable - assert.strictEqual(suggestedFixes.length, 1); - const [suggestedFix] = suggestedFixes; - assert.strictEqual( - suggestedFix.title, - 'consider prefixing with an underscore: `_foo`', - ); - assert.strictEqual( - suggestedFix.applicability, - SuggestionApplicability.MachineApplicable, - ); - }); - - it('should map a wrong number of parameters error', () => { - const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0061', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Error, - ); - assert.strictEqual( - diagnostic.message, - [ - 'this function takes 2 parameters but 3 parameters were supplied', - 'expected 2 parameters', - ].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'E0061'); - assert.strictEqual(diagnostic.source, 'rustc'); - assert.deepStrictEqual(diagnostic.tags, []); - - // One related information for the original definition - const relatedInformation = diagnostic.relatedInformation; - if (!relatedInformation) { - assert.fail('Related information unexpectedly undefined'); - return; - } - assert.strictEqual(relatedInformation.length, 1); - const [related] = relatedInformation; - assert.strictEqual(related.message, 'defined here'); - - // There are no suggested fixes - assert.strictEqual(suggestedFixes.length, 0); - }); - - it('should map a Clippy copy pass by ref warning', () => { - const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'clippy/trivially_copy_pass_by_ref', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Warning, - ); - assert.strictEqual(diagnostic.source, 'clippy'); - assert.strictEqual( - diagnostic.message, - [ - 'this argument is passed by reference, but would be more efficient if passed by value', - '#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]', - 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref', - ].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'trivially_copy_pass_by_ref'); - assert.deepStrictEqual(diagnostic.tags, []); - - // One related information for the lint definition - const relatedInformation = diagnostic.relatedInformation; - if (!relatedInformation) { - assert.fail('Related information unexpectedly undefined'); - return; - } - assert.strictEqual(relatedInformation.length, 1); - const [related] = relatedInformation; - assert.strictEqual(related.message, 'lint level defined here'); - - // One suggested fix to pass by value - assert.strictEqual(suggestedFixes.length, 1); - const [suggestedFix] = suggestedFixes; - assert.strictEqual( - suggestedFix.title, - 'consider passing by value instead: `self`', - ); - // Clippy does not mark this with any applicability - assert.strictEqual( - suggestedFix.applicability, - SuggestionApplicability.Unspecified, - ); - }); - - it('should map a mismatched type error', () => { - const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0308', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Error, - ); - assert.strictEqual( - diagnostic.message, - ['mismatched types', 'expected usize, found u32'].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'E0308'); - assert.strictEqual(diagnostic.source, 'rustc'); - assert.deepStrictEqual(diagnostic.tags, []); - - // No related information - assert.deepStrictEqual(diagnostic.relatedInformation, []); - - // There are no suggested fixes - assert.strictEqual(suggestedFixes.length, 0); - }); - - it('should map a macro invocation location to normal file path', () => { - const { location, diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0277', - ); - - assert.strictEqual( - diagnostic.severity, - vscode.DiagnosticSeverity.Error, - ); - assert.strictEqual( - diagnostic.message, - [ - "can't compare `{integer}` with `&str`", - 'the trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`', - ].join('\n'), - ); - assert.strictEqual(diagnostic.code, 'E0277'); - assert.strictEqual(diagnostic.source, 'rustc'); - assert.deepStrictEqual(diagnostic.tags, []); - - // No related information - assert.deepStrictEqual(diagnostic.relatedInformation, []); - - // There are no suggested fixes - assert.strictEqual(suggestedFixes.length, 0); - - // The file url should be normal file - // Ignore the first part because it depends on vs workspace location - assert.strictEqual( - location.uri.path.substr(-'src/main.rs'.length), - 'src/main.rs', - ); - }); -}); diff --git a/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts b/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts deleted file mode 100644 index 4944dd03..00000000 --- a/rust-analyzer/editors/code/src/test/utils/diagnotics/vscode.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as assert from 'assert'; -import * as vscode from 'vscode'; - -import { areDiagnosticsEqual } from '../../../utils/diagnostics/vscode'; - -const range1 = new vscode.Range( - new vscode.Position(1, 2), - new vscode.Position(3, 4), -); - -const range2 = new vscode.Range( - new vscode.Position(5, 6), - new vscode.Position(7, 8), -); - -describe('areDiagnosticsEqual', () => { - it('should treat identical diagnostics as equal', () => { - const diagnostic1 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - const diagnostic2 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - assert(areDiagnosticsEqual(diagnostic1, diagnostic2)); - }); - - it('should treat diagnostics with different sources as inequal', () => { - const diagnostic1 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - diagnostic1.source = 'rustc'; - - const diagnostic2 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - diagnostic2.source = 'clippy'; - - assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); - }); - - it('should treat diagnostics with different ranges as inequal', () => { - const diagnostic1 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - const diagnostic2 = new vscode.Diagnostic( - range2, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); - }); - - it('should treat diagnostics with different messages as inequal', () => { - const diagnostic1 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - const diagnostic2 = new vscode.Diagnostic( - range1, - 'Goodbye!, world!', - vscode.DiagnosticSeverity.Error, - ); - - assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); - }); - - it('should treat diagnostics with different severities as inequal', () => { - const diagnostic1 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Warning, - ); - - const diagnostic2 = new vscode.Diagnostic( - range1, - 'Hello, world!', - vscode.DiagnosticSeverity.Error, - ); - - assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); - }); -}); diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts deleted file mode 100644 index 6e660bb6..00000000 --- a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFix.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as vscode from 'vscode'; - -import { SuggestionApplicability } from './rust'; - -/** - * Model object for text replacements suggested by the Rust compiler - * - * This is an intermediate form between the raw `rustc` JSON and a - * `vscode.CodeAction`. It's optimised for the use-cases of - * `SuggestedFixCollection`. - */ -export default class SuggestedFix { - public readonly title: string; - public readonly location: vscode.Location; - public readonly replacement: string; - public readonly applicability: SuggestionApplicability; - - /** - * Diagnostics this suggested fix could resolve - */ - public diagnostics: vscode.Diagnostic[]; - - constructor( - title: string, - location: vscode.Location, - replacement: string, - applicability: SuggestionApplicability = SuggestionApplicability.Unspecified, - ) { - this.title = title; - this.location = location; - this.replacement = replacement; - this.applicability = applicability; - this.diagnostics = []; - } - - /** - * Determines if this suggested fix is equivalent to another instance - */ - public isEqual(other: SuggestedFix): boolean { - return ( - this.title === other.title && - this.location.range.isEqual(other.location.range) && - this.replacement === other.replacement && - this.applicability === other.applicability - ); - } - - /** - * Converts this suggested fix to a VS Code Quick Fix code action - */ - public toCodeAction(): vscode.CodeAction { - const codeAction = new vscode.CodeAction( - this.title, - vscode.CodeActionKind.QuickFix, - ); - - const edit = new vscode.WorkspaceEdit(); - edit.replace(this.location.uri, this.location.range, this.replacement); - codeAction.edit = edit; - - codeAction.isPreferred = - this.applicability === SuggestionApplicability.MachineApplicable; - - codeAction.diagnostics = [...this.diagnostics]; - return codeAction; - } -} diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts b/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts deleted file mode 100644 index 57c9856c..00000000 --- a/rust-analyzer/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts +++ /dev/null @@ -1,77 +0,0 @@ -import * as vscode from 'vscode'; -import SuggestedFix from './SuggestedFix'; - -/** - * Collection of suggested fixes across multiple documents - * - * This stores `SuggestedFix` model objects and returns them via the - * `vscode.CodeActionProvider` interface. - */ -export default class SuggestedFixCollection - implements vscode.CodeActionProvider { - public static PROVIDED_CODE_ACTION_KINDS = [vscode.CodeActionKind.QuickFix]; - - /** - * Map of document URI strings to suggested fixes - */ - private suggestedFixes: Map; - - constructor() { - this.suggestedFixes = new Map(); - } - - /** - * Clears all suggested fixes across all documents - */ - public clear(): void { - this.suggestedFixes = new Map(); - } - - /** - * Adds a suggested fix for the given diagnostic - * - * Some suggested fixes will appear in multiple diagnostics. For example, - * forgetting a `mut` on a variable will suggest changing the delaration on - * every mutable usage site. If the suggested fix has already been added - * this method will instead associate the existing fix with the new - * diagnostic. - */ - public addSuggestedFixForDiagnostic( - suggestedFix: SuggestedFix, - diagnostic: vscode.Diagnostic, - ): void { - const fileUriString = suggestedFix.location.uri.toString(); - const fileSuggestions = this.suggestedFixes.get(fileUriString) || []; - - const existingSuggestion = fileSuggestions.find(s => - s.isEqual(suggestedFix), - ); - - if (existingSuggestion) { - // The existing suggestion also applies to this new diagnostic - existingSuggestion.diagnostics.push(diagnostic); - } else { - // We haven't seen this suggestion before - suggestedFix.diagnostics.push(diagnostic); - fileSuggestions.push(suggestedFix); - } - - this.suggestedFixes.set(fileUriString, fileSuggestions); - } - - /** - * Filters suggested fixes by their document and range and converts them to - * code actions - */ - public provideCodeActions( - document: vscode.TextDocument, - range: vscode.Range, - ): vscode.CodeAction[] { - const documentUriString = document.uri.toString(); - - const suggestedFixes = this.suggestedFixes.get(documentUriString); - return (suggestedFixes || []) - .filter(({ location }) => location.range.intersection(range)) - .map(suggestedEdit => suggestedEdit.toCodeAction()); - } -} diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts b/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts deleted file mode 100644 index 1f0c0d3e..00000000 --- a/rust-analyzer/editors/code/src/utils/diagnostics/rust.ts +++ /dev/null @@ -1,299 +0,0 @@ -import * as path from 'path'; -import * as vscode from 'vscode'; - -import SuggestedFix from './SuggestedFix'; - -export enum SuggestionApplicability { - MachineApplicable = 'MachineApplicable', - HasPlaceholders = 'HasPlaceholders', - MaybeIncorrect = 'MaybeIncorrect', - Unspecified = 'Unspecified', -} - -export interface RustDiagnosticSpanMacroExpansion { - span: RustDiagnosticSpan; - macro_decl_name: string; - def_site_span?: RustDiagnosticSpan; -} - -// Reference: -// https://github.com/rust-lang/rust/blob/master/src/libsyntax/json.rs -export interface RustDiagnosticSpan { - line_start: number; - line_end: number; - column_start: number; - column_end: number; - is_primary: boolean; - file_name: string; - label?: string; - expansion?: RustDiagnosticSpanMacroExpansion; - suggested_replacement?: string; - suggestion_applicability?: SuggestionApplicability; -} - -export interface RustDiagnostic { - spans: RustDiagnosticSpan[]; - rendered: string; - message: string; - level: string; - code?: { - code: string; - }; - children: RustDiagnostic[]; -} - -export interface MappedRustDiagnostic { - location: vscode.Location; - diagnostic: vscode.Diagnostic; - suggestedFixes: SuggestedFix[]; -} - -interface MappedRustChildDiagnostic { - related?: vscode.DiagnosticRelatedInformation; - suggestedFix?: SuggestedFix; - messageLine?: string; -} - -/** - * Converts a Rust level string to a VsCode severity - */ -function mapLevelToSeverity(s: string): vscode.DiagnosticSeverity { - if (s === 'error') { - return vscode.DiagnosticSeverity.Error; - } - if (s.startsWith('warn')) { - return vscode.DiagnosticSeverity.Warning; - } - return vscode.DiagnosticSeverity.Information; -} - -/** - * Check whether a file name is from macro invocation - */ -function isFromMacro(fileName: string): boolean { - return fileName.startsWith('<') && fileName.endsWith('>'); -} - -/** - * Converts a Rust macro span to a VsCode location recursively - */ -function mapMacroSpanToLocation( - spanMacro: RustDiagnosticSpanMacroExpansion, -): vscode.Location | undefined { - if (!isFromMacro(spanMacro.span.file_name)) { - return mapSpanToLocation(spanMacro.span); - } - - if (spanMacro.span.expansion) { - return mapMacroSpanToLocation(spanMacro.span.expansion); - } - - return; -} - -/** - * Converts a Rust span to a VsCode location - */ -function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { - if (isFromMacro(span.file_name) && span.expansion) { - const macroLoc = mapMacroSpanToLocation(span.expansion); - if (macroLoc) { - return macroLoc; - } - } - - const fileName = path.join(vscode.workspace.rootPath || '', span.file_name); - const fileUri = vscode.Uri.file(fileName); - - const range = new vscode.Range( - new vscode.Position(span.line_start - 1, span.column_start - 1), - new vscode.Position(span.line_end - 1, span.column_end - 1), - ); - - return new vscode.Location(fileUri, range); -} - -/** - * Converts a secondary Rust span to a VsCode related information - * - * If the span is unlabelled this will return `undefined`. - */ -function mapSecondarySpanToRelated( - span: RustDiagnosticSpan, -): vscode.DiagnosticRelatedInformation | undefined { - if (!span.label) { - // Nothing to label this with - return; - } - - const location = mapSpanToLocation(span); - return new vscode.DiagnosticRelatedInformation(location, span.label); -} - -/** - * Determines if diagnostic is related to unused code - */ -function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { - if (!rd.code) { - return false; - } - - return [ - 'dead_code', - 'unknown_lints', - 'unreachable_code', - 'unused_attributes', - 'unused_imports', - 'unused_macros', - 'unused_variables', - ].includes(rd.code.code); -} - -/** - * Determines if diagnostic is related to deprecated code - */ -function isDeprecated(rd: RustDiagnostic): boolean { - if (!rd.code) { - return false; - } - - return ['deprecated'].includes(rd.code.code); -} - -/** - * Converts a Rust child diagnostic to a VsCode related information - * - * This can have three outcomes: - * - * 1. If this is no primary span this will return a `noteLine` - * 2. If there is a primary span with a suggested replacement it will return a - * `codeAction`. - * 3. If there is a primary span without a suggested replacement it will return - * a `related`. - */ -function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { - const span = rd.spans.find(s => s.is_primary); - - if (!span) { - // `rustc` uses these spanless children as a way to print multi-line - // messages - return { messageLine: rd.message }; - } - - // If we have a primary span use its location, otherwise use the parent - const location = mapSpanToLocation(span); - - // We need to distinguish `null` from an empty string - if (span && typeof span.suggested_replacement === 'string') { - // Include our replacement in the title unless it's empty - const title = span.suggested_replacement - ? `${rd.message}: \`${span.suggested_replacement}\`` - : rd.message; - - return { - suggestedFix: new SuggestedFix( - title, - location, - span.suggested_replacement, - span.suggestion_applicability, - ), - }; - } else { - const related = new vscode.DiagnosticRelatedInformation( - location, - rd.message, - ); - - return { related }; - } -} - -/** - * Converts a Rust root diagnostic to VsCode form - * - * This flattens the Rust diagnostic by: - * - * 1. Creating a `vscode.Diagnostic` with the root message and primary span. - * 2. Adding any labelled secondary spans to `relatedInformation` - * 3. Categorising child diagnostics as either `SuggestedFix`es, - * `relatedInformation` or additional message lines. - * - * If the diagnostic has no primary span this will return `undefined` - */ -export function mapRustDiagnosticToVsCode( - rd: RustDiagnostic, -): MappedRustDiagnostic | undefined { - const primarySpan = rd.spans.find(s => s.is_primary); - if (!primarySpan) { - return; - } - - const location = mapSpanToLocation(primarySpan); - const secondarySpans = rd.spans.filter(s => !s.is_primary); - - const severity = mapLevelToSeverity(rd.level); - let primarySpanLabel = primarySpan.label; - - const vd = new vscode.Diagnostic(location.range, rd.message, severity); - - let source = 'rustc'; - let code = rd.code && rd.code.code; - if (code) { - // See if this is an RFC #2103 scoped lint (e.g. from Clippy) - const scopedCode = code.split('::'); - if (scopedCode.length === 2) { - [source, code] = scopedCode; - } - } - - vd.source = source; - vd.code = code; - vd.relatedInformation = []; - vd.tags = []; - - for (const secondarySpan of secondarySpans) { - const related = mapSecondarySpanToRelated(secondarySpan); - if (related) { - vd.relatedInformation.push(related); - } - } - - const suggestedFixes = []; - for (const child of rd.children) { - const { related, suggestedFix, messageLine } = mapRustChildDiagnostic( - child, - ); - - if (related) { - vd.relatedInformation.push(related); - } - if (suggestedFix) { - suggestedFixes.push(suggestedFix); - } - if (messageLine) { - vd.message += `\n${messageLine}`; - - // These secondary messages usually duplicate the content of the - // primary span label. - primarySpanLabel = undefined; - } - } - - if (primarySpanLabel) { - vd.message += `\n${primarySpanLabel}`; - } - - if (isUnusedOrUnnecessary(rd)) { - vd.tags.push(vscode.DiagnosticTag.Unnecessary); - } - - if (isDeprecated(rd)) { - vd.tags.push(vscode.DiagnosticTag.Deprecated); - } - - return { - location, - diagnostic: vd, - suggestedFixes, - }; -} diff --git a/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts b/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts deleted file mode 100644 index f4a5450e..00000000 --- a/rust-analyzer/editors/code/src/utils/diagnostics/vscode.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as vscode from 'vscode'; - -/** Compares two `vscode.Diagnostic`s for equality */ -export function areDiagnosticsEqual( - left: vscode.Diagnostic, - right: vscode.Diagnostic, -): boolean { - return ( - left.source === right.source && - left.severity === right.severity && - left.range.isEqual(right.range) && - left.message === right.message - ); -} From cba87af0ec9eaab12825a91088915ca16f7d5b80 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 19:08:44 +0100 Subject: [PATCH 248/819] Re-implement status display using LSP 3.15 progress event --- .../editors/code/src/commands/watch_status.ts | 43 +++++++++++++++++++ rust-analyzer/editors/code/src/extension.ts | 8 ++++ 2 files changed, 51 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 8d64394c..2404c3f1 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -57,7 +57,50 @@ export class StatusDisplay implements vscode.Disposable { this.statusBarItem.dispose(); } + public handleProgressNotification(params: ProgressParams) { + const { token, value } = params; + if (token !== "rustAnalyzer/cargoWatcher") { + return; + } + + console.log("Got progress notification", token, value) + switch (value.kind) { + case "begin": + this.show(); + break; + + case "report": + if (value.message) { + this.packageName = value.message; + } + break; + + case "end": + this.hide(); + break; + } + } + private frame() { return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; } } + +// FIXME: Replace this once vscode-languageclient is updated to LSP 3.15 +interface ProgressParams { + token: string + value: WorkDoneProgress +} + +enum WorkDoneProgressKind { + Begin = "begin", + Report = "report", + End = "end" +} + +interface WorkDoneProgress { + kind: WorkDoneProgressKind, + message?: string + cancelable?: boolean + percentage?: string +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 72a4d4bf..1507cb26 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -8,6 +8,7 @@ import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; +import { StatusDisplay } from './commands/watch_status'; export async function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { @@ -83,6 +84,9 @@ export async function activate(context: vscode.ExtensionContext) { overrideCommand('type', commands.onEnter.handle); } + const watchStatus = new StatusDisplay(Server.config.cargoCheckOptions.command || 'check'); + disposeOnDeactivation(watchStatus); + // Notifications are events triggered by the language server const allNotifications: Iterable<[ string, @@ -92,6 +96,10 @@ export async function activate(context: vscode.ExtensionContext) { 'rust-analyzer/publishDecorations', notifications.publishDecorations.handle, ], + [ + '$/progress', + (params) => watchStatus.handleProgressNotification(params), + ] ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); From 8674215794b769355e84c4abca6e463d179f9ad5 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 19:10:30 +0100 Subject: [PATCH 249/819] Re-format VSCode extension changes --- .../editors/code/src/commands/watch_status.ts | 29 +++++++++---------- rust-analyzer/editors/code/src/extension.ts | 10 ++++--- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/commands/watch_status.ts index 2404c3f1..10787b51 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/commands/watch_status.ts @@ -59,23 +59,22 @@ export class StatusDisplay implements vscode.Disposable { public handleProgressNotification(params: ProgressParams) { const { token, value } = params; - if (token !== "rustAnalyzer/cargoWatcher") { + if (token !== 'rustAnalyzer/cargoWatcher') { return; } - console.log("Got progress notification", token, value) switch (value.kind) { - case "begin": + case 'begin': this.show(); break; - case "report": + case 'report': if (value.message) { this.packageName = value.message; } break; - case "end": + case 'end': this.hide(); break; } @@ -88,19 +87,19 @@ export class StatusDisplay implements vscode.Disposable { // FIXME: Replace this once vscode-languageclient is updated to LSP 3.15 interface ProgressParams { - token: string - value: WorkDoneProgress + token: string; + value: WorkDoneProgress; } enum WorkDoneProgressKind { - Begin = "begin", - Report = "report", - End = "end" + Begin = 'begin', + Report = 'report', + End = 'end', } interface WorkDoneProgress { - kind: WorkDoneProgressKind, - message?: string - cancelable?: boolean - percentage?: string -} \ No newline at end of file + kind: WorkDoneProgressKind; + message?: string; + cancelable?: boolean; + percentage?: string; +} diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 1507cb26..36163b6b 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -5,10 +5,10 @@ import * as commands from './commands'; import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; +import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; -import { StatusDisplay } from './commands/watch_status'; export async function activate(context: vscode.ExtensionContext) { function disposeOnDeactivation(disposable: vscode.Disposable) { @@ -84,7 +84,9 @@ export async function activate(context: vscode.ExtensionContext) { overrideCommand('type', commands.onEnter.handle); } - const watchStatus = new StatusDisplay(Server.config.cargoCheckOptions.command || 'check'); + const watchStatus = new StatusDisplay( + Server.config.cargoCheckOptions.command || 'check', + ); disposeOnDeactivation(watchStatus); // Notifications are events triggered by the language server @@ -98,8 +100,8 @@ export async function activate(context: vscode.ExtensionContext) { ], [ '$/progress', - (params) => watchStatus.handleProgressNotification(params), - ] + params => watchStatus.handleProgressNotification(params), + ], ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); From d5c2f26ec4312f21707fe75417b4a0108ad652ed Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 20:23:44 +0100 Subject: [PATCH 250/819] Keep VSCode config mostly backwards compatible --- rust-analyzer/editors/code/package.json | 34 +++++++++------------ rust-analyzer/editors/code/src/config.ts | 31 ++++++++++++------- rust-analyzer/editors/code/src/extension.ts | 2 +- rust-analyzer/editors/code/src/server.ts | 8 +++-- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5f412339..69298e91 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -188,11 +188,6 @@ "default": "ra_lsp_server", "description": "Path to ra_lsp_server executable" }, - "rust-analyzer.enableCargoCheck": { - "type": "boolean", - "default": true, - "description": "Run `cargo check` for diagnostics on save" - }, "rust-analyzer.excludeGlobs": { "type": "array", "default": [], @@ -203,16 +198,26 @@ "default": true, "description": "client provided file watching instead of notify watching." }, - "rust-analyzer.cargo-check.arguments": { + "rust-analyzer.cargo-watch.enable": { + "type": "boolean", + "default": true, + "description": "Run `cargo check` for diagnostics on save" + }, + "rust-analyzer.cargo-watch.arguments": { "type": "array", - "description": "`cargo-check` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo check --features=\"shumway,pdf\"` )", + "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": [] }, - "rust-analyzer.cargo-check.command": { + "rust-analyzer.cargo-watch.command": { "type": "string", - "description": "`cargo-check` command. (e.g: `clippy` will run as `cargo clippy` )", + "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", "default": "check" }, + "rust-analyzer.cargo-watch.allTargets": { + "type": "boolean", + "description": "Check all targets and tests (will be passed as `--all-targets`)", + "default": true + }, "rust-analyzer.trace.server": { "type": "string", "scope": "window", @@ -229,17 +234,6 @@ "default": "off", "description": "Trace requests to the ra_lsp_server" }, - "rust-analyzer.trace.cargo-watch": { - "type": "string", - "scope": "window", - "enum": [ - "off", - "error", - "verbose" - ], - "default": "off", - "description": "Trace output of cargo-watch" - }, "rust-analyzer.lruCapacity": { "type": "number", "default": null, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 96532e2c..4b388b80 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -4,10 +4,11 @@ import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; -export interface CargoCheckOptions { - enabled: boolean; +export interface CargoWatchOptions { + enable: boolean; arguments: string[]; - command: null | string; + command: string; + allTargets: boolean; } export interface CargoFeatures { @@ -29,10 +30,11 @@ export class Config { public featureFlags = {}; // for internal use public withSysroot: null | boolean = null; - public cargoCheckOptions: CargoCheckOptions = { - enabled: true, + public cargoWatchOptions: CargoWatchOptions = { + enable: true, arguments: [], - command: null, + command: '', + allTargets: true, }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, @@ -91,27 +93,34 @@ export class Config { RA_LSP_DEBUG || (config.get('raLspServerPath') as string); } - if (config.has('enableCargoCheck')) { - this.cargoCheckOptions.enabled = config.get( - 'enableCargoCheck', + if (config.has('cargo-watch.enable')) { + this.cargoWatchOptions.enable = config.get( + 'cargo-watch.enable', true, ); } if (config.has('cargo-watch.arguments')) { - this.cargoCheckOptions.arguments = config.get( + this.cargoWatchOptions.arguments = config.get( 'cargo-watch.arguments', [], ); } if (config.has('cargo-watch.command')) { - this.cargoCheckOptions.command = config.get( + this.cargoWatchOptions.command = config.get( 'cargo-watch.command', '', ); } + if (config.has('cargo-watch.allTargets')) { + this.cargoWatchOptions.allTargets = config.get( + 'cargo-watch.allTargets', + true, + ); + } + if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/extension.ts index 36163b6b..1da10ebd 100644 --- a/rust-analyzer/editors/code/src/extension.ts +++ b/rust-analyzer/editors/code/src/extension.ts @@ -85,7 +85,7 @@ export async function activate(context: vscode.ExtensionContext) { } const watchStatus = new StatusDisplay( - Server.config.cargoCheckOptions.command || 'check', + Server.config.cargoWatchOptions.command, ); disposeOnDeactivation(watchStatus); diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 409d3b4b..ae81af84 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -55,9 +55,11 @@ export class Server { publishDecorations: true, lruCapacity: Server.config.lruCapacity, maxInlayHintLength: Server.config.maxInlayHintLength, - cargoCheckEnable: Server.config.cargoCheckOptions.enabled, - cargoCheckCommand: Server.config.cargoCheckOptions.command, - cargoCheckArgs: Server.config.cargoCheckOptions.arguments, + cargoWatchEnable: Server.config.cargoWatchOptions.enable, + cargoWatchArgumets: Server.config.cargoWatchOptions.arguments, + cargoWatchCommand: Server.config.cargoWatchOptions.command, + cargoWatchAllTargets: + Server.config.cargoWatchOptions.allTargets, excludeGlobs: Server.config.excludeGlobs, useClientWatching: Server.config.useClientWatching, featureFlags: Server.config.featureFlags, From 86703f831ae38ae26d0859f4019eabb6e060186f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 00:15:39 +0100 Subject: [PATCH 251/819] Trim down launch configurations --- .../editors/code/.vscode/launch.json | 31 ------------------- .../editors/code/.vscode/settings.json | 11 ------- rust-analyzer/editors/code/.vscode/tasks.json | 20 ------------ 3 files changed, 62 deletions(-) delete mode 100644 rust-analyzer/editors/code/.vscode/launch.json delete mode 100644 rust-analyzer/editors/code/.vscode/settings.json delete mode 100644 rust-analyzer/editors/code/.vscode/tasks.json diff --git a/rust-analyzer/editors/code/.vscode/launch.json b/rust-analyzer/editors/code/.vscode/launch.json deleted file mode 100644 index c3578f47..00000000 --- a/rust-analyzer/editors/code/.vscode/launch.json +++ /dev/null @@ -1,31 +0,0 @@ -// A launch configuration that compiles the extension and then opens it inside a new window -// Use IntelliSense to learn about possible attributes. -// Hover to view descriptions of existing attributes. -// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Extension", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceFolder}"], - "outFiles": ["${workspaceFolder}/out/**/*.js"], - "preLaunchTask": "npm: watch" - }, - { - "name": "Extension Tests", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "${workspaceFolder}/src/test/", - "--extensionDevelopmentPath=${workspaceFolder}", - "--extensionTestsPath=${workspaceFolder}/out/test" - ], - "outFiles": ["${workspaceFolder}/out/test/**/*.js"], - "preLaunchTask": "npm: watch" - } - ] -} diff --git a/rust-analyzer/editors/code/.vscode/settings.json b/rust-analyzer/editors/code/.vscode/settings.json deleted file mode 100644 index fa0a1048..00000000 --- a/rust-analyzer/editors/code/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.exclude": { - "out": false // set this to true to hide the "out" folder with the compiled JS files - }, - "search.exclude": { - "out": true // set this to false to include "out" folder in search results - }, - // Turn off tsc task auto detection since we have the necessary tasks as npm scripts - "typescript.tsc.autoDetect": "off" -} diff --git a/rust-analyzer/editors/code/.vscode/tasks.json b/rust-analyzer/editors/code/.vscode/tasks.json deleted file mode 100644 index 5deb2bcc..00000000 --- a/rust-analyzer/editors/code/.vscode/tasks.json +++ /dev/null @@ -1,20 +0,0 @@ -// See https://go.microsoft.com/fwlink/?LinkId=733558 -// for the documentation about the tasks.json format -{ - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "watch", - "problemMatcher": "$tsc-watch", - "isBackground": true, - "presentation": { - "reveal": "never" - }, - "group": { - "kind": "build", - "isDefault": true - } - } - ] -} From 615c563302e017225dcd8dded1d843ff1117b319 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 02:22:52 +0100 Subject: [PATCH 252/819] Minimize TypeScript build --- rust-analyzer/editors/code/.prettierignore | 2 - rust-analyzer/editors/code/.vscodeignore | 9 - rust-analyzer/editors/code/package-lock.json | 1675 ----------------- rust-analyzer/editors/code/package.json | 43 +- rust-analyzer/editors/code/rollup.config.js | 30 - .../editors/code/src/test/runTest.ts | 22 - .../editors/code/src/test/utils/index.ts | 49 - rust-analyzer/editors/code/tsconfig.json | 8 +- rust-analyzer/editors/code/tslint.json | 15 - 9 files changed, 14 insertions(+), 1839 deletions(-) delete mode 100644 rust-analyzer/editors/code/.prettierignore delete mode 100644 rust-analyzer/editors/code/.vscodeignore delete mode 100644 rust-analyzer/editors/code/rollup.config.js delete mode 100644 rust-analyzer/editors/code/src/test/runTest.ts delete mode 100644 rust-analyzer/editors/code/src/test/utils/index.ts delete mode 100644 rust-analyzer/editors/code/tslint.json diff --git a/rust-analyzer/editors/code/.prettierignore b/rust-analyzer/editors/code/.prettierignore deleted file mode 100644 index 3798f2d1..00000000 --- a/rust-analyzer/editors/code/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -.vscode-test/ diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore deleted file mode 100644 index f9e72b66..00000000 --- a/rust-analyzer/editors/code/.vscodeignore +++ /dev/null @@ -1,9 +0,0 @@ -.vscode/** -.vscode-test/** -out/** -src/** -.gitignore -tsconfig.json -vsc-extension-quickstart.md -tslint.json -node_modules/** diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 67081f3f..767eec3b 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -4,76 +4,12 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", - "dev": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - } - }, - "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", - "dev": true - }, - "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", - "dev": true, - "requires": { - "@types/events": "*", - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, - "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "@types/node": { "version": "12.12.21", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.21.tgz", "integrity": "sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==", "dev": true }, - "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/seedrandom": { "version": "2.4.28", "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", @@ -86,1466 +22,27 @@ "integrity": "sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A==", "dev": true }, - "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", - "dev": true - }, - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "azure-devops-node-api": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", - "integrity": "sha512-pMfGJ6gAQ7LRKTHgiRF+8iaUUeGAI0c8puLaqHLc7B8AR7W6GJLozK9RFeUHFjEGybC9/EB3r67WPd7e46zQ8w==", - "dev": true, - "requires": { - "os": "0.1.1", - "tunnel": "0.0.4", - "typed-rest-client": "1.2.0", - "underscore": "1.8.3" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "cheerio": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", - "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", - "dev": true, - "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.1", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash": "^4.15.0", - "parse5": "^3.0.1" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "css-select": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "dev": true, - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", - "dev": true - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "denodeify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", - "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", - "dev": true - }, - "didyoumean": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", - "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", - "dev": true - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dev": true, - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - }, - "es-abstract": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.3.tgz", - "integrity": "sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.1.0", - "string.prototype.trimright": "^2.1.0" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", - "dev": true - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint-plugin-prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz", - "integrity": "sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA==", - "dev": true, - "requires": { - "fast-diff": "^1.1.1", - "jest-docblock": "^21.0.0" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "http-proxy-agent": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", - "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", - "dev": true, - "requires": { - "agent-base": "4", - "debug": "3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", - "dev": true, - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", - "dev": true - }, - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", - "dev": true - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", - "dev": true - }, - "is-reference": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz", - "integrity": "sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==", - "dev": true, - "requires": { - "@types/estree": "0.0.39" - } - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "jest-docblock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", - "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", - "dev": true - }, - "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", - "dev": true, - "requires": { - "uc.micro": "^1.0.1" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, "lookpath": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.0.4.tgz", "integrity": "sha512-xVFrWlfo7n8VZs1YjBWKkbSIJU7DKE/0Mep62KeT94V1Ui1IY9w5fXfgiCsDIDZkakIYSXSeaW2FLbCqfw9/Cw==" }, - "magic-string": { - "version": "0.25.3", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz", - "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - }, - "markdown-it": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", - "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "entities": "~1.1.1", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - } - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", - "dev": true - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "mocha": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", - "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", - "dev": true, - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "2.2.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "ms": "2.1.1", - "node-environment-flags": "1.0.5", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.0", - "yargs-parser": "13.1.1", - "yargs-unparser": "1.6.0" - }, - "dependencies": { - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - } - }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dev": true, - "requires": { - "boolbase": "~1.0.0" - } - }, - "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", - "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "parse-semver": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", - "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", - "dev": true, - "requires": { - "semver": "^5.1.0" - } - }, - "parse5": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", - "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, - "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true - }, - "read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", - "dev": true, - "requires": { - "mute-stream": "~0.0.4" - } - }, - "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "resolve": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", - "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "rollup": { - "version": "1.27.13", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.13.tgz", - "integrity": "sha512-hDi7M07MpmNSDE8YVwGVFA8L7n8jTLJ4lG65nMAijAyqBe//rtu4JdxjUBE7JqXfdpqxqDTbCDys9WcqdpsQvw==", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/node": "*", - "acorn": "^7.1.0" - } - }, - "rollup-plugin-commonjs": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", - "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", - "dev": true, - "requires": { - "estree-walker": "^0.6.1", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0", - "rollup-pluginutils": "^2.8.1" - }, - "dependencies": { - "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } - } - }, - "rollup-plugin-node-resolve": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", - "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", - "dev": true, - "requires": { - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1", - "rollup-pluginutils": "^2.8.1" - }, - "dependencies": { - "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", - "dev": true - }, - "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } - } - }, - "rollup-plugin-sourcemaps": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz", - "integrity": "sha1-YhJaqUCHqt97g+9N+vYptHMTXoc=", - "dev": true, - "requires": { - "rollup-pluginutils": "^2.0.1", - "source-map-resolve": "^0.5.0" - } - }, - "rollup-plugin-typescript": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", - "integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==", - "dev": true, - "requires": { - "resolve": "^1.10.0", - "rollup-pluginutils": "^2.5.0" - }, - "dependencies": { - "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } - } - }, - "rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, - "requires": { - "estree-walker": "^0.6.1" - } - }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true - }, "seedrandom": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shelljs": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", - "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "shx": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", - "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", - "dev": true, - "requires": { - "es6-object-assign": "^1.0.3", - "minimist": "^1.2.0", - "shelljs": "^0.8.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "source-map-resolve": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", - "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", - "dev": true, - "requires": { - "atob": "^2.1.1", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "sourcemap-codec": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", - "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "string.prototype.trimleft": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", - "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "function-bind": "^1.1.1" - } - }, - "string.prototype.trimright": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", - "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "function-bind": "^1.1.1" - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tmp": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", - "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.1" - } - }, - "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", - "dev": true - } - } - }, - "tslint-config-prettier": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", - "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", - "dev": true - }, - "tslint-plugin-prettier": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz", - "integrity": "sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw==", - "dev": true, - "requires": { - "eslint-plugin-prettier": "^2.2.0", - "lines-and-columns": "^1.1.6", - "tslib": "^1.7.1" - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "tunnel": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", - "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", - "dev": true - }, - "typed-rest-client": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", - "integrity": "sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==", - "dev": true, - "requires": { - "tunnel": "0.0.4", - "underscore": "1.8.3" - } - }, "typescript": { "version": "3.7.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", "dev": true }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url-join": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", - "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "vsce": { - "version": "1.71.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", - "integrity": "sha512-7k+LPC4oJYPyyxs0a5nh4A8CleQ6+2EMPiAiX/bDyN+PmwJFm2FFPqLRxdIsIWfFnkW4ZMQBf10+W62dCRd9kQ==", - "dev": true, - "requires": { - "azure-devops-node-api": "^7.2.0", - "chalk": "^2.4.2", - "cheerio": "^1.0.0-rc.1", - "commander": "^2.8.1", - "denodeify": "^1.2.1", - "didyoumean": "^1.2.1", - "glob": "^7.0.6", - "lodash": "^4.17.10", - "markdown-it": "^8.3.1", - "mime": "^1.3.4", - "minimatch": "^3.0.3", - "osenv": "^0.1.3", - "parse-semver": "^1.1.1", - "read": "^1.0.7", - "semver": "^5.1.0", - "tmp": "0.0.29", - "typed-rest-client": "1.2.0", - "url-join": "^1.1.0", - "yauzl": "^2.3.1", - "yazl": "^2.2.2" - } - }, "vscode-jsonrpc": { "version": "5.0.0-next.5", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.5.tgz", @@ -1580,178 +77,6 @@ "version": "3.15.0-next.9", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz", "integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==" - }, - "vscode-test": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.3.0.tgz", - "integrity": "sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw==", - "dev": true, - "requires": { - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.4", - "rimraf": "^2.6.3" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "yazl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", - "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3" - } } } } diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f28ce177..a113af4d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -17,47 +17,20 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "package": "vsce package", - "compile": "rollup -c", - "watch": "tsc -watch -p ./", - "fix": "prettier **/*.{json,ts} --write && tslint --project . --fix", - "lint": "tslint --project .", - "prettier": "prettier **/*.{json,ts}", - "test": "tsc -p . && node ./out/test/runTest.js", - "travis": "npm run compile && npm run test && npm run lint && npm run prettier -- --write && git diff --exit-code" - }, - "prettier": { - "singleQuote": true, - "tabWidth": 4, - "trailingComma": "all" + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./" }, "dependencies": { - "lookpath": "^1.0.4", - "seedrandom": "^3.0.5", "vscode-languageclient": "^6.0.0-next.9", - "jsonc-parser": "^2.1.0" + "jsonc-parser": "^2.1.0", + "lookpath": "^1.0.4", + "seedrandom": "^3.0.5" }, "devDependencies": { - "@types/glob": "^7.1.1", - "@types/mocha": "^5.2.7", "@types/node": "^12.12.21", - "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", - "glob": "^7.1.6", - "mocha": "^6.2.2", - "prettier": "^1.19.1", - "rollup": "^1.27.13", - "rollup-plugin-commonjs": "^10.1.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-typescript": "^1.0.1", - "shx": "^0.3.1", - "tslint": "^5.20.1", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", - "typescript": "^3.7.3", - "vsce": "^1.71.0", - "vscode-test": "^1.3.0" + "@types/seedrandom": "^2.4.28", + "typescript": "^3.7.3" }, "activationEvents": [ "onLanguage:rust", @@ -65,7 +38,7 @@ "onCommand:rust-analyzer.collectGarbage", "workspaceContains:**/Cargo.toml" ], - "main": "./bundle/extension", + "main": "./out/extension", "contributes": { "taskDefinitions": [ { diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js deleted file mode 100644 index 1b222bbe..00000000 --- a/rust-analyzer/editors/code/rollup.config.js +++ /dev/null @@ -1,30 +0,0 @@ -import typescript from 'rollup-plugin-typescript'; -import resolve from 'rollup-plugin-node-resolve'; -import commonjs from 'rollup-plugin-commonjs'; -import sourcemaps from 'rollup-plugin-sourcemaps' -import nodeBuiltins from 'builtin-modules'; - -export default { - input: './src/extension.ts', - plugins: [ - typescript(), - sourcemaps(), - resolve(), - commonjs({ - namedExports: { - // squelch missing import warnings - 'vscode-languageclient': [ 'CreateFile', 'RenameFile' ] - } - }), - ], - // keep these as require() calls, bundle the rest - external: [ - ...nodeBuiltins, - 'vscode', - ], - output: { - file: './bundle/extension.js', - sourcemap: true, - format: 'cjs', - } -}; diff --git a/rust-analyzer/editors/code/src/test/runTest.ts b/rust-analyzer/editors/code/src/test/runTest.ts deleted file mode 100644 index d880d47d..00000000 --- a/rust-analyzer/editors/code/src/test/runTest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as path from 'path'; - -import { runTests } from 'vscode-test'; - -async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); - - // The path to the extension test runner script - // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './utils/index'); - - // Download VS Code, unzip it and run the integration test - await runTests({ extensionDevelopmentPath, extensionTestsPath }); - } catch (err) { - process.exit(1); - } -} - -main(); diff --git a/rust-analyzer/editors/code/src/test/utils/index.ts b/rust-analyzer/editors/code/src/test/utils/index.ts deleted file mode 100644 index 9927daaf..00000000 --- a/rust-analyzer/editors/code/src/test/utils/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -// -// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING -// -// This file is providing the test runner to use when running extension tests. -// By default the test runner in use is Mocha based. -// -// You can provide your own test runner if you want to override it by exporting -// a function run(testRoot: string, clb: (error:Error) => void) that the extension -// host can call to run the tests. The test runner is expected to use console.log -// to report the results back to the caller. When the tests are finished, return -// a possible error to the callback or null if none. - -import * as glob from 'glob'; -import * as Mocha from 'mocha'; -import * as path from 'path'; - -export function run(): Promise { - // Create the mocha test - const mocha = new Mocha({ - ui: 'bdd', - }); - mocha.useColors(true); - - const testsRoot = __dirname; - - return new Promise((c, e) => { - glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { - if (err) { - return e(err); - } - - // Add files to the test suite - files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); - - try { - // Run the mocha test - mocha.run(failures => { - if (failures > 0) { - e(new Error(`${failures} tests failed.`)); - } else { - c(); - } - }); - } catch (err) { - e(err); - } - }); - }); -} diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 5e11c377..a4fbb4b8 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -3,7 +3,9 @@ "module": "commonjs", "target": "es2018", "outDir": "out", - "lib": ["es2018"], + "lib": [ + "es2018" + ], "sourceMap": true, "rootDir": "src", "strict": true, @@ -12,5 +14,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true }, - "exclude": ["node_modules", ".vscode-test"] + "exclude": [ + "node_modules" + ] } diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json deleted file mode 100644 index f06fa5fa..00000000 --- a/rust-analyzer/editors/code/tslint.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": [ - "tslint:recommended", - "tslint-config-prettier", - "tslint-plugin-prettier" - ], - "rules": { - "interface-name": false, - "prettier": true, - "object-literal-sort-keys": false, - // Allow `_bar` to sort with tsc's `noUnusedParameters` option - "variable-name": [true, "allow-leading-underscore"] - } -} From c1cb1c453f877584e41464cbcd67481a946df540 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 09:51:44 +0100 Subject: [PATCH 253/819] Add rollup --- rust-analyzer/editors/code/.vscodeignore | 4 + rust-analyzer/editors/code/package-lock.json | 726 ++++++++++++++++++- rust-analyzer/editors/code/package.json | 19 +- rust-analyzer/editors/code/rollup.config.js | 25 + rust-analyzer/editors/code/src/server.ts | 12 +- 5 files changed, 751 insertions(+), 35 deletions(-) create mode 100644 rust-analyzer/editors/code/.vscodeignore create mode 100644 rust-analyzer/editors/code/rollup.config.js diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore new file mode 100644 index 00000000..eeb04709 --- /dev/null +++ b/rust-analyzer/editors/code/.vscodeignore @@ -0,0 +1,4 @@ +** +!out/extension.ts +!package.json +!package-lock.json diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 767eec3b..982238fa 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -4,12 +4,72 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@rollup/plugin-commonjs": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz", + "integrity": "sha512-jnm//T5ZWOZ6zmJ61fReSCBOif+Ax8dHVoVggA+d2NA7T4qCWgQ3KYr+zN2faGEYLpe1wa03IzvhR+sqVLxUWg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.0", + "estree-walker": "^0.6.1", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0" + } + }, + "@rollup/plugin-node-resolve": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.0.0.tgz", + "integrity": "sha512-GqWz1CfXOsqpeVMcoM315+O7zMxpRsmhWyhJoxLFHVSp9S64/u02i7len/FnbTNbmgYs+sZyilasijH8UiuboQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.0", + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.11.1" + } + }, + "@rollup/plugin-typescript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.0.1.tgz", + "integrity": "sha512-UA/bN/DlHN19xdOllXmp7G7pM2ac9dQMg0q2T1rg4Bogzb7oHXj2WGafpiNpEm54PivcJdzGRJvRnI6zCISW3w==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.0", + "resolve": "^1.12.2" + } + }, + "@rollup/pluginutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.1.tgz", + "integrity": "sha512-PmNurkecagFimv7ZdKCVOfQuqKDPkrcpLFxRBcQ00LYr4HAjJwhCFxBiY2Xoletll2htTIiXBg6g0Yg21h2M3w==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + } + }, + "@types/estree": { + "version": "0.0.41", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.41.tgz", + "integrity": "sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA==", + "dev": true + }, "@types/node": { - "version": "12.12.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.21.tgz", - "integrity": "sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==", + "version": "12.12.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.22.tgz", + "integrity": "sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ==", "dev": true }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/seedrandom": { "version": "2.4.28", "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", @@ -22,27 +82,641 @@ "integrity": "sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A==", "dev": true }, + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "azure-devops-node-api": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", + "integrity": "sha512-pMfGJ6gAQ7LRKTHgiRF+8iaUUeGAI0c8puLaqHLc7B8AR7W6GJLozK9RFeUHFjEGybC9/EB3r67WPd7e46zQ8w==", + "dev": true, + "requires": { + "os": "0.1.1", + "tunnel": "0.0.4", + "typed-rest-client": "1.2.0", + "underscore": "1.8.3" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cheerio": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", + "dev": true, + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.1", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", + "dev": true + }, + "denodeify": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", + "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", + "dev": true + }, + "didyoumean": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", + "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "dev": true + }, + "dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "dev": true, + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-reference": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", + "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==", + "dev": true, + "requires": { + "@types/estree": "0.0.39" + }, + "dependencies": { + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + } + } + }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" }, - "lookpath": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.0.4.tgz", - "integrity": "sha512-xVFrWlfo7n8VZs1YjBWKkbSIJU7DKE/0Mep62KeT94V1Ui1IY9w5fXfgiCsDIDZkakIYSXSeaW2FLbCqfw9/Cw==" + "linkify-it": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", + "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "dev": true, + "requires": { + "uc.micro": "^1.0.1" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "magic-string": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", + "integrity": "sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "markdown-it": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", + "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "entities": "~1.1.1", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + } + }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "dev": true + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", + "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "parse-semver": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "integrity": "sha1-mkr9bfBj3Egm+T+6SpnPIj9mbLg=", + "dev": true, + "requires": { + "semver": "^5.1.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", + "dev": true, + "requires": { + "mute-stream": "~0.0.4" + } + }, + "readable-stream": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "resolve": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", + "integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "1.27.14", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.14.tgz", + "integrity": "sha512-DuDjEyn8Y79ALYXMt+nH/EI58L5pEw5HU9K38xXdRnxQhvzUTI/nxAawhkAHUQeudANQ//8iyrhVRHJBuR6DSQ==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/node": "*", + "acorn": "^7.1.0" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "dev": true }, "seedrandom": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "sourcemap-codec": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", + "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + }, + "tunnel": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", + "dev": true + }, + "typed-rest-client": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", + "integrity": "sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==", + "dev": true, + "requires": { + "tunnel": "0.0.4", + "underscore": "1.8.3" + } + }, "typescript": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", - "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", + "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", "dev": true }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, + "url-join": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", + "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "vsce": { + "version": "1.71.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", + "integrity": "sha512-7k+LPC4oJYPyyxs0a5nh4A8CleQ6+2EMPiAiX/bDyN+PmwJFm2FFPqLRxdIsIWfFnkW4ZMQBf10+W62dCRd9kQ==", + "dev": true, + "requires": { + "azure-devops-node-api": "^7.2.0", + "chalk": "^2.4.2", + "cheerio": "^1.0.0-rc.1", + "commander": "^2.8.1", + "denodeify": "^1.2.1", + "didyoumean": "^1.2.1", + "glob": "^7.0.6", + "lodash": "^4.17.10", + "markdown-it": "^8.3.1", + "mime": "^1.3.4", + "minimatch": "^3.0.3", + "osenv": "^0.1.3", + "parse-semver": "^1.1.1", + "read": "^1.0.7", + "semver": "^5.1.0", + "tmp": "0.0.29", + "typed-rest-client": "1.2.0", + "url-join": "^1.1.0", + "yauzl": "^2.3.1", + "yazl": "^2.2.2" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "vscode-jsonrpc": { "version": "5.0.0-next.5", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.5.tgz", @@ -55,13 +729,6 @@ "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.0-next.14" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - } } }, "vscode-languageserver-protocol": { @@ -77,6 +744,31 @@ "version": "3.15.0-next.9", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz", "integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3" + } } } } diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a113af4d..8c480cc3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -16,21 +16,26 @@ "vscode": "^1.41.0" }, "scripts": { - "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "vscode:prepublish": "rollup -c", + "package": "vsce package", "watch": "tsc -watch -p ./" }, "dependencies": { - "vscode-languageclient": "^6.0.0-next.9", "jsonc-parser": "^2.1.0", - "lookpath": "^1.0.4", - "seedrandom": "^3.0.5" + "seedrandom": "^3.0.5", + "vscode-languageclient": "^6.0.0-next.9" }, "devDependencies": { + "rollup": "^1.27.14", + "@rollup/plugin-commonjs": "^11.0.0", + "@rollup/plugin-node-resolve": "^6.0.0", + "@rollup/plugin-typescript": "^2.0.1", + "typescript": "^3.7.3", + "tslib": "^1.10.0", + "vsce": "^1.71.0", "@types/node": "^12.12.21", - "@types/vscode": "^1.41.0", "@types/seedrandom": "^2.4.28", - "typescript": "^3.7.3" + "@types/vscode": "^1.41.0" }, "activationEvents": [ "onLanguage:rust", diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js new file mode 100644 index 00000000..e4b21afb --- /dev/null +++ b/rust-analyzer/editors/code/rollup.config.js @@ -0,0 +1,25 @@ +import typescript from '@rollup/plugin-typescript'; +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import nodeBuiltins from 'builtin-modules'; + +export default { + input: 'src/extension.ts', + plugins: [ + typescript(), + resolve({ + preferBuiltins: true + }), + commonjs({ + namedExports: { + // squelch missing import warnings + 'vscode-languageclient': ['CreateFile', 'RenameFile'] + } + }) + ], + external: [...nodeBuiltins, 'vscode'], + output: { + file: './out/extension.js', + format: 'cjs' + } +}; diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index ae81af84..e1ad0520 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -1,5 +1,4 @@ -import { lookpath } from 'lookpath'; -import { homedir, platform } from 'os'; +import { homedir } from 'os'; import * as lc from 'vscode-languageclient'; import { window, workspace } from 'vscode'; @@ -29,15 +28,6 @@ export class Server { } const command = expandPathResolving(this.config.raLspServerPath); - // FIXME: remove check when the following issue is fixed: - // https://github.com/otiai10/lookpath/issues/4 - if (platform() !== 'win32') { - if (!(await lookpath(command))) { - throw new Error( - `Cannot find rust-analyzer server \`${command}\` in PATH.`, - ); - } - } const run: lc.Executable = { command, options: { cwd: folder }, From b0370fcd36e79d8cef2310e148da8d07ee5b7485 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 11:23:38 +0100 Subject: [PATCH 254/819] Minimize typescript CI --- rust-analyzer/editors/code/.vscodeignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index eeb04709..f2c4d330 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -1,4 +1,4 @@ ** -!out/extension.ts +!out/extension.js !package.json !package-lock.json From 360550611f40ba95035f424cfecc89836c46680f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 12:19:58 +0100 Subject: [PATCH 255/819] Rename extension.ts -> main.ts --- rust-analyzer/editors/code/.vscodeignore | 2 +- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/rollup.config.js | 4 ++-- rust-analyzer/editors/code/src/{extension.ts => main.ts} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename rust-analyzer/editors/code/src/{extension.ts => main.ts} (100%) diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index f2c4d330..9bcd28e6 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -1,4 +1,4 @@ ** -!out/extension.js +!out/main.js !package.json !package-lock.json diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8c480cc3..d14a36f8 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -43,7 +43,7 @@ "onCommand:rust-analyzer.collectGarbage", "workspaceContains:**/Cargo.toml" ], - "main": "./out/extension", + "main": "./out/main", "contributes": { "taskDefinitions": [ { diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index e4b21afb..4c001f89 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -4,7 +4,7 @@ import commonjs from '@rollup/plugin-commonjs'; import nodeBuiltins from 'builtin-modules'; export default { - input: 'src/extension.ts', + input: 'src/main.ts', plugins: [ typescript(), resolve({ @@ -19,7 +19,7 @@ export default { ], external: [...nodeBuiltins, 'vscode'], output: { - file: './out/extension.js', + file: './out/main.js', format: 'cjs' } }; diff --git a/rust-analyzer/editors/code/src/extension.ts b/rust-analyzer/editors/code/src/main.ts similarity index 100% rename from rust-analyzer/editors/code/src/extension.ts rename to rust-analyzer/editors/code/src/main.ts From eb61fa8c842c139f32a3e9050480886241373455 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 12:25:55 +0100 Subject: [PATCH 256/819] Simplify --- .../code/src/commands/analyzer_status.ts | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 2777ced2..5840e8fc 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,41 +1,15 @@ import * as vscode from 'vscode'; import { Server } from '../server'; - -const statusUri = vscode.Uri.parse('rust-analyzer-status://status'); - -export class TextDocumentContentProvider - implements vscode.TextDocumentContentProvider { - public eventEmitter = new vscode.EventEmitter(); - public syntaxTree: string = 'Not available'; - - public provideTextDocumentContent( - _uri: vscode.Uri, - ): vscode.ProviderResult { - const editor = vscode.window.activeTextEditor; - if (editor == null) { - return ''; - } - return Server.client.sendRequest( - 'rust-analyzer/analyzerStatus', - null, - ); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} - -let poller: NodeJS.Timer | null = null; - // Shows status of rust-analyzer (for debugging) export function makeCommand(context: vscode.ExtensionContext) { - const textDocumentContentProvider = new TextDocumentContentProvider(); + let poller: NodeJS.Timer | null = null; + const tdcp = new TextDocumentContentProvider(); + context.subscriptions.push( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer-status', - textDocumentContentProvider, + tdcp, ), ); @@ -50,11 +24,11 @@ export function makeCommand(context: vscode.ExtensionContext) { return async function handle() { if (poller == null) { poller = setInterval( - () => textDocumentContentProvider.eventEmitter.fire(statusUri), + () => tdcp.eventEmitter.fire(tdcp.uri), 1000, ); } - const document = await vscode.workspace.openTextDocument(statusUri); + const document = await vscode.workspace.openTextDocument(tdcp.uri); return vscode.window.showTextDocument( document, vscode.ViewColumn.Two, @@ -62,3 +36,26 @@ export function makeCommand(context: vscode.ExtensionContext) { ); }; } + +class TextDocumentContentProvider + implements vscode.TextDocumentContentProvider { + uri = vscode.Uri.parse('rust-analyzer-status://status'); + eventEmitter = new vscode.EventEmitter(); + + provideTextDocumentContent( + _uri: vscode.Uri, + ): vscode.ProviderResult { + const editor = vscode.window.activeTextEditor; + if (editor == null) { + return ''; + } + return Server.client.sendRequest( + 'rust-analyzer/analyzerStatus', + null, + ); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } +} From 8fba0ac37d4145d7bff6783fc2a84f8545676a80 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 14:42:59 +0100 Subject: [PATCH 257/819] Start new ctx module --- .../code/src/commands/analyzer_status.ts | 19 +++++++---- .../editors/code/src/commands/index.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 30 +++++++++++++++++ rust-analyzer/editors/code/src/main.ts | 32 +++++++++++-------- 4 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 rust-analyzer/editors/code/src/ctx.ts diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 5840e8fc..6e92c50e 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,19 +1,19 @@ import * as vscode from 'vscode'; -import { Server } from '../server'; +import { Ctx } from '../ctx'; // Shows status of rust-analyzer (for debugging) -export function makeCommand(context: vscode.ExtensionContext) { +export function analyzerStatus(ctx: Ctx) { let poller: NodeJS.Timer | null = null; - const tdcp = new TextDocumentContentProvider(); + const tdcp = new TextDocumentContentProvider(ctx); - context.subscriptions.push( + ctx.pushCleanup( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer-status', tdcp, ), ); - context.subscriptions.push({ + ctx.pushCleanup({ dispose() { if (poller != null) { clearInterval(poller); @@ -39,9 +39,16 @@ export function makeCommand(context: vscode.ExtensionContext) { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { + uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); + ctx: Ctx + + constructor(ctx: Ctx) { + this.ctx = ctx + } + provideTextDocumentContent( _uri: vscode.Uri, ): vscode.ProviderResult { @@ -49,7 +56,7 @@ class TextDocumentContentProvider if (editor == null) { return ''; } - return Server.client.sendRequest( + return this.ctx.client.sendRequest( 'rust-analyzer/analyzerStatus', null, ); diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 13a69675..ec199539 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,4 +1,4 @@ -import * as analyzerStatus from './analyzer_status'; +import { analyzerStatus } from './analyzer_status'; import * as applySourceChange from './apply_source_change'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts new file mode 100644 index 00000000..8581667b --- /dev/null +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -0,0 +1,30 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; +import { Server } from './server'; + + +export class Ctx { + private extCtx: vscode.ExtensionContext + + constructor(extCtx: vscode.ExtensionContext) { + this.extCtx = extCtx + } + + get client(): lc.LanguageClient { + return Server.client + } + + registerCommand( + name: string, + factory: (ctx: Ctx) => () => Promise, + ) { + const fullName = `rust-analyzer.${name}` + const cmd = factory(this); + const d = vscode.commands.registerCommand(fullName, cmd); + this.pushCleanup(d); + } + + pushCleanup(d: { dispose(): any }) { + this.extCtx.subscriptions.push(d) + } +} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 1da10ebd..048b9bbd 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -9,8 +9,18 @@ import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; +import { Ctx } from './ctx' + +let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { + ctx = new Ctx(context); + ctx.registerCommand( + 'analyzerStatus', + commands.analyzerStatus + ); + + function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); } @@ -48,10 +58,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand( - 'rust-analyzer.analyzerStatus', - commands.analyzerStatus.makeCommand(context), - ); registerCommand('rust-analyzer.collectGarbage', () => Server.client.sendRequest('rust-analyzer/collectGarbage', null), ); @@ -94,15 +100,15 @@ export async function activate(context: vscode.ExtensionContext) { string, lc.GenericNotificationHandler, ]> = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle, + ], + [ + '$/progress', + params => watchStatus.handleProgressNotification(params), + ], + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); From 103c6d3c3a36f131ea1df2b167c0118de7c13074 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 14:53:43 +0100 Subject: [PATCH 258/819] More second command to Ctx --- .../editors/code/src/commands/analyzer_status.ts | 4 ++-- rust-analyzer/editors/code/src/commands/index.ts | 7 +++++++ rust-analyzer/editors/code/src/ctx.ts | 4 +++- rust-analyzer/editors/code/src/main.ts | 10 ++-------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 6e92c50e..c9d32fe0 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; -import { Ctx } from '../ctx'; +import { Ctx, Cmd } from '../ctx'; // Shows status of rust-analyzer (for debugging) -export function analyzerStatus(ctx: Ctx) { +export function analyzerStatus(ctx: Ctx): Cmd { let poller: NodeJS.Timer | null = null; const tdcp = new TextDocumentContentProvider(ctx); diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index ec199539..ed56f5a4 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,3 +1,5 @@ +import { Ctx, Cmd } from '../ctx' + import { analyzerStatus } from './analyzer_status'; import * as applySourceChange from './apply_source_change'; import * as expandMacro from './expand_macro'; @@ -9,6 +11,10 @@ import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; +function collectGarbage(ctx: Ctx): Cmd { + return async () => { ctx.client.sendRequest('rust-analyzer/collectGarbage', null) } +} + export { analyzerStatus, applySourceChange, @@ -20,4 +26,5 @@ export { syntaxTree, onEnter, inlayHints, + collectGarbage }; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 8581667b..9dd2b7d4 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -16,7 +16,7 @@ export class Ctx { registerCommand( name: string, - factory: (ctx: Ctx) => () => Promise, + factory: (ctx: Ctx) => Cmd, ) { const fullName = `rust-analyzer.${name}` const cmd = factory(this); @@ -28,3 +28,5 @@ export class Ctx { this.extCtx.subscriptions.push(d) } } + +export type Cmd = (...args: any[]) => any; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 048b9bbd..9500219c 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -15,11 +15,8 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); - ctx.registerCommand( - 'analyzerStatus', - commands.analyzerStatus - ); - + ctx.registerCommand('analyzerStatus', commands.analyzerStatus); + ctx.registerCommand('collectGarbage', commands.collectGarbage); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -58,9 +55,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand('rust-analyzer.collectGarbage', () => - Server.client.sendRequest('rust-analyzer/collectGarbage', null), - ); registerCommand( 'rust-analyzer.matchingBrace', commands.matchingBrace.handle, From f724b69ac951c0d33a54f07c4496f7019c6a1ca0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 15:08:38 +0100 Subject: [PATCH 259/819] Add prettier --- rust-analyzer/editors/code/package-lock.json | 6 ++++++ rust-analyzer/editors/code/package.json | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 982238fa..806ebdb8 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -534,6 +534,12 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d14a36f8..6662747f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,7 +18,8 @@ "scripts": { "vscode:prepublish": "rollup -c", "package": "vsce package", - "watch": "tsc -watch -p ./" + "watch": "tsc -watch -p ./", + "prettier": "prettier --write **/*.ts" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -26,16 +27,22 @@ "vscode-languageclient": "^6.0.0-next.9" }, "devDependencies": { - "rollup": "^1.27.14", "@rollup/plugin-commonjs": "^11.0.0", "@rollup/plugin-node-resolve": "^6.0.0", "@rollup/plugin-typescript": "^2.0.1", - "typescript": "^3.7.3", - "tslib": "^1.10.0", - "vsce": "^1.71.0", "@types/node": "^12.12.21", "@types/seedrandom": "^2.4.28", - "@types/vscode": "^1.41.0" + "@types/vscode": "^1.41.0", + "prettier": "^1.19.1", + "rollup": "^1.27.14", + "tslib": "^1.10.0", + "typescript": "^3.7.3", + "vsce": "^1.71.0" + }, + "prettier": { + "singleQuote": true, + "tabWidth": 4, + "trailingComma": "all" }, "activationEvents": [ "onLanguage:rust", From 62a466e46ecc70bacfa4bb6ae027a33265e5be8e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 15:11:30 +0100 Subject: [PATCH 260/819] Run prettier --- rust-analyzer/editors/code/src/ctx.ts | 16 ++++++---------- rust-analyzer/editors/code/src/main.ts | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 9dd2b7d4..87f1574d 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -2,30 +2,26 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from './server'; - export class Ctx { - private extCtx: vscode.ExtensionContext + private extCtx: vscode.ExtensionContext; constructor(extCtx: vscode.ExtensionContext) { - this.extCtx = extCtx + this.extCtx = extCtx; } get client(): lc.LanguageClient { - return Server.client + return Server.client; } - registerCommand( - name: string, - factory: (ctx: Ctx) => Cmd, - ) { - const fullName = `rust-analyzer.${name}` + registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { + const fullName = `rust-analyzer.${name}`; const cmd = factory(this); const d = vscode.commands.registerCommand(fullName, cmd); this.pushCleanup(d); } pushCleanup(d: { dispose(): any }) { - this.extCtx.subscriptions.push(d) + this.extCtx.subscriptions.push(d); } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 9500219c..f96fb196 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -9,7 +9,7 @@ import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; -import { Ctx } from './ctx' +import { Ctx } from './ctx'; let ctx!: Ctx; @@ -94,15 +94,15 @@ export async function activate(context: vscode.ExtensionContext) { string, lc.GenericNotificationHandler, ]> = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle, + ], + [ + '$/progress', + params => watchStatus.handleProgressNotification(params), + ], + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); From a509d0ab69f5bfa7c0279dfb5aae385cd4a26991 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 15:20:13 +0100 Subject: [PATCH 261/819] Move matching brace to new Ctx --- .../editors/code/src/commands/index.ts | 2 +- .../code/src/commands/matching_brace.ts | 53 +++++++++---------- rust-analyzer/editors/code/src/ctx.ts | 7 +++ rust-analyzer/editors/code/src/main.ts | 5 +- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index ed56f5a4..9d9b9c57 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,11 +1,11 @@ import { Ctx, Cmd } from '../ctx' import { analyzerStatus } from './analyzer_status'; +import { matchingBrace } from './matching_brace'; import * as applySourceChange from './apply_source_change'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; import * as joinLines from './join_lines'; -import * as matchingBrace from './matching_brace'; import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 364208cc..665b0c33 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -1,34 +1,33 @@ import * as vscode from 'vscode'; - import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; -import { Server } from '../server'; +import { Ctx, Cmd } from '../ctx'; + +export function matchingBrace(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + if (!editor) { + return; + } + const request: FindMatchingBraceParams = { + textDocument: { uri: editor.document.uri.toString() }, + offsets: editor.selections.map(s => ctx.client.code2ProtocolConverter.asPosition(s.active)), + }; + const response = await ctx.client.sendRequest( + 'rust-analyzer/findMatchingBrace', + request, + ); + editor.selections = editor.selections.map((sel, idx) => { + const active = ctx.client.protocol2CodeConverter.asPosition( + response[idx], + ); + const anchor = sel.isEmpty ? active : sel.anchor; + return new vscode.Selection(anchor, active); + }); + editor.revealRange(editor.selection); + } +} interface FindMatchingBraceParams { textDocument: TextDocumentIdentifier; offsets: Position[]; } - -export async function handle() { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - const request: FindMatchingBraceParams = { - textDocument: { uri: editor.document.uri.toString() }, - offsets: editor.selections.map(s => { - return Server.client.code2ProtocolConverter.asPosition(s.active); - }), - }; - const response = await Server.client.sendRequest( - 'rust-analyzer/findMatchingBrace', - request, - ); - editor.selections = editor.selections.map((sel, idx) => { - const active = Server.client.protocol2CodeConverter.asPosition( - response[idx], - ); - const anchor = sel.isEmpty ? active : sel.anchor; - return new vscode.Selection(anchor, active); - }); - editor.revealRange(editor.selection); -} diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 87f1574d..712337fe 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -13,6 +13,13 @@ export class Ctx { return Server.client; } + get activeRustEditor(): vscode.TextEditor | undefined { + const editor = vscode.window.activeTextEditor; + return editor && editor.document.languageId === 'rust' + ? editor + : undefined; + } + registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { const fullName = `rust-analyzer.${name}`; const cmd = factory(this); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index f96fb196..a4149a05 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -17,6 +17,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); + ctx.registerCommand('matchingBrace', commands.matchingBrace); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -55,10 +56,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand( - 'rust-analyzer.matchingBrace', - commands.matchingBrace.handle, - ); registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); registerCommand('rust-analyzer.run', commands.runnables.handle); From 6f4c78621f2dd0b7ce23d17b072dda75667777c9 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 30 Dec 2019 18:22:06 +0100 Subject: [PATCH 262/819] Fix server config mispell in vscode extension --- rust-analyzer/editors/code/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index e1ad0520..10dc079f 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -46,7 +46,7 @@ export class Server { lruCapacity: Server.config.lruCapacity, maxInlayHintLength: Server.config.maxInlayHintLength, cargoWatchEnable: Server.config.cargoWatchOptions.enable, - cargoWatchArgumets: Server.config.cargoWatchOptions.arguments, + cargoWatchArgs: Server.config.cargoWatchOptions.arguments, cargoWatchCommand: Server.config.cargoWatchOptions.command, cargoWatchAllTargets: Server.config.cargoWatchOptions.allTargets, From 44589a3ee70bdf9db23acef5bd92336fb6a414d5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 15:50:15 +0100 Subject: [PATCH 263/819] Move joinLines to the new Ctx --- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/join_lines.ts | 38 +++++++++---------- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 9d9b9c57..8090c7e5 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -2,10 +2,10 @@ import { Ctx, Cmd } from '../ctx' import { analyzerStatus } from './analyzer_status'; import { matchingBrace } from './matching_brace'; +import { joinLines } from './join_lines'; import * as applySourceChange from './apply_source_change'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; -import * as joinLines from './join_lines'; import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 134ddc80..7952fb0c 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,29 +1,29 @@ -import * as vscode from 'vscode'; - import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; -import { Server } from '../server'; +import { Ctx, Cmd } from '../ctx'; import { handle as applySourceChange, SourceChange, } from './apply_source_change'; +export function joinLines(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + if (!editor) { + return; + } + const request: JoinLinesParams = { + range: ctx.client.code2ProtocolConverter.asRange(editor.selection), + textDocument: { uri: editor.document.uri.toString() }, + }; + const change = await ctx.client.sendRequest( + 'rust-analyzer/joinLines', + request, + ); + await applySourceChange(change); + } +} + interface JoinLinesParams { textDocument: TextDocumentIdentifier; range: Range; } - -export async function handle() { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - const request: JoinLinesParams = { - range: Server.client.code2ProtocolConverter.asRange(editor.selection), - textDocument: { uri: editor.document.uri.toString() }, - }; - const change = await Server.client.sendRequest( - 'rust-analyzer/joinLines', - request, - ); - await applySourceChange(change); -} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a4149a05..95beb2d8 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -18,6 +18,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); + ctx.registerCommand('joinLines', commands.joinLines); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -56,7 +57,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); registerCommand('rust-analyzer.run', commands.runnables.handle); // Unlike the above this does not send requests to the language server From 5206f81ab84d737fec4b53593e236781fb1189e2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 16:43:34 +0100 Subject: [PATCH 264/819] Refactor applySourceChange --- .../code/src/commands/analyzer_status.ts | 8 ++- .../editors/code/src/commands/index.ts | 4 +- .../editors/code/src/commands/join_lines.ts | 12 ++--- .../editors/code/src/commands/on_enter.ts | 49 ++++++++--------- rust-analyzer/editors/code/src/ctx.ts | 22 ++++++++ rust-analyzer/editors/code/src/main.ts | 52 ++++--------------- ...pply_source_change.ts => source_change.ts} | 10 ++-- 7 files changed, 68 insertions(+), 89 deletions(-) rename rust-analyzer/editors/code/src/{commands/apply_source_change.ts => source_change.ts} (83%) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index c9d32fe0..849c2ec6 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -40,11 +40,10 @@ export function analyzerStatus(ctx: Ctx): Cmd { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { + ctx: Ctx uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); - ctx: Ctx - constructor(ctx: Ctx) { this.ctx = ctx } @@ -53,9 +52,8 @@ class TextDocumentContentProvider _uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - if (editor == null) { - return ''; - } + if (editor == null) return ''; + return this.ctx.client.sendRequest( 'rust-analyzer/analyzerStatus', null, diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 8090c7e5..0a0a36e2 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -3,10 +3,9 @@ import { Ctx, Cmd } from '../ctx' import { analyzerStatus } from './analyzer_status'; import { matchingBrace } from './matching_brace'; import { joinLines } from './join_lines'; -import * as applySourceChange from './apply_source_change'; +import { onEnter } from './on_enter'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; -import * as onEnter from './on_enter'; import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; @@ -17,7 +16,6 @@ function collectGarbage(ctx: Ctx): Cmd { export { analyzerStatus, - applySourceChange, expandMacro, joinLines, matchingBrace, diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 7952fb0c..1a4b8a2d 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,16 +1,14 @@ import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; import { - handle as applySourceChange, - SourceChange, -} from './apply_source_change'; + applySourceChange, SourceChange +} from '../source_change'; export function joinLines(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) { - return; - } + if (!editor) return; + const request: JoinLinesParams = { range: ctx.client.code2ProtocolConverter.asRange(editor.selection), textDocument: { uri: editor.document.uri.toString() }, @@ -19,7 +17,7 @@ export function joinLines(ctx: Ctx): Cmd { 'rust-analyzer/joinLines', request, ); - await applySourceChange(change); + await applySourceChange(ctx, change); } } diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 772c64b3..4503e13f 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,33 +1,28 @@ -import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from '../server'; import { - handle as applySourceChange, + applySourceChange, SourceChange, -} from './apply_source_change'; +} from '../source_change'; +import { Cmd, Ctx } from '../ctx'; -export async function handle(event: { text: string }): Promise { - const editor = vscode.window.activeTextEditor; - if ( - editor == null || - editor.document.languageId !== 'rust' || - event.text !== '\n' - ) { - return false; - } - const request: lc.TextDocumentPositionParams = { - textDocument: { uri: editor.document.uri.toString() }, - position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }; - const change = await Server.client.sendRequest( - 'rust-analyzer/onEnter', - request, - ); - if (!change) { - return false; +export function onEnter(ctx: Ctx): Cmd { + return async (event: { text: string }) => { + const editor = ctx.activeRustEditor; + if (!editor || event.text !== '\n') return false; + + const request: lc.TextDocumentPositionParams = { + textDocument: { uri: editor.document.uri.toString() }, + position: ctx.client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }; + const change = await ctx.client.sendRequest( + 'rust-analyzer/onEnter', + request, + ); + if (!change) return false; + + await applySourceChange(ctx, change); + return true; } - await applySourceChange(change); - return true; } diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 712337fe..22af5ef3 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -27,6 +27,28 @@ export class Ctx { this.pushCleanup(d); } + overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) { + const defaultCmd = `default:${name}`; + const override = factory(this); + const original = (...args: any[]) => + vscode.commands.executeCommand(defaultCmd, ...args); + try { + const d = vscode.commands.registerCommand( + name, + async (...args: any[]) => { + if (!(await override(...args))) { + return await original(...args); + } + }, + ); + this.pushCleanup(d); + } catch (_) { + vscode.window.showWarningMessage( + 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', + ); + } + } + pushCleanup(d: { dispose(): any }) { this.extCtx.subscriptions.push(d); } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 95beb2d8..c3f28063 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -27,44 +27,12 @@ export async function activate(context: vscode.ExtensionContext) { function registerCommand(name: string, f: any) { disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } - function overrideCommand( - name: string, - f: (...args: any[]) => Promise, - ) { - const defaultCmd = `default:${name}`; - const original = (...args: any[]) => - vscode.commands.executeCommand(defaultCmd, ...args); - - try { - registerCommand(name, async (...args: any[]) => { - const editor = vscode.window.activeTextEditor; - if ( - !editor || - !editor.document || - editor.document.languageId !== 'rust' - ) { - return await original(...args); - } - if (!(await f(...args))) { - return await original(...args); - } - }); - } catch (_) { - vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', - ); - } - } // Commands are requests from vscode to the language server registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); registerCommand('rust-analyzer.run', commands.runnables.handle); // Unlike the above this does not send requests to the language server registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); - registerCommand( - 'rust-analyzer.applySourceChange', - commands.applySourceChange.handle, - ); registerCommand( 'rust-analyzer.showReferences', (uri: string, position: lc.Position, locations: lc.Location[]) => { @@ -78,7 +46,7 @@ export async function activate(context: vscode.ExtensionContext) { ); if (Server.config.enableEnhancedTyping) { - overrideCommand('type', commands.onEnter.handle); + ctx.overrideCommand('type', commands.onEnter); } const watchStatus = new StatusDisplay( @@ -91,15 +59,15 @@ export async function activate(context: vscode.ExtensionContext) { string, lc.GenericNotificationHandler, ]> = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle, + ], + [ + '$/progress', + params => watchStatus.handleProgressNotification(params), + ], + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); diff --git a/rust-analyzer/editors/code/src/commands/apply_source_change.ts b/rust-analyzer/editors/code/src/source_change.ts similarity index 83% rename from rust-analyzer/editors/code/src/commands/apply_source_change.ts rename to rust-analyzer/editors/code/src/source_change.ts index 8167398b..a4f9068b 100644 --- a/rust-analyzer/editors/code/src/commands/apply_source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from '../server'; +import { Ctx } from './ctx'; export interface SourceChange { label: string; @@ -9,8 +9,8 @@ export interface SourceChange { cursorPosition?: lc.TextDocumentPositionParams; } -export async function handle(change: SourceChange) { - const wsEdit = Server.client.protocol2CodeConverter.asWorkspaceEdit( +export async function applySourceChange(ctx: Ctx, change: SourceChange) { + const wsEdit = ctx.client.protocol2CodeConverter.asWorkspaceEdit( change.workspaceEdit, ); let created; @@ -32,10 +32,10 @@ export async function handle(change: SourceChange) { const doc = await vscode.workspace.openTextDocument(toOpenUri); await vscode.window.showTextDocument(doc); } else if (toReveal) { - const uri = Server.client.protocol2CodeConverter.asUri( + const uri = ctx.client.protocol2CodeConverter.asUri( toReveal.textDocument.uri, ); - const position = Server.client.protocol2CodeConverter.asPosition( + const position = ctx.client.protocol2CodeConverter.asPosition( toReveal.position, ); const editor = vscode.window.activeTextEditor; From a6e2273d32c27881f9f2cd2a2d85907ccc0e0b15 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 17:03:05 +0100 Subject: [PATCH 265/819] Move parentModule to the new Ctx --- .../editors/code/src/commands/index.ts | 2 +- .../code/src/commands/parent_module.ts | 52 +++++++++---------- rust-analyzer/editors/code/src/main.ts | 20 +++---- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 0a0a36e2..03ca5821 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,9 +4,9 @@ import { analyzerStatus } from './analyzer_status'; import { matchingBrace } from './matching_brace'; import { joinLines } from './join_lines'; import { onEnter } from './on_enter'; +import { parentModule } from './parent_module'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; -import * as parentModule from './parent_module'; import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index ad49e1bd..2f986009 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -1,32 +1,32 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from '../server'; +import { Ctx, Cmd } from '../ctx'; -export async function handle() { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - const request: lc.TextDocumentPositionParams = { - textDocument: { uri: editor.document.uri.toString() }, - position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }; - const response = await Server.client.sendRequest( - 'rust-analyzer/parentModule', - request, - ); - const loc = response[0]; - if (loc == null) { - return; - } - const uri = Server.client.protocol2CodeConverter.asUri(loc.uri); - const range = Server.client.protocol2CodeConverter.asRange(loc.range); +export function parentModule(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + if (!editor) return; + + const request: lc.TextDocumentPositionParams = { + textDocument: { uri: editor.document.uri.toString() }, + position: ctx.client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }; + const response = await ctx.client.sendRequest( + 'rust-analyzer/parentModule', + request, + ); + const loc = response[0]; + if (loc == null) return; - const doc = await vscode.workspace.openTextDocument(uri); - const e = await vscode.window.showTextDocument(doc); - e.selection = new vscode.Selection(range.start, range.start); - e.revealRange(range, vscode.TextEditorRevealType.InCenter); + const uri = ctx.client.protocol2CodeConverter.asUri(loc.uri); + const range = ctx.client.protocol2CodeConverter.asRange(loc.range); + + const doc = await vscode.workspace.openTextDocument(uri); + const e = await vscode.window.showTextDocument(doc); + e.selection = new vscode.Selection(range.start, range.start); + e.revealRange(range, vscode.TextEditorRevealType.InCenter); + } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index c3f28063..55fedd8b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -19,6 +19,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); ctx.registerCommand('joinLines', commands.joinLines); + ctx.registerCommand('parentModule', commands.parentModule); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -29,7 +30,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); registerCommand('rust-analyzer.run', commands.runnables.handle); // Unlike the above this does not send requests to the language server registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); @@ -59,15 +59,15 @@ export async function activate(context: vscode.ExtensionContext) { string, lc.GenericNotificationHandler, ]> = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle, + ], + [ + '$/progress', + params => watchStatus.handleProgressNotification(params), + ], + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); From 076875deea29405b36b873a312af06f3c879ca70 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 18:31:08 +0100 Subject: [PATCH 266/819] Run prettier on all files --- rust-analyzer/editors/code/package.json | 2 +- .../editors/code/src/commands/analyzer_status.ts | 10 +++------- rust-analyzer/editors/code/src/commands/index.ts | 8 +++++--- rust-analyzer/editors/code/src/commands/join_lines.ts | 6 ++---- .../editors/code/src/commands/matching_brace.ts | 6 ++++-- rust-analyzer/editors/code/src/commands/on_enter.ts | 7 ++----- .../editors/code/src/commands/parent_module.ts | 2 +- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6662747f..46d55e32 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -19,7 +19,7 @@ "vscode:prepublish": "rollup -c", "package": "vsce package", "watch": "tsc -watch -p ./", - "prettier": "prettier --write **/*.ts" + "prettier": "prettier --write '**/*.ts'" }, "dependencies": { "jsonc-parser": "^2.1.0", diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 849c2ec6..830e40e8 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -23,10 +23,7 @@ export function analyzerStatus(ctx: Ctx): Cmd { return async function handle() { if (poller == null) { - poller = setInterval( - () => tdcp.eventEmitter.fire(tdcp.uri), - 1000, - ); + poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000); } const document = await vscode.workspace.openTextDocument(tdcp.uri); return vscode.window.showTextDocument( @@ -39,13 +36,12 @@ export function analyzerStatus(ctx: Ctx): Cmd { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - - ctx: Ctx + ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); constructor(ctx: Ctx) { - this.ctx = ctx + this.ctx = ctx; } provideTextDocumentContent( diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 03ca5821..a7f3bc4c 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,4 +1,4 @@ -import { Ctx, Cmd } from '../ctx' +import { Ctx, Cmd } from '../ctx'; import { analyzerStatus } from './analyzer_status'; import { matchingBrace } from './matching_brace'; @@ -11,7 +11,9 @@ import * as runnables from './runnables'; import * as syntaxTree from './syntaxTree'; function collectGarbage(ctx: Ctx): Cmd { - return async () => { ctx.client.sendRequest('rust-analyzer/collectGarbage', null) } + return async () => { + ctx.client.sendRequest('rust-analyzer/collectGarbage', null); + }; } export { @@ -24,5 +26,5 @@ export { syntaxTree, onEnter, inlayHints, - collectGarbage + collectGarbage, }; diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 1a4b8a2d..e906759c 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,8 +1,6 @@ import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; -import { - applySourceChange, SourceChange -} from '../source_change'; +import { applySourceChange, SourceChange } from '../source_change'; export function joinLines(ctx: Ctx): Cmd { return async () => { @@ -18,7 +16,7 @@ export function joinLines(ctx: Ctx): Cmd { request, ); await applySourceChange(ctx, change); - } + }; } interface JoinLinesParams { diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 665b0c33..a3febc5f 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -10,7 +10,9 @@ export function matchingBrace(ctx: Ctx): Cmd { } const request: FindMatchingBraceParams = { textDocument: { uri: editor.document.uri.toString() }, - offsets: editor.selections.map(s => ctx.client.code2ProtocolConverter.asPosition(s.active)), + offsets: editor.selections.map(s => + ctx.client.code2ProtocolConverter.asPosition(s.active), + ), }; const response = await ctx.client.sendRequest( 'rust-analyzer/findMatchingBrace', @@ -24,7 +26,7 @@ export function matchingBrace(ctx: Ctx): Cmd { return new vscode.Selection(anchor, active); }); editor.revealRange(editor.selection); - } + }; } interface FindMatchingBraceParams { diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 4503e13f..efc0dfe1 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,8 +1,5 @@ import * as lc from 'vscode-languageclient'; -import { - applySourceChange, - SourceChange, -} from '../source_change'; +import { applySourceChange, SourceChange } from '../source_change'; import { Cmd, Ctx } from '../ctx'; export function onEnter(ctx: Ctx): Cmd { @@ -24,5 +21,5 @@ export function onEnter(ctx: Ctx): Cmd { await applySourceChange(ctx, change); return true; - } + }; } diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 2f986009..d641181f 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -28,5 +28,5 @@ export function parentModule(ctx: Ctx): Cmd { const e = await vscode.window.showTextDocument(doc); e.selection = new vscode.Selection(range.start, range.start); e.revealRange(range, vscode.TextEditorRevealType.InCenter); - } + }; } From 4ec12d8430060a034946c65f94ef4f08441877ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 19:05:41 +0100 Subject: [PATCH 267/819] Refactor show syntax tree action --- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/syntaxTree.ts | 76 ------------- .../editors/code/src/commands/syntax_tree.ts | 106 ++++++++++++++++++ rust-analyzer/editors/code/src/ctx.ts | 4 + .../src/events/change_active_text_editor.ts | 9 +- .../code/src/events/change_text_document.ts | 24 ---- .../editors/code/src/events/index.ts | 3 +- rust-analyzer/editors/code/src/main.ts | 26 +---- 8 files changed, 116 insertions(+), 134 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/syntaxTree.ts create mode 100644 rust-analyzer/editors/code/src/commands/syntax_tree.ts delete mode 100644 rust-analyzer/editors/code/src/events/change_text_document.ts diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index a7f3bc4c..8f91b3b7 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -5,10 +5,10 @@ import { matchingBrace } from './matching_brace'; import { joinLines } from './join_lines'; import { onEnter } from './on_enter'; import { parentModule } from './parent_module'; +import { syntaxTree } from './syntax_tree'; import * as expandMacro from './expand_macro'; import * as inlayHints from './inlay_hints'; import * as runnables from './runnables'; -import * as syntaxTree from './syntaxTree'; function collectGarbage(ctx: Ctx): Cmd { return async () => { diff --git a/rust-analyzer/editors/code/src/commands/syntaxTree.ts b/rust-analyzer/editors/code/src/commands/syntaxTree.ts deleted file mode 100644 index 89a80550..00000000 --- a/rust-analyzer/editors/code/src/commands/syntaxTree.ts +++ /dev/null @@ -1,76 +0,0 @@ -import * as vscode from 'vscode'; -import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; - -import { Server } from '../server'; - -export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree'); - -export class SyntaxTreeContentProvider - implements vscode.TextDocumentContentProvider { - public eventEmitter = new vscode.EventEmitter(); - public syntaxTree: string = 'Not available'; - - public provideTextDocumentContent( - uri: vscode.Uri, - ): vscode.ProviderResult { - const editor = vscode.window.activeTextEditor; - if (editor == null) { - return ''; - } - - let range: Range | undefined; - - // When the range based query is enabled we take the range of the selection - if (uri.query === 'range=true') { - range = editor.selection.isEmpty - ? undefined - : Server.client.code2ProtocolConverter.asRange( - editor.selection, - ); - } - - const request: SyntaxTreeParams = { - textDocument: { uri: editor.document.uri.toString() }, - range, - }; - return Server.client.sendRequest( - 'rust-analyzer/syntaxTree', - request, - ); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} - -interface SyntaxTreeParams { - textDocument: TextDocumentIdentifier; - range?: Range; -} - -type SyntaxTreeResult = string; - -// Opens the virtual file that will show the syntax tree -// -// The contents of the file come from the `TextDocumentContentProvider` -export function createHandle(provider: SyntaxTreeContentProvider) { - return async () => { - const editor = vscode.window.activeTextEditor; - const rangeEnabled = !!(editor && !editor.selection.isEmpty); - - const uri = rangeEnabled - ? vscode.Uri.parse(`${syntaxTreeUri.toString()}?range=true`) - : syntaxTreeUri; - - const document = await vscode.workspace.openTextDocument(uri); - - provider.eventEmitter.fire(uri); - - return vscode.window.showTextDocument( - document, - vscode.ViewColumn.Two, - true, - ); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts new file mode 100644 index 00000000..e61fb36d --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -0,0 +1,106 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; + +import { Ctx, Cmd } from '../ctx'; + +// Opens the virtual file that will show the syntax tree +// +// The contents of the file come from the `TextDocumentContentProvider` +export function syntaxTree(ctx: Ctx): Cmd { + const stcp = new SyntaxTreeContentProvider(ctx); + + ctx.pushCleanup( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer', + stcp, + ), + ); + + vscode.workspace.onDidChangeTextDocument( + (event: vscode.TextDocumentChangeEvent) => { + const doc = event.document; + if (doc.languageId !== 'rust') return; + afterLs(() => stcp.eventEmitter.fire(stcp.uri)); + }, + ctx.subscriptions, + ); + + vscode.window.onDidChangeActiveTextEditor( + (editor: vscode.TextEditor | undefined) => { + if (!editor || editor.document.languageId !== 'rust') return; + stcp.eventEmitter.fire(stcp.uri); + }, + ctx.subscriptions, + ); + + return async () => { + const editor = vscode.window.activeTextEditor; + const rangeEnabled = !!(editor && !editor.selection.isEmpty); + + const uri = rangeEnabled + ? vscode.Uri.parse(`${stcp.uri.toString()}?range=true`) + : stcp.uri; + + const document = await vscode.workspace.openTextDocument(uri); + + stcp.eventEmitter.fire(uri); + + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true, + ); + }; +} + +// We need to order this after LS updates, but there's no API for that. +// Hence, good old setTimeout. +function afterLs(f: () => any) { + setTimeout(f, 10); +} + +interface SyntaxTreeParams { + textDocument: lc.TextDocumentIdentifier; + range?: lc.Range; +} + +export class SyntaxTreeContentProvider + implements vscode.TextDocumentContentProvider { + ctx: Ctx; + uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); + eventEmitter = new vscode.EventEmitter(); + syntaxTree: string = 'Not available'; + + constructor(ctx: Ctx) { + this.ctx = ctx; + } + + provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { + const editor = vscode.window.activeTextEditor; + if (editor == null) return ''; + + let range: lc.Range | undefined; + + // When the range based query is enabled we take the range of the selection + if (uri.query === 'range=true') { + range = editor.selection.isEmpty + ? undefined + : this.ctx.client.code2ProtocolConverter.asRange( + editor.selection, + ); + } + + const request: SyntaxTreeParams = { + textDocument: { uri: editor.document.uri.toString() }, + range, + }; + return this.ctx.client.sendRequest( + 'rust-analyzer/syntaxTree', + request, + ); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } +} diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 22af5ef3..c3a3583b 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -49,6 +49,10 @@ export class Ctx { } } + get subscriptions(): { dispose(): any }[] { + return this.extCtx.subscriptions; + } + pushCleanup(d: { dispose(): any }) { this.extCtx.subscriptions.push(d); } diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts index 74b91bd4..4384ee56 100644 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts @@ -1,21 +1,14 @@ import { TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; - -import { - SyntaxTreeContentProvider, - syntaxTreeUri, -} from '../commands/syntaxTree'; import { Decoration } from '../highlighting'; import { Server } from '../server'; -export function makeHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { +export function makeHandler() { return async function handle(editor: TextEditor | undefined) { if (!editor || editor.document.languageId !== 'rust') { return; } - syntaxTreeProvider.eventEmitter.fire(syntaxTreeUri); - if (!Server.config.highlightingOn) { return; } diff --git a/rust-analyzer/editors/code/src/events/change_text_document.ts b/rust-analyzer/editors/code/src/events/change_text_document.ts deleted file mode 100644 index 2e998e88..00000000 --- a/rust-analyzer/editors/code/src/events/change_text_document.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as vscode from 'vscode'; - -import { - SyntaxTreeContentProvider, - syntaxTreeUri, -} from '../commands/syntaxTree'; - -export function createHandler(syntaxTreeProvider: SyntaxTreeContentProvider) { - return (event: vscode.TextDocumentChangeEvent) => { - const doc = event.document; - if (doc.languageId !== 'rust') { - return; - } - afterLs(() => { - syntaxTreeProvider.eventEmitter.fire(syntaxTreeUri); - }); - }; -} - -// We need to order this after LS updates, but there's no API for that. -// Hence, good old setTimeout. -function afterLs(f: () => any) { - setTimeout(f, 10); -} diff --git a/rust-analyzer/editors/code/src/events/index.ts b/rust-analyzer/editors/code/src/events/index.ts index 4c154563..be135474 100644 --- a/rust-analyzer/editors/code/src/events/index.ts +++ b/rust-analyzer/editors/code/src/events/index.ts @@ -1,4 +1,3 @@ import * as changeActiveTextEditor from './change_active_text_editor'; -import * as changeTextDocument from './change_text_document'; -export { changeActiveTextEditor, changeTextDocument }; +export { changeActiveTextEditor }; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 55fedd8b..d92cd164 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -4,7 +4,6 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; -import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; @@ -20,6 +19,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('matchingBrace', commands.matchingBrace); ctx.registerCommand('joinLines', commands.joinLines); ctx.registerCommand('parentModule', commands.parentModule); + ctx.registerCommand('syntaxTree', commands.syntaxTree); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -55,10 +55,7 @@ export async function activate(context: vscode.ExtensionContext) { disposeOnDeactivation(watchStatus); // Notifications are events triggered by the language server - const allNotifications: Iterable<[ - string, - lc.GenericNotificationHandler, - ]> = [ + const allNotifications: [string, lc.GenericNotificationHandler][] = [ [ 'rust-analyzer/publishDecorations', notifications.publishDecorations.handle, @@ -68,20 +65,13 @@ export async function activate(context: vscode.ExtensionContext) { params => watchStatus.handleProgressNotification(params), ], ]; - const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( - events.changeActiveTextEditor.makeHandler(syntaxTreeContentProvider), + events.changeActiveTextEditor.makeHandler(), ); - disposeOnDeactivation( - vscode.workspace.registerTextDocumentContentProvider( - 'rust-analyzer', - syntaxTreeContentProvider, - ), - ); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', @@ -89,21 +79,11 @@ export async function activate(context: vscode.ExtensionContext) { ), ); - registerCommand( - 'rust-analyzer.syntaxTree', - commands.syntaxTree.createHandle(syntaxTreeContentProvider), - ); registerCommand( 'rust-analyzer.expandMacro', commands.expandMacro.createHandle(expandMacroContentProvider), ); - vscode.workspace.onDidChangeTextDocument( - events.changeTextDocument.createHandler(syntaxTreeContentProvider), - null, - context.subscriptions, - ); - const startServer = () => Server.start(allNotifications); const reloadCommand = () => reloadServer(startServer); From 17415d63be52a2200a4b03db4f3cb36e77c7a7eb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 19:07:28 +0100 Subject: [PATCH 268/819] Cleanup imports --- .../editors/code/src/commands/analyzer_status.ts | 1 + rust-analyzer/editors/code/src/commands/join_lines.ts | 7 ++++--- .../editors/code/src/commands/matching_brace.ts | 9 +++++---- rust-analyzer/editors/code/src/commands/on_enter.ts | 1 + rust-analyzer/editors/code/src/commands/parent_module.ts | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 830e40e8..b2b624b7 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,4 +1,5 @@ import * as vscode from 'vscode'; + import { Ctx, Cmd } from '../ctx'; // Shows status of rust-analyzer (for debugging) diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index e906759c..f4f902cf 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,4 +1,5 @@ -import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; +import * as lc from 'vscode-languageclient'; + import { Ctx, Cmd } from '../ctx'; import { applySourceChange, SourceChange } from '../source_change'; @@ -20,6 +21,6 @@ export function joinLines(ctx: Ctx): Cmd { } interface JoinLinesParams { - textDocument: TextDocumentIdentifier; - range: Range; + textDocument: lc.TextDocumentIdentifier; + range: lc.Range; } diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index a3febc5f..59c253f8 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; -import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; +import * as lc from 'vscode-languageclient'; + import { Ctx, Cmd } from '../ctx'; export function matchingBrace(ctx: Ctx): Cmd { @@ -14,7 +15,7 @@ export function matchingBrace(ctx: Ctx): Cmd { ctx.client.code2ProtocolConverter.asPosition(s.active), ), }; - const response = await ctx.client.sendRequest( + const response = await ctx.client.sendRequest( 'rust-analyzer/findMatchingBrace', request, ); @@ -30,6 +31,6 @@ export function matchingBrace(ctx: Ctx): Cmd { } interface FindMatchingBraceParams { - textDocument: TextDocumentIdentifier; - offsets: Position[]; + textDocument: lc.TextDocumentIdentifier; + offsets: lc.Position[]; } diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index efc0dfe1..8324060e 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,4 +1,5 @@ import * as lc from 'vscode-languageclient'; + import { applySourceChange, SourceChange } from '../source_change'; import { Cmd, Ctx } from '../ctx'; diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index d641181f..258b61b2 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; - import * as lc from 'vscode-languageclient'; + import { Ctx, Cmd } from '../ctx'; export function parentModule(ctx: Ctx): Cmd { From 8a593ee4aafffc3b1bd62548e7492eb1750c9431 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 19:12:49 +0100 Subject: [PATCH 269/819] Cleanup --- .../code/src/commands/analyzer_status.ts | 2 +- .../editors/code/src/commands/syntax_tree.ts | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index b2b624b7..e680179a 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; import { Ctx, Cmd } from '../ctx'; -// Shows status of rust-analyzer (for debugging) +// Shows status of rust-analyzer (for debugging) export function analyzerStatus(ctx: Ctx): Cmd { let poller: NodeJS.Timer | null = null; const tdcp = new TextDocumentContentProvider(ctx); diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index e61fb36d..9831c2a2 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -7,12 +7,12 @@ import { Ctx, Cmd } from '../ctx'; // // The contents of the file come from the `TextDocumentContentProvider` export function syntaxTree(ctx: Ctx): Cmd { - const stcp = new SyntaxTreeContentProvider(ctx); + const tdcp = new TextDocumentContentProvider(ctx); ctx.pushCleanup( vscode.workspace.registerTextDocumentContentProvider( 'rust-analyzer', - stcp, + tdcp, ), ); @@ -20,7 +20,7 @@ export function syntaxTree(ctx: Ctx): Cmd { (event: vscode.TextDocumentChangeEvent) => { const doc = event.document; if (doc.languageId !== 'rust') return; - afterLs(() => stcp.eventEmitter.fire(stcp.uri)); + afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); }, ctx.subscriptions, ); @@ -28,7 +28,7 @@ export function syntaxTree(ctx: Ctx): Cmd { vscode.window.onDidChangeActiveTextEditor( (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; - stcp.eventEmitter.fire(stcp.uri); + tdcp.eventEmitter.fire(tdcp.uri); }, ctx.subscriptions, ); @@ -38,12 +38,12 @@ export function syntaxTree(ctx: Ctx): Cmd { const rangeEnabled = !!(editor && !editor.selection.isEmpty); const uri = rangeEnabled - ? vscode.Uri.parse(`${stcp.uri.toString()}?range=true`) - : stcp.uri; + ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) + : tdcp.uri; const document = await vscode.workspace.openTextDocument(uri); - stcp.eventEmitter.fire(uri); + tdcp.eventEmitter.fire(uri); return vscode.window.showTextDocument( document, @@ -64,7 +64,7 @@ interface SyntaxTreeParams { range?: lc.Range; } -export class SyntaxTreeContentProvider +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); @@ -86,8 +86,8 @@ export class SyntaxTreeContentProvider range = editor.selection.isEmpty ? undefined : this.ctx.client.code2ProtocolConverter.asRange( - editor.selection, - ); + editor.selection, + ); } const request: SyntaxTreeParams = { From e801ce42fe562837434ace03ae78fdd86f3aa989 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 19:30:30 +0100 Subject: [PATCH 270/819] Move expand macro to the new context --- .../code/src/commands/analyzer_status.ts | 2 +- .../editors/code/src/commands/expand_macro.ts | 102 ++++++++---------- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/syntax_tree.ts | 7 +- rust-analyzer/editors/code/src/main.ts | 15 +-- 5 files changed, 53 insertions(+), 75 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index e680179a..2c836228 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -37,7 +37,7 @@ export function analyzerStatus(ctx: Ctx): Cmd { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - ctx: Ctx; + private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 17c78280..da208257 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -1,60 +1,23 @@ import * as vscode from 'vscode'; -import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; -import { Server } from '../server'; +import * as lc from 'vscode-languageclient'; -export const expandMacroUri = vscode.Uri.parse( - 'rust-analyzer://expandMacro/[EXPANSION].rs', -); - -export class ExpandMacroContentProvider - implements vscode.TextDocumentContentProvider { - public eventEmitter = new vscode.EventEmitter(); - - public provideTextDocumentContent( - _uri: vscode.Uri, - ): vscode.ProviderResult { - async function handle() { - const editor = vscode.window.activeTextEditor; - if (editor == null) { - return ''; - } - - const position = editor.selection.active; - const request: MacroExpandParams = { - textDocument: { uri: editor.document.uri.toString() }, - position, - }; - const expanded = await Server.client.sendRequest( - 'rust-analyzer/expandMacro', - request, - ); - - if (expanded == null) { - return 'Not available'; - } - - return code_format(expanded); - } - - return handle(); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} +import { Ctx, Cmd } from '../ctx'; // Opens the virtual file that will show the syntax tree // // The contents of the file come from the `TextDocumentContentProvider` -export function createHandle(provider: ExpandMacroContentProvider) { - return async () => { - const uri = expandMacroUri; - - const document = await vscode.workspace.openTextDocument(uri); - - provider.eventEmitter.fire(uri); +export function expandMacro(ctx: Ctx): Cmd { + const tdcp = new TextDocumentContentProvider(ctx); + ctx.pushCleanup( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer', + tdcp, + ), + ); + return async () => { + const document = await vscode.workspace.openTextDocument(tdcp.uri); + tdcp.eventEmitter.fire(tdcp.uri); return vscode.window.showTextDocument( document, vscode.ViewColumn.Two, @@ -63,11 +26,6 @@ export function createHandle(provider: ExpandMacroContentProvider) { }; } -interface MacroExpandParams { - textDocument: TextDocumentIdentifier; - position: Position; -} - interface ExpandedMacro { name: string; expansion: string; @@ -81,3 +39,37 @@ function code_format(expanded: ExpandedMacro): string { return result; } + +class TextDocumentContentProvider + implements vscode.TextDocumentContentProvider { + private ctx: Ctx; + uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs'); + eventEmitter = new vscode.EventEmitter(); + + constructor(ctx: Ctx) { + this.ctx = ctx; + } + + async provideTextDocumentContent(_uri: vscode.Uri): Promise { + const editor = vscode.window.activeTextEditor; + if (editor == null) return ''; + + const position = editor.selection.active; + const request: lc.TextDocumentPositionParams = { + textDocument: { uri: editor.document.uri.toString() }, + position, + }; + const expanded = await this.ctx.client.sendRequest( + 'rust-analyzer/expandMacro', + request, + ); + + if (expanded == null) return 'Not available'; + + return code_format(expanded); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } +} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 8f91b3b7..325ae3da 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -6,7 +6,7 @@ import { joinLines } from './join_lines'; import { onEnter } from './on_enter'; import { parentModule } from './parent_module'; import { syntaxTree } from './syntax_tree'; -import * as expandMacro from './expand_macro'; +import { expandMacro } from './expand_macro'; import * as inlayHints from './inlay_hints'; import * as runnables from './runnables'; diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 9831c2a2..20ff7e5c 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -66,10 +66,9 @@ interface SyntaxTreeParams { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - ctx: Ctx; + private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); eventEmitter = new vscode.EventEmitter(); - syntaxTree: string = 'Not available'; constructor(ctx: Ctx) { this.ctx = ctx; @@ -86,8 +85,8 @@ class TextDocumentContentProvider range = editor.selection.isEmpty ? undefined : this.ctx.client.code2ProtocolConverter.asRange( - editor.selection, - ); + editor.selection, + ); } const request: SyntaxTreeParams = { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index d92cd164..b8e3396a 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -2,7 +2,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { ExpandMacroContentProvider } from './commands/expand_macro'; import { HintsUpdater } from './commands/inlay_hints'; import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; @@ -20,6 +19,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('joinLines', commands.joinLines); ctx.registerCommand('parentModule', commands.parentModule); ctx.registerCommand('syntaxTree', commands.syntaxTree); + ctx.registerCommand('expandMacro', commands.expandMacro); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -65,25 +65,12 @@ export async function activate(context: vscode.ExtensionContext) { params => watchStatus.handleProgressNotification(params), ], ]; - const expandMacroContentProvider = new ExpandMacroContentProvider(); // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( events.changeActiveTextEditor.makeHandler(), ); - disposeOnDeactivation( - vscode.workspace.registerTextDocumentContentProvider( - 'rust-analyzer', - expandMacroContentProvider, - ), - ); - - registerCommand( - 'rust-analyzer.expandMacro', - commands.expandMacro.createHandle(expandMacroContentProvider), - ); - const startServer = () => Server.start(allNotifications); const reloadCommand = () => reloadServer(startServer); From 82be2365dcffb55dcc70d34ba7c362c1dc2057c9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 19:58:44 +0100 Subject: [PATCH 271/819] Refactor runables --- .../editors/code/src/commands/index.ts | 5 +- .../editors/code/src/commands/runnables.ts | 122 +++++++++--------- rust-analyzer/editors/code/src/main.ts | 6 +- 3 files changed, 66 insertions(+), 67 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 325ae3da..9f4636e5 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -8,7 +8,7 @@ import { parentModule } from './parent_module'; import { syntaxTree } from './syntax_tree'; import { expandMacro } from './expand_macro'; import * as inlayHints from './inlay_hints'; -import * as runnables from './runnables'; +import { run, runSingle } from './runnables'; function collectGarbage(ctx: Ctx): Cmd { return async () => { @@ -22,9 +22,10 @@ export { joinLines, matchingBrace, parentModule, - runnables, syntaxTree, onEnter, inlayHints, collectGarbage, + run, + runSingle }; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 7728541d..c4be21a0 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,7 +1,67 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from '../server'; +import { Ctx, Cmd } from '../ctx'; + +export function run(ctx: Ctx): Cmd { + let prevRunnable: RunnableQuickPick | undefined; + + return async () => { + const editor = ctx.activeRustEditor; + if (!editor) return + + const textDocument: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + const params: RunnablesParams = { + textDocument, + position: ctx.client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }; + const runnables = await ctx.client.sendRequest( + 'rust-analyzer/runnables', + params, + ); + const items: RunnableQuickPick[] = []; + if (prevRunnable) { + items.push(prevRunnable); + } + for (const r of runnables) { + if ( + prevRunnable && + JSON.stringify(prevRunnable.runnable) === JSON.stringify(r) + ) { + continue; + } + items.push(new RunnableQuickPick(r)); + } + const item = await vscode.window.showQuickPick(items); + if (!item) return; + + item.detail = 'rerun'; + prevRunnable = item; + const task = createTask(item.runnable); + return await vscode.tasks.executeTask(task); + } +} + +export function runSingle(ctx: Ctx): Cmd { + return async (runnable: Runnable) => { + const editor = ctx.activeRustEditor; + if (!editor) return + + const task = createTask(runnable); + task.group = vscode.TaskGroup.Build; + task.presentationOptions = { + reveal: vscode.TaskRevealKind.Always, + panel: vscode.TaskPanelKind.Dedicated, + clear: true, + }; + + return vscode.tasks.executeTask(task); + } +} interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; @@ -67,63 +127,3 @@ function createTask(spec: Runnable): vscode.Task { t.presentationOptions.clear = true; return t; } - -let prevRunnable: RunnableQuickPick | undefined; -export async function handle(): Promise { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - const textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString(), - }; - const params: RunnablesParams = { - textDocument, - position: Server.client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }; - const runnables = await Server.client.sendRequest( - 'rust-analyzer/runnables', - params, - ); - const items: RunnableQuickPick[] = []; - if (prevRunnable) { - items.push(prevRunnable); - } - for (const r of runnables) { - if ( - prevRunnable && - JSON.stringify(prevRunnable.runnable) === JSON.stringify(r) - ) { - continue; - } - items.push(new RunnableQuickPick(r)); - } - const item = await vscode.window.showQuickPick(items); - if (!item) { - return; - } - - item.detail = 'rerun'; - prevRunnable = item; - const task = createTask(item.runnable); - return await vscode.tasks.executeTask(task); -} - -export async function handleSingle(runnable: Runnable) { - const editor = vscode.window.activeTextEditor; - if (editor == null || editor.document.languageId !== 'rust') { - return; - } - - const task = createTask(runnable); - task.group = vscode.TaskGroup.Build; - task.presentationOptions = { - reveal: vscode.TaskRevealKind.Always, - panel: vscode.TaskPanelKind.Dedicated, - clear: true, - }; - - return vscode.tasks.executeTask(task); -} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index b8e3396a..7ad5e693 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -20,6 +20,8 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('parentModule', commands.parentModule); ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); + ctx.registerCommand('run', commands.run); + ctx.registerCommand('runSingle', commands.runSingle); // Internal action for lenses function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); @@ -29,10 +31,6 @@ export async function activate(context: vscode.ExtensionContext) { disposeOnDeactivation(vscode.commands.registerCommand(name, f)); } - // Commands are requests from vscode to the language server - registerCommand('rust-analyzer.run', commands.runnables.handle); - // Unlike the above this does not send requests to the language server - registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); registerCommand( 'rust-analyzer.showReferences', (uri: string, position: lc.Position, locations: lc.Location[]) => { From 7fe2faa681113b292812ab4edfa66ea9cf3ccc0d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:00:46 +0100 Subject: [PATCH 272/819] Minor refactor --- .../editors/code/src/commands/inlay_hints.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/commands/inlay_hints.ts index ac7dcce6..6d00152f 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/commands/inlay_hints.ts @@ -1,14 +1,13 @@ import * as vscode from 'vscode'; -import { Range, TextDocumentChangeEvent, TextEditor } from 'vscode'; -import { TextDocumentIdentifier } from 'vscode-languageclient'; +import * as lc from 'vscode-languageclient'; import { Server } from '../server'; interface InlayHintsParams { - textDocument: TextDocumentIdentifier; + textDocument: lc.TextDocumentIdentifier; } interface InlayHint { - range: Range; + range: vscode.Range; kind: string; label: string; } @@ -32,11 +31,10 @@ export class HintsUpdater { } public async refreshHintsForVisibleEditors( - cause?: TextDocumentChangeEvent, + cause?: vscode.TextDocumentChangeEvent, ): Promise { - if (!this.displayHints) { - return; - } + if (!this.displayHints) return; + if ( cause !== undefined && (cause.contentChanges.length === 0 || @@ -79,7 +77,7 @@ export class HintsUpdater { } private async updateDecorationsFromServer( - editor: TextEditor, + editor: vscode.TextEditor, ): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints !== null) { From eaec6e60843a6b211e344f9614b91e76c2a87ff1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:07:04 +0100 Subject: [PATCH 273/819] Move all commands to ctx --- .../editors/code/src/commands/index.ts | 17 +++++++++++++- .../editors/code/src/commands/runnables.ts | 8 +++---- rust-analyzer/editors/code/src/main.ts | 23 +++++-------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 9f4636e5..4a2e8e4d 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,3 +1,6 @@ +import * as vscode from 'vscode'; +import * as lc from 'vscode-languageclient'; + import { Ctx, Cmd } from '../ctx'; import { analyzerStatus } from './analyzer_status'; @@ -16,6 +19,17 @@ function collectGarbage(ctx: Ctx): Cmd { }; } +function showReferences(ctx: Ctx): Cmd { + return (uri: string, position: lc.Position, locations: lc.Location[]) => { + vscode.commands.executeCommand( + 'editor.action.showReferences', + vscode.Uri.parse(uri), + ctx.client.protocol2CodeConverter.asPosition(position), + locations.map(ctx.client.protocol2CodeConverter.asLocation), + ); + }; +} + export { analyzerStatus, expandMacro, @@ -27,5 +41,6 @@ export { inlayHints, collectGarbage, run, - runSingle + runSingle, + showReferences, }; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c4be21a0..8cd86c21 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -8,7 +8,7 @@ export function run(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) return + if (!editor) return; const textDocument: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), @@ -43,13 +43,13 @@ export function run(ctx: Ctx): Cmd { prevRunnable = item; const task = createTask(item.runnable); return await vscode.tasks.executeTask(task); - } + }; } export function runSingle(ctx: Ctx): Cmd { return async (runnable: Runnable) => { const editor = ctx.activeRustEditor; - if (!editor) return + if (!editor) return; const task = createTask(runnable); task.group = vscode.TaskGroup.Build; @@ -60,7 +60,7 @@ export function runSingle(ctx: Ctx): Cmd { }; return vscode.tasks.executeTask(task); - } + }; } interface RunnablesParams { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 7ad5e693..4a3e1ab7 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -13,6 +13,8 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); + + // Commands which invokes manually via command pallet, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); @@ -21,28 +23,15 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); - ctx.registerCommand('runSingle', commands.runSingle); // Internal action for lenses + + // Internal commands which are invoked by the server. + ctx.registerCommand('runSingle', commands.runSingle); + ctx.registerCommand('showReferences', commands.showReferences); function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); } - function registerCommand(name: string, f: any) { - disposeOnDeactivation(vscode.commands.registerCommand(name, f)); - } - - registerCommand( - 'rust-analyzer.showReferences', - (uri: string, position: lc.Position, locations: lc.Location[]) => { - vscode.commands.executeCommand( - 'editor.action.showReferences', - vscode.Uri.parse(uri), - Server.client.protocol2CodeConverter.asPosition(position), - locations.map(Server.client.protocol2CodeConverter.asLocation), - ); - }, - ); - if (Server.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); } From 1713b94da002982612beb62d6cfd36ac9898e969 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:10:40 +0100 Subject: [PATCH 274/819] Hints are not commands --- rust-analyzer/editors/code/src/commands/index.ts | 2 -- rust-analyzer/editors/code/src/{commands => }/inlay_hints.ts | 2 +- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) rename rust-analyzer/editors/code/src/{commands => }/inlay_hints.ts (98%) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 4a2e8e4d..89af4be9 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -10,7 +10,6 @@ import { onEnter } from './on_enter'; import { parentModule } from './parent_module'; import { syntaxTree } from './syntax_tree'; import { expandMacro } from './expand_macro'; -import * as inlayHints from './inlay_hints'; import { run, runSingle } from './runnables'; function collectGarbage(ctx: Ctx): Cmd { @@ -38,7 +37,6 @@ export { parentModule, syntaxTree, onEnter, - inlayHints, collectGarbage, run, runSingle, diff --git a/rust-analyzer/editors/code/src/commands/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts similarity index 98% rename from rust-analyzer/editors/code/src/commands/inlay_hints.ts rename to rust-analyzer/editors/code/src/inlay_hints.ts index 6d00152f..b975915c 100644 --- a/rust-analyzer/editors/code/src/commands/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from '../server'; +import { Server } from './server'; interface InlayHintsParams { textDocument: lc.TextDocumentIdentifier; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 4a3e1ab7..cf0ddfa1 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { HintsUpdater } from './commands/inlay_hints'; +import { HintsUpdater } from './inlay_hints'; import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; From 29f4389df010d4db95ec4ebc916b0c03adfd8691 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:16:07 +0100 Subject: [PATCH 275/819] status is not a command --- rust-analyzer/editors/code/src/main.ts | 12 ++++++------ .../watch_status.ts => status_display.ts} | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) rename rust-analyzer/editors/code/src/{commands/watch_status.ts => status_display.ts} (90%) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index cf0ddfa1..d6c21057 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { HintsUpdater } from './inlay_hints'; -import { StatusDisplay } from './commands/watch_status'; +import { StatusDisplay } from './status_display'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; @@ -28,10 +28,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('showReferences', commands.showReferences); - function disposeOnDeactivation(disposable: vscode.Disposable) { - context.subscriptions.push(disposable); - } - if (Server.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); } @@ -39,7 +35,11 @@ export async function activate(context: vscode.ExtensionContext) { const watchStatus = new StatusDisplay( Server.config.cargoWatchOptions.command, ); - disposeOnDeactivation(watchStatus); + ctx.pushCleanup(watchStatus); + + function disposeOnDeactivation(disposable: vscode.Disposable) { + context.subscriptions.push(disposable); + } // Notifications are events triggered by the language server const allNotifications: [string, lc.GenericNotificationHandler][] = [ diff --git a/rust-analyzer/editors/code/src/commands/watch_status.ts b/rust-analyzer/editors/code/src/status_display.ts similarity index 90% rename from rust-analyzer/editors/code/src/commands/watch_status.ts rename to rust-analyzer/editors/code/src/status_display.ts index 10787b51..48cf0655 100644 --- a/rust-analyzer/editors/code/src/commands/watch_status.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export class StatusDisplay implements vscode.Disposable { - public packageName?: string; + packageName?: string; private i = 0; private statusBarItem: vscode.StatusBarItem; @@ -19,7 +19,7 @@ export class StatusDisplay implements vscode.Disposable { this.statusBarItem.hide(); } - public show() { + show() { this.packageName = undefined; this.timer = @@ -28,18 +28,18 @@ export class StatusDisplay implements vscode.Disposable { if (this.packageName) { this.statusBarItem!.text = `cargo ${this.command} [${ this.packageName - }] ${this.frame()}`; + }] ${this.frame()}`; } else { this.statusBarItem!.text = `cargo ${ this.command - } ${this.frame()}`; + } ${this.frame()}`; } }, 300); this.statusBarItem.show(); } - public hide() { + hide() { if (this.timer) { clearInterval(this.timer); this.timer = undefined; @@ -48,7 +48,7 @@ export class StatusDisplay implements vscode.Disposable { this.statusBarItem.hide(); } - public dispose() { + dispose() { if (this.timer) { clearInterval(this.timer); this.timer = undefined; @@ -57,7 +57,7 @@ export class StatusDisplay implements vscode.Disposable { this.statusBarItem.dispose(); } - public handleProgressNotification(params: ProgressParams) { + handleProgressNotification(params: ProgressParams) { const { token, value } = params; if (token !== 'rustAnalyzer/cargoWatcher') { return; From 5f3b059d0380e2624f0d954a774a90ffca354967 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:16:57 +0100 Subject: [PATCH 276/819] Dead code --- .../editors/code/src/commands/line_buffer.ts | 16 ---------------- rust-analyzer/editors/code/src/status_display.ts | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/line_buffer.ts diff --git a/rust-analyzer/editors/code/src/commands/line_buffer.ts b/rust-analyzer/editors/code/src/commands/line_buffer.ts deleted file mode 100644 index fb5b9f7f..00000000 --- a/rust-analyzer/editors/code/src/commands/line_buffer.ts +++ /dev/null @@ -1,16 +0,0 @@ -export class LineBuffer { - private outBuffer: string = ''; - - public processOutput(chunk: string, cb: (line: string) => void) { - this.outBuffer += chunk; - let eolIndex = this.outBuffer.indexOf('\n'); - while (eolIndex >= 0) { - // line includes the EOL - const line = this.outBuffer.slice(0, eolIndex + 1); - cb(line); - this.outBuffer = this.outBuffer.slice(eolIndex + 1); - - eolIndex = this.outBuffer.indexOf('\n'); - } - } -} diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 48cf0655..ed8573f0 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -28,11 +28,11 @@ export class StatusDisplay implements vscode.Disposable { if (this.packageName) { this.statusBarItem!.text = `cargo ${this.command} [${ this.packageName - }] ${this.frame()}`; + }] ${this.frame()}`; } else { this.statusBarItem!.text = `cargo ${ this.command - } ${this.frame()}`; + } ${this.frame()}`; } }, 300); From 7153bbcae25840cd4f3e83abf5cee9d4897194ff Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:21:25 +0100 Subject: [PATCH 277/819] Encapsulate inlay hints activation --- rust-analyzer/editors/code/src/inlay_hints.ts | 38 +++++++++++++++++- rust-analyzer/editors/code/src/main.ts | 39 +------------------ 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index b975915c..4581e227 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,6 +1,42 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from './server'; +import { Ctx } from './ctx'; + +export function activateInlayHints(ctx: Ctx) { + const hintsUpdater = new HintsUpdater(); + hintsUpdater.refreshHintsForVisibleEditors().then(() => { + // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() + // so update the hints once when the focus changes to guarantee their presence + let editorChangeDisposable: vscode.Disposable | null = null; + editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( + _ => { + if (editorChangeDisposable !== null) { + editorChangeDisposable.dispose(); + } + return hintsUpdater.refreshHintsForVisibleEditors(); + }, + ); + + ctx.pushCleanup( + vscode.window.onDidChangeVisibleTextEditors(_ => + hintsUpdater.refreshHintsForVisibleEditors(), + ), + ); + ctx.pushCleanup( + vscode.workspace.onDidChangeTextDocument(e => + hintsUpdater.refreshHintsForVisibleEditors(e), + ), + ); + ctx.pushCleanup( + vscode.workspace.onDidChangeConfiguration(_ => + hintsUpdater.toggleHintsDisplay( + Server.config.displayInlayHints, + ), + ), + ); + }); +} interface InlayHintsParams { textDocument: lc.TextDocumentIdentifier; @@ -18,7 +54,7 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ }, }); -export class HintsUpdater { +class HintsUpdater { private displayHints = true; public async toggleHintsDisplay(displayHints: boolean): Promise { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index d6c21057..7e63a9ca 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { HintsUpdater } from './inlay_hints'; +import { activateInlayHints } from './inlay_hints'; import { StatusDisplay } from './status_display'; import * as events from './events'; import * as notifications from './notifications'; @@ -37,10 +37,6 @@ export async function activate(context: vscode.ExtensionContext) { ); ctx.pushCleanup(watchStatus); - function disposeOnDeactivation(disposable: vscode.Disposable) { - context.subscriptions.push(disposable); - } - // Notifications are events triggered by the language server const allNotifications: [string, lc.GenericNotificationHandler][] = [ [ @@ -71,38 +67,7 @@ export async function activate(context: vscode.ExtensionContext) { } if (Server.config.displayInlayHints) { - const hintsUpdater = new HintsUpdater(); - hintsUpdater.refreshHintsForVisibleEditors().then(() => { - // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() - // so update the hints once when the focus changes to guarantee their presence - let editorChangeDisposable: vscode.Disposable | null = null; - editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( - _ => { - if (editorChangeDisposable !== null) { - editorChangeDisposable.dispose(); - } - return hintsUpdater.refreshHintsForVisibleEditors(); - }, - ); - - disposeOnDeactivation( - vscode.window.onDidChangeVisibleTextEditors(_ => - hintsUpdater.refreshHintsForVisibleEditors(), - ), - ); - disposeOnDeactivation( - vscode.workspace.onDidChangeTextDocument(e => - hintsUpdater.refreshHintsForVisibleEditors(e), - ), - ); - disposeOnDeactivation( - vscode.workspace.onDidChangeConfiguration(_ => - hintsUpdater.toggleHintsDisplay( - Server.config.displayInlayHints, - ), - ), - ); - }); + activateInlayHints(ctx); } } From b35a987143da86daf292b586ac9fa8b7dcee3c00 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:29:21 +0100 Subject: [PATCH 278/819] Encapsulate highlighting activation --- .../src/events/change_active_text_editor.ts | 25 ------------------- .../editors/code/src/events/index.ts | 3 --- .../editors/code/src/highlighting.ts | 22 +++++++++++++++- rust-analyzer/editors/code/src/main.ts | 9 +++---- 4 files changed, 24 insertions(+), 35 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/events/change_active_text_editor.ts delete mode 100644 rust-analyzer/editors/code/src/events/index.ts diff --git a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts b/rust-analyzer/editors/code/src/events/change_active_text_editor.ts deleted file mode 100644 index 4384ee56..00000000 --- a/rust-analyzer/editors/code/src/events/change_active_text_editor.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { TextEditor } from 'vscode'; -import { TextDocumentIdentifier } from 'vscode-languageclient'; -import { Decoration } from '../highlighting'; -import { Server } from '../server'; - -export function makeHandler() { - return async function handle(editor: TextEditor | undefined) { - if (!editor || editor.document.languageId !== 'rust') { - return; - } - - if (!Server.config.highlightingOn) { - return; - } - - const params: TextDocumentIdentifier = { - uri: editor.document.uri.toString(), - }; - const decorations = await Server.client.sendRequest( - 'rust-analyzer/decorationsRequest', - params, - ); - Server.highlighter.setHighlights(editor, decorations); - }; -} diff --git a/rust-analyzer/editors/code/src/events/index.ts b/rust-analyzer/editors/code/src/events/index.ts deleted file mode 100644 index be135474..00000000 --- a/rust-analyzer/editors/code/src/events/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as changeActiveTextEditor from './change_active_text_editor'; - -export { changeActiveTextEditor }; diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4e224a54..ced78adc 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,10 +1,30 @@ -import seedrandom = require('seedrandom'); import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as seedrandom from 'seedrandom'; + import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; import { Server } from './server'; +import { Ctx } from './ctx'; + +export function activateHighlighting(ctx: Ctx) { + vscode.window.onDidChangeActiveTextEditor( + async (editor: vscode.TextEditor | undefined) => { + if (!editor || editor.document.languageId !== 'rust') return; + if (!Server.config.highlightingOn) return; + + const params: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + const decorations = await ctx.client.sendRequest( + 'rust-analyzer/decorationsRequest', + params, + ); + Server.highlighter.setHighlights(editor, decorations); + }, + ); +} export interface Decoration { range: lc.Range; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 7e63a9ca..45657532 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -4,10 +4,10 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; import { StatusDisplay } from './status_display'; -import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; import { Ctx } from './ctx'; +import { activateHighlighting } from './highlighting'; let ctx!: Ctx; @@ -37,6 +37,8 @@ export async function activate(context: vscode.ExtensionContext) { ); ctx.pushCleanup(watchStatus); + activateHighlighting(ctx); + // Notifications are events triggered by the language server const allNotifications: [string, lc.GenericNotificationHandler][] = [ [ @@ -49,11 +51,6 @@ export async function activate(context: vscode.ExtensionContext) { ], ]; - // The events below are plain old javascript events, triggered and handled by vscode - vscode.window.onDidChangeActiveTextEditor( - events.changeActiveTextEditor.makeHandler(), - ); - const startServer = () => Server.start(allNotifications); const reloadCommand = () => reloadServer(startServer); From 92f52256b615672eab72dda71c6215604e767e72 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 20:46:14 +0100 Subject: [PATCH 279/819] Add config to Ctx --- rust-analyzer/editors/code/src/ctx.ts | 5 +++++ rust-analyzer/editors/code/src/highlighting.ts | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 4 +--- rust-analyzer/editors/code/src/main.ts | 8 +++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index c3a3583b..ca431906 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Server } from './server'; +import { Config } from './config'; export class Ctx { private extCtx: vscode.ExtensionContext; @@ -13,6 +14,10 @@ export class Ctx { return Server.client; } + get config(): Config { + return Server.config; + } + get activeRustEditor(): vscode.TextEditor | undefined { const editor = vscode.window.activeTextEditor; return editor && editor.document.languageId === 'rust' diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index ced78adc..0f9271de 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -12,7 +12,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; - if (!Server.config.highlightingOn) return; + if (!ctx.config.highlightingOn) return; const params: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 4581e227..fb8f135c 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -30,9 +30,7 @@ export function activateInlayHints(ctx: Ctx) { ); ctx.pushCleanup( vscode.workspace.onDidChangeConfiguration(_ => - hintsUpdater.toggleHintsDisplay( - Server.config.displayInlayHints, - ), + hintsUpdater.toggleHintsDisplay(ctx.config.displayInlayHints), ), ); }); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 45657532..345ae068 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -28,13 +28,11 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('showReferences', commands.showReferences); - if (Server.config.enableEnhancedTyping) { + if (ctx.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); } - const watchStatus = new StatusDisplay( - Server.config.cargoWatchOptions.command, - ); + const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(watchStatus); activateHighlighting(ctx); @@ -63,7 +61,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.window.showErrorMessage(e.message); } - if (Server.config.displayInlayHints) { + if (ctx.config.displayInlayHints) { activateInlayHints(ctx); } } From 861850b2d841deee93eed3f0c948a5ae3e975488 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 21:28:38 +0100 Subject: [PATCH 280/819] Refactor inlay hints --- rust-analyzer/editors/code/src/inlay_hints.ts | 170 +++++++----------- 1 file changed, 67 insertions(+), 103 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index fb8f135c..aae9de69 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,39 +1,29 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from './server'; + import { Ctx } from './ctx'; export function activateInlayHints(ctx: Ctx) { - const hintsUpdater = new HintsUpdater(); - hintsUpdater.refreshHintsForVisibleEditors().then(() => { - // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() - // so update the hints once when the focus changes to guarantee their presence - let editorChangeDisposable: vscode.Disposable | null = null; - editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( - _ => { - if (editorChangeDisposable !== null) { - editorChangeDisposable.dispose(); - } - return hintsUpdater.refreshHintsForVisibleEditors(); - }, - ); + const hintsUpdater = new HintsUpdater(ctx); + console.log('activateInlayHints'); - ctx.pushCleanup( - vscode.window.onDidChangeVisibleTextEditors(_ => - hintsUpdater.refreshHintsForVisibleEditors(), - ), - ); - ctx.pushCleanup( - vscode.workspace.onDidChangeTextDocument(e => - hintsUpdater.refreshHintsForVisibleEditors(e), - ), - ); - ctx.pushCleanup( - vscode.workspace.onDidChangeConfiguration(_ => - hintsUpdater.toggleHintsDisplay(ctx.config.displayInlayHints), - ), - ); - }); + vscode.window.onDidChangeVisibleTextEditors(async _ => { + await hintsUpdater.refresh(); + }, ctx.subscriptions); + + vscode.workspace.onDidChangeTextDocument(async e => { + if (e.contentChanges.length === 0) return; + if (e.document.languageId !== 'rust') return; + await hintsUpdater.refresh(); + }, ctx.subscriptions); + + vscode.workspace.onDidChangeConfiguration(_ => { + hintsUpdater.setEnabled(ctx.config.displayInlayHints); + }, ctx.subscriptions); + + // XXX: don't await here; + // Who knows what happens if an exception is thrown here... + hintsUpdater.refresh(); } interface InlayHintsParams { @@ -53,95 +43,69 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ }); class HintsUpdater { - private displayHints = true; - - public async toggleHintsDisplay(displayHints: boolean): Promise { - if (this.displayHints !== displayHints) { - this.displayHints = displayHints; - return this.refreshVisibleEditorsHints( - displayHints ? undefined : [], - ); - } - } + private ctx: Ctx; + private enabled = true; - public async refreshHintsForVisibleEditors( - cause?: vscode.TextDocumentChangeEvent, - ): Promise { - if (!this.displayHints) return; - - if ( - cause !== undefined && - (cause.contentChanges.length === 0 || - !this.isRustDocument(cause.document)) - ) { - return; - } - return this.refreshVisibleEditorsHints(); + constructor(ctx: Ctx) { + this.ctx = ctx; } - private async refreshVisibleEditorsHints( - newDecorations?: vscode.DecorationOptions[], - ) { - const promises: Array> = []; - - for (const rustEditor of vscode.window.visibleTextEditors.filter( - editor => this.isRustDocument(editor.document), - )) { - if (newDecorations !== undefined) { - promises.push( - Promise.resolve( - rustEditor.setDecorations( - typeHintDecorationType, - newDecorations, - ), - ), - ); - } else { - promises.push(this.updateDecorationsFromServer(rustEditor)); - } - } + async setEnabled(enabled: boolean) { + if (this.enabled == enabled) return; + this.enabled = enabled; - for (const promise of promises) { - await promise; + if (this.enabled) { + await this.refresh(); + } else { + this.allEditors.forEach(it => this.setDecorations(it, [])); } } - private isRustDocument(document: vscode.TextDocument): boolean { - return document && document.languageId === 'rust'; + async refresh() { + if (!this.enabled) return; + const promises = this.allEditors.map(it => this.refreshEditor(it)); + await Promise.all(promises); } - private async updateDecorationsFromServer( - editor: vscode.TextEditor, - ): Promise { + private async refreshEditor(editor: vscode.TextEditor): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); - if (newHints !== null) { - const newDecorations = newHints.map(hint => ({ - range: hint.range, - renderOptions: { - after: { - contentText: `: ${hint.label}`, - }, + + const newDecorations = (newHints ? newHints : []).map(hint => ({ + range: hint.range, + renderOptions: { + after: { + contentText: `: ${hint.label}`, }, - })); - return editor.setDecorations( - typeHintDecorationType, - newDecorations, - ); - } + }, + })); + this.setDecorations(editor, newDecorations); + } + + private get allEditors(): vscode.TextEditor[] { + return vscode.window.visibleTextEditors.filter( + editor => editor.document.languageId === 'rust', + ); + } + + private setDecorations( + editor: vscode.TextEditor, + decorations: vscode.DecorationOptions[], + ) { + editor.setDecorations( + typeHintDecorationType, + this.enabled ? decorations : [], + ); } private async queryHints(documentUri: string): Promise { const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; - const client = Server.client; - return client - .onReady() - .then(() => - client.sendRequest( - 'rust-analyzer/inlayHints', - request, - ), - ); + await this.ctx.client.onReady(); + + return this.ctx.client.sendRequest( + 'rust-analyzer/inlayHints', + request, + ); } } From 83f4f647c0df6d824ec9f21f2cb82b8de117eec7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 21:39:34 +0100 Subject: [PATCH 281/819] Thoughtlessly copy-paste a fix to a problem I don't understand --- rust-analyzer/editors/code/src/highlighting.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 0f9271de..333319b8 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as seedrandom from 'seedrandom'; +import * as seedrandom_ from 'seedrandom'; +const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; From ecab991c1f8a425075100c4c3f96e44bef482987 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 22:18:16 +0100 Subject: [PATCH 282/819] Retry inlay hints on content modified error --- rust-analyzer/editors/code/rollup.config.js | 2 +- rust-analyzer/editors/code/src/ctx.ts | 15 +++++++++++++++ rust-analyzer/editors/code/src/inlay_hints.ts | 7 +------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 4c001f89..14fb9e08 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -13,7 +13,7 @@ export default { commonjs({ namedExports: { // squelch missing import warnings - 'vscode-languageclient': ['CreateFile', 'RenameFile'] + 'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes'] } }) ], diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index ca431906..75b3542f 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -61,6 +61,21 @@ export class Ctx { pushCleanup(d: { dispose(): any }) { this.extCtx.subscriptions.push(d); } + + async sendRequestWithRetry(method: string, param: any): Promise { + await this.client.onReady(); + const nRetries = 3; + for (let triesLeft = nRetries; ; triesLeft--) { + try { + return await this.client.sendRequest(method, param); + } catch (e) { + if (e.code === lc.ErrorCodes.ContentModified && triesLeft > 0) { + continue; + } + throw e; + } + } + } } export type Cmd = (...args: any[]) => any; diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index aae9de69..16faea22 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -5,8 +5,6 @@ import { Ctx } from './ctx'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); - console.log('activateInlayHints'); - vscode.window.onDidChangeVisibleTextEditors(async _ => { await hintsUpdater.refresh(); }, ctx.subscriptions); @@ -69,7 +67,6 @@ class HintsUpdater { private async refreshEditor(editor: vscode.TextEditor): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); - const newDecorations = (newHints ? newHints : []).map(hint => ({ range: hint.range, renderOptions: { @@ -101,9 +98,7 @@ class HintsUpdater { const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; - await this.ctx.client.onReady(); - - return this.ctx.client.sendRequest( + return this.ctx.sendRequestWithRetry( 'rust-analyzer/inlayHints', request, ); From d8e015977e4083fa79a058afdf394281e2bf6cef Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 22:53:21 +0100 Subject: [PATCH 283/819] Don't request inline hints repeatedly --- rust-analyzer/editors/code/src/ctx.ts | 13 +++++++---- rust-analyzer/editors/code/src/inlay_hints.ts | 23 +++++++++++++++---- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 75b3542f..d3ef27e4 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -62,20 +62,23 @@ export class Ctx { this.extCtx.subscriptions.push(d); } - async sendRequestWithRetry(method: string, param: any): Promise { + async sendRequestWithRetry(method: string, param: any, token: vscode.CancellationToken): Promise { await this.client.onReady(); - const nRetries = 3; - for (let triesLeft = nRetries; ; triesLeft--) { + for (const delay of [2, 4, 6, 8, 10, null]) { try { - return await this.client.sendRequest(method, param); + return await this.client.sendRequest(method, param, token); } catch (e) { - if (e.code === lc.ErrorCodes.ContentModified && triesLeft > 0) { + if (e.code === lc.ErrorCodes.ContentModified && delay !== null) { + await sleep(10 * (1 << delay)) continue; } throw e; } } + throw 'unreachable' } } export type Cmd = (...args: any[]) => any; + +const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 16faea22..d4129740 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -41,6 +41,7 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ }); class HintsUpdater { + private pending: Map = new Map(); private ctx: Ctx; private enabled = true; @@ -67,7 +68,8 @@ class HintsUpdater { private async refreshEditor(editor: vscode.TextEditor): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); - const newDecorations = (newHints ? newHints : []).map(hint => ({ + if (newHints == null) return; + const newDecorations = newHints.map(hint => ({ range: hint.range, renderOptions: { after: { @@ -98,9 +100,20 @@ class HintsUpdater { const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; - return this.ctx.sendRequestWithRetry( - 'rust-analyzer/inlayHints', - request, - ); + let tokenSource = new vscode.CancellationTokenSource(); + let prev = this.pending.get(documentUri); + if (prev) prev.cancel() + this.pending.set(documentUri, tokenSource); + try { + return await this.ctx.sendRequestWithRetry( + 'rust-analyzer/inlayHints', + request, + tokenSource.token, + ); + } finally { + if (!tokenSource.token.isCancellationRequested) { + this.pending.delete(documentUri) + } + } } } From 688f01233673b21c9a9a18ade53d0efc01b7df2f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:12:33 +0100 Subject: [PATCH 284/819] Privatize highlighting --- rust-analyzer/editors/code/src/config.ts | 3 -- rust-analyzer/editors/code/src/ctx.ts | 17 +++++--- .../editors/code/src/highlighting.ts | 40 ++++++++++++++++++- rust-analyzer/editors/code/src/inlay_hints.ts | 4 +- rust-analyzer/editors/code/src/main.ts | 9 +---- .../editors/code/src/notifications/index.ts | 3 -- .../src/notifications/publish_decorations.ts | 24 ----------- rust-analyzer/editors/code/src/server.ts | 2 - 8 files changed, 54 insertions(+), 48 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/notifications/index.ts delete mode 100644 rust-analyzer/editors/code/src/notifications/publish_decorations.ts diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index a88be6e3..2bd27695 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,7 +1,6 @@ import * as vscode from 'vscode'; import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; -import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -56,8 +55,6 @@ export class Config { public userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); - Server.highlighter.removeHighlights(); - let requireReloadMessage = null; if (config.has('highlightingOn')) { diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index d3ef27e4..39eddfcb 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -62,23 +62,30 @@ export class Ctx { this.extCtx.subscriptions.push(d); } - async sendRequestWithRetry(method: string, param: any, token: vscode.CancellationToken): Promise { + async sendRequestWithRetry( + method: string, + param: any, + token: vscode.CancellationToken, + ): Promise { await this.client.onReady(); for (const delay of [2, 4, 6, 8, 10, null]) { try { return await this.client.sendRequest(method, param, token); } catch (e) { - if (e.code === lc.ErrorCodes.ContentModified && delay !== null) { - await sleep(10 * (1 << delay)) + if ( + e.code === lc.ErrorCodes.ContentModified && + delay !== null + ) { + await sleep(10 * (1 << delay)); continue; } throw e; } } - throw 'unreachable' + throw 'unreachable'; } } export type Cmd = (...args: any[]) => any; -const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) +const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 333319b8..c7ee8c0a 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -10,6 +10,36 @@ import { Server } from './server'; import { Ctx } from './ctx'; export function activateHighlighting(ctx: Ctx) { + const highlighter = new Highlighter(); + + ctx.client.onReady().then(() => { + ctx.client.onNotification( + 'rust-analyzer/publishDecorations', + (params: PublishDecorationsParams) => { + if (!ctx.config.highlightingOn) return; + + const targetEditor = vscode.window.visibleTextEditors.find( + editor => { + const unescapedUri = unescape( + editor.document.uri.toString(), + ); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; + }, + ); + if (!targetEditor) return; + + highlighter.setHighlights(targetEditor, params.decorations); + }, + ); + }); + + vscode.workspace.onDidChangeConfiguration( + _ => highlighter.removeHighlights(), + ctx.subscriptions, + ); + vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; @@ -22,11 +52,17 @@ export function activateHighlighting(ctx: Ctx) { 'rust-analyzer/decorationsRequest', params, ); - Server.highlighter.setHighlights(editor, decorations); + highlighter.setHighlights(editor, decorations); }, + ctx.subscriptions, ); } +interface PublishDecorationsParams { + uri: string; + decorations: Decoration[]; +} + export interface Decoration { range: lc.Range; tag: string; @@ -81,7 +117,7 @@ function createDecorationFromTextmate( return vscode.window.createTextEditorDecorationType(decorationOptions); } -export class Highlighter { +class Highlighter { private static initDecorations(): Map< string, vscode.TextEditorDecorationType diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index d4129740..a7be97db 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -102,7 +102,7 @@ class HintsUpdater { }; let tokenSource = new vscode.CancellationTokenSource(); let prev = this.pending.get(documentUri); - if (prev) prev.cancel() + if (prev) prev.cancel(); this.pending.set(documentUri, tokenSource); try { return await this.ctx.sendRequestWithRetry( @@ -112,7 +112,7 @@ class HintsUpdater { ); } finally { if (!tokenSource.token.isCancellationRequested) { - this.pending.delete(documentUri) + this.pending.delete(documentUri); } } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 345ae068..20a3ea11 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -4,7 +4,6 @@ import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; import { StatusDisplay } from './status_display'; -import * as notifications from './notifications'; import { Server } from './server'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; @@ -35,14 +34,8 @@ export async function activate(context: vscode.ExtensionContext) { const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(watchStatus); - activateHighlighting(ctx); - // Notifications are events triggered by the language server const allNotifications: [string, lc.GenericNotificationHandler][] = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], [ '$/progress', params => watchStatus.handleProgressNotification(params), @@ -61,6 +54,8 @@ export async function activate(context: vscode.ExtensionContext) { vscode.window.showErrorMessage(e.message); } + activateHighlighting(ctx); + if (ctx.config.displayInlayHints) { activateInlayHints(ctx); } diff --git a/rust-analyzer/editors/code/src/notifications/index.ts b/rust-analyzer/editors/code/src/notifications/index.ts deleted file mode 100644 index 74c4c356..00000000 --- a/rust-analyzer/editors/code/src/notifications/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as publishDecorations from './publish_decorations'; - -export { publishDecorations }; diff --git a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts b/rust-analyzer/editors/code/src/notifications/publish_decorations.ts deleted file mode 100644 index f23e286a..00000000 --- a/rust-analyzer/editors/code/src/notifications/publish_decorations.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as vscode from 'vscode'; - -import { Decoration } from '../highlighting'; -import { Server } from '../server'; - -export interface PublishDecorationsParams { - uri: string; - decorations: Decoration[]; -} - -export function handle(params: PublishDecorationsParams) { - const targetEditor = vscode.window.visibleTextEditors.find(editor => { - const unescapedUri = unescape(editor.document.uri.toString()); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri; - }); - - if (!Server.config.highlightingOn || !targetEditor) { - return; - } - - Server.highlighter.setHighlights(targetEditor, params.decorations); -} diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 10dc079f..2bb21da6 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -3,7 +3,6 @@ import * as lc from 'vscode-languageclient'; import { window, workspace } from 'vscode'; import { Config } from './config'; -import { Highlighter } from './highlighting'; function expandPathResolving(path: string) { if (path.startsWith('~/')) { @@ -13,7 +12,6 @@ function expandPathResolving(path: string) { } export class Server { - public static highlighter = new Highlighter(); public static config = new Config(); public static client: lc.LanguageClient; From ce9a7277a0948c4352f3c3c4361ab1ea835c81ff Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:27:13 +0100 Subject: [PATCH 285/819] Remove prettier --- rust-analyzer/editors/code/package-lock.json | 6 ------ rust-analyzer/editors/code/package.json | 9 +-------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 806ebdb8..982238fa 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -534,12 +534,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 46d55e32..fd9058a9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,8 +18,7 @@ "scripts": { "vscode:prepublish": "rollup -c", "package": "vsce package", - "watch": "tsc -watch -p ./", - "prettier": "prettier --write '**/*.ts'" + "watch": "tsc -watch -p ./" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -33,17 +32,11 @@ "@types/node": "^12.12.21", "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", - "prettier": "^1.19.1", "rollup": "^1.27.14", "tslib": "^1.10.0", "typescript": "^3.7.3", "vsce": "^1.71.0" }, - "prettier": { - "singleQuote": true, - "tabWidth": 4, - "trailingComma": "all" - }, "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", From 42570ab8239f85597547540c734348a7d7123f0e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:28:13 +0100 Subject: [PATCH 286/819] Add tsfmt --- rust-analyzer/editors/code/package-lock.json | 64 ++++++++++++++++++++ rust-analyzer/editors/code/package.json | 4 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 982238fa..a7e32e28 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -198,6 +198,12 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "commandpost": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/commandpost/-/commandpost-1.4.0.tgz", + "integrity": "sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -269,6 +275,26 @@ "domelementtype": "1" } }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "dev": true, + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -395,6 +421,16 @@ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "magic-string": { "version": "0.25.4", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", @@ -534,6 +570,12 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -590,6 +632,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, "sourcemap-codec": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", @@ -657,6 +705,16 @@ "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", "dev": true }, + "typescript-formatter": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/typescript-formatter/-/typescript-formatter-7.2.2.tgz", + "integrity": "sha512-V7vfI9XArVhriOTYHPzMU2WUnm5IMdu9X/CPxs8mIMGxmTBFpDABlbkBka64PZJ9/xgQeRpK8KzzAG4MPzxBDQ==", + "dev": true, + "requires": { + "commandpost": "^1.0.0", + "editorconfig": "^0.15.0" + } + }, "uc.micro": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", @@ -751,6 +809,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, "yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fd9058a9..9444649f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,7 +18,8 @@ "scripts": { "vscode:prepublish": "rollup -c", "package": "vsce package", - "watch": "tsc -watch -p ./" + "watch": "tsc -watch -p ./", + "fmt": "tsfmt -r" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -35,6 +36,7 @@ "rollup": "^1.27.14", "tslib": "^1.10.0", "typescript": "^3.7.3", + "typescript-formatter": "^7.2.2", "vsce": "^1.71.0" }, "activationEvents": [ From bc48dd5a3d3d3050252012fced76574b6330e4fc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:30:35 +0100 Subject: [PATCH 287/819] Reformat with tsfmt --- .../editors/code/src/commands/syntax_tree.ts | 4 +- rust-analyzer/editors/code/src/config.ts | 4 +- .../editors/code/src/highlighting.ts | 52 +++++++++---------- .../editors/code/src/status_display.ts | 4 +- rust-analyzer/editors/code/tsconfig.json | 3 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 20ff7e5c..5b8f6e4d 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -85,8 +85,8 @@ class TextDocumentContentProvider range = editor.selection.isEmpty ? undefined : this.ctx.client.code2ProtocolConverter.asRange( - editor.selection, - ); + editor.selection, + ); } const request: SyntaxTreeParams = { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 2bd27695..e323110a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -171,9 +171,9 @@ export class Config { (this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures || this.cargoFeatures.noDefaultFeatures !== - this.prevCargoFeatures.noDefaultFeatures || + this.prevCargoFeatures.noDefaultFeatures || this.cargoFeatures.features.length !== - this.prevCargoFeatures.features.length || + this.prevCargoFeatures.features.length || this.cargoFeatures.features.some( (v, i) => v !== this.prevCargoFeatures!.features[i], )) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index c7ee8c0a..96d55037 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -151,32 +151,32 @@ class Highlighter { string, vscode.TextEditorDecorationType, ]> = [ - decoration('comment'), - decoration('string'), - decoration('keyword'), - decoration('keyword.control'), - decoration('keyword.unsafe'), - decoration('function'), - decoration('parameter'), - decoration('constant'), - decoration('type.builtin'), - decoration('type.generic'), - decoration('type.lifetime'), - decoration('type.param'), - decoration('type.self'), - decoration('type'), - decoration('text'), - decoration('attribute'), - decoration('literal'), - decoration('literal.numeric'), - decoration('literal.char'), - decoration('literal.byte'), - decoration('macro'), - decoration('variable'), - decoration('variable.mut', 'underline'), - decoration('field'), - decoration('module'), - ]; + decoration('comment'), + decoration('string'), + decoration('keyword'), + decoration('keyword.control'), + decoration('keyword.unsafe'), + decoration('function'), + decoration('parameter'), + decoration('constant'), + decoration('type.builtin'), + decoration('type.generic'), + decoration('type.lifetime'), + decoration('type.param'), + decoration('type.self'), + decoration('type'), + decoration('text'), + decoration('attribute'), + decoration('literal'), + decoration('literal.numeric'), + decoration('literal.char'), + decoration('literal.byte'), + decoration('macro'), + decoration('variable'), + decoration('variable.mut', 'underline'), + decoration('field'), + decoration('module'), + ]; return new Map(decorations); } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index ed8573f0..48cf0655 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -28,11 +28,11 @@ export class StatusDisplay implements vscode.Disposable { if (this.packageName) { this.statusBarItem!.text = `cargo ${this.command} [${ this.packageName - }] ${this.frame()}`; + }] ${this.frame()}`; } else { this.statusBarItem!.text = `cargo ${ this.command - } ${this.frame()}`; + } ${this.frame()}`; } }, 300); diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index a4fbb4b8..fe3b40f3 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "newLine": "LF" }, "exclude": [ "node_modules" From 5160b06bd0bbae66bb8961a82b763cf3aa51656e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:40:48 +0100 Subject: [PATCH 288/819] Use Ctx in highlighter --- rust-analyzer/editors/code/src/highlighting.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 96d55037..247673b5 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -6,11 +6,10 @@ const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; -import { Server } from './server'; import { Ctx } from './ctx'; export function activateHighlighting(ctx: Ctx) { - const highlighter = new Highlighter(); + const highlighter = new Highlighter(ctx); ctx.client.onReady().then(() => { ctx.client.onNotification( @@ -118,6 +117,12 @@ function createDecorationFromTextmate( } class Highlighter { + private ctx: Ctx; + + constructor(ctx: Ctx) { + this.ctx = ctx; + } + private static initDecorations(): Map< string, vscode.TextEditorDecorationType @@ -213,7 +218,7 @@ class Highlighter { string, [vscode.Range[], boolean] > = new Map(); - const rainbowTime = Server.config.rainbowHighlightingOn; + const rainbowTime = this.ctx.config.rainbowHighlightingOn; for (const tag of this.decorations.keys()) { byTag.set(tag, []); @@ -232,13 +237,13 @@ class Highlighter { colorfulIdents .get(d.bindingHash)![0] .push( - Server.client.protocol2CodeConverter.asRange(d.range), + this.ctx.client.protocol2CodeConverter.asRange(d.range), ); } else { byTag .get(d.tag)! .push( - Server.client.protocol2CodeConverter.asRange(d.range), + this.ctx.client.protocol2CodeConverter.asRange(d.range), ); } } From 117d35bf45aab74d33961f60139c2ad3255e61f0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 23:45:50 +0100 Subject: [PATCH 289/819] Restore internal applySourceChange command --- rust-analyzer/editors/code/src/commands/index.ts | 8 ++++++++ rust-analyzer/editors/code/src/main.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 89af4be9..c28709c8 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; +import * as sourceChange from '../source_change'; import { analyzerStatus } from './analyzer_status'; import { matchingBrace } from './matching_brace'; @@ -29,6 +30,12 @@ function showReferences(ctx: Ctx): Cmd { }; } +function applySourceChange(ctx: Ctx): Cmd { + return async (change: sourceChange.SourceChange) => { + sourceChange.applySourceChange(ctx, change); + } +} + export { analyzerStatus, expandMacro, @@ -41,4 +48,5 @@ export { run, runSingle, showReferences, + applySourceChange, }; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 20a3ea11..0c4abdac 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -26,6 +26,7 @@ export async function activate(context: vscode.ExtensionContext) { // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('showReferences', commands.showReferences); + ctx.registerCommand('applySourceChange', commands.applySourceChange); if (ctx.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); From 46883b3c5299fba6c84c1b2365474cc6e3f2eb97 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 02:17:50 +0100 Subject: [PATCH 290/819] Rearrange code --- rust-analyzer/editors/code/src/ctx.ts | 2 +- .../editors/code/src/highlighting.ts | 211 +++++++++--------- 2 files changed, 106 insertions(+), 107 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 39eddfcb..30dd9811 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -65,7 +65,7 @@ export class Ctx { async sendRequestWithRetry( method: string, param: any, - token: vscode.CancellationToken, + token?: vscode.CancellationToken, ): Promise { await this.client.onReady(); for (const delay of [2, 4, 6, 8, 10, null]) { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 247673b5..4c2e7f67 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -47,7 +47,7 @@ export function activateHighlighting(ctx: Ctx) { const params: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; - const decorations = await ctx.client.sendRequest( + const decorations = await ctx.sendRequestWithRetry( 'rust-analyzer/decorationsRequest', params, ); @@ -62,7 +62,7 @@ interface PublishDecorationsParams { decorations: Decoration[]; } -export interface Decoration { +interface Decoration { range: lc.Range; tag: string; bindingHash?: string; @@ -81,116 +81,17 @@ function fancify(seed: string, shade: 'light' | 'dark') { return `hsl(${h},${s}%,${l}%)`; } -function createDecorationFromTextmate( - themeStyle: scopes.TextMateRuleSettings, -): vscode.TextEditorDecorationType { - const decorationOptions: vscode.DecorationRenderOptions = {}; - decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; - - if (themeStyle.foreground) { - decorationOptions.color = themeStyle.foreground; - } - - if (themeStyle.background) { - decorationOptions.backgroundColor = themeStyle.background; - } - - if (themeStyle.fontStyle) { - const parts: string[] = themeStyle.fontStyle.split(' '); - parts.forEach(part => { - switch (part) { - case 'italic': - decorationOptions.fontStyle = 'italic'; - break; - case 'bold': - decorationOptions.fontWeight = 'bold'; - break; - case 'underline': - decorationOptions.textDecoration = 'underline'; - break; - default: - break; - } - }); - } - return vscode.window.createTextEditorDecorationType(decorationOptions); -} - class Highlighter { private ctx: Ctx; - - constructor(ctx: Ctx) { - this.ctx = ctx; - } - - private static initDecorations(): Map< - string, - vscode.TextEditorDecorationType - > { - const decoration = ( - tag: string, - textDecoration?: string, - ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, scopes.find); - - if (rule) { - const decor = createDecorationFromTextmate(rule); - return [tag, decor]; - } else { - const fallBackTag = 'ralsp.' + tag; - // console.log(' '); - // console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); - // console.log(scopesMapper.find(tag)); - // console.log('Falling back to values defined in: ' + fallBackTag); - // console.log(' '); - const color = new vscode.ThemeColor(fallBackTag); - const decor = vscode.window.createTextEditorDecorationType({ - color, - textDecoration, - }); - return [tag, decor]; - } - }; - - const decorations: Iterable<[ - string, - vscode.TextEditorDecorationType, - ]> = [ - decoration('comment'), - decoration('string'), - decoration('keyword'), - decoration('keyword.control'), - decoration('keyword.unsafe'), - decoration('function'), - decoration('parameter'), - decoration('constant'), - decoration('type.builtin'), - decoration('type.generic'), - decoration('type.lifetime'), - decoration('type.param'), - decoration('type.self'), - decoration('type'), - decoration('text'), - decoration('attribute'), - decoration('literal'), - decoration('literal.numeric'), - decoration('literal.char'), - decoration('literal.byte'), - decoration('macro'), - decoration('variable'), - decoration('variable.mut', 'underline'), - decoration('field'), - decoration('module'), - ]; - - return new Map(decorations); - } - private decorations: Map< string, vscode.TextEditorDecorationType > | null = null; + constructor(ctx: Ctx) { + this.ctx = ctx; + } + public removeHighlights() { if (this.decorations == null) { return; @@ -210,7 +111,7 @@ class Highlighter { // Note: decoration objects need to be kept around so we can dispose them // if the user disables syntax highlighting if (this.decorations == null) { - this.decorations = Highlighter.initDecorations(); + this.decorations = initDecorations(); } const byTag: Map = new Map(); @@ -266,3 +167,101 @@ class Highlighter { } } } + +function initDecorations(): Map< + string, + vscode.TextEditorDecorationType +> { + const decoration = ( + tag: string, + textDecoration?: string, + ): [string, vscode.TextEditorDecorationType] => { + const rule = scopesMapper.toRule(tag, scopes.find); + + if (rule) { + const decor = createDecorationFromTextmate(rule); + return [tag, decor]; + } else { + const fallBackTag = 'ralsp.' + tag; + // console.log(' '); + // console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); + // console.log(scopesMapper.find(tag)); + // console.log('Falling back to values defined in: ' + fallBackTag); + // console.log(' '); + const color = new vscode.ThemeColor(fallBackTag); + const decor = vscode.window.createTextEditorDecorationType({ + color, + textDecoration, + }); + return [tag, decor]; + } + }; + + const decorations: Iterable<[ + string, + vscode.TextEditorDecorationType, + ]> = [ + decoration('comment'), + decoration('string'), + decoration('keyword'), + decoration('keyword.control'), + decoration('keyword.unsafe'), + decoration('function'), + decoration('parameter'), + decoration('constant'), + decoration('type.builtin'), + decoration('type.generic'), + decoration('type.lifetime'), + decoration('type.param'), + decoration('type.self'), + decoration('type'), + decoration('text'), + decoration('attribute'), + decoration('literal'), + decoration('literal.numeric'), + decoration('literal.char'), + decoration('literal.byte'), + decoration('macro'), + decoration('variable'), + decoration('variable.mut', 'underline'), + decoration('field'), + decoration('module'), + ]; + + return new Map(decorations); +} + +function createDecorationFromTextmate( + themeStyle: scopes.TextMateRuleSettings, +): vscode.TextEditorDecorationType { + const decorationOptions: vscode.DecorationRenderOptions = {}; + decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; + + if (themeStyle.foreground) { + decorationOptions.color = themeStyle.foreground; + } + + if (themeStyle.background) { + decorationOptions.backgroundColor = themeStyle.background; + } + + if (themeStyle.fontStyle) { + const parts: string[] = themeStyle.fontStyle.split(' '); + parts.forEach(part => { + switch (part) { + case 'italic': + decorationOptions.fontStyle = 'italic'; + break; + case 'bold': + decorationOptions.fontWeight = 'bold'; + break; + case 'underline': + decorationOptions.textDecoration = 'underline'; + break; + default: + break; + } + }); + } + return vscode.window.createTextEditorDecorationType(decorationOptions); +} From b7bd91ed81a49a780b988fffc999e7b1b79f29fa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 02:21:57 +0100 Subject: [PATCH 291/819] Remove trivial helpers --- rust-analyzer/editors/code/src/scopes.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index cb250b85..46555633 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -82,9 +82,9 @@ function loadThemeNamed(themeName: string) { function loadThemeFile(themePath: string) { const themeContent = [themePath] - .filter(isFile) - .map(readFileText) - .map(parseJSON) + .filter(it => fs.statSync(it).isFile()) + .map(it => fs.readFileSync(it, 'utf8')) + .map(it => jsonc.parse(it)) .filter(theme => theme); themeContent @@ -132,15 +132,3 @@ function loadColors(textMateRules: TextMateRule[]): void { } }); } - -function isFile(filePath: string): boolean { - return [filePath].map(fs.statSync).every(stat => stat.isFile()); -} - -function readFileText(filePath: string): string { - return fs.readFileSync(filePath, 'utf8'); -} - -function parseJSON(content: string): any { - return jsonc.parse(content); -} From 9a009a68d7b19949d2c8ffcc7c2df00d873cc3dd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 02:27:26 +0100 Subject: [PATCH 292/819] Use optional value shortcut --- rust-analyzer/editors/code/src/scopes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 46555633..f98b5745 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -9,9 +9,9 @@ export interface TextMateRule { } export interface TextMateRuleSettings { - foreground: string | undefined; - background: string | undefined; - fontStyle: string | undefined; + foreground?: string; + background?: string; + fontStyle?: string; } // Current theme colors From 8d11fd741b60c33625099389975f84d566f2f401 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 02:30:43 +0100 Subject: [PATCH 293/819] Reduce scope --- rust-analyzer/editors/code/src/scopes.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index f98b5745..1229f0fb 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -42,18 +42,20 @@ export function load() { } } -function filterThemeExtensions(extension: vscode.Extension): boolean { - return ( - extension.extensionKind === vscode.ExtensionKind.UI && - extension.packageJSON.contributes && - extension.packageJSON.contributes.themes - ); -} + // Find current theme on disk function loadThemeNamed(themeName: string) { + function isTheme(extension: vscode.Extension): boolean { + return ( + extension.extensionKind === vscode.ExtensionKind.UI && + extension.packageJSON.contributes && + extension.packageJSON.contributes.themes + ); + } + const themePaths = vscode.extensions.all - .filter(filterThemeExtensions) + .filter(isTheme) .reduce((list, extension) => { return extension.packageJSON.contributes.themes .filter( From 3fc19ae89435e89cceea3f4e92c8781c50e682ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 03:33:00 +0100 Subject: [PATCH 294/819] Switch impure functional style to pure imperative --- rust-analyzer/editors/code/src/config.ts | 2 - .../editors/code/src/highlighting.ts | 8 +- rust-analyzer/editors/code/src/scopes.ts | 150 +++++++----------- rust-analyzer/editors/code/tsconfig.json | 2 +- 4 files changed, 67 insertions(+), 95 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e323110a..f63d1ddc 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,5 +1,4 @@ import * as vscode from 'vscode'; -import * as scopes from './scopes'; import * as scopesMapper from './scopes_mapper'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -60,7 +59,6 @@ export class Config { if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; if (this.highlightingOn) { - scopes.load(); scopesMapper.load(); } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4c2e7f67..5e9cbe0d 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as seedrandom_ from 'seedrandom'; const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 -import * as scopes from './scopes'; +import { loadThemeColors, TextMateRuleSettings } from './scopes'; import * as scopesMapper from './scopes_mapper'; import { Ctx } from './ctx'; @@ -172,11 +172,13 @@ function initDecorations(): Map< string, vscode.TextEditorDecorationType > { + const themeColors = loadThemeColors(); + const decoration = ( tag: string, textDecoration?: string, ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, scopes.find); + const rule = scopesMapper.toRule(tag, it => themeColors.get(it)); if (rule) { const decor = createDecorationFromTextmate(rule); @@ -232,7 +234,7 @@ function initDecorations(): Map< } function createDecorationFromTextmate( - themeStyle: scopes.TextMateRuleSettings, + themeStyle: TextMateRuleSettings, ): vscode.TextEditorDecorationType { const decorationOptions: vscode.DecorationRenderOptions = {}; decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/scopes.ts index 1229f0fb..73fabbf5 100644 --- a/rust-analyzer/editors/code/src/scopes.ts +++ b/rust-analyzer/editors/code/src/scopes.ts @@ -3,28 +3,14 @@ import * as jsonc from 'jsonc-parser'; import * as path from 'path'; import * as vscode from 'vscode'; -export interface TextMateRule { - scope: string | string[]; - settings: TextMateRuleSettings; -} - export interface TextMateRuleSettings { foreground?: string; background?: string; fontStyle?: string; } -// Current theme colors -const rules = new Map(); - -export function find(scope: string): TextMateRuleSettings | undefined { - return rules.get(scope); -} - // Load all textmate scopes in the currently active theme -export function load() { - // Remove any previous theme - rules.clear(); +export function loadThemeColors(): Map { // Find out current color theme const themeName = vscode.workspace .getConfiguration('workbench') @@ -32,20 +18,12 @@ export function load() { if (typeof themeName !== 'string') { // console.warn('workbench.colorTheme is', themeName) - return; - } - // Try to load colors from that theme - try { - loadThemeNamed(themeName); - } catch (e) { - // console.warn('failed to load theme', themeName, e) + return new Map(); } + return loadThemeNamed(themeName); } - - -// Find current theme on disk -function loadThemeNamed(themeName: string) { +function loadThemeNamed(themeName: string): Map { function isTheme(extension: vscode.Extension): boolean { return ( extension.extensionKind === vscode.ExtensionKind.UI && @@ -54,83 +32,77 @@ function loadThemeNamed(themeName: string) { ); } - const themePaths = vscode.extensions.all + let themePaths = vscode.extensions.all .filter(isTheme) - .reduce((list, extension) => { - return extension.packageJSON.contributes.themes - .filter( - (element: any) => - (element.id || element.label) === themeName, - ) - .map((element: any) => - path.join(extension.extensionPath, element.path), - ) - .concat(list); - }, Array()); - - themePaths.forEach(loadThemeFile); + .flatMap(ext => { + return ext.packageJSON.contributes.themes + .filter((it: any) => (it.id || it.label) === themeName) + .map((it: any) => path.join(ext.extensionPath, it.path)); + }) + + const res = new Map(); + for (const themePath of themePaths) { + mergeInto(res, loadThemeFile(themePath)) + } - const tokenColorCustomizations: [any] = [ - vscode.workspace - .getConfiguration('editor') - .get('tokenColorCustomizations'), - ]; + const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + mergeInto(res, loadColors(customizations?.textMateRules ?? [])) - tokenColorCustomizations - .filter(custom => custom && custom.textMateRules) - .map(custom => custom.textMateRules) - .forEach(loadColors); + return res; } -function loadThemeFile(themePath: string) { - const themeContent = [themePath] - .filter(it => fs.statSync(it).isFile()) - .map(it => fs.readFileSync(it, 'utf8')) - .map(it => jsonc.parse(it)) - .filter(theme => theme); +function loadThemeFile(themePath: string): Map { + let text; + try { + text = fs.readFileSync(themePath, 'utf8') + } catch { + return new Map(); + } + const obj = jsonc.parse(text); + const tokenColors = obj?.tokenColors ?? []; + const res = loadColors(tokenColors); + + for (const include in obj?.include ?? []) { + const includePath = path.join(path.dirname(themePath), include); + const tmp = loadThemeFile(includePath); + mergeInto(res, tmp); + } + + return res; +} - themeContent - .filter(theme => theme.tokenColors) - .map(theme => theme.tokenColors) - .forEach(loadColors); +interface TextMateRule { + scope: string | string[]; + settings: TextMateRuleSettings; +} - themeContent - .filter(theme => theme.include) - .map(theme => path.join(path.dirname(themePath), theme.include)) - .forEach(loadThemeFile); +function loadColors(textMateRules: TextMateRule[]): Map { + const res = new Map(); + for (const rule of textMateRules) { + const scopes = typeof rule.scope === 'string' + ? [rule.scope] + : rule.scope; + for (const scope of scopes) { + res.set(scope, rule.settings) + } + } + return res } function mergeRuleSettings( defaultSetting: TextMateRuleSettings | undefined, override: TextMateRuleSettings, ): TextMateRuleSettings { - if (defaultSetting === undefined) { - return override; + return { + foreground: defaultSetting?.foreground ?? override.foreground, + background: defaultSetting?.background ?? override.background, + fontStyle: defaultSetting?.fontStyle ?? override.fontStyle, } - const mergedRule = defaultSetting; - - mergedRule.background = override.background || defaultSetting.background; - mergedRule.foreground = override.foreground || defaultSetting.foreground; - mergedRule.fontStyle = override.fontStyle || defaultSetting.foreground; - - return mergedRule; } -function updateRules( - scope: string, - updatedSettings: TextMateRuleSettings, -): void { - [rules.get(scope)] - .map(settings => mergeRuleSettings(settings, updatedSettings)) - .forEach(settings => rules.set(scope, settings)); -} - -function loadColors(textMateRules: TextMateRule[]): void { - textMateRules.forEach(rule => { - if (typeof rule.scope === 'string') { - updateRules(rule.scope, rule.settings); - } else if (rule.scope instanceof Array) { - rule.scope.forEach(scope => updateRules(scope, rule.settings)); - } - }); +function mergeInto(dst: Map, addition: Map) { + addition.forEach((value, key) => { + const merged = mergeRuleSettings(dst.get(key), value) + dst.set(key, merged) + }) } diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index fe3b40f3..e60eb8e5 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -4,7 +4,7 @@ "target": "es2018", "outDir": "out", "lib": [ - "es2018" + "es2019" ], "sourceMap": true, "rootDir": "src", From c101f189a21b4be96bb5f73809c75c4d1223755a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 11:44:52 +0100 Subject: [PATCH 295/819] Fix #2700 --- rust-analyzer/editors/code/src/ctx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 30dd9811..693ce05e 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -70,7 +70,7 @@ export class Ctx { await this.client.onReady(); for (const delay of [2, 4, 6, 8, 10, null]) { try { - return await this.client.sendRequest(method, param, token); + return await (token ? this.client.sendRequest(method, param, token) : this.client.sendRequest(method, param)); } catch (e) { if ( e.code === lc.ErrorCodes.ContentModified && From 1e2e22ecbad97d77b88fa41a01f45af176f75425 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 09:41:16 +0100 Subject: [PATCH 296/819] Rename file --- rust-analyzer/editors/code/src/highlighting.ts | 2 +- .../editors/code/src/{scopes.ts => load_theme_colors.ts} | 0 rust-analyzer/editors/code/src/scopes_mapper.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename rust-analyzer/editors/code/src/{scopes.ts => load_theme_colors.ts} (100%) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 5e9cbe0d..e97eb086 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as seedrandom_ from 'seedrandom'; const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 -import { loadThemeColors, TextMateRuleSettings } from './scopes'; +import { loadThemeColors, TextMateRuleSettings } from './load_theme_colors'; import * as scopesMapper from './scopes_mapper'; import { Ctx } from './ctx'; diff --git a/rust-analyzer/editors/code/src/scopes.ts b/rust-analyzer/editors/code/src/load_theme_colors.ts similarity index 100% rename from rust-analyzer/editors/code/src/scopes.ts rename to rust-analyzer/editors/code/src/load_theme_colors.ts diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts index e738fa23..1295ab47 100644 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ b/rust-analyzer/editors/code/src/scopes_mapper.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { TextMateRuleSettings } from './scopes'; +import { TextMateRuleSettings } from './load_theme_colors'; let mappings = new Map(); From 948c227503d3310700b3dd6fe65e09788b786502 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 11:06:50 +0100 Subject: [PATCH 297/819] Drop support for legacy colorization --- rust-analyzer/editors/code/src/color_theme.ts | 123 ++++++++++++++++++ rust-analyzer/editors/code/src/config.ts | 4 - .../editors/code/src/highlighting.ts | 106 ++++++--------- .../editors/code/src/load_theme_colors.ts | 108 --------------- .../editors/code/src/scopes_mapper.ts | 78 ----------- 5 files changed, 164 insertions(+), 255 deletions(-) create mode 100644 rust-analyzer/editors/code/src/color_theme.ts delete mode 100644 rust-analyzer/editors/code/src/load_theme_colors.ts delete mode 100644 rust-analyzer/editors/code/src/scopes_mapper.ts diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts new file mode 100644 index 00000000..1df7eba7 --- /dev/null +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -0,0 +1,123 @@ +import * as fs from 'fs'; +import * as jsonc from 'jsonc-parser'; +import * as path from 'path'; +import * as vscode from 'vscode'; + +export interface TextMateRuleSettings { + foreground?: string; + background?: string; + fontStyle?: string; +} + +export class ColorTheme { + private rules: Map = new Map(); + + static load(): ColorTheme { + // Find out current color theme + const themeName = vscode.workspace + .getConfiguration('workbench') + .get('colorTheme'); + + if (typeof themeName !== 'string') { + // console.warn('workbench.colorTheme is', themeName) + return new ColorTheme(); + } + return loadThemeNamed(themeName); + } + + static fromRules(rules: TextMateRule[]): ColorTheme { + const res = new ColorTheme(); + for (const rule of rules) { + const scopes = typeof rule.scope === 'string' + ? [rule.scope] + : rule.scope; + for (const scope of scopes) { + res.rules.set(scope, rule.settings) + } + } + return res + } + + lookup(scopes: string[]): TextMateRuleSettings { + let res: TextMateRuleSettings = {} + for (const scope of scopes) { + this.rules.forEach((value, key) => { + if (scope.startsWith(key)) { + res = mergeRuleSettings(res, value) + } + }) + } + return res + } + + mergeFrom(other: ColorTheme) { + other.rules.forEach((value, key) => { + const merged = mergeRuleSettings(this.rules.get(key), value) + this.rules.set(key, merged) + }) + } +} + +function loadThemeNamed(themeName: string): ColorTheme { + function isTheme(extension: vscode.Extension): boolean { + return ( + extension.extensionKind === vscode.ExtensionKind.UI && + extension.packageJSON.contributes && + extension.packageJSON.contributes.themes + ); + } + + let themePaths = vscode.extensions.all + .filter(isTheme) + .flatMap(ext => { + return ext.packageJSON.contributes.themes + .filter((it: any) => (it.id || it.label) === themeName) + .map((it: any) => path.join(ext.extensionPath, it.path)); + }) + + const res = new ColorTheme(); + for (const themePath of themePaths) { + res.mergeFrom(loadThemeFile(themePath)) + } + + const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])) + + return res; +} + +function loadThemeFile(themePath: string): ColorTheme { + let text; + try { + text = fs.readFileSync(themePath, 'utf8') + } catch { + return new ColorTheme(); + } + const obj = jsonc.parse(text); + const tokenColors = obj?.tokenColors ?? []; + const res = ColorTheme.fromRules(tokenColors); + + for (const include in obj?.include ?? []) { + const includePath = path.join(path.dirname(themePath), include); + const tmp = loadThemeFile(includePath); + res.mergeFrom(tmp); + } + + return res; +} + +interface TextMateRule { + scope: string | string[]; + settings: TextMateRuleSettings; +} + +function mergeRuleSettings( + defaultSetting: TextMateRuleSettings | undefined, + override: TextMateRuleSettings, +): TextMateRuleSettings { + return { + foreground: override.foreground ?? defaultSetting?.foreground, + background: override.background ?? defaultSetting?.background, + fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, + } +} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index f63d1ddc..ccb0ee2b 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,5 +1,4 @@ import * as vscode from 'vscode'; -import * as scopesMapper from './scopes_mapper'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -58,9 +57,6 @@ export class Config { if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; - if (this.highlightingOn) { - scopesMapper.load(); - } } if (config.has('rainbowHighlightingOn')) { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index e97eb086..d383d87e 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -3,8 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as seedrandom_ from 'seedrandom'; const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 -import { loadThemeColors, TextMateRuleSettings } from './load_theme_colors'; -import * as scopesMapper from './scopes_mapper'; +import { ColorTheme, TextMateRuleSettings } from './color_theme'; import { Ctx } from './ctx'; @@ -168,69 +167,16 @@ class Highlighter { } } -function initDecorations(): Map< - string, - vscode.TextEditorDecorationType -> { - const themeColors = loadThemeColors(); - - const decoration = ( - tag: string, - textDecoration?: string, - ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, it => themeColors.get(it)); - - if (rule) { - const decor = createDecorationFromTextmate(rule); - return [tag, decor]; - } else { - const fallBackTag = 'ralsp.' + tag; - // console.log(' '); - // console.log('Missing theme for: <"' + tag + '"> for following mapped scopes:'); - // console.log(scopesMapper.find(tag)); - // console.log('Falling back to values defined in: ' + fallBackTag); - // console.log(' '); - const color = new vscode.ThemeColor(fallBackTag); - const decor = vscode.window.createTextEditorDecorationType({ - color, - textDecoration, - }); - return [tag, decor]; - } - }; - - const decorations: Iterable<[ - string, - vscode.TextEditorDecorationType, - ]> = [ - decoration('comment'), - decoration('string'), - decoration('keyword'), - decoration('keyword.control'), - decoration('keyword.unsafe'), - decoration('function'), - decoration('parameter'), - decoration('constant'), - decoration('type.builtin'), - decoration('type.generic'), - decoration('type.lifetime'), - decoration('type.param'), - decoration('type.self'), - decoration('type'), - decoration('text'), - decoration('attribute'), - decoration('literal'), - decoration('literal.numeric'), - decoration('literal.char'), - decoration('literal.byte'), - decoration('macro'), - decoration('variable'), - decoration('variable.mut', 'underline'), - decoration('field'), - decoration('module'), - ]; - - return new Map(decorations); +function initDecorations(): Map { + const theme = ColorTheme.load(); + const res = new Map() + TAG_TO_SCOPES.forEach((scopes, tag) => { + if (!scopes) throw `unmapped tag: ${tag}` + let rule = theme.lookup(scopes) + const decor = createDecorationFromTextmate(rule); + res.set(tag, decor) + }) + return res; } function createDecorationFromTextmate( @@ -267,3 +213,33 @@ function createDecorationFromTextmate( } return vscode.window.createTextEditorDecorationType(decorationOptions); } + +// sync with tags from `syntax_highlighting.rs`. +const TAG_TO_SCOPES = new Map([ + ["field", ["entity.name.field"]], + ["function", ["entity.name.function"]], + ["module", ["entity.name.module"]], + ["constant", ["entity.name.constant"]], + ["macro", ["entity.name.macro"]], + + ["variable", ["variable"]], + ["variable.mut", ["variable", "meta.mutable"]], + + ["type", ["entity.name.type"]], + ["type.builtin", ["entity.name.type", "support.type.primitive"]], + ["type.self", ["entity.name.type.parameter.self"]], + ["type.param", ["entity.name.type.parameter"]], + ["type.lifetime", ["entity.name.type.lifetime"]], + + ["literal.byte", ["constant.character.byte"]], + ["literal.char", ["constant.character"]], + ["literal.numeric", ["constant.numeric"]], + + ["comment", ["comment"]], + ["string", ["string.quoted"]], + ["attribute", ["meta.attribute"]], + + ["keyword", ["keyword"]], + ["keyword.unsafe", ["keyword.other.unsafe"]], + ["keyword.control", ["keyword.control"]], +]); diff --git a/rust-analyzer/editors/code/src/load_theme_colors.ts b/rust-analyzer/editors/code/src/load_theme_colors.ts deleted file mode 100644 index 73fabbf5..00000000 --- a/rust-analyzer/editors/code/src/load_theme_colors.ts +++ /dev/null @@ -1,108 +0,0 @@ -import * as fs from 'fs'; -import * as jsonc from 'jsonc-parser'; -import * as path from 'path'; -import * as vscode from 'vscode'; - -export interface TextMateRuleSettings { - foreground?: string; - background?: string; - fontStyle?: string; -} - -// Load all textmate scopes in the currently active theme -export function loadThemeColors(): Map { - // Find out current color theme - const themeName = vscode.workspace - .getConfiguration('workbench') - .get('colorTheme'); - - if (typeof themeName !== 'string') { - // console.warn('workbench.colorTheme is', themeName) - return new Map(); - } - return loadThemeNamed(themeName); -} - -function loadThemeNamed(themeName: string): Map { - function isTheme(extension: vscode.Extension): boolean { - return ( - extension.extensionKind === vscode.ExtensionKind.UI && - extension.packageJSON.contributes && - extension.packageJSON.contributes.themes - ); - } - - let themePaths = vscode.extensions.all - .filter(isTheme) - .flatMap(ext => { - return ext.packageJSON.contributes.themes - .filter((it: any) => (it.id || it.label) === themeName) - .map((it: any) => path.join(ext.extensionPath, it.path)); - }) - - const res = new Map(); - for (const themePath of themePaths) { - mergeInto(res, loadThemeFile(themePath)) - } - - const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - mergeInto(res, loadColors(customizations?.textMateRules ?? [])) - - return res; -} - -function loadThemeFile(themePath: string): Map { - let text; - try { - text = fs.readFileSync(themePath, 'utf8') - } catch { - return new Map(); - } - const obj = jsonc.parse(text); - const tokenColors = obj?.tokenColors ?? []; - const res = loadColors(tokenColors); - - for (const include in obj?.include ?? []) { - const includePath = path.join(path.dirname(themePath), include); - const tmp = loadThemeFile(includePath); - mergeInto(res, tmp); - } - - return res; -} - -interface TextMateRule { - scope: string | string[]; - settings: TextMateRuleSettings; -} - -function loadColors(textMateRules: TextMateRule[]): Map { - const res = new Map(); - for (const rule of textMateRules) { - const scopes = typeof rule.scope === 'string' - ? [rule.scope] - : rule.scope; - for (const scope of scopes) { - res.set(scope, rule.settings) - } - } - return res -} - -function mergeRuleSettings( - defaultSetting: TextMateRuleSettings | undefined, - override: TextMateRuleSettings, -): TextMateRuleSettings { - return { - foreground: defaultSetting?.foreground ?? override.foreground, - background: defaultSetting?.background ?? override.background, - fontStyle: defaultSetting?.fontStyle ?? override.fontStyle, - } -} - -function mergeInto(dst: Map, addition: Map) { - addition.forEach((value, key) => { - const merged = mergeRuleSettings(dst.get(key), value) - dst.set(key, merged) - }) -} diff --git a/rust-analyzer/editors/code/src/scopes_mapper.ts b/rust-analyzer/editors/code/src/scopes_mapper.ts deleted file mode 100644 index 1295ab47..00000000 --- a/rust-analyzer/editors/code/src/scopes_mapper.ts +++ /dev/null @@ -1,78 +0,0 @@ -import * as vscode from 'vscode'; -import { TextMateRuleSettings } from './load_theme_colors'; - -let mappings = new Map(); - -const defaultMapping = new Map([ - [ - 'comment', - [ - 'comment', - 'comment.block', - 'comment.line', - 'comment.block.documentation', - ], - ], - ['string', ['string']], - ['keyword', ['keyword']], - ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], - [ - 'keyword.unsafe', - ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'], - ], - ['function', ['entity.name.function']], - ['parameter', ['variable.parameter']], - ['constant', ['constant', 'variable']], - ['type', ['entity.name.type']], - ['builtin', ['variable.language', 'support.type', 'support.type']], - ['text', ['string', 'string.quoted', 'string.regexp']], - ['attribute', ['keyword']], - ['literal', ['string', 'string.quoted', 'string.regexp']], - ['macro', ['entity.name.function', 'keyword.other', 'entity.name.macro']], - ['variable', ['variable']], - ['variable.mut', ['variable', 'storage.modifier']], - [ - 'field', - [ - 'variable.object.property', - 'meta.field.declaration', - 'meta.definition.property', - 'variable.other', - ], - ], - ['module', ['entity.name.section', 'entity.other']], -]); - -export function find(scope: string): string[] { - return mappings.get(scope) || []; -} - -export function toRule( - scope: string, - intoRule: (scope: string) => TextMateRuleSettings | undefined, -): TextMateRuleSettings | undefined { - return find(scope) - .map(intoRule) - .filter(rule => rule !== undefined)[0]; -} - -function isString(value: any): value is string { - return typeof value === 'string'; -} - -function isArrayOfString(value: any): value is string[] { - return Array.isArray(value) && value.every(item => isString(item)); -} - -export function load() { - const rawConfig: { [key: string]: any } = - vscode.workspace - .getConfiguration('rust-analyzer') - .get('scopeMappings') || {}; - - mappings = Object.entries(rawConfig) - .filter(([_, value]) => isString(value) || isArrayOfString(value)) - .reduce((list, [key, value]: [string, string | string[]]) => { - return list.set(key, isString(value) ? [value] : value); - }, defaultMapping); -} From 4b20012ef160e8bac1d5a3c9e97d5ba9cf9c4bb8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 14:34:01 +0100 Subject: [PATCH 298/819] Drop obsolete color configurations --- rust-analyzer/editors/code/package.json | 289 +----------------- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 2 files changed, 2 insertions(+), 289 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9444649f..269bed0f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -147,68 +147,6 @@ "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, - "rust-analyzer.scopeMappings": { - "type": "object", - "definitions": {}, - "properties": { - "comment": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "string": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "keyword": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "keyword.control": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "keyword.unsafe": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "function": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "parameter": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "constant": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "type": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "builtin": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "text": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "attribute": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "literal": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "macro": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "variable": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "variable.mut": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "field": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - }, - "module": { - "$ref": "vscode://schemas/textmate-colors#/items/properties/scope" - } - }, - "additionalProperties": false, - "description": "Mapping Rust Analyzer scopes to TextMateRule scopes list." - }, "rust-analyzer.rainbowHighlightingOn": { "type": "boolean", "default": false, @@ -374,232 +312,7 @@ ], "colors": [ { - "id": "ralsp.comment", - "description": "Color for comments", - "defaults": { - "dark": "#6A9955", - "light": "#008000", - "highContrast": "#7CA668" - } - }, - { - "id": "ralsp.string", - "description": "Color for strings", - "defaults": { - "dark": "#CE9178", - "light": "#A31515", - "highContrast": "#CE9178" - } - }, - { - "id": "ralsp.keyword", - "description": "Color for keywords", - "defaults": { - "dark": "#569cd6", - "light": "#0000FF", - "highContrast": "#569CD6" - } - }, - { - "id": "ralsp.keyword.control", - "description": "Color for control keywords", - "defaults": { - "dark": "#C586C0", - "light": "#AF00DB", - "highContrast": "#C586C0" - } - }, - { - "id": "ralsp.keyword.unsafe", - "description": "Color for unsafe", - "defaults": { - "dark": "#FF3030", - "light": "#FF1010", - "highContrast": "#FF1010" - } - }, - { - "id": "ralsp.function", - "description": "Color for functions", - "defaults": { - "dark": "#DCDCAA", - "light": "#795E26", - "highContrast": "#DCDCAA" - } - }, - { - "id": "ralsp.parameter", - "description": "Color for parameters", - "defaults": { - "dark": "#9CDCFE", - "light": "#001080", - "highContrast": "#9CDCFE" - } - }, - { - "id": "ralsp.builtin", - "description": "Color for builtins", - "defaults": { - "dark": "#DD6718", - "light": "#DD6718", - "highContrast": "#DD6718" - } - }, - { - "id": "ralsp.text", - "description": "Color for text", - "defaults": { - "dark": "#D4D4D4", - "light": "#000000", - "highContrast": "#FFFFFF" - } - }, - { - "id": "ralsp.attribute", - "description": "Color for attributes", - "defaults": { - "dark": "#9FE9BF", - "light": "#1F4B1F", - "highContrast": "#108010" - } - }, - { - "id": "ralsp.literal", - "description": "Color for literals", - "defaults": { - "dark": "#BECEA8", - "light": "#09885A", - "highContrast": "#B5CEA8" - } - }, - { - "id": "ralsp.literal.numeric", - "description": "Color for numeric literals", - "defaults": { - "dark": "#BECEA8", - "light": "#09885A", - "highContrast": "#B5CEA8" - } - }, - { - "id": "ralsp.literal.char", - "description": "Color for character literals", - "defaults": { - "dark": "#BECEA8", - "light": "#09885A", - "highContrast": "#B5CEA8" - } - }, - { - "id": "ralsp.literal.byte", - "description": "Color for byte literals", - "defaults": { - "dark": "#BECEA8", - "light": "#09885A", - "highContrast": "#B5CEA8" - } - }, - { - "id": "ralsp.macro", - "description": "Color for macros", - "defaults": { - "dark": "#BFEBBF", - "light": "#DD6718", - "highContrast": "#ED7718" - } - }, - { - "id": "ralsp.constant", - "description": "Color for constants", - "defaults": { - "dark": "#569cd6", - "light": "#267cb6", - "highContrast": "#569cd6" - } - }, - { - "id": "ralsp.type", - "description": "Color for other types (traits, aliases..)", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.type.builtin", - "description": "Color for built-in types (&str, bool, u16, u32)", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.type.lifetime", - "description": "Color for lifetimes parameters", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.type.self", - "description": "Color for `Self` param type", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.type.param", - "description": "Color for type parameters", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.field", - "description": "Color for fields", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.variable", - "description": "Color for variables", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.variable.mut", - "description": "Color for mutable variables", - "defaults": { - "dark": "#4EC9B0", - "light": "#267F99", - "highContrast": "#4EC9B0" - } - }, - { - "id": "ralsp.module", - "description": "Color for modules", - "defaults": { - "dark": "#D4D4D4", - "light": "#000000", - "highContrast": "#FFFFFF" - } - }, - { - "id": "ralsp.inlayHint", + "id": "rust-analyzer.inlayHint", "description": "Color for inlay hints", "defaults": { "dark": "#A0A0A0F0", diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index a7be97db..7575cead 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -36,7 +36,7 @@ interface InlayHint { const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { - color: new vscode.ThemeColor('ralsp.inlayHint'), + color: new vscode.ThemeColor('rust-analyzer.inlayHint'), }, }); From cc23e02c6a66c3221ba95e6cce1a9a2012bb653a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 15:42:05 +0100 Subject: [PATCH 299/819] Fix color name --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 269bed0f..429d63f7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -312,7 +312,7 @@ ], "colors": [ { - "id": "rust-analyzer.inlayHint", + "id": "rust_analyzer.inlayHint", "description": "Color for inlay hints", "defaults": { "dark": "#A0A0A0F0", diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 7575cead..b6eb7016 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -36,7 +36,7 @@ interface InlayHint { const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { - color: new vscode.ThemeColor('rust-analyzer.inlayHint'), + color: new vscode.ThemeColor('rust_analyzer.inlayHint'), }, }); From 2ac797b27c2b5983379ceb845196a1d069a77925 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 17:22:43 +0100 Subject: [PATCH 300/819] Refactor status activation --- rust-analyzer/editors/code/src/ctx.ts | 5 +++ .../editors/code/src/highlighting.ts | 42 +++++++++---------- rust-analyzer/editors/code/src/main.ts | 17 ++------ rust-analyzer/editors/code/src/server.ts | 9 +--- .../editors/code/src/status_display.ts | 10 ++++- 5 files changed, 38 insertions(+), 45 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 693ce05e..0e62a3a8 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -84,6 +84,11 @@ export class Ctx { } throw 'unreachable'; } + + onNotification(method: string, handler: lc.GenericNotificationHandler) { + this.client.onReady() + .then(() => this.client.onNotification(method, handler)) + } } export type Cmd = (...args: any[]) => any; diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d383d87e..d4e961b5 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -10,28 +10,26 @@ import { Ctx } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - ctx.client.onReady().then(() => { - ctx.client.onNotification( - 'rust-analyzer/publishDecorations', - (params: PublishDecorationsParams) => { - if (!ctx.config.highlightingOn) return; - - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape( - editor.document.uri.toString(), - ); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri; - }, - ); - if (!targetEditor) return; - - highlighter.setHighlights(targetEditor, params.decorations); - }, - ); - }); + ctx.onNotification( + 'rust-analyzer/publishDecorations', + (params: PublishDecorationsParams) => { + if (!ctx.config.highlightingOn) return; + + const targetEditor = vscode.window.visibleTextEditors.find( + editor => { + const unescapedUri = unescape( + editor.document.uri.toString(), + ); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; + }, + ); + if (!targetEditor) return; + + highlighter.setHighlights(targetEditor, params.decorations); + }, + ); vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0c4abdac..511f17ca 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -1,9 +1,8 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; -import { StatusDisplay } from './status_display'; +import { activateStatusDisplay } from './status_display'; import { Server } from './server'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; @@ -32,18 +31,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.overrideCommand('type', commands.onEnter); } - const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command); - ctx.pushCleanup(watchStatus); - - // Notifications are events triggered by the language server - const allNotifications: [string, lc.GenericNotificationHandler][] = [ - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; - - const startServer = () => Server.start(allNotifications); + const startServer = () => Server.start(); const reloadCommand = () => reloadServer(startServer); vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); @@ -55,6 +43,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.window.showErrorMessage(e.message); } + activateStatusDisplay(ctx); activateHighlighting(ctx); if (ctx.config.displayInlayHints) { diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 2bb21da6..5dc8a36b 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -15,9 +15,7 @@ export class Server { public static config = new Config(); public static client: lc.LanguageClient; - public static async start( - notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>, - ) { + public static async start() { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. let folder: string = '.'; @@ -92,11 +90,6 @@ export class Server { }, }; Server.client.registerProposedFeatures(); - Server.client.onReady().then(() => { - for (const [type, handler] of notificationHandlers) { - Server.client.onNotification(type, handler); - } - }); Server.client.start(); } } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 48cf0655..e3719075 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -1,8 +1,16 @@ import * as vscode from 'vscode'; +import { Ctx } from './ctx'; + const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; -export class StatusDisplay implements vscode.Disposable { +export function activateStatusDisplay(ctx: Ctx) { + const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); + ctx.pushCleanup(statusDisplay); + ctx.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); +} + +class StatusDisplay implements vscode.Disposable { packageName?: string; private i = 0; From 66c3118c435ffc4cd0a25c8bc74e996c128d584a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 17:28:01 +0100 Subject: [PATCH 301/819] Move config to Ctx --- rust-analyzer/editors/code/src/ctx.ts | 5 +---- rust-analyzer/editors/code/src/main.ts | 2 +- rust-analyzer/editors/code/src/server.ts | 5 +++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 0e62a3a8..d86fe5a8 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -4,6 +4,7 @@ import { Server } from './server'; import { Config } from './config'; export class Ctx { + readonly config = new Config(); private extCtx: vscode.ExtensionContext; constructor(extCtx: vscode.ExtensionContext) { @@ -14,10 +15,6 @@ export class Ctx { return Server.client; } - get config(): Config { - return Server.config; - } - get activeRustEditor(): vscode.TextEditor | undefined { const editor = vscode.window.activeTextEditor; return editor && editor.document.languageId === 'rust' diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 511f17ca..3d910792 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -31,7 +31,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.overrideCommand('type', commands.onEnter); } - const startServer = () => Server.start(); + const startServer = () => Server.start(ctx.config); const reloadCommand = () => reloadServer(startServer); vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts index 5dc8a36b..ab9f3bfa 100644 --- a/rust-analyzer/editors/code/src/server.ts +++ b/rust-analyzer/editors/code/src/server.ts @@ -12,10 +12,10 @@ function expandPathResolving(path: string) { } export class Server { - public static config = new Config(); + static config: Config; public static client: lc.LanguageClient; - public static async start() { + public static async start(config: Config) { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. let folder: string = '.'; @@ -23,6 +23,7 @@ export class Server { folder = workspace.workspaceFolders[0].uri.fsPath.toString(); } + this.config = config; const command = expandPathResolving(this.config.raLspServerPath); const run: lc.Executable = { command, From 1aafdc1ea6c57b5b93b22d0f33af4ecad3efbcb1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 17:28:27 +0100 Subject: [PATCH 302/819] Drop needless pubs --- rust-analyzer/editors/code/src/config.ts | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index ccb0ee2b..9800b461 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -16,25 +16,25 @@ export interface CargoFeatures { } export class Config { - public highlightingOn = true; - public rainbowHighlightingOn = false; - public enableEnhancedTyping = true; - public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; - public lruCapacity: null | number = null; - public displayInlayHints = true; - public maxInlayHintLength: null | number = null; - public excludeGlobs = []; - public useClientWatching = true; - public featureFlags = {}; + highlightingOn = true; + rainbowHighlightingOn = false; + enableEnhancedTyping = true; + raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; + lruCapacity: null | number = null; + displayInlayHints = true; + maxInlayHintLength: null | number = null; + excludeGlobs = []; + useClientWatching = true; + featureFlags = {}; // for internal use - public withSysroot: null | boolean = null; - public cargoWatchOptions: CargoWatchOptions = { + withSysroot: null | boolean = null; + cargoWatchOptions: CargoWatchOptions = { enable: true, arguments: [], command: '', allTargets: true, }; - public cargoFeatures: CargoFeatures = { + cargoFeatures: CargoFeatures = { noDefaultFeatures: false, allFeatures: true, features: [], @@ -50,7 +50,7 @@ export class Config { this.userConfigChanged(); } - public userConfigChanged() { + userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); let requireReloadMessage = null; From e870c36be925f86d86b5e366daae52f41256dba7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 17:34:52 +0100 Subject: [PATCH 303/819] Refactor config --- rust-analyzer/editors/code/src/config.ts | 10 ++++------ rust-analyzer/editors/code/src/ctx.ts | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 9800b461..ec2790b6 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -43,14 +43,12 @@ export class Config { private prevEnhancedTyping: null | boolean = null; private prevCargoFeatures: null | CargoFeatures = null; - constructor() { - vscode.workspace.onDidChangeConfiguration(_ => - this.userConfigChanged(), - ); - this.userConfigChanged(); + constructor(ctx: vscode.ExtensionContext) { + vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions); + this.refresh(); } - userConfigChanged() { + private refresh() { const config = vscode.workspace.getConfiguration('rust-analyzer'); let requireReloadMessage = null; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index d86fe5a8..393d6a60 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -4,10 +4,11 @@ import { Server } from './server'; import { Config } from './config'; export class Ctx { - readonly config = new Config(); + readonly config: Config; private extCtx: vscode.ExtensionContext; constructor(extCtx: vscode.ExtensionContext) { + this.config = new Config(extCtx) this.extCtx = extCtx; } From 322d306f20d5bd320dfdcb52e4bf72c63e3f1eb8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:14:00 +0100 Subject: [PATCH 304/819] Refactor server lifecycle --- rust-analyzer/editors/code/src/client.ts | 90 +++++++++++++++++ .../code/src/commands/analyzer_status.ts | 5 +- .../editors/code/src/commands/expand_macro.ts | 5 +- .../editors/code/src/commands/index.ts | 25 +++-- .../editors/code/src/commands/join_lines.ts | 7 +- rust-analyzer/editors/code/src/ctx.ts | 76 +++++++++------ .../editors/code/src/highlighting.ts | 56 ++++++----- rust-analyzer/editors/code/src/inlay_hints.ts | 11 ++- rust-analyzer/editors/code/src/main.ts | 35 ++----- rust-analyzer/editors/code/src/server.ts | 96 ------------------- .../editors/code/src/source_change.ts | 9 +- .../editors/code/src/status_display.ts | 4 +- 12 files changed, 218 insertions(+), 201 deletions(-) create mode 100644 rust-analyzer/editors/code/src/client.ts delete mode 100644 rust-analyzer/editors/code/src/server.ts diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts new file mode 100644 index 00000000..94948b10 --- /dev/null +++ b/rust-analyzer/editors/code/src/client.ts @@ -0,0 +1,90 @@ +import { homedir } from 'os'; +import * as lc from 'vscode-languageclient'; + +import { window, workspace } from 'vscode'; +import { Config } from './config'; + +export function createClient(config: Config): lc.LanguageClient { + // '.' Is the fallback if no folder is open + // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. + let folder: string = '.'; + if (workspace.workspaceFolders !== undefined) { + folder = workspace.workspaceFolders[0].uri.fsPath.toString(); + } + + const command = expandPathResolving(config.raLspServerPath); + const run: lc.Executable = { + command, + options: { cwd: folder }, + }; + const serverOptions: lc.ServerOptions = { + run, + debug: run, + }; + const traceOutputChannel = window.createOutputChannel( + 'Rust Analyzer Language Server Trace', + ); + const clientOptions: lc.LanguageClientOptions = { + documentSelector: [{ scheme: 'file', language: 'rust' }], + initializationOptions: { + publishDecorations: true, + lruCapacity: config.lruCapacity, + maxInlayHintLength: config.maxInlayHintLength, + cargoWatchEnable: config.cargoWatchOptions.enable, + cargoWatchArgs: config.cargoWatchOptions.arguments, + cargoWatchCommand: config.cargoWatchOptions.command, + cargoWatchAllTargets: + config.cargoWatchOptions.allTargets, + excludeGlobs: config.excludeGlobs, + useClientWatching: config.useClientWatching, + featureFlags: config.featureFlags, + withSysroot: config.withSysroot, + cargoFeatures: config.cargoFeatures, + }, + traceOutputChannel, + }; + + const res = new lc.LanguageClient( + 'rust-analyzer', + 'Rust Analyzer Language Server', + serverOptions, + clientOptions, + ); + + // HACK: This is an awful way of filtering out the decorations notifications + // However, pending proper support, this is the most effecitve approach + // Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages + // Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting) + // This also requires considering our settings strategy, which is work which needs doing + // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests + res._tracer = { + log: (messageOrDataObject: string | any, data?: string) => { + if (typeof messageOrDataObject === 'string') { + if ( + messageOrDataObject.includes( + 'rust-analyzer/publishDecorations', + ) || + messageOrDataObject.includes( + 'rust-analyzer/decorationsRequest', + ) + ) { + // Don't log publish decorations requests + } else { + // @ts-ignore This is just a utility function + res.logTrace(messageOrDataObject, data); + } + } else { + // @ts-ignore + res.logObjectTrace(messageOrDataObject); + } + }, + }; + res.registerProposedFeatures() + return res; +} +function expandPathResolving(path: string) { + if (path.startsWith('~/')) { + return path.replace('~', homedir()); + } + return path; +} diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 2c836228..cf37dc6f 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -49,9 +49,10 @@ class TextDocumentContentProvider _uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - if (editor == null) return ''; + const client = this.ctx.client + if (!editor || !client) return ''; - return this.ctx.client.sendRequest( + return client.sendRequest( 'rust-analyzer/analyzerStatus', null, ); diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index da208257..472f43b8 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -52,14 +52,15 @@ class TextDocumentContentProvider async provideTextDocumentContent(_uri: vscode.Uri): Promise { const editor = vscode.window.activeTextEditor; - if (editor == null) return ''; + const client = this.ctx.client + if (!editor || !client) return ''; const position = editor.selection.active; const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, position, }; - const expanded = await this.ctx.client.sendRequest( + const expanded = await client.sendRequest( 'rust-analyzer/expandMacro', request, ); diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index c28709c8..4431fdcf 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -15,18 +15,21 @@ import { run, runSingle } from './runnables'; function collectGarbage(ctx: Ctx): Cmd { return async () => { - ctx.client.sendRequest('rust-analyzer/collectGarbage', null); + ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); }; } function showReferences(ctx: Ctx): Cmd { return (uri: string, position: lc.Position, locations: lc.Location[]) => { - vscode.commands.executeCommand( - 'editor.action.showReferences', - vscode.Uri.parse(uri), - ctx.client.protocol2CodeConverter.asPosition(position), - locations.map(ctx.client.protocol2CodeConverter.asLocation), - ); + let client = ctx.client; + if (client) { + vscode.commands.executeCommand( + 'editor.action.showReferences', + vscode.Uri.parse(uri), + client.protocol2CodeConverter.asPosition(position), + locations.map(client.protocol2CodeConverter.asLocation), + ); + } }; } @@ -36,6 +39,13 @@ function applySourceChange(ctx: Ctx): Cmd { } } +function reload(ctx: Ctx): Cmd { + return async () => { + vscode.window.showInformationMessage('Reloading rust-analyzer...'); + await ctx.restartServer(); + } +} + export { analyzerStatus, expandMacro, @@ -49,4 +59,5 @@ export { runSingle, showReferences, applySourceChange, + reload }; diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index f4f902cf..7b08c325 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -6,13 +6,14 @@ import { applySourceChange, SourceChange } from '../source_change'; export function joinLines(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) return; + const client = ctx.client; + if (!editor || !client) return; const request: JoinLinesParams = { - range: ctx.client.code2ProtocolConverter.asRange(editor.selection), + range: client.code2ProtocolConverter.asRange(editor.selection), textDocument: { uri: editor.document.uri.toString() }, }; - const change = await ctx.client.sendRequest( + const change = await client.sendRequest( 'rust-analyzer/joinLines', request, ); diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 393d6a60..13988056 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,19 +1,38 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Server } from './server'; import { Config } from './config'; +import { createClient } from './client' export class Ctx { readonly config: Config; + // Because we have "reload server" action, various listeners **will** face a + // situation where the client is not ready yet, and should be prepared to + // deal with it. + // + // Ideally, this should be replaced with async getter though. + client: lc.LanguageClient | null = null private extCtx: vscode.ExtensionContext; + private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; constructor(extCtx: vscode.ExtensionContext) { this.config = new Config(extCtx) this.extCtx = extCtx; } - get client(): lc.LanguageClient { - return Server.client; + async restartServer() { + let old = this.client; + if (old) { + await old.stop() + } + this.client = null; + const client = createClient(this.config); + this.pushCleanup(client.start()); + await client.onReady(); + + this.client = client + for (const hook of this.onDidRestartHooks) { + hook(client) + } } get activeRustEditor(): vscode.TextEditor | undefined { @@ -60,35 +79,34 @@ export class Ctx { this.extCtx.subscriptions.push(d); } - async sendRequestWithRetry( - method: string, - param: any, - token?: vscode.CancellationToken, - ): Promise { - await this.client.onReady(); - for (const delay of [2, 4, 6, 8, 10, null]) { - try { - return await (token ? this.client.sendRequest(method, param, token) : this.client.sendRequest(method, param)); - } catch (e) { - if ( - e.code === lc.ErrorCodes.ContentModified && - delay !== null - ) { - await sleep(10 * (1 << delay)); - continue; - } - throw e; - } - } - throw 'unreachable'; - } - - onNotification(method: string, handler: lc.GenericNotificationHandler) { - this.client.onReady() - .then(() => this.client.onNotification(method, handler)) + onDidRestart(hook: (client: lc.LanguageClient) => void) { + this.onDidRestartHooks.push(hook) } } export type Cmd = (...args: any[]) => any; +export async function sendRequestWithRetry( + client: lc.LanguageClient, + method: string, + param: any, + token?: vscode.CancellationToken, +): Promise { + for (const delay of [2, 4, 6, 8, 10, null]) { + try { + return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param)); + } catch (e) { + if ( + e.code === lc.ErrorCodes.ContentModified && + delay !== null + ) { + await sleep(10 * (1 << delay)); + continue; + } + throw e; + } + } + throw 'unreachable'; +} + const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index d4e961b5..f9d2e9d9 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -5,31 +5,32 @@ const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular import { ColorTheme, TextMateRuleSettings } from './color_theme'; -import { Ctx } from './ctx'; +import { Ctx, sendRequestWithRetry } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - - ctx.onNotification( - 'rust-analyzer/publishDecorations', - (params: PublishDecorationsParams) => { - if (!ctx.config.highlightingOn) return; - - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape( - editor.document.uri.toString(), - ); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri; - }, - ); - if (!targetEditor) return; - - highlighter.setHighlights(targetEditor, params.decorations); - }, - ); + ctx.onDidRestart(client => { + client.onNotification( + 'rust-analyzer/publishDecorations', + (params: PublishDecorationsParams) => { + if (!ctx.config.highlightingOn) return; + + const targetEditor = vscode.window.visibleTextEditors.find( + editor => { + const unescapedUri = unescape( + editor.document.uri.toString(), + ); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; + }, + ); + if (!targetEditor) return; + + highlighter.setHighlights(targetEditor, params.decorations); + }, + ); + }) vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), @@ -40,11 +41,14 @@ export function activateHighlighting(ctx: Ctx) { async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; if (!ctx.config.highlightingOn) return; + let client = ctx.client; + if (!client) return; const params: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; - const decorations = await ctx.sendRequestWithRetry( + const decorations = await sendRequestWithRetry( + client, 'rust-analyzer/decorationsRequest', params, ); @@ -103,6 +107,8 @@ class Highlighter { } public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) { + let client = this.ctx.client; + if (!client) return; // Initialize decorations if necessary // // Note: decoration objects need to be kept around so we can dispose them @@ -135,13 +141,13 @@ class Highlighter { colorfulIdents .get(d.bindingHash)![0] .push( - this.ctx.client.protocol2CodeConverter.asRange(d.range), + client.protocol2CodeConverter.asRange(d.range), ); } else { byTag .get(d.tag)! .push( - this.ctx.client.protocol2CodeConverter.asRange(d.range), + client.protocol2CodeConverter.asRange(d.range), ); } } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index b6eb7016..e74d6996 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Ctx } from './ctx'; +import { Ctx, sendRequestWithRetry } from './ctx'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); @@ -19,9 +19,7 @@ export function activateInlayHints(ctx: Ctx) { hintsUpdater.setEnabled(ctx.config.displayInlayHints); }, ctx.subscriptions); - // XXX: don't await here; - // Who knows what happens if an exception is thrown here... - hintsUpdater.refresh(); + ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)) } interface InlayHintsParams { @@ -97,6 +95,8 @@ class HintsUpdater { } private async queryHints(documentUri: string): Promise { + let client = this.ctx.client; + if (!client) return null const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; @@ -105,7 +105,8 @@ class HintsUpdater { if (prev) prev.cancel(); this.pending.set(documentUri, tokenSource); try { - return await this.ctx.sendRequestWithRetry( + return await sendRequestWithRetry( + client, 'rust-analyzer/inlayHints', request, tokenSource.token, diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 3d910792..22450060 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -3,7 +3,6 @@ import * as vscode from 'vscode'; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; import { activateStatusDisplay } from './status_display'; -import { Server } from './server'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; @@ -21,6 +20,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); + ctx.registerCommand('reload', commands.reload); // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); @@ -30,38 +30,17 @@ export async function activate(context: vscode.ExtensionContext) { if (ctx.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); } - - const startServer = () => Server.start(ctx.config); - const reloadCommand = () => reloadServer(startServer); - - vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); - + activateStatusDisplay(ctx); + activateHighlighting(ctx); + activateInlayHints(ctx); // Start the language server, finally! try { - await startServer(); + await ctx.restartServer(); } catch (e) { vscode.window.showErrorMessage(e.message); } - - activateStatusDisplay(ctx); - activateHighlighting(ctx); - - if (ctx.config.displayInlayHints) { - activateInlayHints(ctx); - } } -export function deactivate(): Thenable { - if (!Server.client) { - return Promise.resolve(); - } - return Server.client.stop(); -} - -async function reloadServer(startServer: () => Promise) { - if (Server.client != null) { - vscode.window.showInformationMessage('Reloading rust-analyzer...'); - await Server.client.stop(); - await startServer(); - } +export async function deactivate() { + await ctx?.client?.stop(); } diff --git a/rust-analyzer/editors/code/src/server.ts b/rust-analyzer/editors/code/src/server.ts deleted file mode 100644 index ab9f3bfa..00000000 --- a/rust-analyzer/editors/code/src/server.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { homedir } from 'os'; -import * as lc from 'vscode-languageclient'; - -import { window, workspace } from 'vscode'; -import { Config } from './config'; - -function expandPathResolving(path: string) { - if (path.startsWith('~/')) { - return path.replace('~', homedir()); - } - return path; -} - -export class Server { - static config: Config; - public static client: lc.LanguageClient; - - public static async start(config: Config) { - // '.' Is the fallback if no folder is open - // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. - let folder: string = '.'; - if (workspace.workspaceFolders !== undefined) { - folder = workspace.workspaceFolders[0].uri.fsPath.toString(); - } - - this.config = config; - const command = expandPathResolving(this.config.raLspServerPath); - const run: lc.Executable = { - command, - options: { cwd: folder }, - }; - const serverOptions: lc.ServerOptions = { - run, - debug: run, - }; - const traceOutputChannel = window.createOutputChannel( - 'Rust Analyzer Language Server Trace', - ); - const clientOptions: lc.LanguageClientOptions = { - documentSelector: [{ scheme: 'file', language: 'rust' }], - initializationOptions: { - publishDecorations: true, - lruCapacity: Server.config.lruCapacity, - maxInlayHintLength: Server.config.maxInlayHintLength, - cargoWatchEnable: Server.config.cargoWatchOptions.enable, - cargoWatchArgs: Server.config.cargoWatchOptions.arguments, - cargoWatchCommand: Server.config.cargoWatchOptions.command, - cargoWatchAllTargets: - Server.config.cargoWatchOptions.allTargets, - excludeGlobs: Server.config.excludeGlobs, - useClientWatching: Server.config.useClientWatching, - featureFlags: Server.config.featureFlags, - withSysroot: Server.config.withSysroot, - cargoFeatures: Server.config.cargoFeatures, - }, - traceOutputChannel, - }; - - Server.client = new lc.LanguageClient( - 'rust-analyzer', - 'Rust Analyzer Language Server', - serverOptions, - clientOptions, - ); - // HACK: This is an awful way of filtering out the decorations notifications - // However, pending proper support, this is the most effecitve approach - // Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages - // Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting) - // This also requires considering our settings strategy, which is work which needs doing - // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests - Server.client._tracer = { - log: (messageOrDataObject: string | any, data?: string) => { - if (typeof messageOrDataObject === 'string') { - if ( - messageOrDataObject.includes( - 'rust-analyzer/publishDecorations', - ) || - messageOrDataObject.includes( - 'rust-analyzer/decorationsRequest', - ) - ) { - // Don't log publish decorations requests - } else { - // @ts-ignore This is just a utility function - Server.client.logTrace(messageOrDataObject, data); - } - } else { - // @ts-ignore - Server.client.logObjectTrace(messageOrDataObject); - } - }, - }; - Server.client.registerProposedFeatures(); - Server.client.start(); - } -} diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index a4f9068b..887191d9 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -10,7 +10,10 @@ export interface SourceChange { } export async function applySourceChange(ctx: Ctx, change: SourceChange) { - const wsEdit = ctx.client.protocol2CodeConverter.asWorkspaceEdit( + const client = ctx.client; + if (!client) return + + const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( change.workspaceEdit, ); let created; @@ -32,10 +35,10 @@ export async function applySourceChange(ctx: Ctx, change: SourceChange) { const doc = await vscode.workspace.openTextDocument(toOpenUri); await vscode.window.showTextDocument(doc); } else if (toReveal) { - const uri = ctx.client.protocol2CodeConverter.asUri( + const uri = client.protocol2CodeConverter.asUri( toReveal.textDocument.uri, ); - const position = ctx.client.protocol2CodeConverter.asPosition( + const position = client.protocol2CodeConverter.asPosition( toReveal.position, ); const editor = vscode.window.activeTextEditor; diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index e3719075..1454bf8b 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -7,7 +7,9 @@ const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', ' export function activateStatusDisplay(ctx: Ctx) { const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); - ctx.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); + ctx.onDidRestart(client => { + client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); + }) } class StatusDisplay implements vscode.Disposable { From b56fdc4386bb8eefc71abf9a50ed86d75ee19c86 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:38:22 +0100 Subject: [PATCH 305/819] Work around synchrnonisation issue --- rust-analyzer/editors/code/src/main.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 22450060..51dedd5e 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,6 +11,17 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); + // Note: we try to start the server before we register various commands, so + // that it registers its `onDidChangeDocument` handler before us. + // + // This a horribly, horribly wrong way to deal with this problem. + try { + await ctx.restartServer(); + } catch (e) { + vscode.window.showErrorMessage(e.message); + } + + // Commands which invokes manually via command pallet, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); @@ -33,12 +44,6 @@ export async function activate(context: vscode.ExtensionContext) { activateStatusDisplay(ctx); activateHighlighting(ctx); activateInlayHints(ctx); - // Start the language server, finally! - try { - await ctx.restartServer(); - } catch (e) { - vscode.window.showErrorMessage(e.message); - } } export async function deactivate() { From 55fa428f70171aac0f99aaefa7430a238e0869c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:50:32 +0100 Subject: [PATCH 306/819] Fix NPEs --- .../editors/code/src/commands/matching_brace.ts | 12 ++++++------ rust-analyzer/editors/code/src/commands/on_enter.ts | 6 ++++-- .../editors/code/src/commands/parent_module.ts | 11 ++++++----- rust-analyzer/editors/code/src/commands/runnables.ts | 7 ++++--- .../editors/code/src/commands/syntax_tree.ts | 9 ++++----- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 59c253f8..7c58bb7e 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -6,21 +6,21 @@ import { Ctx, Cmd } from '../ctx'; export function matchingBrace(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) { - return; - } + const client = ctx.client; + if (!editor || !client) return; + const request: FindMatchingBraceParams = { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map(s => - ctx.client.code2ProtocolConverter.asPosition(s.active), + client.code2ProtocolConverter.asPosition(s.active), ), }; - const response = await ctx.client.sendRequest( + const response = await client.sendRequest( 'rust-analyzer/findMatchingBrace', request, ); editor.selections = editor.selections.map((sel, idx) => { - const active = ctx.client.protocol2CodeConverter.asPosition( + const active = client.protocol2CodeConverter.asPosition( response[idx], ); const anchor = sel.isEmpty ? active : sel.anchor; diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 8324060e..6f61883c 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -6,15 +6,17 @@ import { Cmd, Ctx } from '../ctx'; export function onEnter(ctx: Ctx): Cmd { return async (event: { text: string }) => { const editor = ctx.activeRustEditor; + const client = ctx.client; if (!editor || event.text !== '\n') return false; + if (!client) return false; const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, - position: ctx.client.code2ProtocolConverter.asPosition( + position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), }; - const change = await ctx.client.sendRequest( + const change = await client.sendRequest( 'rust-analyzer/onEnter', request, ); diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index 258b61b2..bf40b402 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -6,23 +6,24 @@ import { Ctx, Cmd } from '../ctx'; export function parentModule(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) return; + const client = ctx.client; + if (!editor || !client) return; const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, - position: ctx.client.code2ProtocolConverter.asPosition( + position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), }; - const response = await ctx.client.sendRequest( + const response = await client.sendRequest( 'rust-analyzer/parentModule', request, ); const loc = response[0]; if (loc == null) return; - const uri = ctx.client.protocol2CodeConverter.asUri(loc.uri); - const range = ctx.client.protocol2CodeConverter.asRange(loc.range); + const uri = client.protocol2CodeConverter.asUri(loc.uri); + const range = client.protocol2CodeConverter.asRange(loc.range); const doc = await vscode.workspace.openTextDocument(uri); const e = await vscode.window.showTextDocument(doc); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 8cd86c21..7919997c 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -8,18 +8,19 @@ export function run(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) return; + const client = ctx.client; + if (!editor || !client) return; const textDocument: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; const params: RunnablesParams = { textDocument, - position: ctx.client.code2ProtocolConverter.asPosition( + position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), }; - const runnables = await ctx.client.sendRequest( + const runnables = await client.sendRequest( 'rust-analyzer/runnables', params, ); diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 5b8f6e4d..2ee80f91 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -76,7 +76,8 @@ class TextDocumentContentProvider provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - if (editor == null) return ''; + const client = this.ctx.client + if (!editor || !client) return ''; let range: lc.Range | undefined; @@ -84,16 +85,14 @@ class TextDocumentContentProvider if (uri.query === 'range=true') { range = editor.selection.isEmpty ? undefined - : this.ctx.client.code2ProtocolConverter.asRange( - editor.selection, - ); + : client.code2ProtocolConverter.asRange(editor.selection); } const request: SyntaxTreeParams = { textDocument: { uri: editor.document.uri.toString() }, range, }; - return this.ctx.client.sendRequest( + return client.sendRequest( 'rust-analyzer/syntaxTree', request, ); From 0cf2ef0beddaa02ffd2972dd0766fe8c712f99f5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:55:34 +0100 Subject: [PATCH 307/819] Add semicolons --- rust-analyzer/editors/code/package-lock.json | 113 ++++++++++++++++++ rust-analyzer/editors/code/package.json | 3 +- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/color_theme.ts | 28 ++--- .../code/src/commands/analyzer_status.ts | 2 +- .../editors/code/src/commands/expand_macro.ts | 2 +- .../editors/code/src/commands/index.ts | 4 +- .../editors/code/src/commands/syntax_tree.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 14 +-- .../editors/code/src/highlighting.ts | 12 +- rust-analyzer/editors/code/src/inlay_hints.ts | 4 +- .../editors/code/src/source_change.ts | 2 +- .../editors/code/src/status_display.ts | 2 +- rust-analyzer/editors/code/tslint.json | 8 ++ 14 files changed, 160 insertions(+), 38 deletions(-) create mode 100644 rust-analyzer/editors/code/tslint.json diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index a7e32e28..adb01760 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -4,6 +4,26 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, "@rollup/plugin-commonjs": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz", @@ -240,6 +260,12 @@ "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", "dev": true }, + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", + "dev": true + }, "dom-serializer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", @@ -307,12 +333,24 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, "estree-walker": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -401,6 +439,22 @@ } } }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", @@ -474,6 +528,21 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -683,6 +752,50 @@ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tunnel": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 429d63f7..7d809a2d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -19,7 +19,7 @@ "vscode:prepublish": "rollup -c", "package": "vsce package", "watch": "tsc -watch -p ./", - "fmt": "tsfmt -r" + "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -35,6 +35,7 @@ "@types/vscode": "^1.41.0", "rollup": "^1.27.14", "tslib": "^1.10.0", + "tslint": "^5.20.1", "typescript": "^3.7.3", "typescript-formatter": "^7.2.2", "vsce": "^1.71.0" diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 94948b10..743384bd 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -79,7 +79,7 @@ export function createClient(config: Config): lc.LanguageClient { } }, }; - res.registerProposedFeatures() + res.registerProposedFeatures(); return res; } function expandPathResolving(path: string) { diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index 1df7eba7..cbad47f3 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -32,29 +32,29 @@ export class ColorTheme { ? [rule.scope] : rule.scope; for (const scope of scopes) { - res.rules.set(scope, rule.settings) + res.rules.set(scope, rule.settings); } } - return res + return res; } lookup(scopes: string[]): TextMateRuleSettings { - let res: TextMateRuleSettings = {} + let res: TextMateRuleSettings = {}; for (const scope of scopes) { this.rules.forEach((value, key) => { if (scope.startsWith(key)) { - res = mergeRuleSettings(res, value) + res = mergeRuleSettings(res, value); } - }) + }); } - return res + return res; } mergeFrom(other: ColorTheme) { other.rules.forEach((value, key) => { - const merged = mergeRuleSettings(this.rules.get(key), value) - this.rules.set(key, merged) - }) + const merged = mergeRuleSettings(this.rules.get(key), value); + this.rules.set(key, merged); + }); } } @@ -73,15 +73,15 @@ function loadThemeNamed(themeName: string): ColorTheme { return ext.packageJSON.contributes.themes .filter((it: any) => (it.id || it.label) === themeName) .map((it: any) => path.join(ext.extensionPath, it.path)); - }) + }); const res = new ColorTheme(); for (const themePath of themePaths) { - res.mergeFrom(loadThemeFile(themePath)) + res.mergeFrom(loadThemeFile(themePath)); } const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])) + res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); return res; } @@ -89,7 +89,7 @@ function loadThemeNamed(themeName: string): ColorTheme { function loadThemeFile(themePath: string): ColorTheme { let text; try { - text = fs.readFileSync(themePath, 'utf8') + text = fs.readFileSync(themePath, 'utf8'); } catch { return new ColorTheme(); } @@ -119,5 +119,5 @@ function mergeRuleSettings( foreground: override.foreground ?? defaultSetting?.foreground, background: override.background ?? defaultSetting?.background, fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, - } + }; } diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index cf37dc6f..cfe7d1af 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -49,7 +49,7 @@ class TextDocumentContentProvider _uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; return client.sendRequest( diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 472f43b8..dcdde78a 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -52,7 +52,7 @@ class TextDocumentContentProvider async provideTextDocumentContent(_uri: vscode.Uri): Promise { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; const position = editor.selection.active; diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 4431fdcf..9a1697dc 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -36,14 +36,14 @@ function showReferences(ctx: Ctx): Cmd { function applySourceChange(ctx: Ctx): Cmd { return async (change: sourceChange.SourceChange) => { sourceChange.applySourceChange(ctx, change); - } + }; } function reload(ctx: Ctx): Cmd { return async () => { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await ctx.restartServer(); - } + }; } export { diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 2ee80f91..02ea9f16 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -76,7 +76,7 @@ class TextDocumentContentProvider provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; let range: lc.Range | undefined; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 13988056..a2a4e42a 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { createClient } from './client' +import { createClient } from './client'; export class Ctx { readonly config: Config; @@ -10,28 +10,28 @@ export class Ctx { // deal with it. // // Ideally, this should be replaced with async getter though. - client: lc.LanguageClient | null = null + client: lc.LanguageClient | null = null; private extCtx: vscode.ExtensionContext; private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; constructor(extCtx: vscode.ExtensionContext) { - this.config = new Config(extCtx) + this.config = new Config(extCtx); this.extCtx = extCtx; } async restartServer() { let old = this.client; if (old) { - await old.stop() + await old.stop(); } this.client = null; const client = createClient(this.config); this.pushCleanup(client.start()); await client.onReady(); - this.client = client + this.client = client; for (const hook of this.onDidRestartHooks) { - hook(client) + hook(client); } } @@ -80,7 +80,7 @@ export class Ctx { } onDidRestart(hook: (client: lc.LanguageClient) => void) { - this.onDidRestartHooks.push(hook) + this.onDidRestartHooks.push(hook); } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index f9d2e9d9..014e96f7 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -30,7 +30,7 @@ export function activateHighlighting(ctx: Ctx) { highlighter.setHighlights(targetEditor, params.decorations); }, ); - }) + }); vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), @@ -173,13 +173,13 @@ class Highlighter { function initDecorations(): Map { const theme = ColorTheme.load(); - const res = new Map() + const res = new Map(); TAG_TO_SCOPES.forEach((scopes, tag) => { - if (!scopes) throw `unmapped tag: ${tag}` - let rule = theme.lookup(scopes) + if (!scopes) throw `unmapped tag: ${tag}`; + let rule = theme.lookup(scopes); const decor = createDecorationFromTextmate(rule); - res.set(tag, decor) - }) + res.set(tag, decor); + }); return res; } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index e74d6996..6dd767d7 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -19,7 +19,7 @@ export function activateInlayHints(ctx: Ctx) { hintsUpdater.setEnabled(ctx.config.displayInlayHints); }, ctx.subscriptions); - ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)) + ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } interface InlayHintsParams { @@ -96,7 +96,7 @@ class HintsUpdater { private async queryHints(documentUri: string): Promise { let client = this.ctx.client; - if (!client) return null + if (!client) return null; const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index 887191d9..a336269b 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -11,7 +11,7 @@ export interface SourceChange { export async function applySourceChange(ctx: Ctx, change: SourceChange) { const client = ctx.client; - if (!client) return + if (!client) return; const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( change.workspaceEdit, diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 1454bf8b..08cdc8bd 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -9,7 +9,7 @@ export function activateStatusDisplay(ctx: Ctx) { ctx.pushCleanup(statusDisplay); ctx.onDidRestart(client => { client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); - }) + }); } class StatusDisplay implements vscode.Disposable { diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json new file mode 100644 index 00000000..318e02b4 --- /dev/null +++ b/rust-analyzer/editors/code/tslint.json @@ -0,0 +1,8 @@ +{ + "rules": { + "semicolon": [ + true, + "always" + ] + } +} From 8d92749e4c5220acdf685596750611698f6d236d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 20:54:31 +0100 Subject: [PATCH 308/819] Sanity check for missing server binary --- rust-analyzer/editors/code/src/client.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 743384bd..1ff64a93 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -1,5 +1,6 @@ import { homedir } from 'os'; import * as lc from 'vscode-languageclient'; +import { spawnSync } from 'child_process'; import { window, workspace } from 'vscode'; import { Config } from './config'; @@ -13,6 +14,9 @@ export function createClient(config: Config): lc.LanguageClient { } const command = expandPathResolving(config.raLspServerPath); + if (spawnSync(command, ["--version"]).status !== 0) { + window.showErrorMessage(`Unable to execute '${command} --version'`); + } const run: lc.Executable = { command, options: { cwd: folder }, From 90d51fcdccf921c48fabb244a5c66402000c059a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 21:13:30 +0100 Subject: [PATCH 309/819] Fixes to progress display --- rust-analyzer/editors/code/src/main.ts | 21 +++++++++---------- .../editors/code/src/status_display.ts | 8 ++----- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 51dedd5e..430ad31b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,17 +11,6 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); - // Note: we try to start the server before we register various commands, so - // that it registers its `onDidChangeDocument` handler before us. - // - // This a horribly, horribly wrong way to deal with this problem. - try { - await ctx.restartServer(); - } catch (e) { - vscode.window.showErrorMessage(e.message); - } - - // Commands which invokes manually via command pallet, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); @@ -42,7 +31,17 @@ export async function activate(context: vscode.ExtensionContext) { ctx.overrideCommand('type', commands.onEnter); } activateStatusDisplay(ctx); + activateHighlighting(ctx); + // Note: we try to start the server before we activate type hints so that it + // registers its `onDidChangeDocument` handler before us. + // + // This a horribly, horribly wrong way to deal with this problem. + try { + await ctx.restartServer(); + } catch (e) { + vscode.window.showErrorMessage(e.message); + } activateInlayHints(ctx); } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 08cdc8bd..371a2f3b 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -36,13 +36,9 @@ class StatusDisplay implements vscode.Disposable { this.timer || setInterval(() => { if (this.packageName) { - this.statusBarItem!.text = `cargo ${this.command} [${ - this.packageName - }] ${this.frame()}`; + this.statusBarItem!.text = `${this.frame()} cargo ${this.command} [${this.packageName}]`; } else { - this.statusBarItem!.text = `cargo ${ - this.command - } ${this.frame()}`; + this.statusBarItem!.text = `${this.frame()} cargo ${this.command}`; } }, 300); From e9377f5d12d3581f746fee2413101b8a87f965f1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jan 2020 17:04:37 +0100 Subject: [PATCH 310/819] Allow disabling inlay hints --- rust-analyzer/editors/code/src/inlay_hints.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 6dd767d7..078d18f0 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -41,10 +41,11 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ class HintsUpdater { private pending: Map = new Map(); private ctx: Ctx; - private enabled = true; + private enabled: boolean; constructor(ctx: Ctx) { this.ctx = ctx; + this.enabled = ctx.config.displayInlayHints; } async setEnabled(enabled: boolean) { From 03c68f69a8ad13479813ae8713856f1303f3e242 Mon Sep 17 00:00:00 2001 From: Marco Groppo Date: Sat, 11 Jan 2020 13:30:02 +0100 Subject: [PATCH 311/819] Fix lruCapacity config setting type --- rust-analyzer/editors/code/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7d809a2d..e7fc314f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -217,7 +217,10 @@ "description": "Trace requests to the ra_lsp_server" }, "rust-analyzer.lruCapacity": { - "type": "number", + "type": [ + "number", + "null" + ], "default": null, "description": "Number of syntax trees rust-analyzer keeps in memory" }, From 69eca5bdefb2ea4fd016d44ac4be2d370b6f4b0f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 8 Jan 2020 17:21:18 +0100 Subject: [PATCH 312/819] Rename VS Code extension to rust-analyzer --- rust-analyzer/editors/code/.vscodeignore | 1 + rust-analyzer/editors/code/icon.png | Bin 0 -> 17918 bytes rust-analyzer/editors/code/package-lock.json | 4 ++-- rust-analyzer/editors/code/package.json | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 rust-analyzer/editors/code/icon.png diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index 9bcd28e6..3d1156d3 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -2,3 +2,4 @@ !out/main.js !package.json !package-lock.json +!icon.png diff --git a/rust-analyzer/editors/code/icon.png b/rust-analyzer/editors/code/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..992aee4bd56544c29484dfe35875eb2af612ac03 GIT binary patch literal 17918 zcmcGVWm{ZLkcM#vhXBFdgS%^RcL?t8?(P~axH|+58r<8w$m^pK% zyQ})CI#qW^D#}YB!Q;Y%fq@}ONs20ifq~Qg_XmOi-gzLxAq4{y8;}weR`tj_%ZAm& zkiZ*i)~RuDfjTRzvo45aW>zw$%L_7?6P24=D(F#7!j3&|>NlXP8`=;Ps~fb4VHfXV zSP~oU>ACN0+k`xnK#gl#?^thxJbZk5>fV?fA6tKSH{0+$BtRBMMFj)9B8aF#0t3r& z3jl$G5kZQAz@D&)MZmg;z|bJT1Yjai!LFEvLcjvz!AYUOd=ODdz_yJ4A202@ZUhG# zO_P5!S5iV>02tF4JX;WD9BA{3luv=e0~?RicBZ%uKci{>DNBIu8~*u0Gmq*=K!a^P4`J z+a)^NEfq+ZMx)WA+HM!Vl(C1@@o5m!!hw38r%Hq2t1nju6YjU_yr`{d%+;A`P=y+} z1*DhA*Sf=v#VUQh{et5ozx%gKY7N)Vxaf=O-$^=r;ZE5o7he?!^#2>YA;mz3X_sOZ z{1%*02%XVVbKminN^Vn~^yAUj`ye76g}0dSM=h4Agc?*8OiX_^+{LoWE)$-=M2prm z>9AKBpCpxJ~D_Kvb2A2R8pBZfR~(>@O&s|Ry}{*Z=6lvyD&if<#D-XCO#HCpr~ z#^I7HFjx4*B2Bd>*)_-7$lPqK?qSd4`gW%zbY>HzR3B+4OBZ`b?zT?)`Rmm$H@?~r z>{yT3DCZ=zqycCFpygf<>h*ghWM<789T(qByLDv^Bfl@_QK~w+JN0S>E(>h8tzEi{ z#v^aADhEk67+WMlA-{!|Y)W=v*Eh{LFcq>5{5@()@XkC@T=6s#?Xeau*=79Q9D~hf zY<2^6$-ni+hCe3QWBs=t^4;(^(&los*#9aWO#IJp^c{k8tdI_7hq7MyDuS)00sBR# zR%CTn$iD~HYEiS>0?X%ho;aI&r|q|Bt0z}a=tZV1bI`h@FocPCQJ%##_p=Ti0>OYB z>@-BJZoN(SZliYe%Z{ixZKvEmyR}s3m-&W~l3ffRy!L}C5kFm61hEvx35s}PvD4{dZIZo6s^8bcor(4WVGdb7{D#*5T4Rl+He{F1SBeEsIch5C_@s6+!HFh` zH+N>?j^HW_KAum%WvB698qPeCybzp9Ed-o49;ggavs-mIirw$OhOFy3hSvU=NASy2 z9r16}?Xp>F>$t%j3;k2P=`Su7xSzdkm*{R3>M54A@y}N4NAcRUhW`yT|>f6SBk-4Z&`nWl9h({8AzQU-PRi`exFVE zgKF;w^S}HRRH}*~PE%yrsIfItzo;WT90gjPc=Xy7Xu+wcG0G8w_tc)Qj#I^d^=B(7 zNv9|Mf{^2%ZZ)fbX~6XY_3O4Yx}^Pl2ZoK0<>>Ue{nxq9nhKjGSFx+JKjq${>)S)N zl@Cr|gY{QyfBmz9`2A*Y1{0EH;r>}T>^OnI^B#glP6KFQR$-^jRaGPV0hk9r80NFV z(-0mJOU5;-zLh4FZ0!?Y_7DUxFa@o^#?)8dxr~k6h9lr*Gxcy*+HEZ-sH0F@KL{bB` zkNkh;qC!xE;}=zflfI!`b(_I?Z+!1HyKlt&kkQ49%lPEBumTqysp*JW!vP{X88 z94C{AOb{C;kw~M*#nO54%<&$Qcj=GmcDnx|fY18jso3n7PJie%z|O|S_LREWiiG>e zy5O>mmy|90>HGb2|H+~uvc!{C``v{5x=$3>Lz%gE#cLQCc|!cV5RXxNG#((#9uCcR z?=0RI?jYk%FP5rDV<*$rB|I^iJr`YlojU^=>Qh$jRAMZ1beKOyEVBPZVwXgz7P#7y zUZxP_c7~kGg}q*vq!K7!{uZ&!?LsJ;x2?KUZOGL{6TJ_ z_s3ZpqyvOuvxb|#3d8|I8pn`+8LzGn!N*T9*Vo&s@1!oNt`Lfq<$byK1YbzHCjBG> z{=PpiP@pX=Z^P%=`FFZXhPb-7K$NZicY)!$uQEipLxY=;aU_IdbU>@?!)=ue>F+-Z z(n9GF34d>Ot3=kH`+zHuRhk9YfCU5Hg}A2j@R8gN)v|vdl<$kXe`pW4uz>24gVkF- zd^+dN7bdYoAPxHaR_ilL!o5g*=C&F;_UrfUuW^4H?nM&p1Ho0X4?B2V+@8+ZyXzV- zy9s;2;|0b_zijmNfXxeTzc%@|hbeB~?{I&l?&re~k|a8eD7#m?Aq=PEqoJlcG~X$D z%^LOEOh)+3C;04Jeez#gIm<}7Tn60y7xIZBr`@PZ9ZcF+i-NNvsP)?FFA{*8%A2r3 z32RE#o&14g&yImB!|TSE?+(|Gd_{4~+O_YVb>M{AB@{7KwpxvL9rX8Pv8E@`L zkj_=T%l)wtC?>VA;Og?Fl3DQlO&rhO2Id!1>rK?IY1!cyS-U)(8U)?z70#Hr=6K@! zW+5MO>Z%%TFbc6N%u~t(X+={~_-dIn9!#xh4CrZgg_3ub;XmLlXh@+Rh9vii4dH`+O3b zJSTxjA~siQHtB?Hp$=|Z*vT{R(cff3475N7_;$DIew~ngQ=&`twgkw(V4t8m{k=`! z-UXp=rYW1Qs!o~ zCmFtjOy zgg5C?0a?plSjs@p_~1dr0F_mthPd66)-(?O0#z+C{!wKG+k&=fw*Na(G>l;riF)Al zqXGx)3I+s`uQw_-{0sDa&Rh4t7d=(+_GYax^u{qdoNyYIJAnn*_CtnyRM9VdJvG!! ze4^9_e$yr>ECf#9bKQEP4x5?mf)kW5vRp|7W&k&m*WAwW)l?&-R*3o{wO{WY3=FT^ zCy>jpmQ&k=(@mA-h#n;N!xjR};H%PQU<6-xCVf4v2pgaBlaqpaCKy=Sz-uSsg1eGr zqD1{V6j(P#(4;Pqf^@7=pOWr19}ip4WSpymfr(#9sdg9U7^amKmt0s zVZVq+it%t19v0%6PXgABP9D7ZAO+!J&j#nrwFABpEeHl?5g=)@BLL|;+u)v&fQS#l zG6eR9a~;rAD|D1p(m^glE<|!Nv&d@;4wf8fC>1nSK-a+u(X`&S-`E5OW`!Dp(v_?C zCI7geXu&$QefBGu5G0Vj5&ufcnGewrl|)@p>+&ij0SjPQ$kdSY|J+V0`5|>DsyY7f z+HC7?zkFfB`!NK6gKZBDtbiu*9*0e@EykGTQphUPuhm*+T-@zgH-0PT4lyJM;9$9d5foWvFIg~hEwLF+cx(r3HlvX-X6=|6q~yQ90^#QN zdA6yI`yu?17*P`WN)^}?El9>dn2z#7+2gRBl+1P!jYzGCQWjsi*kdvR2UDaKo(Z6t zrGP`+1C{Ki(PVR?Q=?ur1RDY=7YixWC}}^t)odhL4ksemoR`CRTHWle6*bkr+QUN; zt_#mTS3F+fsJD9*P`1*(Mu70;DiOlw-bm&BNz)u`^jqTenIc)-M_^9-hF^WWHog1z=;Z@7G&Il3@R538(XJy4pa67(`{zHOT zEf@0nCo7GoBS}=co2+!Q0&S6(w*gzIsz!Y=*m2(#sj)EgyZu!$rT$$7(CD+M;l1l@ zW<`_*NadzXmP5nd{uv4ir-1APb`S7qhD0Q=Rt4hxYPBK>Wgqssbp{3z^f90QLCu`C zfNhUm1#{M=R%XDkBF1o%k2(Y`2V|p3+}>8`?y?IX zobZ>2`(yhTrb$Uj=y<0B`NdhmgqPFA5vLsu`y4?_nt83*>u1j`AAqemu@Q&j2v!>` zljgPNufLA&#zZ1|aI##L=d=}A93{%No3F5F7MGIt&r^hw?bIb29mrO&BX%az9!)Qj+)o8elaiH{m7e~iLsf?P zv$SNJe!z!O^C)~+TrM#-W85Y?2l+7pOstz~lgUKZc1JPtqhW9<|2u5rBN^z+S8-{r z)nu*W`HOVdi;>2qFujrY&i+F_VeMVw1l!7j8OHVi(k z47{4V93bIwG}xW<33?eAZ2fgT<(iZS{Xy$5I(w4~#Z`~J<1`@Dzuvduh?6xQyvAhO zmto^eOsKGe#`&h(RA*yAlcKC?vUqw=ez{gKSKq9aUvHRHk8p=A;PZ5~sPFEIVHS=| zP~o14%mk6)Rmt>jd4jT!E^xqMH7Y(a9)X%5i8*`tLhfCsp!rfZcm4hTXgWi&T$O@? zg518-xc&h92b?4+@zJg}v~(qb@XvHs^S>SbXG?Vq6)#MsTlE{`4Y41fW=jM>`86xD zn3u1Na<>~T`c!Q{#=Cf&7e2c@Jv~jF58qxdyD+qwl{hE(D{to|q!Ce}I$lmHk#N}@ zy!{uebq9m)c+B-z6WGsf98k_8)uQVOH!mO^O6ENZAObH99kG#yU?7ZyPTPd5g<=?q0UT zi5ybPVVsKlX=Uu9` z4?k2>!Xk;Y{yNF1x?L zmtOa8!^?edZ*LC2caDH>hMqR!h0Tg)SviXl`SIesRb#VVt02w(nhK2w?1~z~yrA#7 z)D8taDf!t0Q1OzLc$~HSjhxrO^8>rz(dX^y`u*kpbvIsc{Gh&?g_rlW?XuH);Wv&g z^bKlS4?V(s;dr$k1$)X;vwiMqPg5}6SD)5Kknf84ggtv)*qR6r4D66}=f|*1FDI4R z6AF)aY~?M^KGVD+b!uNSR1FT@V@0cH96t9KEUd$(Ghho2vnd%g;xWHjZg`fhwm=|7 z=QZakJm}8SJ&)WSg5x61F{9d_@4)RdH)S5Xu$wC{gSqaCCyh*C->kJd!y^BDnT7-X z9c$oiUdWe!?{V6uiw!CgwcyLDUTsJeKUXayh*QQHl0kVjU@#8s#mW}@g^7ttuh+gL zMiV{2; zyrSM3^gUa^_ho-9HM?^!ZC@F_(feucF$Ac=jY3THF00D4qLT2@>gYMS5Pf#vn2LQ+J70l~S8+7X#V%y*F*#Yk12l908(z zpR*b>Eslt^t1f?#bMj_NO7=&0mYQ7|0RqN88|JmR1Wc`l|0b~%wzIJkD98xvVz$5w z`47jUn?uKBqHE6H1bfu<-J;=vtdqhy?x<`ea@5YBn~8(oD+y-d@rC6TTEg`gy#z1% zUZ)(Jej_B(e&*TDqJNeG*^-JT=dAbSbfT6W+KjacKkG0>V6#m{%xHfjD__VOwWX{; zKZn8}>XV&LShr+MUSyVrmym7*EjgG`g;({z(aa#a2LtknLHwmYtFyB;ZEBFLT-~^9 z_XNLsl*@nDhI6Du{yIjB4c(>J8h+&FAORw*a}%E7?{80XJS(*P;XFm0-FbCN0qm?A zP0Zh_VoQ=@X!FFqus@Yi9#lzIq>2+$^XZLDxGCsrD)R7HusFWKS0 zLw*kcRSKh$hbK*nMPOpG*eYcgC&_x$>b^5Lp`GJuMLi$e8s`|^x&Wir!?(^>Q!dM* z;KZz4awOdh(VtyL7`F-4`^h)4(yE=#G%Xu?~8*TxRB@q79Eft`}&1hdgRFv^zU zZYd>rMtp9L4#VNxVwl0;F;VIp5`5SSYu+a<@xLBdWmDv+SdlroH0hx0QTQuV&ulRNe4fPrnutp@fA!#q^N`3} zyCWJ1O$Iv3>0#I>o*^v?Od}Jqejl$5B4&6I3*LfL3Z%V}=ESs${zgy@mFk`*7t-FO z+#};ObL*7gBnQ<9}PRB`V1M%;Y(zZ|vf^X>EhHlkENLeth z!;S6CIpLzmyz=UmuvvMb!}1t$Lt<*MhJWhX2n$U^LjJ01wzjDrq=f%EXc{4lj38Mx z&4WdPi#ypM6<^LMf=-o6YV2ti6Wx6uVi5yE+FpE8qp(WhO@Zt?^W?QeA2_VG z$GIO&3D2>CvLr+EQ5SqF27BqGW;E!De1$n99Gp2>_m)`V!c9k4%RS4UtPvMywVLvu zLwDk;ozSxloDM^OM11guX#)!_6tmzDOp-FDSI!fhl^)-mW3lR;@WGYpT$O@KD#Waz zA^&*$QC9UtQ25>nPCJDobz+aW$NCBDh{s0aS?Y}Dl*wj3m-8uPNG;vpYF>6tuEi?8 zcXY=6w_eIP8B|3j3en;^8oG2_EKGWb<>1so8h-RReoC5b3I>L8HyZ}mE$ooe2?jMCj^z9NI6c<>1ksZYu~W-Yfc4H3Ii;+Vyf0d|Qp=>cW_i|6dEXtlD+Fp^2V6XPUKrkhAsM&vDgb2GoDrbbBn{C8 zOiPmH>0B0j`wBynj1=$wYy=JTq1zc_@&hBRC?;D-0~v8lJf>7@ctSr~()6F9F&{VB z40Qj#zxPx|N=_n#5{}Q&dB}qNuw<8eY=4%>pQIyU!12>T5}N#47o-S#B;b7HKM`cO ziN6IHIs_@MMjEl|nGC3XT^r~Z5RXvS3jOw#mZucaZtb>lTD^)GdxO~q^jr_F6S9n= zwN!;wqvl;vye8-b)Uxi{I1HhS0-_~b^Ky%Vd*qX~92=1s8@IpF8d7a5eJ3s}j?tQXb*ANX zI^pzMGcq*1_yJD^#d4M+thk(pfxEvJ4OG}Laz8cM_HCu#F{OY$q3g3_!nfChY%+=A zR4;@6%!G{rm_9{ooX4W5-eXTSwja!HDNblOQNyjZF=OreZO8_L5z4emR(*5(6@L`t zNv#=nqsn4Xo^5&5sZoRS@Vwp7v7xDAgOt#sc9Ve0|17nn)z!r1Q+wH?5Ku$GMQRyz zx_~mAe*7@)IS2u#;N~Wmv9xKy4Te;#&vgu`wb?1HpVl{aiP6pf@H+eB9I2 zpi_v$38JIksA%}5{Krk zHaT6?k^1rCRX?Yzs-N1*cW>X_FV?)poutYsD=+u*j zgcju4E2kJI;RrI#d6?923Hu?3j;|b1U-XBE=$(d6HBd`H0VEmB zn`%OsJ^wg|rWxe(9}hXKaIZeFik-0qcvhXRiGCMht3eI9oWK0TnvL_nWlvY;fbi-^ zlUSvRs9;`PaGa2?q83U?DjaPsZ}(|ET4Aq1AZP0aNt%jNbkB1%55VTXxZ^g2y)Gr$ee6Wtg7Wwkt8TnGIIj;N2&BqW~;>QZni(RIVaf%E(! zE5P`m3z-+@@mwNS-PBxvxjj<0b-WFF=6)ab7_y8QfARgz6{x8sOz|JK2pOck^t>l( zH_ts@SYE8FY<87)dTXTSD*PN%9RlrJk&OBZePGT&rb;A1Ic*COe%mE3sJB}iv31L$ z#w%HgRL0XY>6vf(6fY0z782VX6t1g_qO1d6h2=7%`g$uchVK6+9@G5tAIZs94)i%o z9?drl>+KEtEnDx88};x(q2_X&9B5TJxi#4I`-UqIet#V?kZ7u5qs6Ane<(@4(tyvc z%qZ;rgmbf^{?9Gr+i6oWG}&)@-W!G-(oNKoZ{IT5_)NBWBtDR_#USxG;BA(UBE5gB zPXxoBw7C;xr~(u6PA(mr`je?!9Jp6liyEi|wbP9X(Z?mcbX|Y3VliZ`@%9ZRurNfj z1r=$VOy`RV8!`m!)fN~b22x5aB3w>@#f!FEQRz-P{iHuRuOU|q6Th+^*o#QD{uc)o$NMr=OUTqjUnpk=Ak17s~uU5B&IPeJf z(9pklxsM9HebfSntuT68qAx3}e%A!das2L=PS$i>wCwVMMikzL0CGo=2Ha3x$ z!PT9Q;OxVVex~N3!f`sj_2M!_{=Q|u;q-=Dy{a3I41XL>RvwM$iK6lI^#_?XR zcWXT)CpbVu$&wm@0PWZDUO!O<Htsi}dw>dEI)`mG(8YRW)>G+LV zx*VBCZc)O#C#SfrP&-wGm5X&2LTS!-*R-a>r5LnlGrFl5tPExjUBaTRt7pEtmi#mo zqPhqsc$so?;XUwrW)*TsnD4{>gcxI8=5ytn%NIX&6DopSjx3(NbJaVI=1)`IEW&@R zuYQi_73tmj1sN=TY}xhHZrmZ3fgK?9a-K=_k?~iB=Ky)rKf3oH&35JC6B@)Gb>3HJ z6e%@(@3&Kv&0)**b|pS!@o$Fj2ar6u)IpM)xU}Bhq~l}>?GePX{-61qos+;rxk@~t zCh5ScOMQcdeG2r-gjuD!IV(=x%`AeA7i1j&!x!VPl~w;BR|`DxhobZFtM}?y!S-)j z3WnNtlmv3gJbYA%HK;{e`5I&`NpnO;lcYRJnKkGRA_siZV`#sm#}iC5WZF;p_Ydo< zqOUEPW6YX4<8d(O3Y6$}t$95|yjS23g)yvaQRE(;e}|nN>O5_-aYT>Slg%sdfj z&8e}LOmp-Fo}EYDiI`Lf>4%`kVfph+`W!G$#ZvzX9*bV`{wqDWljZx$LfLh=B6qX0 z<|&uK&fs+^=d~jAoovszG{OtT#WDW=M(lovJIBXWr_Xv__+gbJ)g#xEuBFC9-Ks*BLKleve@$JA1|@-@1$ z>H0V8sz8?+m{`6QnnH`Z3d`;H{ScBfnp&Mbtf*3X>I}ZMUvdvN8VW#j7HFy@7ovBR zb~_QZgu{mza9!OJWtq+SI_!j;7W7PLBWk{TheC|y2shh#m>@zy%cc)TK=7j*J`+ag z5q)JbjXG{ga?LTPl0AC5(8Maf`FMs6B7W{y@T6azv0L%lFR&U+e%re^ffm%PpX7Do z*P6^_z(+IZtB-eUOs>`8)8L{kzZ+uIT;VzZQ#rtr^OI>agA-<;?)CqPOmNP2nIIt8 zbyrQR?`zN}9(l?Mf`Is@f2SA{bf|~X`IbS&t~waJee}spD9!l%fIej|U8{)E`p7n3 z<95d_jQ?SCGEbjrO$`(O`WU2$7J_+z87JM(Zs)^YM28kR^V8wAkM}1d9~IC(-YTqF zl58*?;i-8s`a))(kovz(VCJb~>F)U|ZDju!DLLr<`%{#Sza675kMiVD%jEOs1Xcid_ z>Y!-Y5NcSmEnRLtL_&=5R3;h$*bvYMO60RiCm$qxjVf(d!Na8X$k*O#SZ4RFM^RX8 znP#liu%8~Bm?wh*{K?BG-en0J26H$DG}ebDfa+%2U1K0{UpjjV3ZFIKE_h+&)mNhK zxc6ujntm<@5*`n`Fu}ady3V8bZA~d=vPK*hw_iTD%p<|Z@9;ec>p`8L^I{uCy}#*7 z7fqFvq%xaFPv$E>63-bX<`afabNhy77%nivdc)B~nT-jX9e;<1|W}M~Y_yyhH3=~{{KZ_^y(2T#{y7>2FRx$_oR3qYr9O}Jx zcmOwX!oUG{4sEIIdh49mbY`+6EXM}MXqrd`+?e^TRuZ4>l#^U&TZ$sBV)&PHM~OzO z(RCgYUSXR{xl_m81NvpT%^dl2NIXAtpMUKkKV1e>^21-ZWj>}`ohnsg#IcR+f;5gX z*9)Qj`O0~XS`4`ia@!43xEe>}gjl<2ia#G|@M&w3eUW8YcYPw#I9Qd&6-|mtIMteb z2Ky&4>w4urb$jyju$cguvY%9g|e1qs}MuQFhZ|L^A%^L>+qyS|jRyk!w%~$n6 zGK|3*&E*FDt|;2CjY&vy|40ghI<?U~h-u9Mvz*p~^WkU^Ph_w%qV@?#mg zzq|dLWR^~J$;sela`B@F2L~vCiGf^F=l}$=&WHl3&%|DV-2Z}#B5hOo+Xbg2&`v(z z0UD`mURR0?&6h!;w&C#(Z&8as)kU9ftn+0!>h1akL4I*N7x25TP^8I9r1>w!)7*{PI1*ATw!I? z#RWkKL*wRaP(oa8Bpom3?j0&v5kWzF%zuUOPMxt4-LQ! zEYc*tG>K|*B+;mU8|nzeRF>C_k~B^5o>G-3>IJpvRcha6`n~>LY0*&!r>gK@SG>6{pj#hH9C1t=A}n1mL1PChgTY z#D9V>T2?Kl`$v&|Nq_55=v%m?#mgo|q+PQHk|Tg`b9IFkw(u|gCA-|rlv&(EuewMD zA(+uq0kMo}`0Ud310ZB9>9jOiJ`IORBUBj0nT_?HN+ADBS^CQtU|ddr?PTDx>ZDKQ z-Z0UPjVa#0ctHs(j#4n5%xFySt8pL&X=0H;3BMs{LkeU_H74)xaJ!9rB9`jOZk29| zpYfpm?DYYITHW%>_B#yA&|^PaKGAjNgI4io%)(T`L@QzqCiznCb8|?i4dwYAsESAK zCYFV*{$O}N4ej8FP^FY246Nl_GJphfC;2YfkQsxI*D^-B8!$$ODI;hMClHkE^A{wy z#-k|=J!yVgqSwG9cKA~$KuX)BNHSS`nPSR`E$xF+E5=LX)Vk~h9^I>)c|Dz#4XEfv zwq^Kr4z&$X?f3n|w!1C=K-0^mJ|*K7cwl14h3Fha5aDX7Suc$`vuvhhDQ z@ZGLy3b6ozDq{qxzPbnAX?=q%PQi?jmE?E$biZT!SQEVNor{3oz5OL`gZ|9+>gItPS>K!4WbBEdWQ zX5N=@DuV%B-JJ-nO~Ae&b4x*j^2Q-3$A8({7L9|}(8U!d<}TL#={)B)gCFzh%!Nv5@_tk-&+@%xVdNEsL&)5*r~BEaFgA;=si^y6x_VbG;LSzqo*X8a})i zWv^_=5c($3GD6FO2!j&kY^B|Sb42*r0k9{1owTR1E z>S>rV#lujG`2En$agl+@ryk$!@d1y?tJQ=c0mYuv%`+1&oAV`Kc=E@gb3L6On{O2h z%T*gM55x7QdU?$zetXgjF%|D;L)2}mdfKgXiu=dfNXpWI%^fvM{Gs6M(8}wLpL1IB`LhDNHADNeQ(-9JAwU)8HyYS8GSm zL(xJ$ZRS;75Q8ue$`6&|2Hb&q+K^wjtXh#HE&+v4W3x>|{G;AWD2SkS^E+0x3ZRKT z50|5hjvbsg7$nN+Et|ye53Yy{<+?fFj&8oC_D5L&r5Z3Kq{pEnaD2w+57rU^8Mm&>4p~;cQrDN}tyvF>pfEgrSlGzJ4;L(V zP$exHH!tD<+W8OyX_Jy_Y>II>CIHKQW#m49CHPmb@PX3rn~1()t4B4pDfu6%UFhsK zm?`b;+elbBhxVr=_e$A0%f8EL?x)fe!UKy(D1akCAdGvd=1p zB_D#b$#nQFC1PzJ4NZYHkIDstG$C|cf1n(z&mbGX$%~zR4u0mrt1IigEsKg{P#@h$ z15sHhkO7R;1sN9??dDX=%+-RgrBr>7j9gZHzH}GcA)GYAW^Qk5xr^ir4ePIYrEZ5g zOwBrFc2~aORa`?tL6Z?m|BW8WrSppN-3jyc+>u>e0CT$@pz{l#L|j%&1?SJFo!*-M zDTWtP(>bXc3KW5E_DyOIvPz(YlRut9OW{RPuLDT7tsfzv6QS-x$caJUU(|tv6FBK) z+#IMOMIRS0ideaMKln779Yd+uuXtUM)84p&RXm8Pcm+dC9B|`p+gnvg)3QXpkJ6CM zJ=H)^2k0~_4f-P8tj*4(yQ;dNNk(R?ITdhJ5=^G?TKhJ$V;^x2%@Oe~M(;y@%5fvG z^ULT)T4hU&5NMI@F@6fEKF_HJ)1K;52x5^@KpM_7D8l%)`Q?5?^#!VQp$}0oo8jmJ z;oRz1B7e#}I34N@FCU{%aq3aZVn=Sy?>KN#N%Y@Enq8)ihL7s;O-m$YJC&XVgudww zF{CZxRqwtD_b;ZaRe04@9TuA8j7`v-O%z?O-g>L%z9|XC7vQ2tXdweOJbnPk(6-pnc z_Qn{y@W1rRn(?aB(9`q#y*>4XqtK*8#m4&H&ue({4d(0vJnr)x^KH2?(Cuzf|6Wc< zhZ@GPI%vE1HvQ1%ewoALT2U0zTLBYQK)~yEw$|$Q8`Z?jEQi;9(ul;{#$ee+i_&{L z6wAn1mjeD8-2q<^_>mOa>VKMjfr0Wnkx&pl01dLzY(G`vIqq<|(V?O5t5%r*&{3mN zvvIvUgb5FQ3xgK&-lKckNVodV3v~S-+I4hvgRJK<$@oR-gds2@NF&ha1Mp^l;=LjQ zb$YCXi8i-$Tvjtgc}Ms8)0(bM!#)_Oa_H0U*-{1lhKQTzjZMGTbMMRNXzelRuhGT! zo1IvUdO%^o8BGM0Jaw$uZvAD=SwK=!HYbzQo|2p#0|R54diD2@KMf5HR}Kp*t)3!U zS}RZ2yS5GTX_B(CI`t-Si>2D(I^R+I0dfSmnQS2)V&A6k<9Y}jx@K)OGa^i%wta`| z+mqvBbG}IaEk54YXw$>VYyut^i|IUY-mhNLW@ct0A|gr&xBWeKO697r59g=rZSFz= zU1zn`y}#(SDdn>)O1(W+0cea-zZ0K`XzF^$5M{52=`0vUK(p0};v5$sv8*^U^*uv- z^HVoOtJJ9|C;$**dv@WW@vQN}BI8FyL|CjYFp7|}u&`|Sz1m7ovMplA z4g&VV()VFzVM#3Ku>_0*_!hhSg$~Rq9W^x_1h&Wdt2@x|{Y9#{b8V$`#v(B>Q9j$~ z!{8k-iEfu)2jGL9*f=s&(CvBMu}hYgLigzULP-C9SGZ<_D2DufEgbm+E&hI zWMB>&a+bb+1Z)% z;pF}0=B5VvRx}plzgrCD(@qr?l~VcalO*EIxw$z7f#;CKLeg*FqW)n4w24xo`1wXh z=C43P!$vKMSlmX-SxV_*t!6v9;~srg)j7a3fRQV4POAXO)qlR~HSw26l^=~tK1)(w zegQb{mfFMwV0zlWEUs_>puGc#WgCy>dcG88v_DO3HnyR-B0 z{-}Rq_U{m|4uGt7`Mz>IlQJRtf4)Bs#S`UnIg%DPO=fYk8gvKj7}ez9`yEZ^@9mj% z=qYqY$WpGhIv>syO0>D2hUxuvIo=tFe!N(B)~4g*Yp<;Znqt3y|JH7{yFZ?VH5KIK z5JsIXk&}@tZW=4`eSHA*1s)C#4jDNvI-1wxia32BCM_)u@LyCY$E|MgblHP!A?R4~ zq^vBTn>{J%V(~cqR)=j7tll)#|wNA!>ec=d9 z7*oa{5R}b7<_f!m81fQM)VWrhGQkA}1;Co-^18<{KXtvWR zm2{_EUt(jTqDF^@^LTnB<>a!tohiN1w*a0l5E53e(lRNHHO_%Z9bqKYSr-syiGUG;fN@Nd`GLzm%tK?VC9cS zVbX4RU-CS=Rd)a7Jqwx+*GA1B+q}ul#-OxY_`i5 z+9L0m-e{7^&%e89lB9OtT4qne%X0WlDt{HcLXC zp#KQF#N_0n+2dg>wCDjmPP?<2!thxQi8y>IR|r5cu(7b*w|k*)#Do_o_33*lBm<2u6G9d`$bp4v*c&28iQew3V1ZVc4Ikp z{3V@Q`RM7Z0B=sN(CzSIKSw>u7@nLg;n5UPx=Ypfb38A$*l2$S*u<0hLWeZ`FvH8P zPl0*xE^R8DSFa}4} zoYr=wVHuzfX9Ipxy|`nCbpf7`k<-ZTc>J#z5WoF>X6J&mU0q)11H@uwYCtaVkU%EEf?1f9l7fkaC1J^*+PD4oa#{l|t_-iZM=hvmN_)3IMl-}V;_4)t{s31mzO1$>USMVMl7k6hRHcz=z0bfU@@!X!vG z018{7%lRBv%u-%nPADH>IVV(j>b6?P1tfGKhwML(|5~5%ugTX{?2d@k_La((GZu43 zx(b;^sSzlA4YIr|j+3J6;1Xt0`F%2dH1sWRCiP!hzxtL@lp6Zo3p4B;#5YNKBVD9z z9WFd;kt%f*e6FjSt`AcEkd5DoIlRp*)!DJ^2|xfhhG++jfJP=hokr>Tg=uSLSreVj z%;nB3g>9`>t!!lZ2*Qh%$Lo*u&4muV$XM>mdYf3jqn~ezqj+N*lE5fi(#E%?jc_#Yuk+3J%WoeOQi( zLA+r`jjQVJ>FJSIp}JVAGagT4X6x1a5mjk7QxGbWFR7qF)ulgU!vW;8Z9v4D*F}I5 z_Ich@e@UBPC5uNgCz$yu7V=!H&#A2B7D zkGE%FYmw;hISMC|h7e2UE8bmhegeX}ClL=NjL+jTT&Jr1{F1?LO{tJ0Yw2yLsksCM z7vK!S_fC)+E~nkw+wD|oX=#!_nMnISBx)qh!TNL9q`I`R2S>=urhgD&c>3 zgjW1x4N&c=EN+!LicdgkfOI+e4Z}ykf4)Kum{Y^=64$SxT2+L69#_w|hcqd;>{fGG z+|GXQ_ZqmfML^~m5dn$lx$XevN+tB3Rf-M7SJwWQf~Jr^MEOov?ehlMe#Un z^8S)*<7B}0{*QD43R-EhZL?kFkgh|E`3W3B`T0}mf0k)0(Du-+S1Rz9 zJ)dJhQIXNr2P$qB1rH8bzu)7WX&az4k)zegt69O_p;i6#&Mh-dv&F71Jze$n6>uST z;HO}NNh{|4Tj|sHW@5dbgI^8Vq&WqN}N!(MsQj?OD zyk|}Xwij0X+9dfL*nx6x=Sx*K7V1A9y|2cy`Si{&!0ydcV2|bI4M8bU(W%p>9XnC9 zZuxWJBnh+BQzFOA+rGWKTMZ1EdvnyTwnVM<^YcryF}`%AXvW&fa*>gdCr_R{ljbJW z=>lr3*H})M1J;CdO)`bvD%;Kp0@gZPwwNrNRxD|ua%H31v4m5%fIF#xx$XCPL$#>2 zWhW*mhS+{GeRx9ItnN>RTUK%lurb}z!m>&;JKITbdj8E#OM$KEo-4;VfDH!V%JH-; zca6u-D-Fwn^n)M2FTYor{_f7se-qB{F;bhH`QyXGdFgINZ|*ISa(TuIOga-LOn6Y4 zwggB4(*UsFIZJW3#A9Gl)w4tmn62&tn~F_MO%j{97tQ%|oweso0Wgq&9k}QDTqP`P z^6u=ocvzBeuYuot0b$|E6DM9=zaT$YF+H^X*XAdv-5NV`;>G2(oLi^zy7YVi`Ni2^|UBWH<4N9 z_|~Yk2NM>UTomVO73w@9&*xgyeKpHesyC!xe!ADvq>VS^Wis;&XZo}ioe*~vaEapc zHY`8W4Lr3Z;L!WDc!mR)*=T(p33&&i{LyD%`2T<5RYCQc3j$h!=ejU>y85}Sb4q9e E0LAdZ<^TWy literal 0 HcmV?d00001 diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index adb01760..3059323a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { - "name": "ra-lsp", - "version": "0.0.1", + "name": "rust-analyzer", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e7fc314f..7c22d21d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -1,10 +1,11 @@ { - "name": "ra-lsp", - "displayName": "ra-lsp", + "name": "rust-analyzer", + "displayName": "rust-analyzer", "description": "An alternative rust language server to the RLS", "preview": true, "private": true, - "version": "0.0.1", + "icon": "icon.png", + "version": "0.1.0", "publisher": "matklad", "repository": { "url": "https://github.com/matklad/rust-analyzer/" From 458824d5df7e363f4ec4dde6b9bf71236efc8cf2 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 13 Jan 2020 16:49:44 -0500 Subject: [PATCH 313/819] vscode-languageclient 6.0.0-next.10 --- rust-analyzer/editors/code/package-lock.json | 30 ++++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 3059323a..746dd4bc 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -889,32 +889,32 @@ } }, "vscode-jsonrpc": { - "version": "5.0.0-next.5", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.5.tgz", - "integrity": "sha512-k9akfglxWgr0dtLNscq2uBq48XJwnhf4EaDxn05KQowRwR0DkNML0zeYqFRLtXZe6x5vpL5ppyu4o6GqL+23YQ==" + "version": "5.0.0-next.7", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.7.tgz", + "integrity": "sha512-DZuEyxaWuA0srFh9kKu2fudVG6d5CJhte3OW2ILM8lZqpHjI+/D2byrowFd0YmEbyQB2nh0yqg0sa1mhxOtivA==" }, "vscode-languageclient": { - "version": "6.0.0-next.9", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.9.tgz", - "integrity": "sha512-NEpeeFM9FKrrRqlBHXGfwpkhtnjruDz3zfFBP+Cymr10qigAEtE/JsODJsIG/ErGqjh3/JXxu8SUOVTGu5oK+w==", + "version": "6.0.0-next.10", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.10.tgz", + "integrity": "sha512-xJ9KNJnHfGIMz7ewuXijtUTje1Tc2fpuyYS/DHZI/MBwYRLp7L38KnivvYJmUICdPnrQTSvPSWKbjlwWhMlKwQ==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.0-next.14" + "vscode-languageserver-protocol": "^3.15.0-next.15" } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.14", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.14.tgz", - "integrity": "sha512-xUwwno6Q6RFd2Z2EWV9D3dQlsKPnHyiZMNWq+EC7JJdp2WH1gRlD+KPX4UGRCnJK0WI5omqHV313IESPwRY5xA==", + "version": "3.15.0-next.15", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.15.tgz", + "integrity": "sha512-c1f47pxAtUE+gYTGLoySVA+nBUbPtz8NMOLOB69RiTBQobSJBO1XXKB8TXz8BSxpG5T8qRXeEm2vXrM/eepYKg==", "requires": { - "vscode-jsonrpc": "^5.0.0-next.5", - "vscode-languageserver-types": "^3.15.0-next.9" + "vscode-jsonrpc": "^5.0.0-next.7", + "vscode-languageserver-types": "^3.15.0-next.10" } }, "vscode-languageserver-types": { - "version": "3.15.0-next.9", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.9.tgz", - "integrity": "sha512-Rl/8qJ6932nrHCdPn+9y0x08uLVQaSLRG+U4JzhyKpWU4eJbVaDRoAcz1Llj7CErJGbPr6kdBvShPy5fRfR+Uw==" + "version": "3.15.0-next.10", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.10.tgz", + "integrity": "sha512-s9Psd+0sQVkH4o1U7hwTNJRuXQQgFvGVZIim7Wb44tcq54rZou3kJKCtdFEm0aHUuYxIrMPYrzuh1jlqCbRegw==" }, "wrappy": { "version": "1.0.2", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7c22d21d..fe294886 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.0.0-next.9" + "vscode-languageclient": "^6.0.0-next.10" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.0", From 0dea2bdbcb821142f48a3d83129465cad8b7ac2c Mon Sep 17 00:00:00 2001 From: imtsuki Date: Wed, 15 Jan 2020 01:02:01 +0800 Subject: [PATCH 314/819] Add inlay parameter name hints for function calls Signed-off-by: imtsuki --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 51 +++++++++++++++---- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7c22d21d..ed637d11 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -228,7 +228,7 @@ "rust-analyzer.displayInlayHints": { "type": "boolean", "default": true, - "description": "Display additional type information in the editor" + "description": "Display additional type and parameter information in the editor" }, "rust-analyzer.maxInlayHintLength": { "type": "number", diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 078d18f0..c4206cf5 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -38,6 +38,12 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ }, }); +const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ + before: { + color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + } +}) + class HintsUpdater { private pending: Map = new Map(); private ctx: Ctx; @@ -55,7 +61,10 @@ class HintsUpdater { if (this.enabled) { await this.refresh(); } else { - this.allEditors.forEach(it => this.setDecorations(it, [])); + this.allEditors.forEach(it => { + this.setTypeDecorations(it, []); + this.setParameterDecorations(it, []); + }); } } @@ -68,15 +77,27 @@ class HintsUpdater { private async refreshEditor(editor: vscode.TextEditor): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints == null) return; - const newDecorations = newHints.map(hint => ({ - range: hint.range, - renderOptions: { - after: { - contentText: `: ${hint.label}`, + const newTypeDecorations = newHints.filter(hint => hint.kind === 'TypeHint') + .map(hint => ({ + range: hint.range, + renderOptions: { + after: { + contentText: `: ${hint.label}`, + }, }, - }, - })); - this.setDecorations(editor, newDecorations); + })); + this.setTypeDecorations(editor, newTypeDecorations); + + const newParameterDecorations = newHints.filter(hint => hint.kind === 'ParameterHint') + .map(hint => ({ + range: hint.range, + renderOptions: { + before: { + contentText: `${hint.label}: `, + }, + }, + })); + this.setParameterDecorations(editor, newParameterDecorations); } private get allEditors(): vscode.TextEditor[] { @@ -85,7 +106,7 @@ class HintsUpdater { ); } - private setDecorations( + private setTypeDecorations( editor: vscode.TextEditor, decorations: vscode.DecorationOptions[], ) { @@ -95,6 +116,16 @@ class HintsUpdater { ); } + private setParameterDecorations( + editor: vscode.TextEditor, + decorations: vscode.DecorationOptions[], + ) { + editor.setDecorations( + parameterHintDecorationType, + this.enabled ? decorations : [], + ); + } + private async queryHints(documentUri: string): Promise { let client = this.ctx.client; if (!client) return null; From 0f3b384b124dd6a66e00b791f4dea30fd6928924 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 14 Jan 2020 14:53:38 -0500 Subject: [PATCH 315/819] Language Server Protocol 3.15 is now stable Update the client --- rust-analyzer/editors/code/package-lock.json | 30 ++++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 746dd4bc..05c57c7f 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -889,32 +889,32 @@ } }, "vscode-jsonrpc": { - "version": "5.0.0-next.7", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0-next.7.tgz", - "integrity": "sha512-DZuEyxaWuA0srFh9kKu2fudVG6d5CJhte3OW2ILM8lZqpHjI+/D2byrowFd0YmEbyQB2nh0yqg0sa1mhxOtivA==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0.tgz", + "integrity": "sha512-QeAniC/xTWauVQgyNgEqNJ0Qm/Jw8QySGRQhRFPwb8c4FPp9k6QNgJp0ayXWws5qhdaHkiXkGPlzjOPZFQQKLw==" }, "vscode-languageclient": { - "version": "6.0.0-next.10", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0-next.10.tgz", - "integrity": "sha512-xJ9KNJnHfGIMz7ewuXijtUTje1Tc2fpuyYS/DHZI/MBwYRLp7L38KnivvYJmUICdPnrQTSvPSWKbjlwWhMlKwQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0.tgz", + "integrity": "sha512-6MDksAP79GRbcHFsXS6ndo12s0m/h7eNdS/IanRgWxaezqB4a4KzHIHrE0bE+nSFB+snaSToGs1bxnPeKdO5fQ==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.0-next.15" + "vscode-languageserver-protocol": "^3.15.0" } }, "vscode-languageserver-protocol": { - "version": "3.15.0-next.15", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0-next.15.tgz", - "integrity": "sha512-c1f47pxAtUE+gYTGLoySVA+nBUbPtz8NMOLOB69RiTBQobSJBO1XXKB8TXz8BSxpG5T8qRXeEm2vXrM/eepYKg==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0.tgz", + "integrity": "sha512-PZEopQzHR3Lo422HeDxCpGN0sYz+kReO+du3F/AcFT1cCPunoVsDJv7ikEolFRKEn+hEIZiAaIX4yoSZ+ip5Nw==", "requires": { - "vscode-jsonrpc": "^5.0.0-next.7", - "vscode-languageserver-types": "^3.15.0-next.10" + "vscode-jsonrpc": "^5.0.0", + "vscode-languageserver-types": "3.15.0" } }, "vscode-languageserver-types": { - "version": "3.15.0-next.10", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.10.tgz", - "integrity": "sha512-s9Psd+0sQVkH4o1U7hwTNJRuXQQgFvGVZIim7Wb44tcq54rZou3kJKCtdFEm0aHUuYxIrMPYrzuh1jlqCbRegw==" + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0.tgz", + "integrity": "sha512-AXteNagMhBWnZ6gNN0UB4HTiD/7TajgfHl6jaM6O7qz3zDJw0H3Jf83w05phihnBRCML+K6Ockh8f8bL0OObPw==" }, "wrappy": { "version": "1.0.2", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fe294886..77d31a04 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.0.0-next.10" + "vscode-languageclient": "^6.0.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.0", From 63e3cc3bb8dcf10cf9636c0486be2a6a2663a075 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Tue, 14 Jan 2020 20:52:48 -0500 Subject: [PATCH 316/819] Display vscode message after changing cargo-watch options --- rust-analyzer/editors/code/src/config.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index ec2790b6..c6d5fc4a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -42,6 +42,7 @@ export class Config { private prevEnhancedTyping: null | boolean = null; private prevCargoFeatures: null | CargoFeatures = null; + private prevCargoWatchOptions: null | CargoWatchOptions = null; constructor(ctx: vscode.ExtensionContext) { vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions); @@ -173,6 +174,24 @@ export class Config { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; + + if ( + this.prevCargoWatchOptions !== null && + (this.cargoWatchOptions.enable !== + this.prevCargoWatchOptions.enable || + this.cargoWatchOptions.command !== + this.prevCargoWatchOptions.command || + this.cargoWatchOptions.allTargets !== + this.prevCargoWatchOptions.allTargets || + this.cargoWatchOptions.arguments.length !== + this.prevCargoWatchOptions.arguments.length || + this.cargoWatchOptions.arguments.some( + (v, i) => v !== this.prevCargoWatchOptions!.arguments[i], + )) + ) { + requireReloadMessage = 'Changing cargo-watch options requires a reload'; + } + this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; if (requireReloadMessage !== null) { const reloadAction = 'Reload now'; From b207a00280e101238b6e8a26d2d572d38e1a2412 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Tue, 14 Jan 2020 22:52:49 -0500 Subject: [PATCH 317/819] Improve readability --- rust-analyzer/editors/code/src/config.ts | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c6d5fc4a..fc21c881 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -174,22 +174,19 @@ export class Config { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; - - if ( - this.prevCargoWatchOptions !== null && - (this.cargoWatchOptions.enable !== - this.prevCargoWatchOptions.enable || - this.cargoWatchOptions.command !== - this.prevCargoWatchOptions.command || - this.cargoWatchOptions.allTargets !== - this.prevCargoWatchOptions.allTargets || - this.cargoWatchOptions.arguments.length !== - this.prevCargoWatchOptions.arguments.length || + + if (this.prevCargoWatchOptions !== null) { + const changed = + this.cargoWatchOptions.enable !== this.prevCargoWatchOptions.enable || + this.cargoWatchOptions.command !== this.prevCargoWatchOptions.command || + this.cargoWatchOptions.allTargets !== this.prevCargoWatchOptions.allTargets || + this.cargoWatchOptions.arguments.length !== this.prevCargoWatchOptions.arguments.length || this.cargoWatchOptions.arguments.some( (v, i) => v !== this.prevCargoWatchOptions!.arguments[i], - )) - ) { - requireReloadMessage = 'Changing cargo-watch options requires a reload'; + ); + if (changed) { + requireReloadMessage = 'Changing cargo-watch options requires a reload'; + } } this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; From f3bef948e7e144ea6fa9c01bf969d952620581f5 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 15 Jan 2020 11:47:56 +0100 Subject: [PATCH 318/819] Use types from vscode-langaugeclient --- rust-analyzer/editors/code/rollup.config.js | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- .../editors/code/src/status_display.ts | 36 ++++--------------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 14fb9e08..de6a3b2b 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -13,7 +13,7 @@ export default { commonjs({ namedExports: { // squelch missing import warnings - 'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes'] + 'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes', 'WorkDoneProgress', 'WorkDoneProgressBegin', 'WorkDoneProgressReport', 'WorkDoneProgressEnd'] } }) ], diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index c4206cf5..6357e44f 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -42,7 +42,7 @@ const parameterHintDecorationType = vscode.window.createTextEditorDecorationType before: { color: new vscode.ThemeColor('rust_analyzer.inlayHint'), } -}) +}); class HintsUpdater { private pending: Map = new Map(); diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 371a2f3b..c75fddf9 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -1,5 +1,7 @@ import * as vscode from 'vscode'; +import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd } from 'vscode-languageclient'; + import { Ctx } from './ctx'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; @@ -8,7 +10,7 @@ export function activateStatusDisplay(ctx: Ctx) { const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); ctx.onDidRestart(client => { - client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); + client.onProgress(WorkDoneProgress.type, 'rustAnalyzer/cargoWatcher', params => statusDisplay.handleProgressNotification(params)); }); } @@ -63,20 +65,15 @@ class StatusDisplay implements vscode.Disposable { this.statusBarItem.dispose(); } - handleProgressNotification(params: ProgressParams) { - const { token, value } = params; - if (token !== 'rustAnalyzer/cargoWatcher') { - return; - } - - switch (value.kind) { + handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) { + switch (params.kind) { case 'begin': this.show(); break; case 'report': - if (value.message) { - this.packageName = value.message; + if (params.message) { + this.packageName = params.message; } break; @@ -90,22 +87,3 @@ class StatusDisplay implements vscode.Disposable { return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; } } - -// FIXME: Replace this once vscode-languageclient is updated to LSP 3.15 -interface ProgressParams { - token: string; - value: WorkDoneProgress; -} - -enum WorkDoneProgressKind { - Begin = 'begin', - Report = 'report', - End = 'end', -} - -interface WorkDoneProgress { - kind: WorkDoneProgressKind; - message?: string; - cancelable?: boolean; - percentage?: string; -} From 81f0ce07ce96a7b001cad1fdfedfdfc9ea82fd46 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 15 Jan 2020 16:07:39 +0100 Subject: [PATCH 319/819] Extension icon --- rust-analyzer/editors/code/icon.png | Bin 17918 -> 15341 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/rust-analyzer/editors/code/icon.png b/rust-analyzer/editors/code/icon.png index 992aee4bd56544c29484dfe35875eb2af612ac03..072090c6f4a1fbebc0a2e1ba20d991d5a75d513a 100644 GIT binary patch literal 15341 zcmdVAWlUXP^fq{rqQ$j1rFe07cPLU^Tio5kkrr2hK%g~Wz6j9Z3JWY+1O$R+ z<*BOatn%57%-+$?)WX_?%-O@+8qCk)ezImV@I{p7W2C8LbAkp>XD6zNy@Rbx;qk;`|E?SOCBtK~e<`lJebqWF zU#7p(*`z*m8uJJqgTC>+BKLhVF+G#wCSmf_Qoltn+PjPu(v7L=?r(YX%7a*Ib(H4n z)X0`}({0pp@33!Qk}ldlaW7Xt$#JYv8PTjY2B)1~DD}d#gKupFO=w`zuw=jWTnbI} zx1#jt5R4D=*WBI4;WG8A(QiL)w#^zQGG0(oEVyy2=p8!rNK#RyM(8HZH3jq8Hk{#? zvz#L>(*`8RZC$S&Z-sO``d;Tcl@BA@dqv?~V3sizeon1fTb2;*^5|t>yMeprzKJnN znwN&VKyfk(=swuON$ZYT4Cfk~Fzc%r5W1tBzVwD7H#{6R7JUcPuC$s1Yan5X@Vh!L z``0ifl`<>(&!L|w1^M{M0~Urx7xF0A`UB^UuUlik%15ZGOl^^A(e9}JX^=!jNjCbx zv-i!)wrNkzc7@6nFrW!mh6Z+Y^qivv%@%qEhoybTTB;!_X zI2!Znj9Xk4%%O~(VYe{GK%HS$9Y^&ak#WCjgSN5sovtaI40cB_R)j{?%!Ei={81jiOh!l#tx3GCFMe~cnJFNbo}Q*$otpxWP~fX4wA#tZSDT- zSMl3n`Ly%ncZI|A!*%z~$qj^3_<8l^7VIiHB6=FH?i4GOlSXUb z;b*Gn%v(|Ly_RBiUH?4UK%0$wgv7(=3Y)c`%EF`9lC_ga;$I-!7!yYGk)K+b5L;P? zk^xD}#X^?Dauj<|JDrgahWWyX+nqLpRq^7g{5U0sRI4HU2fmuDZN1n~ML`ZVyC|tc zQuCIk$gf`I0|E}dzhNQA?v{*r?7`P?vS-`Ge0u%&idtghM(oeIjLBpTgSxb&3)7b7 zR`OCe-?G{*(TZs6s_N`go!@^XEh@!d8gWv^VzT<}SwZ9)QICsiv;y16FvyEu6oF6x+iWO*FClI+wFTF3PZEK@&^FDzyE zZ6{ij`>2~tTYybG%`X3=paN!hMIGJWFF0Rz^UmazAvb^cS(9UX8l41+VmpnymsK7% z|MPfL@?T})R^A`Bao zbkLt$!mGIUYg*-~6xQVQNt;Z^5qUDw=R+{_9h7?B3)qGiYt4kZyk|D{!J5GFTu7M7 zQ8c_vk1qJ|r!=!Iq9_3>w&(dt*zR@s7o^`29 z=i4_((oLVx*Tbe$*5TBDa3*MA+-#?-tv`LfZB>u)q9w)pP4h1s`A>oO`H+C!;2xQI zda)u8ukh?tsj#WiKhcp3?6btmb)7c{waBhgtjpeG{)+Z#B)`YjqgkJoo|vdzhktNl z1TlUz2(C7*Dx*M-G=<_0SGQu3k|a!*6E(DIps7MeH245)}!3hy@vb_Am4!IRA+y?u5M0VIDzR_tNoj zTCA9j8DV{uVjoI>RS2e%b7MTedEM9-#)%E>^D1Bhp=jKf>=R99hZKv2i2oucfm+PK zSW|_DCCb8i&Ol3)v872y)L;^ZI*}8el|5Ctav>r)CV_U-5qwo{otbSW7Mfk|_dum? z#&X+Xcj47|zQ#-uTkCNVy?_IsF2W>d0^;g$2_vWjeXTE4!9=8_+%5lZB2QPxXquu< z#ot|_yr;PP3~z55DWOkEw)6={A>i-Mo8E!ecAnp9D)WWJb{h&pOh}`!GktSV9T@{d z;>+o&_-t9YGs0%b+uY?7dB((Yi5Y~xN*SDMaBUw8By2bfk@Zki2^$mX{GyWF{_t^* zQd{pjvHHVWuOX&k1(bGg=X>!fe~Q%2K6o0(ZA>$!K?-Mz(4e)boD>@ zyRG=R%BXl<%}p#x+)EFq!?tX;5$4~I=IC7D#x1W@qznl9AnEU}dioIK#C3F}C;ib+ zKe8)0^h2%PNq%aG>O@1V6c`|26GdH$|4ty>M8uJgn}?)`zoj0pv8s-qQp0OG;r}M~ zN=Z3Hm0w}V(|vK;BkQ|kuL`}V@9!wzwclOlzIA77=y{ti-yboEDlkN_lo2^|3V5>; z1_SO9+?;TnVV|kF0*l{Si4p{Vf;b^m{B?S>z!`QP(#aHa?8fDNeG`GF_DAcrU<-?o zH3z16_TSFQt1B#_-2lGIM8Wi+9k;x~KH+Eb-mf1*DC0UFI1a>iIK_|7F`_lP31t%( zd#_?U=o2xDkFN%iB0nYbs#Gt9!v6DWmJt@z2=qNQ_%aDM@@mg`!}QyqB`;_Wz69Q? zb8}UzKQ^*KSc^OD_yJhtyl`J48^3P;xgGt93HkR)sAL&_rG@&$X`@@SN^D1r;Kb{Y zp{i=MKdO0o>uQcVdu-u&swn=!GJM7-Wy4Gk*#Pa*=-YAiBHG0RZ9+#({=GhpAF0f> z2hGRgc9gGWPZp^u4o07SM8*s{nGDfLs1O=Tds&0 z-_n}MJeGIwzTq$oVYdlN5TAy8E(_eRaW+bO(tN9aFqV83McJIp@iaxr3oA(XuD_I8 z1HXp+wbDtqc-MY^JF3j2L(j7lW+FhXLTUQmJkfNEgoux3mghf9 zbGk1cJpzUEnaHeO;giQFFFP{h-jhS9Or{$+ya-JRqo`mWf?GK9kaL-?HPRIgQl&pB z#a}r0>))8J=8i>tg((pen{Bvm9J3Y0sEe-m#+DbUO&ledxYZan+{HU4M9s!Am^V+Dl5|TR^vyUYY!z8Hs>Tq!pV^*9`r+14j)i;=+E%U;a;-Q9~Su)viFboV%2# z(4BJkw#gv*SP+e}QA zV0|p($eW%)W$FcI1tMM2h_|i*cd;bQP0|8~K6cbHx{d9=#roD=@7hIcVNgBc3)QG> zvA-pkah-*~qi@Ebd1Op^<#+wvW-c}^-S4By9UO`ZTee{3wjHZMUB~^$8vlb2)5jIW z)q|2JB$0P&bu#NSJqV7#@hlM3Kdk8uV&x%;@1D6&9Eey4PbZ6 z+tT$wj9vDjJLAa1+;fZxk%;uW^N2cwKNQ6dXOt5}xP;o^wKnaOBx4OxH^Yr>%=<0G z3I}U+y*E<|xK&O{=a}OAyz|61)<`|!pE6%7rQh}xBI(K`xU=6LA&oU`+s~GHUm6`E zrPTFs;H68t{muTw?5y-%X+u$Zvh`CNCv4HtsE16c(_12(^q*BzN*5Jo>@Mk)iqHYE zoui4tPJhj_P2h5-_ANNY-@luBZOS@}EE3RXJ=BfqyXo^QVO0-z96e-U#J$Lt61_U7KR~?UTK?1-jB?^0>9w2-ad`&_k{KbFS=4)!=0v z^xE9o7|!6{aW_h~>R#7R(O%|3UPMOzV3T!Cmcq86gS5p;l2f}c>b;j+ojAL=s+_;< zD3r14s}!D*c)kRD+K-Ryn=LkkMfPX)gP3}L(bC5yREfAQ+W*Rb##kX~r!%hd2JyFa zF=HCcl05nl!u+nXCqt_XjLwovHqHXYtY{(T67+)^ho-R><@W&*?@lkRZrXWsRn}`G zJoK;}44(NSm~ITixB_Oq0w?dOc>Pw`Zt|lhVvn!iPNiw%z2emO=Y^L1>!M!E%vj|4 z4b?}9(&IT14$yD*)pKZ?eMf%O|BCk~xd+2LEE#`swA&j>j#qB^$|nao$E40Chju9L^U3B5p9EcLxv+1yC0kgmA?uGQ6tXy*7W#ekNLbdeYPJfIu}Ng~Y58u=!jJeW zB6;kmy$0uvcE=yzJ|mO3p+&dr6hBqNUwpDy`ufraJ+pu3f}ZH??r{YWIFq*S_WYq6DJ?T)Gv$r1LdP(`~&(ya`IAJ6++ zCw}`+|2DXKE_UPV^(1BT-uNqE9r$CG?>@m$x3;*mEmj{vAW*>;Vq!`%Vq*V`b_24V z;S(ny-K~TjqWH1yZ6c~Gx6}%~}|IpId-_bHg2U`95mEBVs z6j4)&S{X=o1GBmPC;!h|%GG3S?ceU*6r_7APVOgy!seupUErdg5W(LP>rJqK_Pz=ON{NbbAb=+6BGZ zd)r*E_bwAnDyIk}F(WhsVKI;_Y4V^69qtbDHKnI~yZVH-?2=6STAOXJ(g@y))gS{{s z2!W76WW+^O-4~Bm+`O?(HgC={D=b?6`q0Xd<-j4d(FHpC7tdD*&`1cV3ZoNxu4;Wy z{P&OBJ>dJg2aR;~clN((SozWjIq%+)w^=VW?mJDz02!RVC!O-G98&f{cU|O)BJjbNYGBw#%CH`eaQ=KtOA_(sT z6uKyFg+a&D&DoZTi3vG5xud&eWl4!c%gXb^o=}veQG{)AY3cs@ub_k33Y`{L8zZAU z)%%vu-Jv>mZHa!$5bQoh!S^5a^aLC>#Sz&~y^dQ>+9&d)8peZkDrOH44-@G%7#aHk32y)F&h+-kw6m zkO~R99WMhRbkuQFOH?s1Fy3=PM86sgjf^nR(3}p4HLV=alxf5e@i_jSEMQ&!7(eja z5r!=I21Sr3e$2Lk$)Noq%j>wLygXq;(Dm;mB|CdU9h@-28DabVF<--yPZW;#^W$}q zLORuw4-to@s=Yn46^cLlCRc`#Uwd=&U1>*KWu@)zaO#-geR;+;3j;$GIy9KyCNVKl zdp{W#78czg zLJ0Zqlf_z#k4{b(I6e{G8=5~p1-zvzRw>EN&DAskUfN+blE!g)d71otnM+ft(_s7b za2r0~(%9H|dTOu!20Y(`jf122glD%@fAqH~TYa$d@1^HxCddd5h-PD1ZNpW=LqlG- zJIOm9?dx`|=_4W{BJWv%SaRDV8}_>ALv(a>SsuHoLGWmF=5ws9tj@f|a<75bhQ3d? zdvf~D(>sn8dM&P7y-|aUb@et&=W)tFuH+vMTfJ;%qq+}Pu1AZPzp)f)Z09hsu(S+b zZn|#%4vToOv9YNbW+J`t!oL4BJz1 zucwESlF~s=A8hhDtHoq~wNc;I;Q|{KRj)a_B|Cu#`mm{!j7*pvS3+!TY)XnW0?1DN zJ%1+hvVHIV{tAMB-cJafpPx^f*Y)=1cY6!WO^zH-t(e99xobQ}3vg>08J91yNGTSN`g~a(S}fQd66(7k&o7zz=SW@YoI@`%{S4*1N6wT!#|c z#twXH#3F}8BTRUzeEjHkIPdUyIX7g?@3!KC2Xq5Q)E?tIX{E@1NtLT@USEQPe=tJ0 z--=sl)>+OpI&2wpCn~#*FK!yd+y;8^)1U9ov z-czfHlB6Jg^GX!>MdiT}!gMDt*z!h~yx0 zlD;J-x(qQiAOw;vVVD{l+f%;$&Sq{o)1|JF}Sm_s)VwU%m0@r{?u!Doc z@;5x7hg_EB^kQIcCB z$as}IVvM;oAi&4P&|D7Z<9eWl5jMOUR$SA6eL8(4u&M)FPb%o$ICp>}akg(Dpj75z zh5oWq(^fQJGjQ(QbP!6mcqed>fisdEUH+$=t&9wKNHDWKJ&7 zFbo8}OBj?I4*PZCT_^~`Xa6)_7dkgDc!((e_hHkE(~a&_cwkg0%i$Cj3k!??9)NIo z-`I~H!Mu!NWn;U)Jm}*GpzO8M^_ribq2b#LfYg|UQAqex#v-7>bzJ}^?}Gok|Nj`wof0#Agy?c8V-ur(=`k#+s%ls|ii(QDjp(tgLkdJEARxfS z#RX{>`~lDk2F7P*{Ao+yOIQT*bvyz>Ld8tpI)H4{%G8Mky>Gr5WM^dwI&A(vsOk`; zpa5ws4H1m|F3p+Fz{F&Cvf7r;W%qQ}M@mmm&vZd}adBbbzVRw=Vjh5-I0`A$H>~+m zF(g#+VYIKnQ}}zMnL5CaBbeIV8T#Uuz@T=Y7TE&N^8spVg|z7!Ger^f6dhsFRwF1~ zZ4r@Qfv=D!CnqZl0z1y1?oZ52OkTnhSUZ=7bpYVo?fxA{oB1CbB}G|j0$#3i{7)d! zbA9d#2FQnli;HdPWlWE04TEl@{lm?ff#0LckPW4f&~uF6!xq~ZKR_@e88D#l5&_W0 z8#dG744xVn&Ib3h&A(Gc*@8Z4sqhHoWNiSORoC%~f*v3_>@cSQOmTSBu;$vbQjRQ) z5TO1oKAz3*$@?~PFN$k*{>NvS188*7?;M&Hvkj}B2j^A9i@Yx}w$b%U9iA*$IAW>8 z?>UXbYMZmPx3?FR2v2?zTm*0fxwN=gv(>$tzwc^NjwzGZC7c5qfqXoW({{Ph^+?+z zx*|V+drDDgr*s(@QagOc@^L#}ahtyjWX{+rBq*Rn!o$NuCZF4&M=$_7K<&-%=w!kE zCjePX=q@<{&;~rO91qxuw5+5=tIf0Sp|8pN_Wb8h(1`&9V{mYAY*w1pFvJ905AhFP zp^K7EnX_ZsW|o-^i1_-ptAu)99csM{ZAZ(QJ4m!VP*YR$eh_h_{*a+Gs3a#Vd+5q1 z2Zt_dP+C=GXKo&Ac>op!V;&G>`?t=xGd~nW*4Nk18dm?X^dGZ$G*y(9lRI*4>Dy8+ zW72a|#y)br2T(xh{*Vo^uhn*?d87M_l%%Boy_iSaDlir(Zui?0(7{uGYZt6#-`MEs z=_x2Eh>AiZ!=rbtjZaUryX;R#5pvO4&4ZY^Jc4 z8nFKDfLtCBuf^@el&3^zkT6cLuGmPSUtrrHSi zwNo1R3hsF5>Vq!_PIDtKE&Wx!EZ+?t_$1>VgFSGT#`nMe`vCDkGE8B0JkCE?Dlir0Kz~0oK@=^VR&pWR- zx3^X3f(V+m zzdvdi%N8;a+-d?81R&3m8RM6j#B9?S0z2Ar+$={WRa|2_A}cR%toL#!YkPZJ=<%)|}8QL>u9zL5HA=1u$n zl?OJT9HDEz+UWXth0poV`0TQ+rRDzqOc_8jL_|cxbdccFLGwE8S(O46fC-rq1#>3M z;m}APe!-L0F1FF$T^+R;4}1gIfQ^Rc>n%LO1`aYJV%)P!yv{G+w5hP9`xAM6-zen( zjcH0+9jA!l|LJ+Tk3k`M+DNjLm>MRIHrW$XheE zU=7fFJp-T^AVUlK+1D&Q^b*=d5^^!}^JkR6fh1@Eh{nNOmEYBZ8A$a$mnl_kSBsz; z$H&K~>H`lLRMOLH0|XI}*hZ<{;*&+EaSWX!&MY8N_8&}lT` z!RQFipaRPXf3h?;Z=A0RlShY;#bSVN(f`N}(aZk*A0_|)tKB8cs$B?yREB_tk7XTi zrh3(sm5X+!Iv%$1OZzA2g_%*BKXq@Nxr@i_2|aH)^Xf4s5A8UDB2+ZBVZV6fx*LxU z?a#W2hl@)5f@mLl z4|yV|%v(BnOw_L6OqG|PP=g)I$iODW!^6TNCd7(QNr_E}MJFZ216?aj%<`$1CYWU2 zZGr1tV}$|q-^+0QsyT{q#-f^%rl!KeD^UwAWd{e5joYpZ2}(Rhc23S}Mvc;(oQ<~~ zD(Iqs9Q!3QvA=uAz)M&u+3w-VcwFJD3T~C&2DR^j=ffC-s00?<2pB=Z|*PkpuUWDm} zzwpB@dUQ-oB0{XGdWH08Vimspf;zi7PEIN+{^k6szt{~-ph$;E^hiaMEY;XOhhb5t zSE$b>qeBPBqCeR_Px3kUAFfuI#SFK%)pT`?bcXwJKmit3I>HH_|#8c z?%vhM%S?~US~~f|8>)DjimQu@B9Jrhs@iW|r;^yr#?E2_!KBQ>V#VrZSesidZU?O9 z!p~U(tRn+5zH1!@CB?@k#N#9$mU^30U}Rytpbj#}yMR z?aVc=&IZTk%3XN%fRxa|_`6KH^hAH=aWvEtdqBIZUk~^7`3h@CU@weFH|`2(8%#t;J&+)OvI;s z>*Ci9)~?7B+=-(^eqJqbqBaFmopRyeBr1&Px*tw@nq7K6&LrCrv1F8huJMDc(Z`Rj zql&}bJLYrsBZPjwCc~t*hIF9M+;P6LTjAOg&qKP(0t9 zv1~IE#`s^KQttZmWzbd?kpW8-`s~L2(+QOgEm^T_M)3CcKX|I;ZdK5@_T3zh;gRo3 z^faCnP8bl|1nn#-0fko{SiJj zxa|AX-(Ao_WoHit%l$lBtZ68$Px5F)5@2mva~C7i_W?b;Q+jH}oxPnMu;5<1*U1O@ zuhhYi@1NAmT;@Ont$XJ0Jh{#C`~*ls2{zZOj{zQY0@?Unu950xlrQ6EI5>p%vW!V8 zqj`8NZd|%wR7mODTDUo)0`9GfH1;k>I3bgWHwj83{CdWBHNzzAKvr zLts;BG@t&mU0$MWY!sH=Up4c}orNIpjpAVA;v^<(=r$^8YpL0|&1Zf{UOGB=|2^b~ zHo1ji!bCw}y=>;MGh9%+-&%WjDC+)dofVy7iv6;KI{RaR=Mu2<uWnHs|>8|W&H8Ss;B;X%9LdJX3v$GNs z5>I17py%&`D+jVUC!;3&|bq@o5O5sNSTm!2IUYfKpRk^24#Nbh?PDVmZI^aAmU z0@t>3e0raa1>DuHNw<<=slDSU$w5Q}E>YH`VM%d&_lVElek~yAwrH&1zO#oCPv7UU z3V5Xu+l5TqG(%)m6w4b0S1+8GjlDN~Oa}WH7#I{yB%rUP2^webp6Bjn%k>O&boib_ zJgD-NyFM4s?Ej0lNK||A+QY-9z?wZIY_7u-x5ID*wCu-!k?ZT95Wh@-^wS1q?)NeB`h2i98BGrIEP7!Y2pRc`TSFfQnXq7(uVG=hupnq5`O0S1?{Dsfe49+u z-vNe!x%v1k*ap_ww%R*x1E!L$yX^1(3X&Pv)Y!>rJ+J&lXGcTB#)0i?HhB;Qv#8I` z`Q@#m-xR)tgoK3NJx3t|7wgxy&{_bt%U|>~m;SLf#td}Ts#!Q(_!0vq1l_Qg*)&&6 zyh}J4zLaHQib4>aIXLQ6^xlkqVg~8O|94t?dI4|x_@{BKm;V4ZT(LDH0geDm6GO9T z{gQHpzhlDwI<{v<1JXh#KiK7gN&{h#z?P`eF#d0(Edntr^~JboqnH4s_TeL7a1VYO z4{fMl*p`jMqr(jeUIa}hL(q<*qT!x5evOQRf`W|9@g~Z$PO?HBRCf@Ags7;^BQStx;G9Ovr0-y^z{Dz{ad`RxA%ANZ&>(Ogs(j_KbVal zT*9@1P$}jJBrAqZlr2yxo3Ru@pWYvjMK6p4yU_*v>J=p=m9w911aivECA= zB?q+{ur5L@EZi#;5_bFPD2h;&H|28&Dd=De0=mrEqi?$vuGhRY2y0Ro0E9yq2G!TD z$z#}N%l3nu!iJg>7zZVe9(?cx#mBRE%Vx&K#rcn+lq6oWw*mHI5mMnHi2c z;5p#H@z}mmm$9hZqHZCBv1n-rfWBg zvn)&ivOpFH5_)Jn>HLM&L`_JT?(HfM4vX6Kld^z=lp3t90w5B*R6ICD?|QP-adb~? zHi`p|L$jsi&|wq9H6(%WXZ@&Md=sO9jKtb+Chgkd(>+Hhq<85t5Hgvx6i$W^D2#we z?(aWGQIqa1NMTg7B&74$vu99VR$Ods0V1)MTLj&ffJc-nh?c49=DtfJy}@@(#|=oT zEhFjK_gM^X=<_>|qVsH@&%VkIh!LU)P~R_??H^qL%>0H%aeu1FmgU=fZ2#k}ZxHZf+fM5t&RQ_++wtPGE-ONFuM8C8U;Gkqt zoV&&r@b-WD4(~$YZ~>O|S0!hcYjmlay9ZFWVQEAZtQIRN?%o)zgC|i9(23g1W2x)0 zpAZ|4&)h974>Vta;GP8BBQNPZb#Utp?8$!)XpUUGBQDN=J79=#*q;m#G-!( z6{?mT`~+%m7RidBgLI^tP6g&HSpQB|mrp$T*SYtHk_9z61BXPZj*^UTm<9;IaT#Cn z+$oE^yxe>Ns`l$jzWg+Juq>uilOBK`T~OxiX}^ENBEmC2G=FZ0B&6SfVgUxBZCW82 z=wmh)_A6PxBI zL4hwL26i0z^cXGr&`I&qSF4Ta?Nrf&g*qNo)T^>4kG-6o6V{$10rdO1d*%*~=eN5X zJ%&lOFH5v4d>vLZ(j`~PZlnA9dOm3>xcfz9eTZGH?iO0TU+RQlXXMwUg)2iq_yR8%BS z!@KF2WX9uVS~1%TAhfn_VR@6(BReK3RC)?uQAtiq|74cY-&(9va*s55&U~;@>Dy=i+_~4+Mo7^eiD3} zJ6QQ?bAQLwA?SG6*uBx1+dYVCQ37*!NzCV|+J|akS;vYh{UK}6&+=-ywA7OF>4BY{ zU3Xhh{e>_g#m1sP&){VboHi#%MJWgwo9#U~{}VqRKrSe7O<$q#6rZ>+D^ib=v>7J^ z{cB#6{OjSv)iN_vN0o1z$M&^0_tCFTnBLRVYb=kUk;5Y7Y>Lqot6B*?vlsaA@t^^} zR9DkTPDZ?yjD+#H`t{(T<_ z@TtMmsfj!ZiJsvgc~FV@GCu$hsVFKebRDWc0@vn`qQeL2Uaswz*|pah41^(>^W2(^ z0+t6>HeU(qT3k$gzT>(e<59-GK3qECY5|p$W;pw z2|c*Kx*)3n;)l!0zIeXT(lwvrZl)p0JLmOrw5M9WV08bkX|4Cq+Lt^RWH}&@zj)X` zz`ulu1$z0VH-{IT5(iuVagxKX3$^N>WIvsoihTauIoi3;H2ZwCa{YX1hZr5%V7+8p zr~PQbTK5nE{at)7B7C>)bnr`r5NOB-)Sp<*R{CAoA-C$=+1sDS{(@O*uv)TAcWu%I zwD`Q{cKa*3zsgQF&&4LaU%fUsbI8xG(7HdqNA_zn2plohX$A+x^!oed#f{s#0Ug9& zfhCaYy-uEX=miloTK-rs{ybXgcqdzXI|TG9HtU?^8C|xvHoAs*_f?^>wrgw$O}jsRuh-P;5+`T2_Vx^{b8MNQ73U zT2`LA9yF4DTF<#+dY5glhnp_6H%yy~#xexr(&a#nbS+n3LT2h{J|3!ia6ADthtFcr zXw7E9Gj8r3G3wqh&lpaY&{{6VEel^!dFx9iCIUTCt~KB5nYm|ev+A3PfbU!BC!8ZG zJbRAEuk5NdsRVfiK+R#`%6f!H)7ut2dD+Ze$EI1o+soy>z5BjCf(SXr*0U?Vs)yUC z@WH{MhosQZUh1s0w#$2B2FH1unw_kFWAsbF-Fzwe_D+M)6c_H=0_`?*4Ay=)-}bq! zT#sw4c^{m)SN`$J{IJ)GXQ1Eg9WplNA>{COPQ~CPS%@t|39WNY)24oJuR~i&)A_m0 zEhIFQ&U_p7i_`P3pywy+k-F9{+VIU>O48k|;q;qM9|2EiJZ~0eWo);jg}o{vX3_Nw zKbV`ggh<%qL7 z9P+svr5&8am=X8pQ|~xYznAkw#`9yUm)I4;g3a-oV?+as+h5=}t&+X)P zcS!;8Vds_=K|gON$4Qv$6+Ywf&h7l)WxlZj_g6wZR+Wx^uMt2`1BNU3dF4@GfQ@?D zXAfo0fEpoCUQ$h8x!UP^)vja7`$0S+J0m$M&G8~-VypLooR@c>uKn>bBm&!K23iyW z9N405_<^?2@#vD>O9BH$RMn`sxctGluhM4igxm9BPhF6ZoSVBCoMPtL5=}HHp3JBG z8G2xh>AP6pE(vdc!wPgECx0;bI8h(f1h6wWzXJRh9S_gSa^qg3apf57XWC-gVFm>t zHW@r#_2sRbvO=i)VxDb+EaZYUUJamqlV58GdTxZc1f>(^z9$DU&)%EW)Mnsx@+C)& zui?KA{fBDdb8mckG}R)v_o1C3cW8%^fgbp++xGk!2z5Z`jBmWl<_=gVr@Wj`W-F|c zLC;U$tp1y4=^%7WAyKsC-8BTGBT!F7&sUhI9SNZsd#zm=(;j8 z%GC`vy$|-&(soU)e0+Q)Ou#vrnwpD(i^53A8`&E7()qN#$fMOvU0ICmf_CPvZK zZDeF<8w$m^pK% zyQ})CI#qW^D#}YB!Q;Y%fq@}ONs20ifq~Qg_XmOi-gzLxAq4{y8;}weR`tj_%ZAm& zkiZ*i)~RuDfjTRzvo45aW>zw$%L_7?6P24=D(F#7!j3&|>NlXP8`=;Ps~fb4VHfXV zSP~oU>ACN0+k`xnK#gl#?^thxJbZk5>fV?fA6tKSH{0+$BtRBMMFj)9B8aF#0t3r& z3jl$G5kZQAz@D&)MZmg;z|bJT1Yjai!LFEvLcjvz!AYUOd=ODdz_yJ4A202@ZUhG# zO_P5!S5iV>02tF4JX;WD9BA{3luv=e0~?RicBZ%uKci{>DNBIu8~*u0Gmq*=K!a^P4`J z+a)^NEfq+ZMx)WA+HM!Vl(C1@@o5m!!hw38r%Hq2t1nju6YjU_yr`{d%+;A`P=y+} z1*DhA*Sf=v#VUQh{et5ozx%gKY7N)Vxaf=O-$^=r;ZE5o7he?!^#2>YA;mz3X_sOZ z{1%*02%XVVbKminN^Vn~^yAUj`ye76g}0dSM=h4Agc?*8OiX_^+{LoWE)$-=M2prm z>9AKBpCpxJ~D_Kvb2A2R8pBZfR~(>@O&s|Ry}{*Z=6lvyD&if<#D-XCO#HCpr~ z#^I7HFjx4*B2Bd>*)_-7$lPqK?qSd4`gW%zbY>HzR3B+4OBZ`b?zT?)`Rmm$H@?~r z>{yT3DCZ=zqycCFpygf<>h*ghWM<789T(qByLDv^Bfl@_QK~w+JN0S>E(>h8tzEi{ z#v^aADhEk67+WMlA-{!|Y)W=v*Eh{LFcq>5{5@()@XkC@T=6s#?Xeau*=79Q9D~hf zY<2^6$-ni+hCe3QWBs=t^4;(^(&los*#9aWO#IJp^c{k8tdI_7hq7MyDuS)00sBR# zR%CTn$iD~HYEiS>0?X%ho;aI&r|q|Bt0z}a=tZV1bI`h@FocPCQJ%##_p=Ti0>OYB z>@-BJZoN(SZliYe%Z{ixZKvEmyR}s3m-&W~l3ffRy!L}C5kFm61hEvx35s}PvD4{dZIZo6s^8bcor(4WVGdb7{D#*5T4Rl+He{F1SBeEsIch5C_@s6+!HFh` zH+N>?j^HW_KAum%WvB698qPeCybzp9Ed-o49;ggavs-mIirw$OhOFy3hSvU=NASy2 z9r16}?Xp>F>$t%j3;k2P=`Su7xSzdkm*{R3>M54A@y}N4NAcRUhW`yT|>f6SBk-4Z&`nWl9h({8AzQU-PRi`exFVE zgKF;w^S}HRRH}*~PE%yrsIfItzo;WT90gjPc=Xy7Xu+wcG0G8w_tc)Qj#I^d^=B(7 zNv9|Mf{^2%ZZ)fbX~6XY_3O4Yx}^Pl2ZoK0<>>Ue{nxq9nhKjGSFx+JKjq${>)S)N zl@Cr|gY{QyfBmz9`2A*Y1{0EH;r>}T>^OnI^B#glP6KFQR$-^jRaGPV0hk9r80NFV z(-0mJOU5;-zLh4FZ0!?Y_7DUxFa@o^#?)8dxr~k6h9lr*Gxcy*+HEZ-sH0F@KL{bB` zkNkh;qC!xE;}=zflfI!`b(_I?Z+!1HyKlt&kkQ49%lPEBumTqysp*JW!vP{X88 z94C{AOb{C;kw~M*#nO54%<&$Qcj=GmcDnx|fY18jso3n7PJie%z|O|S_LREWiiG>e zy5O>mmy|90>HGb2|H+~uvc!{C``v{5x=$3>Lz%gE#cLQCc|!cV5RXxNG#((#9uCcR z?=0RI?jYk%FP5rDV<*$rB|I^iJr`YlojU^=>Qh$jRAMZ1beKOyEVBPZVwXgz7P#7y zUZxP_c7~kGg}q*vq!K7!{uZ&!?LsJ;x2?KUZOGL{6TJ_ z_s3ZpqyvOuvxb|#3d8|I8pn`+8LzGn!N*T9*Vo&s@1!oNt`Lfq<$byK1YbzHCjBG> z{=PpiP@pX=Z^P%=`FFZXhPb-7K$NZicY)!$uQEipLxY=;aU_IdbU>@?!)=ue>F+-Z z(n9GF34d>Ot3=kH`+zHuRhk9YfCU5Hg}A2j@R8gN)v|vdl<$kXe`pW4uz>24gVkF- zd^+dN7bdYoAPxHaR_ilL!o5g*=C&F;_UrfUuW^4H?nM&p1Ho0X4?B2V+@8+ZyXzV- zy9s;2;|0b_zijmNfXxeTzc%@|hbeB~?{I&l?&re~k|a8eD7#m?Aq=PEqoJlcG~X$D z%^LOEOh)+3C;04Jeez#gIm<}7Tn60y7xIZBr`@PZ9ZcF+i-NNvsP)?FFA{*8%A2r3 z32RE#o&14g&yImB!|TSE?+(|Gd_{4~+O_YVb>M{AB@{7KwpxvL9rX8Pv8E@`L zkj_=T%l)wtC?>VA;Og?Fl3DQlO&rhO2Id!1>rK?IY1!cyS-U)(8U)?z70#Hr=6K@! zW+5MO>Z%%TFbc6N%u~t(X+={~_-dIn9!#xh4CrZgg_3ub;XmLlXh@+Rh9vii4dH`+O3b zJSTxjA~siQHtB?Hp$=|Z*vT{R(cff3475N7_;$DIew~ngQ=&`twgkw(V4t8m{k=`! z-UXp=rYW1Qs!o~ zCmFtjOy zgg5C?0a?plSjs@p_~1dr0F_mthPd66)-(?O0#z+C{!wKG+k&=fw*Na(G>l;riF)Al zqXGx)3I+s`uQw_-{0sDa&Rh4t7d=(+_GYax^u{qdoNyYIJAnn*_CtnyRM9VdJvG!! ze4^9_e$yr>ECf#9bKQEP4x5?mf)kW5vRp|7W&k&m*WAwW)l?&-R*3o{wO{WY3=FT^ zCy>jpmQ&k=(@mA-h#n;N!xjR};H%PQU<6-xCVf4v2pgaBlaqpaCKy=Sz-uSsg1eGr zqD1{V6j(P#(4;Pqf^@7=pOWr19}ip4WSpymfr(#9sdg9U7^amKmt0s zVZVq+it%t19v0%6PXgABP9D7ZAO+!J&j#nrwFABpEeHl?5g=)@BLL|;+u)v&fQS#l zG6eR9a~;rAD|D1p(m^glE<|!Nv&d@;4wf8fC>1nSK-a+u(X`&S-`E5OW`!Dp(v_?C zCI7geXu&$QefBGu5G0Vj5&ufcnGewrl|)@p>+&ij0SjPQ$kdSY|J+V0`5|>DsyY7f z+HC7?zkFfB`!NK6gKZBDtbiu*9*0e@EykGTQphUPuhm*+T-@zgH-0PT4lyJM;9$9d5foWvFIg~hEwLF+cx(r3HlvX-X6=|6q~yQ90^#QN zdA6yI`yu?17*P`WN)^}?El9>dn2z#7+2gRBl+1P!jYzGCQWjsi*kdvR2UDaKo(Z6t zrGP`+1C{Ki(PVR?Q=?ur1RDY=7YixWC}}^t)odhL4ksemoR`CRTHWle6*bkr+QUN; zt_#mTS3F+fsJD9*P`1*(Mu70;DiOlw-bm&BNz)u`^jqTenIc)-M_^9-hF^WWHog1z=;Z@7G&Il3@R538(XJy4pa67(`{zHOT zEf@0nCo7GoBS}=co2+!Q0&S6(w*gzIsz!Y=*m2(#sj)EgyZu!$rT$$7(CD+M;l1l@ zW<`_*NadzXmP5nd{uv4ir-1APb`S7qhD0Q=Rt4hxYPBK>Wgqssbp{3z^f90QLCu`C zfNhUm1#{M=R%XDkBF1o%k2(Y`2V|p3+}>8`?y?IX zobZ>2`(yhTrb$Uj=y<0B`NdhmgqPFA5vLsu`y4?_nt83*>u1j`AAqemu@Q&j2v!>` zljgPNufLA&#zZ1|aI##L=d=}A93{%No3F5F7MGIt&r^hw?bIb29mrO&BX%az9!)Qj+)o8elaiH{m7e~iLsf?P zv$SNJe!z!O^C)~+TrM#-W85Y?2l+7pOstz~lgUKZc1JPtqhW9<|2u5rBN^z+S8-{r z)nu*W`HOVdi;>2qFujrY&i+F_VeMVw1l!7j8OHVi(k z47{4V93bIwG}xW<33?eAZ2fgT<(iZS{Xy$5I(w4~#Z`~J<1`@Dzuvduh?6xQyvAhO zmto^eOsKGe#`&h(RA*yAlcKC?vUqw=ez{gKSKq9aUvHRHk8p=A;PZ5~sPFEIVHS=| zP~o14%mk6)Rmt>jd4jT!E^xqMH7Y(a9)X%5i8*`tLhfCsp!rfZcm4hTXgWi&T$O@? zg518-xc&h92b?4+@zJg}v~(qb@XvHs^S>SbXG?Vq6)#MsTlE{`4Y41fW=jM>`86xD zn3u1Na<>~T`c!Q{#=Cf&7e2c@Jv~jF58qxdyD+qwl{hE(D{to|q!Ce}I$lmHk#N}@ zy!{uebq9m)c+B-z6WGsf98k_8)uQVOH!mO^O6ENZAObH99kG#yU?7ZyPTPd5g<=?q0UT zi5ybPVVsKlX=Uu9` z4?k2>!Xk;Y{yNF1x?L zmtOa8!^?edZ*LC2caDH>hMqR!h0Tg)SviXl`SIesRb#VVt02w(nhK2w?1~z~yrA#7 z)D8taDf!t0Q1OzLc$~HSjhxrO^8>rz(dX^y`u*kpbvIsc{Gh&?g_rlW?XuH);Wv&g z^bKlS4?V(s;dr$k1$)X;vwiMqPg5}6SD)5Kknf84ggtv)*qR6r4D66}=f|*1FDI4R z6AF)aY~?M^KGVD+b!uNSR1FT@V@0cH96t9KEUd$(Ghho2vnd%g;xWHjZg`fhwm=|7 z=QZakJm}8SJ&)WSg5x61F{9d_@4)RdH)S5Xu$wC{gSqaCCyh*C->kJd!y^BDnT7-X z9c$oiUdWe!?{V6uiw!CgwcyLDUTsJeKUXayh*QQHl0kVjU@#8s#mW}@g^7ttuh+gL zMiV{2; zyrSM3^gUa^_ho-9HM?^!ZC@F_(feucF$Ac=jY3THF00D4qLT2@>gYMS5Pf#vn2LQ+J70l~S8+7X#V%y*F*#Yk12l908(z zpR*b>Eslt^t1f?#bMj_NO7=&0mYQ7|0RqN88|JmR1Wc`l|0b~%wzIJkD98xvVz$5w z`47jUn?uKBqHE6H1bfu<-J;=vtdqhy?x<`ea@5YBn~8(oD+y-d@rC6TTEg`gy#z1% zUZ)(Jej_B(e&*TDqJNeG*^-JT=dAbSbfT6W+KjacKkG0>V6#m{%xHfjD__VOwWX{; zKZn8}>XV&LShr+MUSyVrmym7*EjgG`g;({z(aa#a2LtknLHwmYtFyB;ZEBFLT-~^9 z_XNLsl*@nDhI6Du{yIjB4c(>J8h+&FAORw*a}%E7?{80XJS(*P;XFm0-FbCN0qm?A zP0Zh_VoQ=@X!FFqus@Yi9#lzIq>2+$^XZLDxGCsrD)R7HusFWKS0 zLw*kcRSKh$hbK*nMPOpG*eYcgC&_x$>b^5Lp`GJuMLi$e8s`|^x&Wir!?(^>Q!dM* z;KZz4awOdh(VtyL7`F-4`^h)4(yE=#G%Xu?~8*TxRB@q79Eft`}&1hdgRFv^zU zZYd>rMtp9L4#VNxVwl0;F;VIp5`5SSYu+a<@xLBdWmDv+SdlroH0hx0QTQuV&ulRNe4fPrnutp@fA!#q^N`3} zyCWJ1O$Iv3>0#I>o*^v?Od}Jqejl$5B4&6I3*LfL3Z%V}=ESs${zgy@mFk`*7t-FO z+#};ObL*7gBnQ<9}PRB`V1M%;Y(zZ|vf^X>EhHlkENLeth z!;S6CIpLzmyz=UmuvvMb!}1t$Lt<*MhJWhX2n$U^LjJ01wzjDrq=f%EXc{4lj38Mx z&4WdPi#ypM6<^LMf=-o6YV2ti6Wx6uVi5yE+FpE8qp(WhO@Zt?^W?QeA2_VG z$GIO&3D2>CvLr+EQ5SqF27BqGW;E!De1$n99Gp2>_m)`V!c9k4%RS4UtPvMywVLvu zLwDk;ozSxloDM^OM11guX#)!_6tmzDOp-FDSI!fhl^)-mW3lR;@WGYpT$O@KD#Waz zA^&*$QC9UtQ25>nPCJDobz+aW$NCBDh{s0aS?Y}Dl*wj3m-8uPNG;vpYF>6tuEi?8 zcXY=6w_eIP8B|3j3en;^8oG2_EKGWb<>1so8h-RReoC5b3I>L8HyZ}mE$ooe2?jMCj^z9NI6c<>1ksZYu~W-Yfc4H3Ii;+Vyf0d|Qp=>cW_i|6dEXtlD+Fp^2V6XPUKrkhAsM&vDgb2GoDrbbBn{C8 zOiPmH>0B0j`wBynj1=$wYy=JTq1zc_@&hBRC?;D-0~v8lJf>7@ctSr~()6F9F&{VB z40Qj#zxPx|N=_n#5{}Q&dB}qNuw<8eY=4%>pQIyU!12>T5}N#47o-S#B;b7HKM`cO ziN6IHIs_@MMjEl|nGC3XT^r~Z5RXvS3jOw#mZucaZtb>lTD^)GdxO~q^jr_F6S9n= zwN!;wqvl;vye8-b)Uxi{I1HhS0-_~b^Ky%Vd*qX~92=1s8@IpF8d7a5eJ3s}j?tQXb*ANX zI^pzMGcq*1_yJD^#d4M+thk(pfxEvJ4OG}Laz8cM_HCu#F{OY$q3g3_!nfChY%+=A zR4;@6%!G{rm_9{ooX4W5-eXTSwja!HDNblOQNyjZF=OreZO8_L5z4emR(*5(6@L`t zNv#=nqsn4Xo^5&5sZoRS@Vwp7v7xDAgOt#sc9Ve0|17nn)z!r1Q+wH?5Ku$GMQRyz zx_~mAe*7@)IS2u#;N~Wmv9xKy4Te;#&vgu`wb?1HpVl{aiP6pf@H+eB9I2 zpi_v$38JIksA%}5{Krk zHaT6?k^1rCRX?Yzs-N1*cW>X_FV?)poutYsD=+u*j zgcju4E2kJI;RrI#d6?923Hu?3j;|b1U-XBE=$(d6HBd`H0VEmB zn`%OsJ^wg|rWxe(9}hXKaIZeFik-0qcvhXRiGCMht3eI9oWK0TnvL_nWlvY;fbi-^ zlUSvRs9;`PaGa2?q83U?DjaPsZ}(|ET4Aq1AZP0aNt%jNbkB1%55VTXxZ^g2y)Gr$ee6Wtg7Wwkt8TnGIIj;N2&BqW~;>QZni(RIVaf%E(! zE5P`m3z-+@@mwNS-PBxvxjj<0b-WFF=6)ab7_y8QfARgz6{x8sOz|JK2pOck^t>l( zH_ts@SYE8FY<87)dTXTSD*PN%9RlrJk&OBZePGT&rb;A1Ic*COe%mE3sJB}iv31L$ z#w%HgRL0XY>6vf(6fY0z782VX6t1g_qO1d6h2=7%`g$uchVK6+9@G5tAIZs94)i%o z9?drl>+KEtEnDx88};x(q2_X&9B5TJxi#4I`-UqIet#V?kZ7u5qs6Ane<(@4(tyvc z%qZ;rgmbf^{?9Gr+i6oWG}&)@-W!G-(oNKoZ{IT5_)NBWBtDR_#USxG;BA(UBE5gB zPXxoBw7C;xr~(u6PA(mr`je?!9Jp6liyEi|wbP9X(Z?mcbX|Y3VliZ`@%9ZRurNfj z1r=$VOy`RV8!`m!)fN~b22x5aB3w>@#f!FEQRz-P{iHuRuOU|q6Th+^*o#QD{uc)o$NMr=OUTqjUnpk=Ak17s~uU5B&IPeJf z(9pklxsM9HebfSntuT68qAx3}e%A!das2L=PS$i>wCwVMMikzL0CGo=2Ha3x$ z!PT9Q;OxVVex~N3!f`sj_2M!_{=Q|u;q-=Dy{a3I41XL>RvwM$iK6lI^#_?XR zcWXT)CpbVu$&wm@0PWZDUO!O<Htsi}dw>dEI)`mG(8YRW)>G+LV zx*VBCZc)O#C#SfrP&-wGm5X&2LTS!-*R-a>r5LnlGrFl5tPExjUBaTRt7pEtmi#mo zqPhqsc$so?;XUwrW)*TsnD4{>gcxI8=5ytn%NIX&6DopSjx3(NbJaVI=1)`IEW&@R zuYQi_73tmj1sN=TY}xhHZrmZ3fgK?9a-K=_k?~iB=Ky)rKf3oH&35JC6B@)Gb>3HJ z6e%@(@3&Kv&0)**b|pS!@o$Fj2ar6u)IpM)xU}Bhq~l}>?GePX{-61qos+;rxk@~t zCh5ScOMQcdeG2r-gjuD!IV(=x%`AeA7i1j&!x!VPl~w;BR|`DxhobZFtM}?y!S-)j z3WnNtlmv3gJbYA%HK;{e`5I&`NpnO;lcYRJnKkGRA_siZV`#sm#}iC5WZF;p_Ydo< zqOUEPW6YX4<8d(O3Y6$}t$95|yjS23g)yvaQRE(;e}|nN>O5_-aYT>Slg%sdfj z&8e}LOmp-Fo}EYDiI`Lf>4%`kVfph+`W!G$#ZvzX9*bV`{wqDWljZx$LfLh=B6qX0 z<|&uK&fs+^=d~jAoovszG{OtT#WDW=M(lovJIBXWr_Xv__+gbJ)g#xEuBFC9-Ks*BLKleve@$JA1|@-@1$ z>H0V8sz8?+m{`6QnnH`Z3d`;H{ScBfnp&Mbtf*3X>I}ZMUvdvN8VW#j7HFy@7ovBR zb~_QZgu{mza9!OJWtq+SI_!j;7W7PLBWk{TheC|y2shh#m>@zy%cc)TK=7j*J`+ag z5q)JbjXG{ga?LTPl0AC5(8Maf`FMs6B7W{y@T6azv0L%lFR&U+e%re^ffm%PpX7Do z*P6^_z(+IZtB-eUOs>`8)8L{kzZ+uIT;VzZQ#rtr^OI>agA-<;?)CqPOmNP2nIIt8 zbyrQR?`zN}9(l?Mf`Is@f2SA{bf|~X`IbS&t~waJee}spD9!l%fIej|U8{)E`p7n3 z<95d_jQ?SCGEbjrO$`(O`WU2$7J_+z87JM(Zs)^YM28kR^V8wAkM}1d9~IC(-YTqF zl58*?;i-8s`a))(kovz(VCJb~>F)U|ZDju!DLLr<`%{#Sza675kMiVD%jEOs1Xcid_ z>Y!-Y5NcSmEnRLtL_&=5R3;h$*bvYMO60RiCm$qxjVf(d!Na8X$k*O#SZ4RFM^RX8 znP#liu%8~Bm?wh*{K?BG-en0J26H$DG}ebDfa+%2U1K0{UpjjV3ZFIKE_h+&)mNhK zxc6ujntm<@5*`n`Fu}ady3V8bZA~d=vPK*hw_iTD%p<|Z@9;ec>p`8L^I{uCy}#*7 z7fqFvq%xaFPv$E>63-bX<`afabNhy77%nivdc)B~nT-jX9e;<1|W}M~Y_yyhH3=~{{KZ_^y(2T#{y7>2FRx$_oR3qYr9O}Jx zcmOwX!oUG{4sEIIdh49mbY`+6EXM}MXqrd`+?e^TRuZ4>l#^U&TZ$sBV)&PHM~OzO z(RCgYUSXR{xl_m81NvpT%^dl2NIXAtpMUKkKV1e>^21-ZWj>}`ohnsg#IcR+f;5gX z*9)Qj`O0~XS`4`ia@!43xEe>}gjl<2ia#G|@M&w3eUW8YcYPw#I9Qd&6-|mtIMteb z2Ky&4>w4urb$jyju$cguvY%9g|e1qs}MuQFhZ|L^A%^L>+qyS|jRyk!w%~$n6 zGK|3*&E*FDt|;2CjY&vy|40ghI<?U~h-u9Mvz*p~^WkU^Ph_w%qV@?#mg zzq|dLWR^~J$;sela`B@F2L~vCiGf^F=l}$=&WHl3&%|DV-2Z}#B5hOo+Xbg2&`v(z z0UD`mURR0?&6h!;w&C#(Z&8as)kU9ftn+0!>h1akL4I*N7x25TP^8I9r1>w!)7*{PI1*ATw!I? z#RWkKL*wRaP(oa8Bpom3?j0&v5kWzF%zuUOPMxt4-LQ! zEYc*tG>K|*B+;mU8|nzeRF>C_k~B^5o>G-3>IJpvRcha6`n~>LY0*&!r>gK@SG>6{pj#hH9C1t=A}n1mL1PChgTY z#D9V>T2?Kl`$v&|Nq_55=v%m?#mgo|q+PQHk|Tg`b9IFkw(u|gCA-|rlv&(EuewMD zA(+uq0kMo}`0Ud310ZB9>9jOiJ`IORBUBj0nT_?HN+ADBS^CQtU|ddr?PTDx>ZDKQ z-Z0UPjVa#0ctHs(j#4n5%xFySt8pL&X=0H;3BMs{LkeU_H74)xaJ!9rB9`jOZk29| zpYfpm?DYYITHW%>_B#yA&|^PaKGAjNgI4io%)(T`L@QzqCiznCb8|?i4dwYAsESAK zCYFV*{$O}N4ej8FP^FY246Nl_GJphfC;2YfkQsxI*D^-B8!$$ODI;hMClHkE^A{wy z#-k|=J!yVgqSwG9cKA~$KuX)BNHSS`nPSR`E$xF+E5=LX)Vk~h9^I>)c|Dz#4XEfv zwq^Kr4z&$X?f3n|w!1C=K-0^mJ|*K7cwl14h3Fha5aDX7Suc$`vuvhhDQ z@ZGLy3b6ozDq{qxzPbnAX?=q%PQi?jmE?E$biZT!SQEVNor{3oz5OL`gZ|9+>gItPS>K!4WbBEdWQ zX5N=@DuV%B-JJ-nO~Ae&b4x*j^2Q-3$A8({7L9|}(8U!d<}TL#={)B)gCFzh%!Nv5@_tk-&+@%xVdNEsL&)5*r~BEaFgA;=si^y6x_VbG;LSzqo*X8a})i zWv^_=5c($3GD6FO2!j&kY^B|Sb42*r0k9{1owTR1E z>S>rV#lujG`2En$agl+@ryk$!@d1y?tJQ=c0mYuv%`+1&oAV`Kc=E@gb3L6On{O2h z%T*gM55x7QdU?$zetXgjF%|D;L)2}mdfKgXiu=dfNXpWI%^fvM{Gs6M(8}wLpL1IB`LhDNHADNeQ(-9JAwU)8HyYS8GSm zL(xJ$ZRS;75Q8ue$`6&|2Hb&q+K^wjtXh#HE&+v4W3x>|{G;AWD2SkS^E+0x3ZRKT z50|5hjvbsg7$nN+Et|ye53Yy{<+?fFj&8oC_D5L&r5Z3Kq{pEnaD2w+57rU^8Mm&>4p~;cQrDN}tyvF>pfEgrSlGzJ4;L(V zP$exHH!tD<+W8OyX_Jy_Y>II>CIHKQW#m49CHPmb@PX3rn~1()t4B4pDfu6%UFhsK zm?`b;+elbBhxVr=_e$A0%f8EL?x)fe!UKy(D1akCAdGvd=1p zB_D#b$#nQFC1PzJ4NZYHkIDstG$C|cf1n(z&mbGX$%~zR4u0mrt1IigEsKg{P#@h$ z15sHhkO7R;1sN9??dDX=%+-RgrBr>7j9gZHzH}GcA)GYAW^Qk5xr^ir4ePIYrEZ5g zOwBrFc2~aORa`?tL6Z?m|BW8WrSppN-3jyc+>u>e0CT$@pz{l#L|j%&1?SJFo!*-M zDTWtP(>bXc3KW5E_DyOIvPz(YlRut9OW{RPuLDT7tsfzv6QS-x$caJUU(|tv6FBK) z+#IMOMIRS0ideaMKln779Yd+uuXtUM)84p&RXm8Pcm+dC9B|`p+gnvg)3QXpkJ6CM zJ=H)^2k0~_4f-P8tj*4(yQ;dNNk(R?ITdhJ5=^G?TKhJ$V;^x2%@Oe~M(;y@%5fvG z^ULT)T4hU&5NMI@F@6fEKF_HJ)1K;52x5^@KpM_7D8l%)`Q?5?^#!VQp$}0oo8jmJ z;oRz1B7e#}I34N@FCU{%aq3aZVn=Sy?>KN#N%Y@Enq8)ihL7s;O-m$YJC&XVgudww zF{CZxRqwtD_b;ZaRe04@9TuA8j7`v-O%z?O-g>L%z9|XC7vQ2tXdweOJbnPk(6-pnc z_Qn{y@W1rRn(?aB(9`q#y*>4XqtK*8#m4&H&ue({4d(0vJnr)x^KH2?(Cuzf|6Wc< zhZ@GPI%vE1HvQ1%ewoALT2U0zTLBYQK)~yEw$|$Q8`Z?jEQi;9(ul;{#$ee+i_&{L z6wAn1mjeD8-2q<^_>mOa>VKMjfr0Wnkx&pl01dLzY(G`vIqq<|(V?O5t5%r*&{3mN zvvIvUgb5FQ3xgK&-lKckNVodV3v~S-+I4hvgRJK<$@oR-gds2@NF&ha1Mp^l;=LjQ zb$YCXi8i-$Tvjtgc}Ms8)0(bM!#)_Oa_H0U*-{1lhKQTzjZMGTbMMRNXzelRuhGT! zo1IvUdO%^o8BGM0Jaw$uZvAD=SwK=!HYbzQo|2p#0|R54diD2@KMf5HR}Kp*t)3!U zS}RZ2yS5GTX_B(CI`t-Si>2D(I^R+I0dfSmnQS2)V&A6k<9Y}jx@K)OGa^i%wta`| z+mqvBbG}IaEk54YXw$>VYyut^i|IUY-mhNLW@ct0A|gr&xBWeKO697r59g=rZSFz= zU1zn`y}#(SDdn>)O1(W+0cea-zZ0K`XzF^$5M{52=`0vUK(p0};v5$sv8*^U^*uv- z^HVoOtJJ9|C;$**dv@WW@vQN}BI8FyL|CjYFp7|}u&`|Sz1m7ovMplA z4g&VV()VFzVM#3Ku>_0*_!hhSg$~Rq9W^x_1h&Wdt2@x|{Y9#{b8V$`#v(B>Q9j$~ z!{8k-iEfu)2jGL9*f=s&(CvBMu}hYgLigzULP-C9SGZ<_D2DufEgbm+E&hI zWMB>&a+bb+1Z)% z;pF}0=B5VvRx}plzgrCD(@qr?l~VcalO*EIxw$z7f#;CKLeg*FqW)n4w24xo`1wXh z=C43P!$vKMSlmX-SxV_*t!6v9;~srg)j7a3fRQV4POAXO)qlR~HSw26l^=~tK1)(w zegQb{mfFMwV0zlWEUs_>puGc#WgCy>dcG88v_DO3HnyR-B0 z{-}Rq_U{m|4uGt7`Mz>IlQJRtf4)Bs#S`UnIg%DPO=fYk8gvKj7}ez9`yEZ^@9mj% z=qYqY$WpGhIv>syO0>D2hUxuvIo=tFe!N(B)~4g*Yp<;Znqt3y|JH7{yFZ?VH5KIK z5JsIXk&}@tZW=4`eSHA*1s)C#4jDNvI-1wxia32BCM_)u@LyCY$E|MgblHP!A?R4~ zq^vBTn>{J%V(~cqR)=j7tll)#|wNA!>ec=d9 z7*oa{5R}b7<_f!m81fQM)VWrhGQkA}1;Co-^18<{KXtvWR zm2{_EUt(jTqDF^@^LTnB<>a!tohiN1w*a0l5E53e(lRNHHO_%Z9bqKYSr-syiGUG;fN@Nd`GLzm%tK?VC9cS zVbX4RU-CS=Rd)a7Jqwx+*GA1B+q}ul#-OxY_`i5 z+9L0m-e{7^&%e89lB9OtT4qne%X0WlDt{HcLXC zp#KQF#N_0n+2dg>wCDjmPP?<2!thxQi8y>IR|r5cu(7b*w|k*)#Do_o_33*lBm<2u6G9d`$bp4v*c&28iQew3V1ZVc4Ikp z{3V@Q`RM7Z0B=sN(CzSIKSw>u7@nLg;n5UPx=Ypfb38A$*l2$S*u<0hLWeZ`FvH8P zPl0*xE^R8DSFa}4} zoYr=wVHuzfX9Ipxy|`nCbpf7`k<-ZTc>J#z5WoF>X6J&mU0q)11H@uwYCtaVkU%EEf?1f9l7fkaC1J^*+PD4oa#{l|t_-iZM=hvmN_)3IMl-}V;_4)t{s31mzO1$>USMVMl7k6hRHcz=z0bfU@@!X!vG z018{7%lRBv%u-%nPADH>IVV(j>b6?P1tfGKhwML(|5~5%ugTX{?2d@k_La((GZu43 zx(b;^sSzlA4YIr|j+3J6;1Xt0`F%2dH1sWRCiP!hzxtL@lp6Zo3p4B;#5YNKBVD9z z9WFd;kt%f*e6FjSt`AcEkd5DoIlRp*)!DJ^2|xfhhG++jfJP=hokr>Tg=uSLSreVj z%;nB3g>9`>t!!lZ2*Qh%$Lo*u&4muV$XM>mdYf3jqn~ezqj+N*lE5fi(#E%?jc_#Yuk+3J%WoeOQi( zLA+r`jjQVJ>FJSIp}JVAGagT4X6x1a5mjk7QxGbWFR7qF)ulgU!vW;8Z9v4D*F}I5 z_Ich@e@UBPC5uNgCz$yu7V=!H&#A2B7D zkGE%FYmw;hISMC|h7e2UE8bmhegeX}ClL=NjL+jTT&Jr1{F1?LO{tJ0Yw2yLsksCM z7vK!S_fC)+E~nkw+wD|oX=#!_nMnISBx)qh!TNL9q`I`R2S>=urhgD&c>3 zgjW1x4N&c=EN+!LicdgkfOI+e4Z}ykf4)Kum{Y^=64$SxT2+L69#_w|hcqd;>{fGG z+|GXQ_ZqmfML^~m5dn$lx$XevN+tB3Rf-M7SJwWQf~Jr^MEOov?ehlMe#Un z^8S)*<7B}0{*QD43R-EhZL?kFkgh|E`3W3B`T0}mf0k)0(Du-+S1Rz9 zJ)dJhQIXNr2P$qB1rH8bzu)7WX&az4k)zegt69O_p;i6#&Mh-dv&F71Jze$n6>uST z;HO}NNh{|4Tj|sHW@5dbgI^8Vq&WqN}N!(MsQj?OD zyk|}Xwij0X+9dfL*nx6x=Sx*K7V1A9y|2cy`Si{&!0ydcV2|bI4M8bU(W%p>9XnC9 zZuxWJBnh+BQzFOA+rGWKTMZ1EdvnyTwnVM<^YcryF}`%AXvW&fa*>gdCr_R{ljbJW z=>lr3*H})M1J;CdO)`bvD%;Kp0@gZPwwNrNRxD|ua%H31v4m5%fIF#xx$XCPL$#>2 zWhW*mhS+{GeRx9ItnN>RTUK%lurb}z!m>&;JKITbdj8E#OM$KEo-4;VfDH!V%JH-; zca6u-D-Fwn^n)M2FTYor{_f7se-qB{F;bhH`QyXGdFgINZ|*ISa(TuIOga-LOn6Y4 zwggB4(*UsFIZJW3#A9Gl)w4tmn62&tn~F_MO%j{97tQ%|oweso0Wgq&9k}QDTqP`P z^6u=ocvzBeuYuot0b$|E6DM9=zaT$YF+H^X*XAdv-5NV`;>G2(oLi^zy7YVi`Ni2^|UBWH<4N9 z_|~Yk2NM>UTomVO73w@9&*xgyeKpHesyC!xe!ADvq>VS^Wis;&XZo}ioe*~vaEapc zHY`8W4Lr3Z;L!WDc!mR)*=T(p33&&i{LyD%`2T<5RYCQc3j$h!=ejU>y85}Sb4q9e E0LAdZ<^TWy From 456ae44c525e492d83ae5aaf4e76c899b132e0c0 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 2 Jan 2020 01:39:01 +0200 Subject: [PATCH 320/819] Another attempt to add multiple edits --- rust-analyzer/editors/code/src/commands/index.ts | 4 ++-- rust-analyzer/editors/code/src/source_change.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 9a1697dc..0ff708b1 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -34,8 +34,8 @@ function showReferences(ctx: Ctx): Cmd { } function applySourceChange(ctx: Ctx): Cmd { - return async (change: sourceChange.SourceChange) => { - sourceChange.applySourceChange(ctx, change); + return async (change: sourceChange.SourceChange, alternativeChanges: sourceChange.SourceChange[] | undefined) => { + sourceChange.applySourceChange(ctx, change, alternativeChanges); }; } diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index a336269b..b19d325d 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -9,7 +9,7 @@ export interface SourceChange { cursorPosition?: lc.TextDocumentPositionParams; } -export async function applySourceChange(ctx: Ctx, change: SourceChange) { +async function applySelectedSourceChange(ctx: Ctx, change: SourceChange) { const client = ctx.client; if (!client) return; @@ -55,3 +55,13 @@ export async function applySourceChange(ctx: Ctx, change: SourceChange) { ); } } + +export async function applySourceChange(ctx: Ctx, change: SourceChange, alternativeChanges: SourceChange[] | undefined) { + if (alternativeChanges !== undefined && alternativeChanges.length > 0) { + const selectedChange = await vscode.window.showQuickPick([change, ...alternativeChanges]); + if (!selectedChange) return; + await applySelectedSourceChange(ctx, selectedChange); + } else { + await applySelectedSourceChange(ctx, change); + } +} From 5a451daae4eea2873cd2083f143aeae28c6c6e29 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 12 Jan 2020 00:40:36 +0200 Subject: [PATCH 321/819] Apply the api design suggestions --- .../editors/code/src/commands/index.ts | 17 +++++++++++++++-- rust-analyzer/editors/code/src/main.ts | 1 + rust-analyzer/editors/code/src/source_change.ts | 12 +----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 0ff708b1..dc075aa8 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -34,8 +34,20 @@ function showReferences(ctx: Ctx): Cmd { } function applySourceChange(ctx: Ctx): Cmd { - return async (change: sourceChange.SourceChange, alternativeChanges: sourceChange.SourceChange[] | undefined) => { - sourceChange.applySourceChange(ctx, change, alternativeChanges); + return async (change: sourceChange.SourceChange) => { + sourceChange.applySourceChange(ctx, change); + }; +} + +function selectAndApplySourceChange(ctx: Ctx): Cmd { + return async (changes: sourceChange.SourceChange[]) => { + if (changes.length === 1) { + await sourceChange.applySourceChange(ctx, changes[0]); + } else if (changes.length > 0) { + const selectedChange = await vscode.window.showQuickPick(changes); + if (!selectedChange) return; + await sourceChange.applySourceChange(ctx, selectedChange); + } }; } @@ -59,5 +71,6 @@ export { runSingle, showReferences, applySourceChange, + selectAndApplySourceChange, reload }; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 430ad31b..0494ccf6 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -26,6 +26,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySourceChange', commands.applySourceChange); + ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); if (ctx.config.enableEnhancedTyping) { ctx.overrideCommand('type', commands.onEnter); diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index b19d325d..a336269b 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -9,7 +9,7 @@ export interface SourceChange { cursorPosition?: lc.TextDocumentPositionParams; } -async function applySelectedSourceChange(ctx: Ctx, change: SourceChange) { +export async function applySourceChange(ctx: Ctx, change: SourceChange) { const client = ctx.client; if (!client) return; @@ -55,13 +55,3 @@ async function applySelectedSourceChange(ctx: Ctx, change: SourceChange) { ); } } - -export async function applySourceChange(ctx: Ctx, change: SourceChange, alternativeChanges: SourceChange[] | undefined) { - if (alternativeChanges !== undefined && alternativeChanges.length > 0) { - const selectedChange = await vscode.window.showQuickPick([change, ...alternativeChanges]); - if (!selectedChange) return; - await applySelectedSourceChange(ctx, selectedChange); - } else { - await applySelectedSourceChange(ctx, change); - } -} From 50904c1d0b33db0b69184c0a1d9b4ef7af7ba9b1 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Mon, 20 Jan 2020 19:48:32 -0500 Subject: [PATCH 322/819] vscode-languageclient 6.0.1 --- rust-analyzer/editors/code/package-lock.json | 22 ++++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 05c57c7f..b81cf382 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -889,25 +889,25 @@ } }, "vscode-jsonrpc": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.0.tgz", - "integrity": "sha512-QeAniC/xTWauVQgyNgEqNJ0Qm/Jw8QySGRQhRFPwb8c4FPp9k6QNgJp0ayXWws5qhdaHkiXkGPlzjOPZFQQKLw==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", + "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.0.tgz", - "integrity": "sha512-6MDksAP79GRbcHFsXS6ndo12s0m/h7eNdS/IanRgWxaezqB4a4KzHIHrE0bE+nSFB+snaSToGs1bxnPeKdO5fQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.1.tgz", + "integrity": "sha512-7yZaSHichTJEyOJykI2RLQEECf9MqNLoklzC/1OVi/M8ioIsWQ1+lkN1nTsUhd6+F7p9ar9dNmPiEhL0i5uUBA==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.0" + "vscode-languageserver-protocol": "^3.15.1" } }, "vscode-languageserver-protocol": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.0.tgz", - "integrity": "sha512-PZEopQzHR3Lo422HeDxCpGN0sYz+kReO+du3F/AcFT1cCPunoVsDJv7ikEolFRKEn+hEIZiAaIX4yoSZ+ip5Nw==", + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.1.tgz", + "integrity": "sha512-wJAo06VM9ZBnRqslplDjfz6Tdive0O7z44yNxBFA3x0/YZkXBIL6I+9rwQ/9Y//0X0eCh12FQrj+KmEXf2L5eA==", "requires": { - "vscode-jsonrpc": "^5.0.0", + "vscode-jsonrpc": "^5.0.1", "vscode-languageserver-types": "3.15.0" } }, diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d4c31073..cd9c99b3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.0.0" + "vscode-languageclient": "^6.0.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.0", From a58437240e3833f757d44dfb7b4c6a7d58da71a0 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 27 Jan 2020 10:25:22 -0500 Subject: [PATCH 323/819] vscode-languageclient 6.1.0 Adds support for proposed semantic highlighting extension --- rust-analyzer/editors/code/package-lock.json | 24 ++++++++++---------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b81cf382..d38a45b8 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -782,7 +782,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", "dev": true } } @@ -894,27 +894,27 @@ "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.0.1.tgz", - "integrity": "sha512-7yZaSHichTJEyOJykI2RLQEECf9MqNLoklzC/1OVi/M8ioIsWQ1+lkN1nTsUhd6+F7p9ar9dNmPiEhL0i5uUBA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz", + "integrity": "sha1-7mfAt4GMQs4CgVctBcia38xPWjg=", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.1" + "vscode-languageserver-protocol": "^3.15.2" } }, "vscode-languageserver-protocol": { - "version": "3.15.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.1.tgz", - "integrity": "sha512-wJAo06VM9ZBnRqslplDjfz6Tdive0O7z44yNxBFA3x0/YZkXBIL6I+9rwQ/9Y//0X0eCh12FQrj+KmEXf2L5eA==", + "version": "3.15.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz", + "integrity": "sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg==", "requires": { "vscode-jsonrpc": "^5.0.1", - "vscode-languageserver-types": "3.15.0" + "vscode-languageserver-types": "3.15.1" } }, "vscode-languageserver-types": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0.tgz", - "integrity": "sha512-AXteNagMhBWnZ6gNN0UB4HTiD/7TajgfHl6jaM6O7qz3zDJw0H3Jf83w05phihnBRCML+K6Ockh8f8bL0OObPw==" + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", + "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" }, "wrappy": { "version": "1.0.2", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index cd9c99b3..ce3de1e9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,7 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.0.1" + "vscode-languageclient": "^6.1.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.0", From d1a4729a1b6e519b48039897ff832b176183ad54 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 28 Jan 2020 00:09:56 +0200 Subject: [PATCH 324/819] Prefer imports starting with std --- rust-analyzer/editors/code/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d38a45b8..96e9ac37 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -782,7 +782,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } From f79b3912cee124bcf532cf0337bf929ff0b66f9a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Jan 2020 15:11:44 +0100 Subject: [PATCH 325/819] :arrow_up: node --- rust-analyzer/editors/code/package-lock.json | 82 ++++++++++---------- rust-analyzer/editors/code/package.json | 12 +-- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d38a45b8..f92ce1fe 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -25,9 +25,9 @@ } }, "@rollup/plugin-commonjs": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz", - "integrity": "sha512-jnm//T5ZWOZ6zmJ61fReSCBOif+Ax8dHVoVggA+d2NA7T4qCWgQ3KYr+zN2faGEYLpe1wa03IzvhR+sqVLxUWg==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz", + "integrity": "sha512-SaVUoaLDg3KnIXC5IBNIspr1APTYDzk05VaYcI6qz+0XX3ZlSCwAkfAhNSOxfd5GAdcm/63Noi4TowOY9MpcDg==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.0", @@ -38,9 +38,9 @@ } }, "@rollup/plugin-node-resolve": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.0.0.tgz", - "integrity": "sha512-GqWz1CfXOsqpeVMcoM315+O7zMxpRsmhWyhJoxLFHVSp9S64/u02i7len/FnbTNbmgYs+sZyilasijH8UiuboQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.1.0.tgz", + "integrity": "sha512-Cv7PDIvxdE40SWilY5WgZpqfIUEaDxFxs89zCAHjqyRwlTSuql4M5hjIuc5QYJkOH0/vyiyNXKD72O+LhRipGA==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.0", @@ -51,34 +51,42 @@ } }, "@rollup/plugin-typescript": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.0.1.tgz", - "integrity": "sha512-UA/bN/DlHN19xdOllXmp7G7pM2ac9dQMg0q2T1rg4Bogzb7oHXj2WGafpiNpEm54PivcJdzGRJvRnI6zCISW3w==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.1.0.tgz", + "integrity": "sha512-7lXKGY06aofrceVez/YnN2axttFdHSqlUBpCJ6ebzDfxwLDKMgSV5lD4ykBcdgE7aK3egxuLkD/HKyRB5L8Log==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.0", - "resolve": "^1.12.2" + "resolve": "^1.13.1" } }, "@rollup/pluginutils": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.1.tgz", - "integrity": "sha512-PmNurkecagFimv7ZdKCVOfQuqKDPkrcpLFxRBcQ00LYr4HAjJwhCFxBiY2Xoletll2htTIiXBg6g0Yg21h2M3w==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.6.tgz", + "integrity": "sha512-Nb6U7sg11v8D+E4mxRxwT+UumUL7MSnwI8V1SJB3THyW2MOGD/Q6GyxLtpnjrbT3zTRPSozzDMyVZwemgldO3w==", "dev": true, "requires": { - "estree-walker": "^0.6.1" + "estree-walker": "^1.0.1" + }, + "dependencies": { + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + } } }, "@types/estree": { - "version": "0.0.41", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.41.tgz", - "integrity": "sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA==", + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, "@types/node": { - "version": "12.12.22", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.22.tgz", - "integrity": "sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ==", + "version": "12.12.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.25.tgz", + "integrity": "sha512-nf1LMGZvgFX186geVZR1xMZKKblJiRfiASTHw85zED2kI1yDKHDwTKMdkaCbTlXoRKlGKaDfYywt+V0As30q3w==", "dev": true }, "@types/resolve": { @@ -429,14 +437,6 @@ "dev": true, "requires": { "@types/estree": "0.0.39" - }, - "dependencies": { - "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - } } }, "js-tokens": { @@ -486,9 +486,9 @@ } }, "magic-string": { - "version": "0.25.4", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", - "integrity": "sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==", + "version": "0.25.6", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.6.tgz", + "integrity": "sha512-3a5LOMSGoCTH5rbqobC2HuDNRtE2glHZ8J7pK+QZYppyWA36yuNpsX994rIY2nCuyP7CZYy7lQq/X2jygiZ89g==", "dev": true, "requires": { "sourcemap-codec": "^1.4.4" @@ -675,9 +675,9 @@ } }, "rollup": { - "version": "1.27.14", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.14.tgz", - "integrity": "sha512-DuDjEyn8Y79ALYXMt+nH/EI58L5pEw5HU9K38xXdRnxQhvzUTI/nxAawhkAHUQeudANQ//8iyrhVRHJBuR6DSQ==", + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.30.1.tgz", + "integrity": "sha512-Uus8mwQXwaO+ZVoNwBcXKhT0AvycFCBW/W8VZtkpVGsotRllWk9oldfCjqWmTnFRI0y7x6BnEqSqc65N+/YdBw==", "dev": true, "requires": { "@types/estree": "*", @@ -708,9 +708,9 @@ "dev": true }, "sourcemap-codec": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", - "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, "sprintf-js": { @@ -782,7 +782,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true } } @@ -813,9 +813,9 @@ } }, "typescript": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", - "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "dev": true }, "typescript-formatter": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ce3de1e9..55d470fa 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -28,16 +28,16 @@ "vscode-languageclient": "^6.1.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^11.0.0", - "@rollup/plugin-node-resolve": "^6.0.0", - "@rollup/plugin-typescript": "^2.0.1", - "@types/node": "^12.12.21", + "@rollup/plugin-commonjs": "^11.0.1", + "@rollup/plugin-node-resolve": "^6.1.0", + "@rollup/plugin-typescript": "^2.1.0", + "@types/node": "^12.12.25", "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", - "rollup": "^1.27.14", + "rollup": "^1.30.1", "tslib": "^1.10.0", "tslint": "^5.20.1", - "typescript": "^3.7.3", + "typescript": "^3.7.5", "typescript-formatter": "^7.2.2", "vsce": "^1.71.0" }, From 64a8dc01e2f90ecc2de913c3c04caac01c4c57ba Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 28 Jan 2020 17:21:40 +0200 Subject: [PATCH 326/819] Revert accidental package-lock.json change --- rust-analyzer/editors/code/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 96e9ac37..d38a45b8 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -782,7 +782,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", "dev": true } } From 22389a265417e81486163d6bf0fae5e93970480e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Jan 2020 17:00:00 +0100 Subject: [PATCH 327/819] Provide better diagnostics if the server is not in path --- rust-analyzer/editors/code/src/client.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 1ff64a93..15e1a087 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -15,7 +15,13 @@ export function createClient(config: Config): lc.LanguageClient { const command = expandPathResolving(config.raLspServerPath); if (spawnSync(command, ["--version"]).status !== 0) { - window.showErrorMessage(`Unable to execute '${command} --version'`); + window.showErrorMessage( + `Unable to execute '${command} --version' + +Perhaps it is not in $PATH? + +PATH=${process.env.PATH} +`); } const run: lc.Executable = { command, From 12968941560b466abfb6fc034a377bbfd14b1172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 31 Jan 2020 20:55:10 +0200 Subject: [PATCH 328/819] Improve responsiveness of the cargo check status label --- .../editors/code/src/status_display.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index c75fddf9..7345bc3f 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -17,7 +17,7 @@ export function activateStatusDisplay(ctx: Ctx) { class StatusDisplay implements vscode.Disposable { packageName?: string; - private i = 0; + private i: number = 0; private statusBarItem: vscode.StatusBarItem; private command: string; private timer?: NodeJS.Timeout; @@ -37,11 +37,8 @@ class StatusDisplay implements vscode.Disposable { this.timer = this.timer || setInterval(() => { - if (this.packageName) { - this.statusBarItem!.text = `${this.frame()} cargo ${this.command} [${this.packageName}]`; - } else { - this.statusBarItem!.text = `${this.frame()} cargo ${this.command}`; - } + this.tick(); + this.refreshLabel(); }, 300); this.statusBarItem.show(); @@ -65,6 +62,14 @@ class StatusDisplay implements vscode.Disposable { this.statusBarItem.dispose(); } + refreshLabel() { + if (this.packageName) { + this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`; + } else { + this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command}`; + } + } + handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) { switch (params.kind) { case 'begin': @@ -74,6 +79,7 @@ class StatusDisplay implements vscode.Disposable { case 'report': if (params.message) { this.packageName = params.message; + this.refreshLabel(); } break; @@ -83,7 +89,7 @@ class StatusDisplay implements vscode.Disposable { } } - private frame() { - return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; + private tick() { + this.i = (this.i + 1) % spinnerFrames.length; } } From 44be374ba8635ab8ed65b13e8fec1e5793cfba14 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 1 Feb 2020 13:12:39 +0100 Subject: [PATCH 329/819] [VSCode] Fix syntax highlighting Fixes #2969 --- rust-analyzer/editors/code/src/color_theme.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index cbad47f3..e4d20490 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -28,7 +28,9 @@ export class ColorTheme { static fromRules(rules: TextMateRule[]): ColorTheme { const res = new ColorTheme(); for (const rule of rules) { - const scopes = typeof rule.scope === 'string' + const scopes = typeof rule.scope === 'undefined' + ? [] + : typeof rule.scope === 'string' ? [rule.scope] : rule.scope; for (const scope of scopes) { From 2070e082d9e8498ae4fff61cc6f7a24e5a169729 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 1 Feb 2020 13:39:04 +0100 Subject: [PATCH 330/819] Fix seedrandom in packaged extension Fixes #2971 --- rust-analyzer/editors/code/src/highlighting.ts | 3 +-- rust-analyzer/editors/code/tsconfig.json | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 014e96f7..fc7cd5a1 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,7 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as seedrandom_ from 'seedrandom'; -const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 +import seedrandom from 'seedrandom'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index e60eb8e5..1ea43396 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -13,7 +13,8 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "newLine": "LF" + "newLine": "LF", + "esModuleInterop": true, }, "exclude": [ "node_modules" From 86475de947abef4addd9210111510413ca6d4ade Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 1 Feb 2020 13:41:11 +0100 Subject: [PATCH 331/819] Tsfmt --- rust-analyzer/editors/code/src/color_theme.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index e4d20490..d816f617 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -31,8 +31,8 @@ export class ColorTheme { const scopes = typeof rule.scope === 'undefined' ? [] : typeof rule.scope === 'string' - ? [rule.scope] - : rule.scope; + ? [rule.scope] + : rule.scope; for (const scope of scopes) { res.rules.set(scope, rule.settings); } From 44885962a72d840471824a981706846ef958bc14 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 1 Feb 2020 23:11:39 +0200 Subject: [PATCH 332/819] vscode: moved tslib to runtime dependencies and added \"importHelpers\": true --- rust-analyzer/editors/code/package-lock.json | 3 +-- rust-analyzer/editors/code/package.json | 4 ++-- rust-analyzer/editors/code/tsconfig.json | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index f92ce1fe..02e17d18 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -749,8 +749,7 @@ "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "tslint": { "version": "5.20.1", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 55d470fa..3e190326 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,8 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.1.0" + "vscode-languageclient": "^6.1.0", + "tslib": "^1.10.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.1", @@ -35,7 +36,6 @@ "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", "rollup": "^1.30.1", - "tslib": "^1.10.0", "tslint": "^5.20.1", "typescript": "^3.7.5", "typescript-formatter": "^7.2.2", diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 1ea43396..1e17e451 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -15,6 +15,7 @@ "noFallthroughCasesInSwitch": true, "newLine": "LF", "esModuleInterop": true, + "importHelpers": true }, "exclude": [ "node_modules" From 8f2351d686fe0e0bf9b7b29db66846598fdd87da Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 12:16:41 +0200 Subject: [PATCH 333/819] fix repo link in package.json --- rust-analyzer/editors/code/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 55d470fa..4aefd448 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -8,7 +8,8 @@ "version": "0.1.0", "publisher": "matklad", "repository": { - "url": "https://github.com/matklad/rust-analyzer/" + "url": "https://github.com/rust-analyzer/rust-analyzer.git", + "type": "git" }, "categories": [ "Other" From 0c5061489f0f23a693792b7cdd84635dbd517095 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 21:12:59 +0200 Subject: [PATCH 334/819] vscode extension cleanup: migrate to prefer-const tslint rule --- rust-analyzer/editors/code/src/color_theme.ts | 2 +- rust-analyzer/editors/code/src/commands/index.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 2 +- rust-analyzer/editors/code/src/highlighting.ts | 6 +++--- rust-analyzer/editors/code/src/inlay_hints.ts | 6 +++--- rust-analyzer/editors/code/tslint.json | 3 ++- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index d816f617..71113d37 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -69,7 +69,7 @@ function loadThemeNamed(themeName: string): ColorTheme { ); } - let themePaths = vscode.extensions.all + const themePaths = vscode.extensions.all .filter(isTheme) .flatMap(ext => { return ext.packageJSON.contributes.themes diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index dc075aa8..4501809e 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -21,7 +21,7 @@ function collectGarbage(ctx: Ctx): Cmd { function showReferences(ctx: Ctx): Cmd { return (uri: string, position: lc.Position, locations: lc.Location[]) => { - let client = ctx.client; + const client = ctx.client; if (client) { vscode.commands.executeCommand( 'editor.action.showReferences', diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index a2a4e42a..b882a8e5 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -20,7 +20,7 @@ export class Ctx { } async restartServer() { - let old = this.client; + const old = this.client; if (old) { await old.stop(); } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index fc7cd5a1..3d190c3a 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -40,7 +40,7 @@ export function activateHighlighting(ctx: Ctx) { async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; if (!ctx.config.highlightingOn) return; - let client = ctx.client; + const client = ctx.client; if (!client) return; const params: lc.TextDocumentIdentifier = { @@ -106,7 +106,7 @@ class Highlighter { } public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) { - let client = this.ctx.client; + const client = this.ctx.client; if (!client) return; // Initialize decorations if necessary // @@ -175,7 +175,7 @@ function initDecorations(): Map { const res = new Map(); TAG_TO_SCOPES.forEach((scopes, tag) => { if (!scopes) throw `unmapped tag: ${tag}`; - let rule = theme.lookup(scopes); + const rule = theme.lookup(scopes); const decor = createDecorationFromTextmate(rule); res.set(tag, decor); }); diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 6357e44f..ae751018 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -127,13 +127,13 @@ class HintsUpdater { } private async queryHints(documentUri: string): Promise { - let client = this.ctx.client; + const client = this.ctx.client; if (!client) return null; const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; - let tokenSource = new vscode.CancellationTokenSource(); - let prev = this.pending.get(documentUri); + const tokenSource = new vscode.CancellationTokenSource(); + const prev = this.pending.get(documentUri); if (prev) prev.cancel(); this.pending.set(documentUri, tokenSource); try { diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index 318e02b4..0df11b2f 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -3,6 +3,7 @@ "semicolon": [ true, "always" - ] + ], + "prefer-const": true } } From 39f2689d312a8831f20856bed74e3e9531a6ddd0 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 21:37:22 +0200 Subject: [PATCH 335/819] vscode refactoring: use more laconic export snytax, split huge string to several lines --- .../editors/code/src/commands/index.ts | 45 ++++++------------- rust-analyzer/editors/code/src/ctx.ts | 4 +- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 4501809e..5a4c1df5 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,22 +4,22 @@ import * as lc from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; import * as sourceChange from '../source_change'; -import { analyzerStatus } from './analyzer_status'; -import { matchingBrace } from './matching_brace'; -import { joinLines } from './join_lines'; -import { onEnter } from './on_enter'; -import { parentModule } from './parent_module'; -import { syntaxTree } from './syntax_tree'; -import { expandMacro } from './expand_macro'; -import { run, runSingle } from './runnables'; - -function collectGarbage(ctx: Ctx): Cmd { +export * from './analyzer_status'; +export * from './matching_brace'; +export * from './join_lines'; +export * from './on_enter'; +export * from './parent_module'; +export * from './syntax_tree'; +export * from './expand_macro'; +export * from './runnables'; + +export function collectGarbage(ctx: Ctx): Cmd { return async () => { ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); }; } -function showReferences(ctx: Ctx): Cmd { +export function showReferences(ctx: Ctx): Cmd { return (uri: string, position: lc.Position, locations: lc.Location[]) => { const client = ctx.client; if (client) { @@ -33,13 +33,13 @@ function showReferences(ctx: Ctx): Cmd { }; } -function applySourceChange(ctx: Ctx): Cmd { +export function applySourceChange(ctx: Ctx): Cmd { return async (change: sourceChange.SourceChange) => { sourceChange.applySourceChange(ctx, change); }; } -function selectAndApplySourceChange(ctx: Ctx): Cmd { +export function selectAndApplySourceChange(ctx: Ctx): Cmd { return async (changes: sourceChange.SourceChange[]) => { if (changes.length === 1) { await sourceChange.applySourceChange(ctx, changes[0]); @@ -51,26 +51,9 @@ function selectAndApplySourceChange(ctx: Ctx): Cmd { }; } -function reload(ctx: Ctx): Cmd { +export function reload(ctx: Ctx): Cmd { return async () => { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await ctx.restartServer(); }; } - -export { - analyzerStatus, - expandMacro, - joinLines, - matchingBrace, - parentModule, - syntaxTree, - onEnter, - collectGarbage, - run, - runSingle, - showReferences, - applySourceChange, - selectAndApplySourceChange, - reload -}; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index b882a8e5..094566d0 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -66,7 +66,9 @@ export class Ctx { this.pushCleanup(d); } catch (_) { vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', + 'Enhanced typing feature is disabled because of incompatibility ' + + 'with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: ' + + 'https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', ); } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0494ccf6..de45f660 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,7 +11,7 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); - // Commands which invokes manually via command pallet, shortcut, etc. + // Commands which invokes manually via command pallete, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); From 4605039c9fd588b1c3b9042515dedc620edb0b24 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 21:38:49 +0200 Subject: [PATCH 336/819] vscode: fix type --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index de45f660..6813c3c4 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,7 +11,7 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); - // Commands which invokes manually via command pallete, shortcut, etc. + // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); From 5f4fbae53bd9036f3ed28f6612ee9439b58d6e05 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 22:19:59 +0200 Subject: [PATCH 337/819] vscode extension: migrate from any to unknown where possible --- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/color_theme.ts | 2 +- .../editors/code/src/commands/syntax_tree.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 15e1a087..1778c4e9 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -68,7 +68,7 @@ PATH=${process.env.PATH} // This also requires considering our settings strategy, which is work which needs doing // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests res._tracer = { - log: (messageOrDataObject: string | any, data?: string) => { + log: (messageOrDataObject: string | unknown, data?: string) => { if (typeof messageOrDataObject === 'string') { if ( messageOrDataObject.includes( diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index 71113d37..7e10c7f7 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -61,7 +61,7 @@ export class ColorTheme { } function loadThemeNamed(themeName: string): ColorTheme { - function isTheme(extension: vscode.Extension): boolean { + function isTheme(extension: vscode.Extension): boolean { return ( extension.extensionKind === vscode.ExtensionKind.UI && extension.packageJSON.contributes && diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 02ea9f16..562df50c 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -55,7 +55,7 @@ export function syntaxTree(ctx: Ctx): Cmd { // We need to order this after LS updates, but there's no API for that. // Hence, good old setTimeout. -function afterLs(f: () => any) { +function afterLs(f: () => unknown) { setTimeout(f, 10); } diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 094566d0..aae2c5f9 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -52,12 +52,12 @@ export class Ctx { overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) { const defaultCmd = `default:${name}`; const override = factory(this); - const original = (...args: any[]) => + const original = (...args: unknown[]) => vscode.commands.executeCommand(defaultCmd, ...args); try { const d = vscode.commands.registerCommand( name, - async (...args: any[]) => { + async (...args: unknown[]) => { if (!(await override(...args))) { return await original(...args); } @@ -73,11 +73,11 @@ export class Ctx { } } - get subscriptions(): { dispose(): any }[] { + get subscriptions(): { dispose(): unknown }[] { return this.extCtx.subscriptions; } - pushCleanup(d: { dispose(): any }) { + pushCleanup(d: { dispose(): unknown }) { this.extCtx.subscriptions.push(d); } @@ -86,12 +86,12 @@ export class Ctx { } } -export type Cmd = (...args: any[]) => any; +export type Cmd = (...args: unknown[]) => unknown; export async function sendRequestWithRetry( client: lc.LanguageClient, method: string, - param: any, + param: unknown, token?: vscode.CancellationToken, ): Promise { for (const delay of [2, 4, 6, 8, 10, null]) { From b0b4d6489ddf809bb48b915414cec7d02ae9940e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 22:36:12 +0200 Subject: [PATCH 338/819] vscode: fix, fallback to any for cmd type --- rust-analyzer/editors/code/src/ctx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index aae2c5f9..2d703af5 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -86,7 +86,7 @@ export class Ctx { } } -export type Cmd = (...args: unknown[]) => unknown; +export type Cmd = (...args: any[]) => unknown; export async function sendRequestWithRetry( client: lc.LanguageClient, From 058bb846e93ed26ba7eb996000b26bc2325a7e0a Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 23:23:01 +0200 Subject: [PATCH 339/819] vscode: use void where possible --- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 8 ++++++-- rust-analyzer/editors/code/src/status_display.ts | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 562df50c..211f2251 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -55,7 +55,7 @@ export function syntaxTree(ctx: Ctx): Cmd { // We need to order this after LS updates, but there's no API for that. // Hence, good old setTimeout. -function afterLs(f: () => unknown) { +function afterLs(f: () => void) { setTimeout(f, 10); } diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 2d703af5..05d21ae5 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; + import { Config } from './config'; import { createClient } from './client'; @@ -73,11 +74,11 @@ export class Ctx { } } - get subscriptions(): { dispose(): unknown }[] { + get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } - pushCleanup(d: { dispose(): unknown }) { + pushCleanup(d: Disposable) { this.extCtx.subscriptions.push(d); } @@ -86,6 +87,9 @@ export class Ctx { } } +export interface Disposable { + dispose(): void; +} export type Cmd = (...args: any[]) => unknown; export async function sendRequestWithRetry( diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 7345bc3f..4317410c 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd } from 'vscode-languageclient'; +import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd, Disposable } from 'vscode-languageclient'; import { Ctx } from './ctx'; @@ -14,7 +14,7 @@ export function activateStatusDisplay(ctx: Ctx) { }); } -class StatusDisplay implements vscode.Disposable { +class StatusDisplay implements vscode.Disposable, Disposable { packageName?: string; private i: number = 0; From 130f3b3d2f9f0d2333a1b59067715fddb01937cb Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 23:38:04 +0200 Subject: [PATCH 340/819] vscode: updated rollup typescript so it typechecks the bundle --- rust-analyzer/editors/code/package-lock.json | 2062 +++++++++++++++++- rust-analyzer/editors/code/package.json | 7 +- 2 files changed, 2041 insertions(+), 28 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 02e17d18..da0cf450 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -24,6 +24,24 @@ "js-tokens": "^4.0.0" } }, + "@npmcli/ci-detect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.1.1.tgz", + "integrity": "sha512-h5eW3DljLypyhvfK94FkSSm4qtSUFddth/xW+7vnkVCEUJR38MYvctCSZkxqrzmXZSzpfImuAwwKvRqkEuDvCQ==", + "dev": true + }, + "@npmcli/installed-package-contents": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.5.tgz", + "integrity": "sha512-aKIwguaaqb6ViwSOFytniGvLPb9SMCUm39TgM3SfUo7n0TxUMbwoXfpwyvQ4blm10lzbAwTsvjr7QZ85LvTi4A==", + "dev": true, + "requires": { + "npm-bundled": "^1.1.1", + "npm-normalize-package-bin": "^1.0.1", + "read-package-json-fast": "^1.1.1", + "readdir-scoped-modules": "^1.1.0" + } + }, "@rollup/plugin-commonjs": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz", @@ -51,13 +69,13 @@ } }, "@rollup/plugin-typescript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.1.0.tgz", - "integrity": "sha512-7lXKGY06aofrceVez/YnN2axttFdHSqlUBpCJ6ebzDfxwLDKMgSV5lD4ykBcdgE7aK3egxuLkD/HKyRB5L8Log==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-3.0.0.tgz", + "integrity": "sha512-O6915Ril3+Q0B4P898PULAcPFZfPuatEB/4nox7bnK48ekGrmamMYhMB5tOqWjihEWrw4oz/NL+c+/kS3Fk95g==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.0", - "resolve": "^1.13.1" + "@rollup/pluginutils": "^3.0.1", + "resolve": "^1.14.1" } }, "@rollup/pluginutils": { @@ -77,6 +95,27 @@ } } }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -116,6 +155,48 @@ "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", "dev": true }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, + "agentkeepalive": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.1.0.tgz", + "integrity": "sha512-CW/n1wxF8RpEuuiq6Vbn9S8m0VSYDMnZESqaJ6F2cWN9fY8rei2qaxweIaRgq+ek8TqfoFIsUjaGNKGGEHElSg==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + } + }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-align": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", + "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", + "dev": true, + "requires": { + "string-width": "^3.0.0" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -125,6 +206,12 @@ "color-convert": "^1.9.0" } }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -134,6 +221,12 @@ "sprintf-js": "~1.0.2" } }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -158,6 +251,22 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, + "boxen": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", + "integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^5.3.1", + "chalk": "^2.4.2", + "cli-boxes": "^2.2.0", + "string-width": "^3.0.0", + "term-size": "^1.2.0", + "type-fest": "^0.3.0", + "widest-line": "^2.0.0" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -180,6 +289,100 @@ "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", "dev": true }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "cacache": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-14.0.0.tgz", + "integrity": "sha512-+Nr/BnA/tjAUXza9gH8F+FSP+1HvWqCKt4c95dQr4EDVJVafbzmPZpLKCkLYexs6vSd2B/1TOXrAoNnqVPfvRA==", + "dev": true, + "requires": { + "chownr": "^1.1.2", + "figgy-pudding": "^3.5.1", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.2", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.0.0", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "move-concurrently": "^1.0.1", + "p-map": "^3.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^2.7.1", + "ssri": "^7.0.0", + "tar": "^6.0.0", + "unique-filename": "^1.1.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -205,6 +408,54 @@ "parse5": "^3.0.1" } }, + "chownr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", + "dev": true + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cint": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/cint/-/cint-8.2.1.tgz", + "integrity": "sha1-cDhrG0jidz0NYxZqVa/5TvRFahI=", + "dev": true + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-boxes": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", + "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", + "dev": true + }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + } + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -220,6 +471,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -238,6 +495,68 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "configstore": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", + "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + } + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -256,12 +575,64 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "dev": true + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", "dev": true }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "dezalgo": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -309,6 +680,21 @@ "domelementtype": "1" } }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "editorconfig": { "version": "0.15.3", "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", @@ -329,12 +715,58 @@ } } }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "dev": true, + "optional": true, + "requires": { + "iconv-lite": "~0.4.13" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=", + "dev": true + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -359,6 +791,27 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -368,12 +821,93 @@ "pend": "~1.2.0" } }, + "figgy-pudding": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", + "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -388,12 +922,98 @@ "path-is-absolute": "^1.0.0" } }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "^1.3.4" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "dependencies": { + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, + "hosted-git-info": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz", + "integrity": "sha512-ezZMWtHXm7Eb7Rq4Mwnx2vs79WUx2QmRg3+ZqeGroKzfDO+EprOcgRPYghsOP9JuYBfK18VojmRTGCg8Ma+ktw==", + "dev": true, + "requires": { + "lru-cache": "^5.1.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -408,21 +1028,148 @@ "readable-stream": "^3.1.1" } }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "http-cache-semantics": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==", + "dev": true + }, + "http-proxy-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz", + "integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "agent-base": "5", + "debug": "4" } }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "dev": true, + "requires": { + "ms": "^2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "dev": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-installed-globally": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "dev": true, + "requires": { + "global-dirs": "^0.1.0", + "is-path-inside": "^1.0.0" + } + }, + "is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", + "dev": true }, "is-module": { "version": "1.0.0", @@ -430,6 +1177,27 @@ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, + "is-npm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", + "integrity": "sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA==", + "dev": true + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, "is-reference": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", @@ -439,6 +1207,36 @@ "@types/estree": "0.0.39" } }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -455,11 +1253,126 @@ "esprima": "^4.0.0" } }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.0.1.tgz", + "integrity": "sha512-XFY2Mbnmg+8r7MRsxfArVkZcfjxGlF/NjM3LsPXVeCX/GBF/1FTCv+idHBYC4qLPtK7q8HC8bapLoWqnhP/bXw==", + "dev": true + }, + "json-parse-helpfulerror": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz", + "integrity": "sha1-E/FM4C7tTpgSl7ZOueO5MuLdE9w=", + "dev": true, + "requires": { + "jju": "^1.1.0" + } + }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "libnpmconfig": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", + "integrity": "sha512-9esX8rTQAHqarx6qeZqmGQKBNZR5OIbl/Ayr0qQDy3oXja2iFVQQI81R6GZ2a02bSNZ9p3YOGX1O6HHCb1X7kA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "find-up": "^3.0.0", + "ini": "^1.3.5" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -469,12 +1382,27 @@ "uc.micro": "^1.0.1" } }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, "lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -494,6 +1422,55 @@ "sourcemap-codec": "^1.4.4" } }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "make-fetch-happen": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.1.tgz", + "integrity": "sha512-7fNjiOXNZhNGQzG5P15nU97aZQtzPU2GVgVd7pnqnl5gnpLzMAD8bAe5YG4iW2s0PTqaZy9xGv4Wfqe872kRNQ==", + "dev": true, + "requires": { + "agentkeepalive": "^4.1.0", + "cacache": "^14.0.0", + "http-cache-semantics": "^4.0.3", + "http-proxy-agent": "^3.0.0", + "https-proxy-agent": "^4.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^5.1.1", + "minipass": "^3.0.0", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^1.1.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "promise-retry": "^1.1.1", + "socks-proxy-agent": "^4.0.0", + "ssri": "^7.0.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, "markdown-it": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", @@ -519,6 +1496,12 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -534,6 +1517,100 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "minipass": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.1.tgz", + "integrity": "sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-fetch": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.2.1.tgz", + "integrity": "sha512-ssHt0dkljEDaKmTgQ04DQgx2ag6G2gMPxA5hpcsoeTbfDgRf2fC2gNSRc6kISjD7ckCpHwwQvXxuTBK8402fXg==", + "dev": true, + "requires": { + "encoding": "^0.1.12", + "minipass": "^3.1.0", + "minipass-pipeline": "^1.2.2", + "minipass-sized": "^1.0.3", + "minizlib": "^2.0.0" + } + }, + "minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-json-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz", + "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==", + "dev": true, + "requires": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } + }, + "minipass-pipeline": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.2.tgz", + "integrity": "sha512-3JS5A2DKhD2g0Gg8x3yamO0pj7YeKGwVlDS90pF++kxptwx/F+B//roxf9SqYil5tQo65bijy+dAuAFZmYOouA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minizlib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.0.tgz", + "integrity": "sha512-EzTZN/fjSvifSX0SlqUERCN39o6T40AMarPbv0MrarSFtIITCBh7bi+dU8nxGFHuqs9jdIAeoYoKuQAAASsPPA==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -543,12 +1620,284 @@ "minimist": "0.0.8" } }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nested-error-stacks": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.0.1.tgz", + "integrity": "sha512-SrQrok4CATudVzBS7coSz26QRSmlK9TzzoFbeKfcPBUFPjcQM9Rqvr/DlJkOrwI/0KcgvMub1n1g5Jt9EgRn4A==", + "dev": true + }, + "node-alias": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/node-alias/-/node-alias-1.0.4.tgz", + "integrity": "sha1-HxuRa1a56iQcATX5fO1pQPVW8pI=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "lodash": "^4.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "dev": true + }, + "npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "dev": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-check-updates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-4.0.1.tgz", + "integrity": "sha512-rDrKAqhQuTYq2EkndroPMZGA9N6tpTotOVOIJoxRa3ZKnb/mOcq2TZv4A4LLSM8+9kZlP+sBwE+XAGh8wWZw/w==", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "cint": "^8.2.1", + "cli-table": "^0.3.1", + "commander": "^4.0.1", + "fast-diff": "^1.2.0", + "find-up": "4.1.0", + "get-stdin": "^7.0.0", + "json-parse-helpfulerror": "^1.0.3", + "libnpmconfig": "^1.2.1", + "lodash": "^4.17.15", + "node-alias": "^1.0.4", + "pacote": "^10.2.0", + "progress": "^2.0.3", + "prompts": "^2.3.0", + "rc-config-loader": "^3.0.0", + "requireg": "^0.2.2", + "semver": "^6.3.0", + "semver-utils": "^1.1.4", + "spawn-please": "^0.3.0", + "update-notifier": "^3.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "commander": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", + "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "npm-package-arg": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.0.0.tgz", + "integrity": "sha512-JgqZHCEUKvhX7EehLNdySiuB227a0QYra9wpZOkW+jvwsRYKkce7y5Rv2axkxScJU1EP+L32jT2PLhQz7IWHlw==", + "dev": true, + "requires": { + "hosted-git-info": "^3.0.2", + "osenv": "^0.1.5", + "semver": "^7.0.0", + "validate-npm-package-name": "^3.0.0" + }, + "dependencies": { + "semver": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", + "dev": true + } + } + }, + "npm-packlist": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-2.0.3.tgz", + "integrity": "sha512-geT5P1y+58INE/jlxBHNsucRX7jpZAgW+XkxAe1NWN7N9SNwpueWTUPRoVdJH+hFpqcdAChRUE/HWsXQI+8JaQ==", + "dev": true, + "requires": { + "glob": "^7.1.6", + "ignore-walk": "^3.0.3", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-pick-manifest": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-5.0.0.tgz", + "integrity": "sha512-YUW9xObM7Y1OkQ/gSmU5VQyI3vCkG5lwOrdycw0dpj9/3dE8h9CKY8tVyHTIp50+mV8jOAGH4m4Lts7zz2rN4Q==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "npm-package-arg": "^8.0.0", + "semver": "^7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", + "dev": true + } + } + }, + "npm-registry-fetch": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-6.0.0.tgz", + "integrity": "sha512-TSzEzudrky0ArPskchM/7F5SrawBY5acMNtRqFuacEI2lCKEyfBjaENuuIU5Uq2CyHfJ+gWp5QlCprolKa5wKg==", + "dev": true, + "requires": { + "@npmcli/ci-detect": "^1.0.0", + "figgy-pudding": "^3.4.1", + "lru-cache": "^5.1.1", + "make-fetch-happen": "^7.1.0", + "minipass": "^3.0.0", + "minipass-fetch": "^1.1.2", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.0.0", + "npm-package-arg": "^8.0.0", + "safe-buffer": "^5.2.0", + "semver": "^7.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "semver": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -579,20 +1928,135 @@ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "dev": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + } + }, + "pacote": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-10.3.1.tgz", + "integrity": "sha512-rCChFkLK9aqmk34ewjVmoUL3MD0yxzj3xkknS7MtDO5rx5z4d4bB+GxsAu4zoYc9r3ynQyEfc2GNtpL94yZaEw==", + "dev": true, + "requires": { + "@npmcli/installed-package-contents": "^1.0.5", + "cacache": "^14.0.0", + "chownr": "^1.1.3", + "fs-minipass": "^2.1.0", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.0.1", + "minipass-fetch": "^1.2.1", + "mkdirp": "^1.0.3", + "npm-package-arg": "^8.0.0", + "npm-packlist": "^2.0.3", + "npm-pick-manifest": "^5.0.0", + "npm-registry-fetch": "^6.0.0", + "osenv": "^0.1.5", + "promise-inflight": "^1.0.1", + "promise-retry": "^1.1.1", + "read-package-json-fast": "^1.1.3", + "semver": "^7.1.1", + "ssri": "^7.1.0", + "tar": "^6.0.0", + "which": "^2.0.2" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + }, + "semver": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } } }, "parse-semver": { @@ -621,12 +2085,30 @@ "@types/node": "*" } }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -639,12 +2121,104 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "promise-retry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", + "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", + "dev": true, + "requires": { + "err-code": "^1.0.0", + "retry": "^0.10.0" + } + }, + "prompts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.0.tgz", + "integrity": "sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.3" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "rc-config-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-3.0.0.tgz", + "integrity": "sha512-bwfUSB37TWkHfP+PPjb/x8BUjChFmmBK44JMfVnU7paisWqZl/o5k7ttCH+EQLnrbn2Aq8Fo1LAsyUiz+WF4CQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "js-yaml": "^3.12.0", + "json5": "^2.1.1", + "require-from-string": "^2.0.2" + } + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -654,6 +2228,16 @@ "mute-stream": "~0.0.4" } }, + "read-package-json-fast": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-1.1.3.tgz", + "integrity": "sha512-MmFqiyfCXV2Dmm4jH24DEGhxdkUDFivJQj4oPZQPOKywxR7HWBE6WnMWDAapfFHi3wm1b+mhR+XHlUH0CL8axg==", + "dev": true, + "requires": { + "json-parse-even-better-errors": "^2.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, "readable-stream": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", @@ -665,6 +2249,64 @@ "util-deprecate": "^1.0.1" } }, + "readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "registry-auth-token": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", + "integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "requireg": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/requireg/-/requireg-0.2.2.tgz", + "integrity": "sha512-nYzyjnFcPNGR3lx9lwPPPnuQxv6JWEZd2Ci0u9opN7N5zUEPIhY/GbL3vMGOr2UXwEg9WwSyV9X9Y/kLFgPsOg==", + "dev": true, + "requires": { + "nested-error-stacks": "~2.0.1", + "rc": "~1.2.7", + "resolve": "~1.7.1" + }, + "dependencies": { + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + } + } + }, "resolve": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", @@ -674,6 +2316,30 @@ "path-parse": "^1.0.6" } }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rollup": { "version": "1.30.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.30.1.tgz", @@ -685,12 +2351,28 @@ "acorn": "^7.1.0" } }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "optional": true + }, "seedrandom": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", @@ -701,24 +2383,155 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "^5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "semver-utils": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/semver-utils/-/semver-utils-1.1.4.tgz", + "integrity": "sha512-EjnoLE5OGmDAVV/8YDoN5KiajNadjzIp9BAHOhYeQHt7j0UWxjmgsx4YD48wp4Ue1Qogq38F1GNUJNqF1kKKxA==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sisteransi": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.4.tgz", + "integrity": "sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig==", + "dev": true + }, + "smart-buffer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz", + "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==", + "dev": true + }, + "socks": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz", + "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==", + "dev": true, + "requires": { + "ip": "1.1.5", + "smart-buffer": "^4.1.0" + } + }, + "socks-proxy-agent": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz", + "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==", + "dev": true, + "requires": { + "agent-base": "~4.2.1", + "socks": "~2.3.2" + }, + "dependencies": { + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + } + } + }, "sourcemap-codec": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, + "spawn-please": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/spawn-please/-/spawn-please-0.3.0.tgz", + "integrity": "sha1-2zOOxM/2Orxp8dDgjO6euL69nRE=", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "ssri": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", + "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "minipass": "^3.1.1" + } + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -728,6 +2541,27 @@ "safe-buffer": "~5.2.0" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -737,6 +2571,43 @@ "has-flag": "^3.0.0" } }, + "tar": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.1.tgz", + "integrity": "sha512-bKhKrrz2FJJj5s7wynxy/fyxpE0CmCjmOQ1KV4KkgXFWOgoIT/NbTMnB1n+LFNrNk0SSBVGGxcK5AGsyC+pW5Q==", + "dev": true, + "requires": { + "chownr": "^1.1.3", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.0", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "^0.7.0" + } + }, "tmp": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", @@ -746,6 +2617,12 @@ "os-tmpdir": "~1.0.1" } }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -801,6 +2678,12 @@ "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, + "type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true + }, "typed-rest-client": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", @@ -839,18 +2722,83 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "^1.0.0" + } + }, + "update-notifier": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz", + "integrity": "sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ==", + "dev": true, + "requires": { + "boxen": "^3.0.0", + "chalk": "^2.0.1", + "configstore": "^4.0.0", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.1.0", + "is-npm": "^3.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.0.0", + "semver-diff": "^2.0.0", + "xdg-basedir": "^3.0.0" + } + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", "dev": true }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, "vsce": { "version": "1.71.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", @@ -915,12 +2863,74 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "widest-line": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", + "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", + "dev": true, + "requires": { + "string-width": "^2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index beb72121..15bcac62 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,9 @@ "vscode:prepublish": "rollup -c", "package": "vsce package", "watch": "tsc -watch -p ./", - "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" + "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix", + "bump-deps:dry-run": "npm-check-updates", + "bump-deps": "npm-check-updates --upgrade && npm install" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -32,10 +34,11 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.1", "@rollup/plugin-node-resolve": "^6.1.0", - "@rollup/plugin-typescript": "^2.1.0", + "@rollup/plugin-typescript": "^3.0.0", "@types/node": "^12.12.25", "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", + "npm-check-updates": "^4.0.1", "rollup": "^1.30.1", "tslint": "^5.20.1", "typescript": "^3.7.5", From 551d46f6b564bd5ee23b6c59b57aa9b919fff19f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 2 Feb 2020 23:47:52 +0200 Subject: [PATCH 341/819] vscode: dropped npm-check-updates script --- rust-analyzer/editors/code/package-lock.json | 2060 +----------------- rust-analyzer/editors/code/package.json | 5 +- 2 files changed, 26 insertions(+), 2039 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index da0cf450..4096255a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -24,24 +24,6 @@ "js-tokens": "^4.0.0" } }, - "@npmcli/ci-detect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.1.1.tgz", - "integrity": "sha512-h5eW3DljLypyhvfK94FkSSm4qtSUFddth/xW+7vnkVCEUJR38MYvctCSZkxqrzmXZSzpfImuAwwKvRqkEuDvCQ==", - "dev": true - }, - "@npmcli/installed-package-contents": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-1.0.5.tgz", - "integrity": "sha512-aKIwguaaqb6ViwSOFytniGvLPb9SMCUm39TgM3SfUo7n0TxUMbwoXfpwyvQ4blm10lzbAwTsvjr7QZ85LvTi4A==", - "dev": true, - "requires": { - "npm-bundled": "^1.1.1", - "npm-normalize-package-bin": "^1.0.1", - "read-package-json-fast": "^1.1.1", - "readdir-scoped-modules": "^1.1.0" - } - }, "@rollup/plugin-commonjs": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz", @@ -95,27 +77,6 @@ } } }, - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "requires": { - "defer-to-connect": "^1.0.1" - } - }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -155,48 +116,6 @@ "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", "dev": true }, - "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true - }, - "agentkeepalive": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.1.0.tgz", - "integrity": "sha512-CW/n1wxF8RpEuuiq6Vbn9S8m0VSYDMnZESqaJ6F2cWN9fY8rei2qaxweIaRgq+ek8TqfoFIsUjaGNKGGEHElSg==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - } - }, - "aggregate-error": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", - "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", - "dev": true, - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, - "ansi-align": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", - "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", - "dev": true, - "requires": { - "string-width": "^3.0.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -206,12 +125,6 @@ "color-convert": "^1.9.0" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -221,12 +134,6 @@ "sprintf-js": "~1.0.2" } }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", - "dev": true - }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -251,22 +158,6 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, - "boxen": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", - "integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==", - "dev": true, - "requires": { - "ansi-align": "^3.0.0", - "camelcase": "^5.3.1", - "chalk": "^2.4.2", - "cli-boxes": "^2.2.0", - "string-width": "^3.0.0", - "term-size": "^1.2.0", - "type-fest": "^0.3.0", - "widest-line": "^2.0.0" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -289,100 +180,6 @@ "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", "dev": true }, - "builtins": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", - "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", - "dev": true - }, - "cacache": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-14.0.0.tgz", - "integrity": "sha512-+Nr/BnA/tjAUXza9gH8F+FSP+1HvWqCKt4c95dQr4EDVJVafbzmPZpLKCkLYexs6vSd2B/1TOXrAoNnqVPfvRA==", - "dev": true, - "requires": { - "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", - "fs-minipass": "^2.0.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.2", - "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "minipass": "^3.0.0", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "mkdirp": "^1.0.3", - "move-concurrently": "^1.0.1", - "p-map": "^3.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^2.7.1", - "ssri": "^7.0.0", - "tar": "^6.0.0", - "unique-filename": "^1.1.1" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "mkdirp": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", - "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } - }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "dependencies": { - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - } - } - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -408,54 +205,6 @@ "parse5": "^3.0.1" } }, - "chownr": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", - "dev": true - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "cint": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/cint/-/cint-8.2.1.tgz", - "integrity": "sha1-cDhrG0jidz0NYxZqVa/5TvRFahI=", - "dev": true - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true - }, - "cli-boxes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", - "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", - "dev": true - }, - "cli-table": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", - "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", - "dev": true, - "requires": { - "colors": "1.0.3" - } - }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -471,12 +220,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "colors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", - "dev": true - }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -495,68 +238,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "configstore": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", - "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", - "dev": true, - "requires": { - "dot-prop": "^4.1.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" - } - }, - "copy-concurrently": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "crypto-random-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", - "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", - "dev": true - }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -575,64 +256,12 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "debuglog": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", - "dev": true - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true - }, - "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", "dev": true }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "dezalgo": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", - "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", - "dev": true, - "requires": { - "asap": "^2.0.0", - "wrappy": "1" - } - }, "didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -680,21 +309,6 @@ "domelementtype": "1" } }, - "dot-prop": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", - "dev": true, - "requires": { - "is-obj": "^1.0.0" - } - }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, "editorconfig": { "version": "0.15.3", "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", @@ -715,58 +329,12 @@ } } }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "dev": true, - "optional": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, - "err-code": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", - "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=", - "dev": true - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -791,27 +359,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -821,93 +368,12 @@ "pend": "~1.2.0" } }, - "figgy-pudding": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", - "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", - "dev": true - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", - "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "get-stdin": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", - "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -922,98 +388,12 @@ "path-is-absolute": "^1.0.0" } }, - "global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", - "dev": true, - "requires": { - "ini": "^1.3.4" - } - }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } - } - }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true - }, - "hosted-git-info": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz", - "integrity": "sha512-ezZMWtHXm7Eb7Rq4Mwnx2vs79WUx2QmRg3+ZqeGroKzfDO+EprOcgRPYghsOP9JuYBfK18VojmRTGCg8Ma+ktw==", - "dev": true, - "requires": { - "lru-cache": "^5.1.1" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } - }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -1028,148 +408,21 @@ "readable-stream": "^3.1.1" } }, - "http-cache-semantics": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", - "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==", - "dev": true - }, - "http-proxy-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz", - "integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==", - "dev": true, - "requires": { - "agent-base": "5", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "agent-base": "5", - "debug": "4" + "once": "^1.3.0", + "wrappy": "1" } }, - "humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "dev": true, - "requires": { - "ms": "^2.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "iferr": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", - "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", - "dev": true - }, - "ignore-walk": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", - "dev": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true - }, - "infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true - }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-installed-globally": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", - "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", - "dev": true, - "requires": { - "global-dirs": "^0.1.0", - "is-path-inside": "^1.0.0" - } - }, - "is-lambda": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", - "dev": true + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "is-module": { "version": "1.0.0", @@ -1177,27 +430,6 @@ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, - "is-npm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", - "integrity": "sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA==", - "dev": true - }, - "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true - }, - "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, "is-reference": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", @@ -1207,36 +439,6 @@ "@types/estree": "0.0.39" } }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "jju": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", - "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1253,126 +455,11 @@ "esprima": "^4.0.0" } }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.0.1.tgz", - "integrity": "sha512-XFY2Mbnmg+8r7MRsxfArVkZcfjxGlF/NjM3LsPXVeCX/GBF/1FTCv+idHBYC4qLPtK7q8HC8bapLoWqnhP/bXw==", - "dev": true - }, - "json-parse-helpfulerror": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz", - "integrity": "sha1-E/FM4C7tTpgSl7ZOueO5MuLdE9w=", - "dev": true, - "requires": { - "jju": "^1.1.0" - } - }, - "json5": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", - "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" }, - "jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", - "dev": true - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "requires": { - "json-buffer": "3.0.0" - } - }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true - }, - "latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "requires": { - "package-json": "^6.3.0" - } - }, - "libnpmconfig": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", - "integrity": "sha512-9esX8rTQAHqarx6qeZqmGQKBNZR5OIbl/Ayr0qQDy3oXja2iFVQQI81R6GZ2a02bSNZ9p3YOGX1O6HHCb1X7kA==", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "find-up": "^3.0.0", - "ini": "^1.3.5" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -1382,27 +469,12 @@ "uc.micro": "^1.0.1" } }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - }, "lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -1422,55 +494,6 @@ "sourcemap-codec": "^1.4.4" } }, - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "make-fetch-happen": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.1.tgz", - "integrity": "sha512-7fNjiOXNZhNGQzG5P15nU97aZQtzPU2GVgVd7pnqnl5gnpLzMAD8bAe5YG4iW2s0PTqaZy9xGv4Wfqe872kRNQ==", - "dev": true, - "requires": { - "agentkeepalive": "^4.1.0", - "cacache": "^14.0.0", - "http-cache-semantics": "^4.0.3", - "http-proxy-agent": "^3.0.0", - "https-proxy-agent": "^4.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^5.1.1", - "minipass": "^3.0.0", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^1.1.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", - "ssri": "^7.0.1" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } - }, "markdown-it": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", @@ -1496,12 +519,6 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1517,100 +534,6 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, - "minipass": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.1.tgz", - "integrity": "sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-fetch": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.2.1.tgz", - "integrity": "sha512-ssHt0dkljEDaKmTgQ04DQgx2ag6G2gMPxA5hpcsoeTbfDgRf2fC2gNSRc6kISjD7ckCpHwwQvXxuTBK8402fXg==", - "dev": true, - "requires": { - "encoding": "^0.1.12", - "minipass": "^3.1.0", - "minipass-pipeline": "^1.2.2", - "minipass-sized": "^1.0.3", - "minizlib": "^2.0.0" - } - }, - "minipass-flush": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-json-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz", - "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==", - "dev": true, - "requires": { - "jsonparse": "^1.3.1", - "minipass": "^3.0.0" - } - }, - "minipass-pipeline": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.2.tgz", - "integrity": "sha512-3JS5A2DKhD2g0Gg8x3yamO0pj7YeKGwVlDS90pF++kxptwx/F+B//roxf9SqYil5tQo65bijy+dAuAFZmYOouA==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-sized": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", - "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minizlib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.0.tgz", - "integrity": "sha512-EzTZN/fjSvifSX0SlqUERCN39o6T40AMarPbv0MrarSFtIITCBh7bi+dU8nxGFHuqs9jdIAeoYoKuQAAASsPPA==", - "dev": true, - "requires": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -1620,284 +543,12 @@ "minimist": "0.0.8" } }, - "move-concurrently": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", - "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "nested-error-stacks": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.0.1.tgz", - "integrity": "sha512-SrQrok4CATudVzBS7coSz26QRSmlK9TzzoFbeKfcPBUFPjcQM9Rqvr/DlJkOrwI/0KcgvMub1n1g5Jt9EgRn4A==", - "dev": true - }, - "node-alias": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/node-alias/-/node-alias-1.0.4.tgz", - "integrity": "sha1-HxuRa1a56iQcATX5fO1pQPVW8pI=", - "dev": true, - "requires": { - "chalk": "^1.1.1", - "lodash": "^4.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", - "dev": true - }, - "npm-bundled": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", - "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", - "dev": true, - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-check-updates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-4.0.1.tgz", - "integrity": "sha512-rDrKAqhQuTYq2EkndroPMZGA9N6tpTotOVOIJoxRa3ZKnb/mOcq2TZv4A4LLSM8+9kZlP+sBwE+XAGh8wWZw/w==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "cint": "^8.2.1", - "cli-table": "^0.3.1", - "commander": "^4.0.1", - "fast-diff": "^1.2.0", - "find-up": "4.1.0", - "get-stdin": "^7.0.0", - "json-parse-helpfulerror": "^1.0.3", - "libnpmconfig": "^1.2.1", - "lodash": "^4.17.15", - "node-alias": "^1.0.4", - "pacote": "^10.2.0", - "progress": "^2.0.3", - "prompts": "^2.3.0", - "rc-config-loader": "^3.0.0", - "requireg": "^0.2.2", - "semver": "^6.3.0", - "semver-utils": "^1.1.4", - "spawn-please": "^0.3.0", - "update-notifier": "^3.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "commander": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", - "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", - "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", - "dev": true - }, - "npm-package-arg": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.0.0.tgz", - "integrity": "sha512-JgqZHCEUKvhX7EehLNdySiuB227a0QYra9wpZOkW+jvwsRYKkce7y5Rv2axkxScJU1EP+L32jT2PLhQz7IWHlw==", - "dev": true, - "requires": { - "hosted-git-info": "^3.0.2", - "osenv": "^0.1.5", - "semver": "^7.0.0", - "validate-npm-package-name": "^3.0.0" - }, - "dependencies": { - "semver": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", - "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", - "dev": true - } - } - }, - "npm-packlist": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-2.0.3.tgz", - "integrity": "sha512-geT5P1y+58INE/jlxBHNsucRX7jpZAgW+XkxAe1NWN7N9SNwpueWTUPRoVdJH+hFpqcdAChRUE/HWsXQI+8JaQ==", - "dev": true, - "requires": { - "glob": "^7.1.6", - "ignore-walk": "^3.0.3", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-pick-manifest": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-5.0.0.tgz", - "integrity": "sha512-YUW9xObM7Y1OkQ/gSmU5VQyI3vCkG5lwOrdycw0dpj9/3dE8h9CKY8tVyHTIp50+mV8jOAGH4m4Lts7zz2rN4Q==", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "npm-package-arg": "^8.0.0", - "semver": "^7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", - "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", - "dev": true - } - } - }, - "npm-registry-fetch": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-6.0.0.tgz", - "integrity": "sha512-TSzEzudrky0ArPskchM/7F5SrawBY5acMNtRqFuacEI2lCKEyfBjaENuuIU5Uq2CyHfJ+gWp5QlCprolKa5wKg==", - "dev": true, - "requires": { - "@npmcli/ci-detect": "^1.0.0", - "figgy-pudding": "^3.4.1", - "lru-cache": "^5.1.1", - "make-fetch-happen": "^7.1.0", - "minipass": "^3.0.0", - "minipass-fetch": "^1.1.2", - "minipass-json-stream": "^1.0.1", - "minizlib": "^2.0.0", - "npm-package-arg": "^8.0.0", - "safe-buffer": "^5.2.0", - "semver": "^7.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "semver": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", - "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -1923,140 +574,25 @@ "dev": true }, "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", - "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", - "dev": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, - "package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "requires": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - } + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true }, - "pacote": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-10.3.1.tgz", - "integrity": "sha512-rCChFkLK9aqmk34ewjVmoUL3MD0yxzj3xkknS7MtDO5rx5z4d4bB+GxsAu4zoYc9r3ynQyEfc2GNtpL94yZaEw==", + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "@npmcli/installed-package-contents": "^1.0.5", - "cacache": "^14.0.0", - "chownr": "^1.1.3", - "fs-minipass": "^2.1.0", - "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "minipass": "^3.0.1", - "minipass-fetch": "^1.2.1", - "mkdirp": "^1.0.3", - "npm-package-arg": "^8.0.0", - "npm-packlist": "^2.0.3", - "npm-pick-manifest": "^5.0.0", - "npm-registry-fetch": "^6.0.0", - "osenv": "^0.1.5", - "promise-inflight": "^1.0.1", - "promise-retry": "^1.1.1", - "read-package-json-fast": "^1.1.3", - "semver": "^7.1.1", - "ssri": "^7.1.0", - "tar": "^6.0.0", - "which": "^2.0.2" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "mkdirp": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", - "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", - "dev": true - }, - "semver": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", - "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - } + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "parse-semver": { @@ -2085,30 +621,12 @@ "@types/node": "*" } }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -2121,104 +639,12 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true - }, - "promise-retry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", - "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", - "dev": true, - "requires": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - } - }, - "prompts": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.0.tgz", - "integrity": "sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg==", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.3" - } - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "rc-config-loader": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-3.0.0.tgz", - "integrity": "sha512-bwfUSB37TWkHfP+PPjb/x8BUjChFmmBK44JMfVnU7paisWqZl/o5k7ttCH+EQLnrbn2Aq8Fo1LAsyUiz+WF4CQ==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "js-yaml": "^3.12.0", - "json5": "^2.1.1", - "require-from-string": "^2.0.2" - } - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -2228,16 +654,6 @@ "mute-stream": "~0.0.4" } }, - "read-package-json-fast": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-1.1.3.tgz", - "integrity": "sha512-MmFqiyfCXV2Dmm4jH24DEGhxdkUDFivJQj4oPZQPOKywxR7HWBE6WnMWDAapfFHi3wm1b+mhR+XHlUH0CL8axg==", - "dev": true, - "requires": { - "json-parse-even-better-errors": "^2.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, "readable-stream": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", @@ -2249,64 +665,6 @@ "util-deprecate": "^1.0.1" } }, - "readdir-scoped-modules": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", - "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", - "dev": true, - "requires": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "graceful-fs": "^4.1.2", - "once": "^1.3.0" - } - }, - "registry-auth-token": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", - "integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "requireg": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/requireg/-/requireg-0.2.2.tgz", - "integrity": "sha512-nYzyjnFcPNGR3lx9lwPPPnuQxv6JWEZd2Ci0u9opN7N5zUEPIhY/GbL3vMGOr2UXwEg9WwSyV9X9Y/kLFgPsOg==", - "dev": true, - "requires": { - "nested-error-stacks": "~2.0.1", - "rc": "~1.2.7", - "resolve": "~1.7.1" - }, - "dependencies": { - "resolve": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", - "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - } - } - }, "resolve": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", @@ -2316,30 +674,6 @@ "path-parse": "^1.0.6" } }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" - } - }, - "retry": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", - "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "rollup": { "version": "1.30.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.30.1.tgz", @@ -2351,28 +685,12 @@ "acorn": "^7.1.0" } }, - "run-queue": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", - "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", - "dev": true, - "requires": { - "aproba": "^1.1.1" - } - }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true - }, "seedrandom": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", @@ -2383,155 +701,24 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, - "semver-diff": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", - "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", - "dev": true, - "requires": { - "semver": "^5.0.3" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "semver-utils": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/semver-utils/-/semver-utils-1.1.4.tgz", - "integrity": "sha512-EjnoLE5OGmDAVV/8YDoN5KiajNadjzIp9BAHOhYeQHt7j0UWxjmgsx4YD48wp4Ue1Qogq38F1GNUJNqF1kKKxA==", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "sisteransi": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.4.tgz", - "integrity": "sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig==", - "dev": true - }, - "smart-buffer": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz", - "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==", - "dev": true - }, - "socks": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz", - "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==", - "dev": true, - "requires": { - "ip": "1.1.5", - "smart-buffer": "^4.1.0" - } - }, - "socks-proxy-agent": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz", - "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==", - "dev": true, - "requires": { - "agent-base": "~4.2.1", - "socks": "~2.3.2" - }, - "dependencies": { - "agent-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", - "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - } - } - }, "sourcemap-codec": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, - "spawn-please": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/spawn-please/-/spawn-please-0.3.0.tgz", - "integrity": "sha1-2zOOxM/2Orxp8dDgjO6euL69nRE=", - "dev": true - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "ssri": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", - "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "minipass": "^3.1.1" - } - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -2541,27 +728,6 @@ "safe-buffer": "~5.2.0" } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -2571,43 +737,6 @@ "has-flag": "^3.0.0" } }, - "tar": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.1.tgz", - "integrity": "sha512-bKhKrrz2FJJj5s7wynxy/fyxpE0CmCjmOQ1KV4KkgXFWOgoIT/NbTMnB1n+LFNrNk0SSBVGGxcK5AGsyC+pW5Q==", - "dev": true, - "requires": { - "chownr": "^1.1.3", - "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", - "minizlib": "^2.1.0", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "dependencies": { - "mkdirp": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", - "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "term-size": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", - "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", - "dev": true, - "requires": { - "execa": "^0.7.0" - } - }, "tmp": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", @@ -2617,12 +746,6 @@ "os-tmpdir": "~1.0.1" } }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true - }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -2678,12 +801,6 @@ "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, - "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true - }, "typed-rest-client": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", @@ -2722,83 +839,18 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, - "unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", - "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "unique-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", - "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", - "dev": true, - "requires": { - "crypto-random-string": "^1.0.0" - } - }, - "update-notifier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz", - "integrity": "sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ==", - "dev": true, - "requires": { - "boxen": "^3.0.0", - "chalk": "^2.0.1", - "configstore": "^4.0.0", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.1.0", - "is-npm": "^3.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.0.0", - "semver-diff": "^2.0.0", - "xdg-basedir": "^3.0.0" - } - }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", "dev": true }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "requires": { - "prepend-http": "^2.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "validate-npm-package-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", - "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", - "dev": true, - "requires": { - "builtins": "^1.0.3" - } - }, "vsce": { "version": "1.71.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", @@ -2863,74 +915,12 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "widest-line": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", - "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", - "dev": true, - "requires": { - "string-width": "^2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "xdg-basedir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", - "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", - "dev": true - }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 15bcac62..e733ee2b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,9 +21,7 @@ "vscode:prepublish": "rollup -c", "package": "vsce package", "watch": "tsc -watch -p ./", - "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix", - "bump-deps:dry-run": "npm-check-updates", - "bump-deps": "npm-check-updates --upgrade && npm install" + "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -38,7 +36,6 @@ "@types/node": "^12.12.25", "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", - "npm-check-updates": "^4.0.1", "rollup": "^1.30.1", "tslint": "^5.20.1", "typescript": "^3.7.5", From d9f3b3e74160f056db200f628e2f733dd0ea447f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 3 Feb 2020 10:50:19 +0200 Subject: [PATCH 342/819] vscode: fix bundling by switching to es2015 target modules system --- rust-analyzer/editors/code/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 1e17e451..1740abb2 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "commonjs", + "module": "es2015", "target": "es2018", "outDir": "out", "lib": [ From bd05aeb7a6f11d31994a993c47987c3a9a6b1853 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 13:54:12 +0100 Subject: [PATCH 343/819] Fix build of typscript extension --- rust-analyzer/editors/code/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 1740abb2..42130c5e 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "moduleResolution": "node", "module": "es2015", "target": "es2018", "outDir": "out", From 650c59015604b376b9068a32fccdb20c0aa14847 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 14:57:14 +0100 Subject: [PATCH 344/819] Remove recent improvements to the build script tslib as a dev dependency and commonjs modules are definitely *wrong* in the ideal world, **but** in the real world that's the only combination that works. See https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Problems.20with.20TypeScript.20build --- rust-analyzer/editors/code/package-lock.json | 15 ++++++++------- rust-analyzer/editors/code/package.json | 8 ++++---- rust-analyzer/editors/code/tsconfig.json | 6 ++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 4096255a..712153c3 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -51,13 +51,13 @@ } }, "@rollup/plugin-typescript": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-3.0.0.tgz", - "integrity": "sha512-O6915Ril3+Q0B4P898PULAcPFZfPuatEB/4nox7bnK48ekGrmamMYhMB5tOqWjihEWrw4oz/NL+c+/kS3Fk95g==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.1.0.tgz", + "integrity": "sha512-7lXKGY06aofrceVez/YnN2axttFdHSqlUBpCJ6ebzDfxwLDKMgSV5lD4ykBcdgE7aK3egxuLkD/HKyRB5L8Log==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.1", - "resolve": "^1.14.1" + "@rollup/pluginutils": "^3.0.0", + "resolve": "^1.13.1" } }, "@rollup/pluginutils": { @@ -749,7 +749,8 @@ "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true }, "tslint": { "version": "5.20.1", @@ -895,7 +896,7 @@ "vscode-languageclient": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz", - "integrity": "sha1-7mfAt4GMQs4CgVctBcia38xPWjg=", + "integrity": "sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA==", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.2" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e733ee2b..06aa747f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -26,20 +26,20 @@ "dependencies": { "jsonc-parser": "^2.1.0", "seedrandom": "^3.0.5", - "vscode-languageclient": "^6.1.0", - "tslib": "^1.10.0" + "vscode-languageclient": "^6.1.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.1", "@rollup/plugin-node-resolve": "^6.1.0", - "@rollup/plugin-typescript": "^3.0.0", + "@rollup/plugin-typescript": "^2.0.0", "@types/node": "^12.12.25", "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", "rollup": "^1.30.1", + "tslib": "^1.10.0", "tslint": "^5.20.1", - "typescript": "^3.7.5", "typescript-formatter": "^7.2.2", + "typescript": "^3.7.5", "vsce": "^1.71.0" }, "activationEvents": [ diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 42130c5e..d74169c2 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { - "moduleResolution": "node", - "module": "es2015", + "module": "commonjs", "target": "es2018", "outDir": "out", "lib": [ @@ -15,8 +14,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "newLine": "LF", - "esModuleInterop": true, - "importHelpers": true + "esModuleInterop": true }, "exclude": [ "node_modules" From e9a26f15276ce9cf0202ea55e50bbf0c9d6d2c85 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 16:37:12 +0100 Subject: [PATCH 345/819] Use simple prng instead of a dependency closes #2999 --- rust-analyzer/editors/code/package-lock.json | 11 -------- rust-analyzer/editors/code/package.json | 2 -- .../editors/code/src/highlighting.ts | 25 ++++++++++++++++--- rust-analyzer/editors/code/tsconfig.json | 3 +-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 712153c3..0760f870 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -98,12 +98,6 @@ "@types/node": "*" } }, - "@types/seedrandom": { - "version": "2.4.28", - "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-2.4.28.tgz", - "integrity": "sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA==", - "dev": true - }, "@types/vscode": { "version": "1.41.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.41.0.tgz", @@ -691,11 +685,6 @@ "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, - "seedrandom": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", - "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 06aa747f..a46b0a82 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,7 +25,6 @@ }, "dependencies": { "jsonc-parser": "^2.1.0", - "seedrandom": "^3.0.5", "vscode-languageclient": "^6.1.0" }, "devDependencies": { @@ -33,7 +32,6 @@ "@rollup/plugin-node-resolve": "^6.1.0", "@rollup/plugin-typescript": "^2.0.0", "@types/node": "^12.12.25", - "@types/seedrandom": "^2.4.28", "@types/vscode": "^1.41.0", "rollup": "^1.30.1", "tslib": "^1.10.0", diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 3d190c3a..66216e0f 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import seedrandom from 'seedrandom'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; @@ -70,9 +69,9 @@ interface Decoration { // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 function fancify(seed: string, shade: 'light' | 'dark') { - const random = seedrandom(seed); + const random = randomU32Numbers(hashString(seed)) const randomInt = (min: number, max: number) => { - return Math.floor(random() * (max - min + 1)) + min; + return Math.abs(random()) % (max - min + 1) + min; }; const h = randomInt(0, 360); @@ -246,3 +245,23 @@ const TAG_TO_SCOPES = new Map([ ["keyword.unsafe", ["keyword.other.unsafe"]], ["keyword.control", ["keyword.control"]], ]); + +function randomU32Numbers(seed: number) { + let random = seed | 0; + return () => { + random ^= random << 13; + random ^= random >> 17; + random ^= random << 5; + random |= 0; + return random + } +} + +function hashString(str: string): number { + let res = 0; + for (let i = 0; i < str.length; ++i) { + const c = str.codePointAt(i)!!; + res = (res * 31 + c) & ~0; + } + return res; +} diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index d74169c2..e60eb8e5 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -13,8 +13,7 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "newLine": "LF", - "esModuleInterop": true + "newLine": "LF" }, "exclude": [ "node_modules" From d11b6a793c583d79b094ff3808a931d80f359f48 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 16:49:25 +0100 Subject: [PATCH 346/819] Update some rollup packages --- rust-analyzer/editors/code/package-lock.json | 55 +++++++++++--------- rust-analyzer/editors/code/package.json | 6 +-- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 0760f870..261e36a0 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -25,29 +25,40 @@ } }, "@rollup/plugin-commonjs": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz", - "integrity": "sha512-SaVUoaLDg3KnIXC5IBNIspr1APTYDzk05VaYcI6qz+0XX3ZlSCwAkfAhNSOxfd5GAdcm/63Noi4TowOY9MpcDg==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz", + "integrity": "sha512-MPYGZr0qdbV5zZj8/2AuomVpnRVXRU5XKXb3HVniwRoRCreGlf5kOE081isNWeiLIi6IYkwTX9zE0/c7V8g81g==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.0", - "estree-walker": "^0.6.1", + "estree-walker": "^1.0.1", "is-reference": "^1.1.2", "magic-string": "^0.25.2", "resolve": "^1.11.0" } }, "@rollup/plugin-node-resolve": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.1.0.tgz", - "integrity": "sha512-Cv7PDIvxdE40SWilY5WgZpqfIUEaDxFxs89zCAHjqyRwlTSuql4M5hjIuc5QYJkOH0/vyiyNXKD72O+LhRipGA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.1.tgz", + "integrity": "sha512-14ddhD7TnemeHE97a4rLOhobfYvUVcaYuqTnL8Ti7Jxi9V9Jr5LY7Gko4HZ5k4h4vqQM0gBQt6tsp9xXW94WPA==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.0", + "@rollup/pluginutils": "^3.0.6", "@types/resolve": "0.0.8", "builtin-modules": "^3.1.0", "is-module": "^1.0.0", - "resolve": "^1.11.1" + "resolve": "^1.14.2" + }, + "dependencies": { + "resolve": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz", + "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } } }, "@rollup/plugin-typescript": { @@ -61,20 +72,12 @@ } }, "@rollup/pluginutils": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.6.tgz", - "integrity": "sha512-Nb6U7sg11v8D+E4mxRxwT+UumUL7MSnwI8V1SJB3THyW2MOGD/Q6GyxLtpnjrbT3zTRPSozzDMyVZwemgldO3w==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.8.tgz", + "integrity": "sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw==", "dev": true, "requires": { "estree-walker": "^1.0.1" - }, - "dependencies": { - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - } } }, "@types/estree": { @@ -342,9 +345,9 @@ "dev": true }, "estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", "dev": true }, "esutils": { @@ -669,9 +672,9 @@ } }, "rollup": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.30.1.tgz", - "integrity": "sha512-Uus8mwQXwaO+ZVoNwBcXKhT0AvycFCBW/W8VZtkpVGsotRllWk9oldfCjqWmTnFRI0y7x6BnEqSqc65N+/YdBw==", + "version": "1.31.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.0.tgz", + "integrity": "sha512-9C6ovSyNeEwvuRuUUmsTpJcXac1AwSL1a3x+O5lpmQKZqi5mmrjauLeqIjvREC+yNRR8fPdzByojDng+af3nVw==", "dev": true, "requires": { "@types/estree": "*", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a46b0a82..e4eae7b3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -28,12 +28,12 @@ "vscode-languageclient": "^6.1.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^11.0.1", - "@rollup/plugin-node-resolve": "^6.1.0", + "@rollup/plugin-commonjs": "^11.0.2", + "@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-typescript": "^2.0.0", "@types/node": "^12.12.25", "@types/vscode": "^1.41.0", - "rollup": "^1.30.1", + "rollup": "^1.31.0", "tslib": "^1.10.0", "tslint": "^5.20.1", "typescript-formatter": "^7.2.2", From b695ca2ac0903501f4960554f7ebca99e86a4834 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 17:39:34 +0100 Subject: [PATCH 347/819] Remove rollup-typescript It seems like just calling typescript directly is simpler and more reliable? --- rust-analyzer/editors/code/package-lock.json | 10 ---------- rust-analyzer/editors/code/package.json | 3 +-- rust-analyzer/editors/code/rollup.config.js | 4 +--- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 261e36a0..353af06b 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -61,16 +61,6 @@ } } }, - "@rollup/plugin-typescript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-2.1.0.tgz", - "integrity": "sha512-7lXKGY06aofrceVez/YnN2axttFdHSqlUBpCJ6ebzDfxwLDKMgSV5lD4ykBcdgE7aK3egxuLkD/HKyRB5L8Log==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.0", - "resolve": "^1.13.1" - } - }, "@rollup/pluginutils": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.8.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e4eae7b3..2d4a6f67 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,7 +18,7 @@ "vscode": "^1.41.0" }, "scripts": { - "vscode:prepublish": "rollup -c", + "vscode:prepublish": "tsc -p ./ && rollup -c", "package": "vsce package", "watch": "tsc -watch -p ./", "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" @@ -30,7 +30,6 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", - "@rollup/plugin-typescript": "^2.0.0", "@types/node": "^12.12.25", "@types/vscode": "^1.41.0", "rollup": "^1.31.0", diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index de6a3b2b..f8d320f4 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -1,12 +1,10 @@ -import typescript from '@rollup/plugin-typescript'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import nodeBuiltins from 'builtin-modules'; export default { - input: 'src/main.ts', + input: 'out/main.js', plugins: [ - typescript(), resolve({ preferBuiltins: true }), From 9526c075f1a05018d5e55328f6402ec8f3b910c3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Feb 2020 18:03:36 +0100 Subject: [PATCH 348/819] Remove unnecessary flags --- rust-analyzer/editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2d4a6f67..c0d8f018 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,9 +18,9 @@ "vscode": "^1.41.0" }, "scripts": { - "vscode:prepublish": "tsc -p ./ && rollup -c", + "vscode:prepublish": "tsc && rollup -c", "package": "vsce package", - "watch": "tsc -watch -p ./", + "watch": "tsc --watch", "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" }, "dependencies": { From 341a9cd31831c137714abefd136394a36f70a57e Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Sun, 2 Feb 2020 02:21:04 +0100 Subject: [PATCH 349/819] Add regular onEnter command, allowing onEnter to be called without overriding the type command. --- rust-analyzer/editors/code/package.json | 5 ++ .../editors/code/src/commands/on_enter.ts | 51 ++++++++++++------- rust-analyzer/editors/code/src/main.ts | 3 +- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c0d8f018..9987a28f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -114,6 +114,11 @@ "command": "rust-analyzer.reload", "title": "Restart server", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.onEnter", + "title": "Enhanced enter key", + "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 6f61883c..1b3d3d74 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,28 +1,43 @@ +import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { applySourceChange, SourceChange } from '../source_change'; import { Cmd, Ctx } from '../ctx'; -export function onEnter(ctx: Ctx): Cmd { +async function handleKeypress(ctx: Ctx) { + const editor = ctx.activeRustEditor; + const client = ctx.client; + if (!editor) return false; + if (!client) return false; + + const request: lc.TextDocumentPositionParams = { + textDocument: { uri: editor.document.uri.toString() }, + position: client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }; + const change = await client.sendRequest( + 'rust-analyzer/onEnter', + request, + ); + if (!change) return false; + + await applySourceChange(ctx, change); + return true; +} + +export function onEnterOverride(ctx: Ctx): Cmd { return async (event: { text: string }) => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || event.text !== '\n') return false; - if (!client) return false; + if (event.text === '\n') { + handleKeypress(ctx); + } + }; +} - const request: lc.TextDocumentPositionParams = { - textDocument: { uri: editor.document.uri.toString() }, - position: client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }; - const change = await client.sendRequest( - 'rust-analyzer/onEnter', - request, - ); - if (!change) return false; +export function onEnter(ctx: Ctx): Cmd { + return async () => { + if (handleKeypress(ctx)) return; - await applySourceChange(ctx, change); - return true; + await vscode.commands.executeCommand('default:type', { text: '\n' }); }; } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 6813c3c4..5c061e72 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -21,6 +21,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); ctx.registerCommand('reload', commands.reload); + ctx.registerCommand('onEnter', commands.onEnter); // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); @@ -29,7 +30,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); if (ctx.config.enableEnhancedTyping) { - ctx.overrideCommand('type', commands.onEnter); + ctx.overrideCommand('type', commands.onEnterOverride); } activateStatusDisplay(ctx); From ce79f3d4b4fc01a1ddc46c142a8e8e6eec8cf84f Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Sun, 2 Feb 2020 15:58:53 +0100 Subject: [PATCH 350/819] Change default enhanced typing behavior from using type to using keybindings. --- rust-analyzer/editors/code/package.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9987a28f..05f55cb3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -141,6 +141,11 @@ "command": "rust-analyzer.run", "key": "ctrl+r", "when": "editorTextFocus && editorLangId == rust" + }, + { + "command": "rust-analyzer.onEnter", + "key": "enter", + "when": "editorTextFocus && editorLangId == rust" } ], "configuration": { @@ -164,7 +169,7 @@ }, "rust-analyzer.enableEnhancedTyping": { "type": "boolean", - "default": true, + "default": false, "description": "Enables enhanced typing. NOTE: If using a VIM extension, you should set this to false" }, "rust-analyzer.raLspServerPath": { From 0e33569738131e9017a58789854595b0be2bb79f Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Mon, 3 Feb 2020 20:24:50 +0100 Subject: [PATCH 351/819] Remove enableEnhancedTyping and type overriding infrastructure. --- rust-analyzer/editors/code/package.json | 5 ---- .../editors/code/src/commands/on_enter.ts | 10 +------- rust-analyzer/editors/code/src/ctx.ts | 24 ------------------- rust-analyzer/editors/code/src/main.ts | 3 --- 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 05f55cb3..42112476 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -167,11 +167,6 @@ "default": {}, "description": "Fine grained feature flags to disable annoying features" }, - "rust-analyzer.enableEnhancedTyping": { - "type": "boolean", - "default": false, - "description": "Enables enhanced typing. NOTE: If using a VIM extension, you should set this to false" - }, "rust-analyzer.raLspServerPath": { "type": [ "string" diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 1b3d3d74..ac582b42 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -26,17 +26,9 @@ async function handleKeypress(ctx: Ctx) { return true; } -export function onEnterOverride(ctx: Ctx): Cmd { - return async (event: { text: string }) => { - if (event.text === '\n') { - handleKeypress(ctx); - } - }; -} - export function onEnter(ctx: Ctx): Cmd { return async () => { - if (handleKeypress(ctx)) return; + if (await handleKeypress(ctx)) return; await vscode.commands.executeCommand('default:type', { text: '\n' }); }; diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 05d21ae5..aa75943b 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -50,30 +50,6 @@ export class Ctx { this.pushCleanup(d); } - overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) { - const defaultCmd = `default:${name}`; - const override = factory(this); - const original = (...args: unknown[]) => - vscode.commands.executeCommand(defaultCmd, ...args); - try { - const d = vscode.commands.registerCommand( - name, - async (...args: unknown[]) => { - if (!(await override(...args))) { - return await original(...args); - } - }, - ); - this.pushCleanup(d); - } catch (_) { - vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility ' + - 'with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: ' + - 'https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', - ); - } - } - get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5c061e72..efc31b2e 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -29,9 +29,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); - if (ctx.config.enableEnhancedTyping) { - ctx.overrideCommand('type', commands.onEnterOverride); - } activateStatusDisplay(ctx); activateHighlighting(ctx); From 17d4b8e83f782e2cbfd816a158408fa22ad30b6c Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Mon, 3 Feb 2020 22:26:20 +0100 Subject: [PATCH 352/819] vscode: Only handle enter if the suggest widget is hidden. --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 42112476..c9404a4d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -145,7 +145,7 @@ { "command": "rust-analyzer.onEnter", "key": "enter", - "when": "editorTextFocus && editorLangId == rust" + "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust" } ], "configuration": { From b3c28c726fa02304305f424c7183d48995b70ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Geis?= Date: Tue, 4 Feb 2020 01:44:12 +0100 Subject: [PATCH 353/819] Merge two if statements into one in editors/code/src/commands/on_enter.ts. Co-Authored-By: Veetaha --- rust-analyzer/editors/code/src/commands/on_enter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index ac582b42..c636234d 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -8,7 +8,7 @@ async function handleKeypress(ctx: Ctx) { const editor = ctx.activeRustEditor; const client = ctx.client; if (!editor) return false; - if (!client) return false; + if (!editor || !client) return false; const request: lc.TextDocumentPositionParams = { textDocument: { uri: editor.document.uri.toString() }, From fdee126e94501191321388fe3ae3b784eb00ebb2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 5 Feb 2020 00:13:46 +0200 Subject: [PATCH 354/819] vscode: yet another refactor commit --- rust-analyzer/editors/code/package-lock.json | 2 +- rust-analyzer/editors/code/src/client.ts | 29 ++++++++----------- rust-analyzer/editors/code/src/color_theme.ts | 18 ++++++------ .../editors/code/src/commands/on_enter.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 4 +-- .../editors/code/src/highlighting.ts | 8 ++--- rust-analyzer/editors/code/src/main.ts | 2 +- 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 353af06b..66d50406 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -878,7 +878,7 @@ "vscode-languageclient": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz", - "integrity": "sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA==", + "integrity": "sha1-7mfAt4GMQs4CgVctBcia38xPWjg=", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.2" diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 1778c4e9..7e7e909d 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -7,25 +7,21 @@ import { Config } from './config'; export function createClient(config: Config): lc.LanguageClient { // '.' Is the fallback if no folder is open - // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. - let folder: string = '.'; - if (workspace.workspaceFolders !== undefined) { - folder = workspace.workspaceFolders[0].uri.fsPath.toString(); - } + // TODO?: Workspace folders support Uri's (eg: file://test.txt). + // It might be a good idea to test if the uri points to a file. + const workspaceFolderPath = workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.'; - const command = expandPathResolving(config.raLspServerPath); - if (spawnSync(command, ["--version"]).status !== 0) { + const raLspServerPath = expandPathResolving(config.raLspServerPath); + if (spawnSync(raLspServerPath, ["--version"]).status !== 0) { window.showErrorMessage( - `Unable to execute '${command} --version' - -Perhaps it is not in $PATH? - -PATH=${process.env.PATH} -`); + `Unable to execute '${raLspServerPath} --version'\n\n` + + `Perhaps it is not in $PATH?\n\n` + + `PATH=${process.env.PATH}\n` + ); } const run: lc.Executable = { - command, - options: { cwd: folder }, + command: raLspServerPath, + options: { cwd: workspaceFolderPath }, }; const serverOptions: lc.ServerOptions = { run, @@ -43,8 +39,7 @@ PATH=${process.env.PATH} cargoWatchEnable: config.cargoWatchOptions.enable, cargoWatchArgs: config.cargoWatchOptions.arguments, cargoWatchCommand: config.cargoWatchOptions.command, - cargoWatchAllTargets: - config.cargoWatchOptions.allTargets, + cargoWatchAllTargets: config.cargoWatchOptions.allTargets, excludeGlobs: config.excludeGlobs, useClientWatching: config.useClientWatching, featureFlags: config.featureFlags, diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index 7e10c7f7..a6957a76 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -33,6 +33,7 @@ export class ColorTheme { : typeof rule.scope === 'string' ? [rule.scope] : rule.scope; + for (const scope of scopes) { res.rules.set(scope, rule.settings); } @@ -69,13 +70,13 @@ function loadThemeNamed(themeName: string): ColorTheme { ); } - const themePaths = vscode.extensions.all + const themePaths: string[] = vscode.extensions.all .filter(isTheme) - .flatMap(ext => { - return ext.packageJSON.contributes.themes + .flatMap( + ext => ext.packageJSON.contributes.themes .filter((it: any) => (it.id || it.label) === themeName) - .map((it: any) => path.join(ext.extensionPath, it.path)); - }); + .map((it: any) => path.join(ext.extensionPath, it.path)) + ); const res = new ColorTheme(); for (const themePath of themePaths) { @@ -96,13 +97,12 @@ function loadThemeFile(themePath: string): ColorTheme { return new ColorTheme(); } const obj = jsonc.parse(text); - const tokenColors = obj?.tokenColors ?? []; + const tokenColors: TextMateRule[] = obj?.tokenColors ?? []; const res = ColorTheme.fromRules(tokenColors); - for (const include in obj?.include ?? []) { + for (const include of obj?.include ?? []) { const includePath = path.join(path.dirname(themePath), include); - const tmp = loadThemeFile(includePath); - res.mergeFrom(tmp); + res.mergeFrom(loadThemeFile(includePath)); } return res; diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index c636234d..25eaebcb 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -7,7 +7,7 @@ import { Cmd, Ctx } from '../ctx'; async function handleKeypress(ctx: Ctx) { const editor = ctx.activeRustEditor; const client = ctx.client; - if (!editor) return false; + if (!editor || !client) return false; const request: lc.TextDocumentPositionParams = { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index fc21c881..c750b2d5 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,9 +23,9 @@ export class Config { lruCapacity: null | number = null; displayInlayHints = true; maxInlayHintLength: null | number = null; - excludeGlobs = []; + excludeGlobs: string[] = []; useClientWatching = true; - featureFlags = {}; + featureFlags: Record = {}; // for internal use withSysroot: null | boolean = null; cargoWatchOptions: CargoWatchOptions = { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 66216e0f..e90fb8ac 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -69,7 +69,7 @@ interface Decoration { // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 function fancify(seed: string, shade: 'light' | 'dark') { - const random = randomU32Numbers(hashString(seed)) + const random = randomU32Numbers(hashString(seed)); const randomInt = (min: number, max: number) => { return Math.abs(random()) % (max - min + 1) + min; }; @@ -253,14 +253,14 @@ function randomU32Numbers(seed: number) { random ^= random >> 17; random ^= random << 5; random |= 0; - return random - } + return random; + }; } function hashString(str: string): number { let res = 0; for (let i = 0; i < str.length; ++i) { - const c = str.codePointAt(i)!!; + const c = str.codePointAt(i)!; res = (res * 31 + c) & ~0; } return res; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index efc31b2e..5efce41f 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -6,7 +6,7 @@ import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; -let ctx!: Ctx; +let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); From 92c92db1974c5eab5ce01cab64214f14d393320d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 5 Feb 2020 21:38:19 +0200 Subject: [PATCH 355/819] vscode: removed changes to integrity hash in package-lock.json --- rust-analyzer/editors/code/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 66d50406..353af06b 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -878,7 +878,7 @@ "vscode-languageclient": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz", - "integrity": "sha1-7mfAt4GMQs4CgVctBcia38xPWjg=", + "integrity": "sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA==", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.2" From 8d8a5a05534d89f1e6860b63c4b34dcc283f67f0 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 5 Feb 2020 22:39:47 +0200 Subject: [PATCH 356/819] vscode: eliminate floating promises and insane amount of resource handle leaks --- rust-analyzer/editors/code/package.json | 2 +- .../editors/code/src/commands/index.ts | 2 +- .../editors/code/src/commands/syntax_tree.ts | 2 ++ rust-analyzer/editors/code/src/config.ts | 2 +- .../editors/code/src/highlighting.ts | 2 ++ rust-analyzer/editors/code/src/inlay_hints.ts | 34 ++++++++++++------- .../editors/code/src/status_display.ts | 10 +++--- rust-analyzer/editors/code/tslint.json | 3 +- 8 files changed, 36 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c9404a4d..11d37053 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "vscode:prepublish": "tsc && rollup -c", "package": "vsce package", "watch": "tsc --watch", - "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" + "fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 5a4c1df5..aee96943 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -35,7 +35,7 @@ export function showReferences(ctx: Ctx): Cmd { export function applySourceChange(ctx: Ctx): Cmd { return async (change: sourceChange.SourceChange) => { - sourceChange.applySourceChange(ctx, change); + await sourceChange.applySourceChange(ctx, change); }; } diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 211f2251..7dde66ad 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -22,6 +22,7 @@ export function syntaxTree(ctx: Ctx): Cmd { if (doc.languageId !== 'rust') return; afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); }, + null, ctx.subscriptions, ); @@ -30,6 +31,7 @@ export function syntaxTree(ctx: Ctx): Cmd { if (!editor || editor.document.languageId !== 'rust') return; tdcp.eventEmitter.fire(tdcp.uri); }, + null, ctx.subscriptions, ); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index fc21c881..585229ed 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -45,7 +45,7 @@ export class Config { private prevCargoWatchOptions: null | CargoWatchOptions = null; constructor(ctx: vscode.ExtensionContext) { - vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions); + vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), null, ctx.subscriptions); this.refresh(); } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 66216e0f..22458a39 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -32,6 +32,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), + null, ctx.subscriptions, ); @@ -52,6 +53,7 @@ export function activateHighlighting(ctx: Ctx) { ); highlighter.setHighlights(editor, decorations); }, + null, ctx.subscriptions, ); } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index ae751018..1c019a51 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -5,19 +5,27 @@ import { Ctx, sendRequestWithRetry } from './ctx'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); - vscode.window.onDidChangeVisibleTextEditors(async _ => { - await hintsUpdater.refresh(); - }, ctx.subscriptions); - - vscode.workspace.onDidChangeTextDocument(async e => { - if (e.contentChanges.length === 0) return; - if (e.document.languageId !== 'rust') return; - await hintsUpdater.refresh(); - }, ctx.subscriptions); - - vscode.workspace.onDidChangeConfiguration(_ => { - hintsUpdater.setEnabled(ctx.config.displayInlayHints); - }, ctx.subscriptions); + vscode.window.onDidChangeVisibleTextEditors( + async _ => hintsUpdater.refresh(), + null, + ctx.subscriptions + ); + + vscode.workspace.onDidChangeTextDocument( + async event => { + if (event.contentChanges.length !== 0) return; + if (event.document.languageId !== 'rust') return; + await hintsUpdater.refresh(); + }, + null, + ctx.subscriptions + ); + + vscode.workspace.onDidChangeConfiguration( + async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints), + null, + ctx.subscriptions + ); ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 4317410c..51dbf388 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -9,12 +9,14 @@ const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', ' export function activateStatusDisplay(ctx: Ctx) { const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); - ctx.onDidRestart(client => { - client.onProgress(WorkDoneProgress.type, 'rustAnalyzer/cargoWatcher', params => statusDisplay.handleProgressNotification(params)); - }); + ctx.onDidRestart(client => ctx.pushCleanup(client.onProgress( + WorkDoneProgress.type, + 'rustAnalyzer/cargoWatcher', + params => statusDisplay.handleProgressNotification(params) + ))); } -class StatusDisplay implements vscode.Disposable, Disposable { +class StatusDisplay implements Disposable { packageName?: string; private i: number = 0; diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json index 0df11b2f..333e2a32 100644 --- a/rust-analyzer/editors/code/tslint.json +++ b/rust-analyzer/editors/code/tslint.json @@ -4,6 +4,7 @@ true, "always" ], - "prefer-const": true + "prefer-const": true, + "no-floating-promises": true } } From cdb98df722f04acaa7272d499a98d001cec9f6b4 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 7 Feb 2020 00:09:13 +0200 Subject: [PATCH 357/819] vscode: add FIXME about language client shared resource protection --- rust-analyzer/editors/code/src/ctx.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index aa75943b..a4dcc303 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -11,6 +11,9 @@ export class Ctx { // deal with it. // // Ideally, this should be replaced with async getter though. + // FIXME: this actually needs syncronization of some kind (check how + // vscode deals with `deactivate()` call when extension has some work scheduled + // on the event loop to get a better picture of what we can do here) client: lc.LanguageClient | null = null; private extCtx: vscode.ExtensionContext; private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; From dd2cb6ec9b29294374a8cb99ec189c795fe0c5c7 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 7 Feb 2020 03:11:24 +0200 Subject: [PATCH 358/819] added fetchLatestArtifactMetadata() and downloadFile() functions --- rust-analyzer/editors/code/package-lock.json | 25 +++++++++ rust-analyzer/editors/code/package.json | 6 +- .../editors/code/src/github/download_file.ts | 26 +++++++++ .../github/fetch_latest_artifact_metadata.ts | 55 +++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/src/github/download_file.ts create mode 100644 rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 353af06b..5c056463 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -82,6 +82,15 @@ "integrity": "sha512-nf1LMGZvgFX186geVZR1xMZKKblJiRfiASTHw85zED2kI1yDKHDwTKMdkaCbTlXoRKlGKaDfYywt+V0As30q3w==", "dev": true }, + "@types/node-fetch": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.4.tgz", + "integrity": "sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -91,6 +100,12 @@ "@types/node": "*" } }, + "@types/throttle-debounce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz", + "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==", + "dev": true + }, "@types/vscode": { "version": "1.41.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.41.0.tgz", @@ -536,6 +551,11 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -719,6 +739,11 @@ "has-flag": "^3.0.0" } }, + "throttle-debounce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.1.0.tgz", + "integrity": "sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg==" + }, "tmp": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 11d37053..8e23718c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -25,18 +25,22 @@ }, "dependencies": { "jsonc-parser": "^2.1.0", + "node-fetch": "^2.6.0", + "throttle-debounce": "^2.1.0", "vscode-languageclient": "^6.1.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", "@types/node": "^12.12.25", + "@types/node-fetch": "^2.5.4", + "@types/throttle-debounce": "^2.1.0", "@types/vscode": "^1.41.0", "rollup": "^1.31.0", "tslib": "^1.10.0", "tslint": "^5.20.1", - "typescript-formatter": "^7.2.2", "typescript": "^3.7.5", + "typescript-formatter": "^7.2.2", "vsce": "^1.71.0" }, "activationEvents": [ diff --git a/rust-analyzer/editors/code/src/github/download_file.ts b/rust-analyzer/editors/code/src/github/download_file.ts new file mode 100644 index 00000000..f40750be --- /dev/null +++ b/rust-analyzer/editors/code/src/github/download_file.ts @@ -0,0 +1,26 @@ +import fetch from "node-fetch"; +import { throttle } from "throttle-debounce"; +import * as fs from "fs"; + +export async function downloadFile( + url: string, + destFilePath: fs.PathLike, + onProgress: (readBytes: number, totalBytes: number) => void +): Promise { + onProgress = throttle(100, /* noTrailing: */ true, onProgress); + + const response = await fetch(url); + + const totalBytes = Number(response.headers.get('content-length')); + let readBytes = 0; + + return new Promise((resolve, reject) => response.body + .on("data", (chunk: Buffer) => { + readBytes += chunk.length; + onProgress(readBytes, totalBytes); + }) + .on("end", resolve) + .on("error", reject) + .pipe(fs.createWriteStream(destFilePath)) + ); +} diff --git a/rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts new file mode 100644 index 00000000..52641ca6 --- /dev/null +++ b/rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts @@ -0,0 +1,55 @@ +import fetch from "node-fetch"; + +const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; + +export interface FetchLatestArtifactMetadataOpts { + repoName: string; + repoOwner: string; + artifactFileName: string; +} + +export interface ArtifactMetadata { + releaseName: string; + releaseDate: Date; + downloadUrl: string; +} + +export async function fetchLatestArtifactMetadata( + opts: FetchLatestArtifactMetadataOpts +): Promise { + + const repoOwner = encodeURIComponent(opts.repoOwner); + const repoName = encodeURIComponent(opts.repoName); + + const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/latest`; + const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; + + // We skip runtime type checks for simplicity (here we cast from `any` to `Release`) + + const response: GithubRelease = await fetch(requestUrl, { + headers: { Accept: "application/vnd.github.v3+json" } + }) + .then(res => res.json()); + + const artifact = response.assets.find(artifact => artifact.name === opts.artifactFileName); + + return !artifact ? null : { + releaseName: response.name, + releaseDate: new Date(response.published_at), + downloadUrl: artifact.browser_download_url + }; + + // Noise denotes tremendous amount of data that we are not using here + interface GithubRelease { + name: string; + published_at: Date; + assets: Array<{ + browser_download_url: string; + + [noise: string]: unknown; + }>; + + [noise: string]: unknown; + } + +} From 988d5ba4cc4fdf5ce39f2b27f5c531ee725a7275 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 04:22:44 +0200 Subject: [PATCH 359/819] vscode: amended config to use binary from globalStoragePath, added ui for downloading --- rust-analyzer/editors/code/package-lock.json | 13 ++ rust-analyzer/editors/code/package.json | 6 +- rust-analyzer/editors/code/src/client.ts | 22 +--- rust-analyzer/editors/code/src/config.ts | 56 +++++++-- rust-analyzer/editors/code/src/ctx.ts | 6 +- .../{github => installation}/download_file.ts | 2 +- .../fetch_latest_artifact_metadata.ts | 18 +-- .../code/src/installation/interfaces.ts | 26 ++++ .../code/src/installation/language_server.ts | 119 ++++++++++++++++++ rust-analyzer/editors/code/tsconfig.json | 2 + 10 files changed, 229 insertions(+), 41 deletions(-) rename rust-analyzer/editors/code/src/{github => installation}/download_file.ts (91%) rename rust-analyzer/editors/code/src/{github => installation}/fetch_latest_artifact_metadata.ts (75%) create mode 100644 rust-analyzer/editors/code/src/installation/interfaces.ts create mode 100644 rust-analyzer/editors/code/src/installation/language_server.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5c056463..1b7c8910 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -753,6 +753,19 @@ "os-tmpdir": "~1.0.1" } }, + "ts-not-nil": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-not-nil/-/ts-not-nil-1.0.1.tgz", + "integrity": "sha512-19+u+3okJddVZlrIdTOdFBaMsHYDInIGDPiujxfRa0RS2Ch5055zVG4GAqa+CZ/Rd1a+7ORSm8O4+2kesPymtw==", + "requires": { + "ts-typedefs": ">=3.2.0" + } + }, + "ts-typedefs": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ts-typedefs/-/ts-typedefs-3.2.0.tgz", + "integrity": "sha512-NglEH2YiY40YxNAvwBISqqXRTKlQq6x+qoCF+tkjPxwrPbrkmq7V3LXavmxrD63fENtMhFkcqgMJtOirtow9iA==" + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8e23718c..c0a62619 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,6 +27,7 @@ "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", "throttle-debounce": "^2.1.0", + "ts-not-nil": "^1.0.1", "vscode-languageclient": "^6.1.0" }, "devDependencies": { @@ -173,10 +174,11 @@ }, "rust-analyzer.raLspServerPath": { "type": [ + "null", "string" ], - "default": "ra_lsp_server", - "description": "Path to ra_lsp_server executable" + "default": null, + "description": "Path to ra_lsp_server executable (points to bundled binary by default)" }, "rust-analyzer.excludeGlobs": { "type": "array", diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 7e7e909d..7639ed44 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -1,24 +1,18 @@ -import { homedir } from 'os'; import * as lc from 'vscode-languageclient'; -import { spawnSync } from 'child_process'; import { window, workspace } from 'vscode'; import { Config } from './config'; +import { ensureLanguageServerBinary } from './installation/language_server'; -export function createClient(config: Config): lc.LanguageClient { +export async function createClient(config: Config): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. const workspaceFolderPath = workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.'; - const raLspServerPath = expandPathResolving(config.raLspServerPath); - if (spawnSync(raLspServerPath, ["--version"]).status !== 0) { - window.showErrorMessage( - `Unable to execute '${raLspServerPath} --version'\n\n` + - `Perhaps it is not in $PATH?\n\n` + - `PATH=${process.env.PATH}\n` - ); - } + const raLspServerPath = await ensureLanguageServerBinary(config.raLspServerSource); + if (!raLspServerPath) return null; + const run: lc.Executable = { command: raLspServerPath, options: { cwd: workspaceFolderPath }, @@ -87,9 +81,3 @@ export function createClient(config: Config): lc.LanguageClient { res.registerProposedFeatures(); return res; } -function expandPathResolving(path: string) { - if (path.startsWith('~/')) { - return path.replace('~', homedir()); - } - return path; -} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 52462043..aca5dab5 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,4 +1,6 @@ +import * as os from "os"; import * as vscode from 'vscode'; +import { BinarySource, BinarySourceType } from "./installation/interfaces"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -16,10 +18,24 @@ export interface CargoFeatures { } export class Config { + readonly raLspServerGithubArtifactName = { + linux: "ra_lsp_server-linux", + darwin: "ra_lsp_server-mac", + win32: "ra_lsp_server-windows.exe", + aix: null, + android: null, + freebsd: null, + openbsd: null, + sunos: null, + cygwin: null, + netbsd: null, + }[process.platform]; + + raLspServerSource!: null | BinarySource; + highlightingOn = true; rainbowHighlightingOn = false; enableEnhancedTyping = true; - raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; lruCapacity: null | number = null; displayInlayHints = true; maxInlayHintLength: null | number = null; @@ -45,11 +61,20 @@ export class Config { private prevCargoWatchOptions: null | CargoWatchOptions = null; constructor(ctx: vscode.ExtensionContext) { - vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), null, ctx.subscriptions); - this.refresh(); + vscode.workspace.onDidChangeConfiguration(_ => this.refresh(ctx), null, ctx.subscriptions); + this.refresh(ctx); + } + + private static expandPathResolving(path: string) { + if (path.startsWith('~/')) { + return path.replace('~', os.homedir()); + } + return path; } - private refresh() { + // FIXME: revisit the logic for `if (.has(...)) config.get(...)` set default + // values only in one place (i.e. remove default values from non-readonly members declarations) + private refresh(ctx: vscode.ExtensionContext) { const config = vscode.workspace.getConfiguration('rust-analyzer'); let requireReloadMessage = null; @@ -82,9 +107,26 @@ export class Config { this.prevEnhancedTyping = this.enableEnhancedTyping; } - if (config.has('raLspServerPath')) { - this.raLspServerPath = - RA_LSP_DEBUG || (config.get('raLspServerPath') as string); + { + const raLspServerPath = RA_LSP_DEBUG ?? config.get("raLspServerPath"); + if (raLspServerPath) { + this.raLspServerSource = { + type: BinarySourceType.ExplicitPath, + path: Config.expandPathResolving(raLspServerPath) + }; + } else if (this.raLspServerGithubArtifactName) { + this.raLspServerSource = { + type: BinarySourceType.GithubBinary, + dir: ctx.globalStoragePath, + file: this.raLspServerGithubArtifactName, + repo: { + name: "rust-analyzer", + owner: "rust-analyzer", + } + }; + } else { + this.raLspServerSource = null; + } } if (config.has('cargo-watch.enable')) { diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index a4dcc303..f0e2d72f 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -29,7 +29,11 @@ export class Ctx { await old.stop(); } this.client = null; - const client = createClient(this.config); + const client = await createClient(this.config); + if (!client) { + throw new Error("Rust Analyzer Language Server is not available"); + } + this.pushCleanup(client.start()); await client.onReady(); diff --git a/rust-analyzer/editors/code/src/github/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts similarity index 91% rename from rust-analyzer/editors/code/src/github/download_file.ts rename to rust-analyzer/editors/code/src/installation/download_file.ts index f40750be..7b537e11 100644 --- a/rust-analyzer/editors/code/src/github/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -7,7 +7,7 @@ export async function downloadFile( destFilePath: fs.PathLike, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - onProgress = throttle(100, /* noTrailing: */ true, onProgress); + onProgress = throttle(1000, /* noTrailing: */ true, onProgress); const response = await fetch(url); diff --git a/rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts similarity index 75% rename from rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts rename to rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts index 52641ca6..f07431aa 100644 --- a/rust-analyzer/editors/code/src/github/fetch_latest_artifact_metadata.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts @@ -1,25 +1,19 @@ import fetch from "node-fetch"; +import { GithubRepo, ArtifactMetadata } from "./interfaces"; const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; export interface FetchLatestArtifactMetadataOpts { - repoName: string; - repoOwner: string; + repo: GithubRepo; artifactFileName: string; } -export interface ArtifactMetadata { - releaseName: string; - releaseDate: Date; - downloadUrl: string; -} - export async function fetchLatestArtifactMetadata( opts: FetchLatestArtifactMetadataOpts -): Promise { +): Promise { - const repoOwner = encodeURIComponent(opts.repoOwner); - const repoName = encodeURIComponent(opts.repoName); + const repoOwner = encodeURIComponent(opts.repo.owner); + const repoName = encodeURIComponent(opts.repo.name); const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/latest`; const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; @@ -35,14 +29,12 @@ export async function fetchLatestArtifactMetadata( return !artifact ? null : { releaseName: response.name, - releaseDate: new Date(response.published_at), downloadUrl: artifact.browser_download_url }; // Noise denotes tremendous amount of data that we are not using here interface GithubRelease { name: string; - published_at: Date; assets: Array<{ browser_download_url: string; diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts new file mode 100644 index 00000000..f54e24e2 --- /dev/null +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -0,0 +1,26 @@ +export interface GithubRepo { + name: string; + owner: string; +} + +export interface ArtifactMetadata { + releaseName: string; + downloadUrl: string; +} + + +export enum BinarySourceType { ExplicitPath, GithubBinary } + +export type BinarySource = EplicitPathSource | GithubBinarySource; + +export interface EplicitPathSource { + type: BinarySourceType.ExplicitPath; + path: string; +} + +export interface GithubBinarySource { + type: BinarySourceType.GithubBinary; + repo: GithubRepo; + dir: string; + file: string; +} diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts new file mode 100644 index 00000000..2b3ce662 --- /dev/null +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -0,0 +1,119 @@ +import { unwrapNotNil } from "ts-not-nil"; +import { spawnSync } from "child_process"; +import * as vscode from "vscode"; +import * as path from "path"; +import { strict as assert } from "assert"; +import { promises as fs } from "fs"; + +import { BinarySource, BinarySourceType, GithubBinarySource } from "./interfaces"; +import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata"; +import { downloadFile } from "./download_file"; + +export async function downloadLatestLanguageServer( + {file: artifactFileName, dir: installationDir, repo}: GithubBinarySource +) { + const binaryMetadata = await fetchLatestArtifactMetadata({ artifactFileName, repo }); + + const { + releaseName, + downloadUrl + } = unwrapNotNil(binaryMetadata, `Latest GitHub release lacks "${artifactFileName}" file`); + + await fs.mkdir(installationDir).catch(err => assert.strictEqual( + err && err.code, + "EEXIST", + `Couldn't create directory "${installationDir}" to download `+ + `language server binary: ${err.message}` + )); + + const installationPath = path.join(installationDir, artifactFileName); + + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, // FIXME: add support for canceling download? + title: `Downloading language server ${releaseName}` + }, + async (progress, _) => { + let lastPrecentage = 0; + await downloadFile(downloadUrl, installationPath, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPrecentage + }); + + lastPrecentage = newPercentage; + }); + } + ); + + await fs.chmod(installationPath, 111); // Set xxx permissions +} +export async function ensureLanguageServerBinary( + langServerSource: null | BinarySource +): Promise { + + if (!langServerSource) { + vscode.window.showErrorMessage( + "Unfortunately we don't ship binaries for your platform yet. " + + "You need to manually clone rust-analyzer repository and " + + "run `cargo xtask install --server` to build the language server from sources. " + + "If you feel that your platform should be supported, please create an issue " + + "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " + + "will consider it." + ); + return null; + } + + switch (langServerSource.type) { + case BinarySourceType.ExplicitPath: { + if (isBinaryAvailable(langServerSource.path)) { + return langServerSource.path; + } + vscode.window.showErrorMessage( + `Unable to execute ${'`'}${langServerSource.path} --version${'`'}. ` + + "To use the bundled language server, set `rust-analyzer.raLspServerPath` " + + "value to `null` or remove it from the settings to use it by default." + ); + return null; + } + case BinarySourceType.GithubBinary: { + const bundledBinaryPath = path.join(langServerSource.dir, langServerSource.file); + + if (!isBinaryAvailable(bundledBinaryPath)) { + const userResponse = await vscode.window.showInformationMessage( + `Language server binary for rust-analyzer was not found. ` + + `Do you want to download it now?`, + "Download now", "Cancel" + ); + if (userResponse !== "Download now") return null; + + try { + await downloadLatestLanguageServer(langServerSource); + } catch (err) { + await vscode.window.showErrorMessage( + `Failed to download language server from ${langServerSource.repo.name} ` + + `GitHub repository: ${err.message}` + ); + return null; + } + + + assert( + isBinaryAvailable(bundledBinaryPath), + "Downloaded language server binary is not functional" + ); + + vscode.window.showInformationMessage( + "Rust analyzer language server was successfully installed" + ); + } + return bundledBinaryPath; + } + } + + function isBinaryAvailable(binaryPath: string) { + return spawnSync(binaryPath, ["--version"]).status === 0; + } +} diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index e60eb8e5..0c770297 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -6,6 +6,8 @@ "lib": [ "es2019" ], + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, "sourceMap": true, "rootDir": "src", "strict": true, From 9336ad12841069ef3103b93550d691ec7ea4f393 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 20:07:00 +0200 Subject: [PATCH 360/819] vscode: changed chmod value to 755 as per @lnicola --- .../editors/code/src/installation/language_server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 2b3ce662..8d8c6295 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -12,7 +12,7 @@ import { downloadFile } from "./download_file"; export async function downloadLatestLanguageServer( {file: artifactFileName, dir: installationDir, repo}: GithubBinarySource ) { - const binaryMetadata = await fetchLatestArtifactMetadata({ artifactFileName, repo }); + const binaryMetadata = await fetchLatestArtifactMetadata(repo, artifactFileName); const { releaseName, @@ -20,7 +20,7 @@ export async function downloadLatestLanguageServer( } = unwrapNotNil(binaryMetadata, `Latest GitHub release lacks "${artifactFileName}" file`); await fs.mkdir(installationDir).catch(err => assert.strictEqual( - err && err.code, + err?.code, "EEXIST", `Couldn't create directory "${installationDir}" to download `+ `language server binary: ${err.message}` @@ -48,7 +48,7 @@ export async function downloadLatestLanguageServer( } ); - await fs.chmod(installationPath, 111); // Set xxx permissions + await fs.chmod(installationPath, 755); // Set (rwx, r_x, r_x) permissions } export async function ensureLanguageServerBinary( langServerSource: null | BinarySource From 2a5f65260f4d0b4520933ec743d82e5962060ecb Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 20:18:33 +0200 Subject: [PATCH 361/819] vscode: converted fetchLatestArtifactMetadata params to positional, added docs --- .../fetch_latest_artifact_metadata.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts index f07431aa..cda955af 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts @@ -3,29 +3,28 @@ import { GithubRepo, ArtifactMetadata } from "./interfaces"; const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; -export interface FetchLatestArtifactMetadataOpts { - repo: GithubRepo; - artifactFileName: string; -} - +/** + * Fetches the latest release from GitHub `repo` and returns metadata about + * `artifactFileName` shipped with this release or `null` if no such artifact was published. + */ export async function fetchLatestArtifactMetadata( - opts: FetchLatestArtifactMetadataOpts + repo: GithubRepo, artifactFileName: string ): Promise { - const repoOwner = encodeURIComponent(opts.repo.owner); - const repoName = encodeURIComponent(opts.repo.name); + const repoOwner = encodeURIComponent(repo.owner); + const repoName = encodeURIComponent(repo.name); const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/latest`; const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; - // We skip runtime type checks for simplicity (here we cast from `any` to `Release`) + // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) const response: GithubRelease = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }) .then(res => res.json()); - const artifact = response.assets.find(artifact => artifact.name === opts.artifactFileName); + const artifact = response.assets.find(artifact => artifact.name === artifactFileName); return !artifact ? null : { releaseName: response.name, @@ -36,6 +35,7 @@ export async function fetchLatestArtifactMetadata( interface GithubRelease { name: string; assets: Array<{ + name: string; browser_download_url: string; [noise: string]: unknown; From 2af74b68b6801438a7d2ce7dc2e58e29112ba6ec Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 21:03:27 +0200 Subject: [PATCH 362/819] vscode: add docs to installation module interfaces and sanity check to donloadFile() --- .../code/src/installation/download_file.ts | 10 +++++- .../code/src/installation/interfaces.ts | 33 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 7b537e11..0cc5fc0c 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -1,17 +1,25 @@ import fetch from "node-fetch"; import { throttle } from "throttle-debounce"; import * as fs from "fs"; +import { strict as assert } from "assert"; +/** + * Downloads file from `url` and stores it at `destFilePath`. + * `onProgress` callback is periodically called to track the progress of downloading, + * it gets the already read and total amount of bytes to read as its parameters. + */ export async function downloadFile( url: string, destFilePath: fs.PathLike, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - onProgress = throttle(1000, /* noTrailing: */ true, onProgress); + onProgress = throttle(500, /* noTrailing: */ true, onProgress); const response = await fetch(url); const totalBytes = Number(response.headers.get('content-length')); + assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol"); + let readBytes = 0; return new Promise((resolve, reject) => response.body diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index f54e24e2..03eac5b7 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -3,24 +3,51 @@ export interface GithubRepo { owner: string; } +/** + * Metadata about particular artifact retrieved from GitHub releases. + */ export interface ArtifactMetadata { releaseName: string; downloadUrl: string; } - +/** + * Type tag for `BinarySource` discriminated union. + */ export enum BinarySourceType { ExplicitPath, GithubBinary } -export type BinarySource = EplicitPathSource | GithubBinarySource; +/** + * Represents the source of a binary artifact which is either specified by the user + * explicitly, or bundled by this extension from GitHub releases. + */ +export type BinarySource = ExplicitPathSource | GithubBinarySource; + -export interface EplicitPathSource { +export interface ExplicitPathSource { type: BinarySourceType.ExplicitPath; + + /** + * Filesystem path to the binary specified by the user explicitly. + */ path: string; } export interface GithubBinarySource { type: BinarySourceType.GithubBinary; + + /** + * Repository where the binary is stored. + */ repo: GithubRepo; + + /** + * Directory on the filesystem where the bundled binary is stored. + */ dir: string; + + /** + * Name of the binary file. It is stored under the same name on GitHub releases + * and in local `.dir`. + */ file: string; } From 0b832995c9ee787fc666e73a537027acadbc0eb2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 21:24:29 +0200 Subject: [PATCH 363/819] vscode: add name to the second unused argument of withProgress() callback --- rust-analyzer/editors/code/src/installation/language_server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 8d8c6295..b75d3a00 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -34,7 +34,7 @@ export async function downloadLatestLanguageServer( cancellable: false, // FIXME: add support for canceling download? title: `Downloading language server ${releaseName}` }, - async (progress, _) => { + async (progress, _cancellationToken) => { let lastPrecentage = 0; await downloadFile(downloadUrl, installationPath, (readBytes, totalBytes) => { const newPercentage = (readBytes / totalBytes) * 100; From b58cf4854bfa288bd35d402a9dd47df11b48125d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 21:25:03 +0200 Subject: [PATCH 364/819] vscode: reduce throttle latency of downloadFile() progress callback for smoother UX --- rust-analyzer/editors/code/src/installation/download_file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 0cc5fc0c..ec16dcd6 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -13,7 +13,7 @@ export async function downloadFile( destFilePath: fs.PathLike, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - onProgress = throttle(500, /* noTrailing: */ true, onProgress); + onProgress = throttle(200, /* noTrailing: */ true, onProgress); const response = await fetch(url); From 5c25738a724900ce36ee125b50a3619a99f8f109 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 00:27:04 +0200 Subject: [PATCH 365/819] vscode: refactor platform artifact name query to switch statement, move BinarySource union variants into a namespace --- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 89 +++++++++++-------- .../code/src/installation/interfaces.ts | 58 ++++++------ .../code/src/installation/language_server.ts | 10 +-- 4 files changed, 89 insertions(+), 70 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 7639ed44..2e3d4aba 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -10,7 +10,7 @@ export async function createClient(config: Config): Promise("raLspServerPath"); + + if (raLspServerPath) { + return { + type: BinarySource.Type.ExplicitPath, + path: Config.expandPathResolving(raLspServerPath) + }; + } + + const prebuiltBinaryName = Config.prebuiltLangServerFileName(process.platform); + + return !prebuiltBinaryName ? null : { + type: BinarySource.Type.GithubRelease, + dir: ctx.globalStoragePath, + file: prebuiltBinaryName, + repo: { + name: "rust-analyzer", + owner: "rust-analyzer", + } + }; + } + + // FIXME: revisit the logic for `if (.has(...)) config.get(...)` set default // values only in one place (i.e. remove default values from non-readonly members declarations) private refresh(ctx: vscode.ExtensionContext) { @@ -107,27 +144,7 @@ export class Config { this.prevEnhancedTyping = this.enableEnhancedTyping; } - { - const raLspServerPath = RA_LSP_DEBUG ?? config.get("raLspServerPath"); - if (raLspServerPath) { - this.raLspServerSource = { - type: BinarySourceType.ExplicitPath, - path: Config.expandPathResolving(raLspServerPath) - }; - } else if (this.raLspServerGithubArtifactName) { - this.raLspServerSource = { - type: BinarySourceType.GithubBinary, - dir: ctx.globalStoragePath, - file: this.raLspServerGithubArtifactName, - repo: { - name: "rust-analyzer", - owner: "rust-analyzer", - } - }; - } else { - this.raLspServerSource = null; - } - } + this.langServerSource = Config.langServerBinarySource(ctx, config); if (config.has('cargo-watch.enable')) { this.cargoWatchOptions.enable = config.get( diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index 03eac5b7..8039d0b9 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -11,43 +11,45 @@ export interface ArtifactMetadata { downloadUrl: string; } -/** - * Type tag for `BinarySource` discriminated union. - */ -export enum BinarySourceType { ExplicitPath, GithubBinary } - /** * Represents the source of a binary artifact which is either specified by the user * explicitly, or bundled by this extension from GitHub releases. */ -export type BinarySource = ExplicitPathSource | GithubBinarySource; - - -export interface ExplicitPathSource { - type: BinarySourceType.ExplicitPath; +export type BinarySource = BinarySource.ExplicitPath | BinarySource.GithubRelease; +export namespace BinarySource { /** - * Filesystem path to the binary specified by the user explicitly. + * Type tag for `BinarySource` discriminated union. */ - path: string; -} + export const enum Type { ExplicitPath, GithubRelease } -export interface GithubBinarySource { - type: BinarySourceType.GithubBinary; + export interface ExplicitPath { + type: Type.ExplicitPath; - /** - * Repository where the binary is stored. - */ - repo: GithubRepo; + /** + * Filesystem path to the binary specified by the user explicitly. + */ + path: string; + } - /** - * Directory on the filesystem where the bundled binary is stored. - */ - dir: string; + export interface GithubRelease { + type: Type.GithubRelease; + + /** + * Repository where the binary is stored. + */ + repo: GithubRepo; + + /** + * Directory on the filesystem where the bundled binary is stored. + */ + dir: string; + + /** + * Name of the binary file. It is stored under the same name on GitHub releases + * and in local `.dir`. + */ + file: string; + } - /** - * Name of the binary file. It is stored under the same name on GitHub releases - * and in local `.dir`. - */ - file: string; } diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index b75d3a00..522d59eb 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -5,12 +5,12 @@ import * as path from "path"; import { strict as assert } from "assert"; import { promises as fs } from "fs"; -import { BinarySource, BinarySourceType, GithubBinarySource } from "./interfaces"; +import { BinarySource } from "./interfaces"; import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata"; import { downloadFile } from "./download_file"; export async function downloadLatestLanguageServer( - {file: artifactFileName, dir: installationDir, repo}: GithubBinarySource + {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease ) { const binaryMetadata = await fetchLatestArtifactMetadata(repo, artifactFileName); @@ -67,7 +67,7 @@ export async function ensureLanguageServerBinary( } switch (langServerSource.type) { - case BinarySourceType.ExplicitPath: { + case BinarySource.Type.ExplicitPath: { if (isBinaryAvailable(langServerSource.path)) { return langServerSource.path; } @@ -78,7 +78,7 @@ export async function ensureLanguageServerBinary( ); return null; } - case BinarySourceType.GithubBinary: { + case BinarySource.Type.GithubRelease: { const bundledBinaryPath = path.join(langServerSource.dir, langServerSource.file); if (!isBinaryAvailable(bundledBinaryPath)) { @@ -106,7 +106,7 @@ export async function ensureLanguageServerBinary( ); vscode.window.showInformationMessage( - "Rust analyzer language server was successfully installed" + "Rust analyzer language server was successfully installed 🦀" ); } return bundledBinaryPath; From 4114bcbc46a07ef1a7e1222f2ebdcea7b7cccae7 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 00:28:32 +0200 Subject: [PATCH 366/819] vscode: refactor comment --- rust-analyzer/editors/code/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index f216ab46..5aed8c9f 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -78,7 +78,7 @@ export class Config { case "sunos": case "cygwin": case "netbsd": return null; - // The list of platforms is exhaustive see (`NodeJS.Platform` type definition) + // The list of platforms is exhaustive (see `NodeJS.Platform` type definition) } } From 5402ac5fd06f61bcc1bd4571ec441630f1ee6abb Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 00:42:51 +0200 Subject: [PATCH 367/819] vscode: rename raLspServer variable to langServer --- rust-analyzer/editors/code/src/config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 5aed8c9f..46394600 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -86,12 +86,12 @@ export class Config { ctx: vscode.ExtensionContext, config: vscode.WorkspaceConfiguration ): null | BinarySource { - const raLspServerPath = RA_LSP_DEBUG ?? config.get("raLspServerPath"); + const langServerPath = RA_LSP_DEBUG ?? config.get("raLspServerPath"); - if (raLspServerPath) { + if (langServerPath) { return { type: BinarySource.Type.ExplicitPath, - path: Config.expandPathResolving(raLspServerPath) + path: Config.expandPathResolving(langServerPath) }; } From bce40964158e0b65770bef5dbcfc0027e53f13aa Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 00:58:53 +0200 Subject: [PATCH 368/819] vscode: minor names and message contents changes --- rust-analyzer/editors/code/src/ctx.ts | 5 ++++- .../code/src/installation/language_server.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index f0e2d72f..70042a47 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -31,7 +31,10 @@ export class Ctx { this.client = null; const client = await createClient(this.config); if (!client) { - throw new Error("Rust Analyzer Language Server is not available"); + throw new Error( + "Rust Analyzer Language Server is not available. " + + "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)." + ); } this.pushCleanup(client.start()); diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 522d59eb..d09fc63a 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -72,19 +72,19 @@ export async function ensureLanguageServerBinary( return langServerSource.path; } vscode.window.showErrorMessage( - `Unable to execute ${'`'}${langServerSource.path} --version${'`'}. ` + - "To use the bundled language server, set `rust-analyzer.raLspServerPath` " + + `Unable to run ${langServerSource.path} binary. ` + + "To use the pre-built language server, set `rust-analyzer.raLspServerPath` " + "value to `null` or remove it from the settings to use it by default." ); return null; } case BinarySource.Type.GithubRelease: { - const bundledBinaryPath = path.join(langServerSource.dir, langServerSource.file); + const prebuiltBinaryPath = path.join(langServerSource.dir, langServerSource.file); - if (!isBinaryAvailable(bundledBinaryPath)) { + if (!isBinaryAvailable(prebuiltBinaryPath)) { const userResponse = await vscode.window.showInformationMessage( - `Language server binary for rust-analyzer was not found. ` + - `Do you want to download it now?`, + "Language server binary for rust-analyzer was not found. " + + "Do you want to download it now?", "Download now", "Cancel" ); if (userResponse !== "Download now") return null; @@ -101,7 +101,7 @@ export async function ensureLanguageServerBinary( assert( - isBinaryAvailable(bundledBinaryPath), + isBinaryAvailable(prebuiltBinaryPath), "Downloaded language server binary is not functional" ); @@ -109,7 +109,7 @@ export async function ensureLanguageServerBinary( "Rust analyzer language server was successfully installed 🦀" ); } - return bundledBinaryPath; + return prebuiltBinaryPath; } } From 2d305862ce4dd213cdab06c0c5e68dfa733c70fb Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 12:54:51 +0200 Subject: [PATCH 369/819] vscode: fix chmod to octal literal Co-Authored-By: Aleksey Kladov --- rust-analyzer/editors/code/src/installation/language_server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index d09fc63a..ea1228e4 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -48,7 +48,7 @@ export async function downloadLatestLanguageServer( } ); - await fs.chmod(installationPath, 755); // Set (rwx, r_x, r_x) permissions + await fs.chmod(installationPath, 0o755); // Set (rwx, r_x, r_x) permissions } export async function ensureLanguageServerBinary( langServerSource: null | BinarySource From aba3da2033351d73a642f9e61e3a79d30d1e59b7 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 13:36:36 +0200 Subject: [PATCH 370/819] vscode: refactor levels of code nesting and string literals quotes --- .../code/src/installation/language_server.ts | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index ea1228e4..e571cbc9 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -71,9 +71,10 @@ export async function ensureLanguageServerBinary( if (isBinaryAvailable(langServerSource.path)) { return langServerSource.path; } + vscode.window.showErrorMessage( `Unable to run ${langServerSource.path} binary. ` + - "To use the pre-built language server, set `rust-analyzer.raLspServerPath` " + + `To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` + "value to `null` or remove it from the settings to use it by default." ); return null; @@ -81,34 +82,37 @@ export async function ensureLanguageServerBinary( case BinarySource.Type.GithubRelease: { const prebuiltBinaryPath = path.join(langServerSource.dir, langServerSource.file); - if (!isBinaryAvailable(prebuiltBinaryPath)) { - const userResponse = await vscode.window.showInformationMessage( - "Language server binary for rust-analyzer was not found. " + - "Do you want to download it now?", - "Download now", "Cancel" - ); - if (userResponse !== "Download now") return null; - - try { - await downloadLatestLanguageServer(langServerSource); - } catch (err) { - await vscode.window.showErrorMessage( - `Failed to download language server from ${langServerSource.repo.name} ` + - `GitHub repository: ${err.message}` - ); - return null; - } - - - assert( - isBinaryAvailable(prebuiltBinaryPath), - "Downloaded language server binary is not functional" - ); + if (isBinaryAvailable(prebuiltBinaryPath)) { + return prebuiltBinaryPath; + } - vscode.window.showInformationMessage( - "Rust analyzer language server was successfully installed 🦀" + const userResponse = await vscode.window.showInformationMessage( + "Language server binary for rust-analyzer was not found. " + + "Do you want to download it now?", + "Download now", "Cancel" + ); + if (userResponse !== "Download now") return null; + + try { + await downloadLatestLanguageServer(langServerSource); + } catch (err) { + await vscode.window.showErrorMessage( + `Failed to download language server from ${langServerSource.repo.name} ` + + `GitHub repository: ${err.message}` ); + return null; } + + + assert( + isBinaryAvailable(prebuiltBinaryPath), + "Downloaded language server binary is not functional" + ); + + vscode.window.showInformationMessage( + "Rust analyzer language server was successfully installed 🦀" + ); + return prebuiltBinaryPath; } } From 5e53657b4ad2f97b0ce8ef993139fdf0154a2800 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 13:39:54 +0200 Subject: [PATCH 371/819] vscode: remove noise data fields declarations as per @matklad --- .../src/installation/fetch_latest_artifact_metadata.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts index cda955af..f1019e08 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts @@ -31,17 +31,12 @@ export async function fetchLatestArtifactMetadata( downloadUrl: artifact.browser_download_url }; - // Noise denotes tremendous amount of data that we are not using here + // We omit declaration of tremendous amount of fields that we are not using here interface GithubRelease { name: string; assets: Array<{ name: string; browser_download_url: string; - - [noise: string]: unknown; }>; - - [noise: string]: unknown; } - } From 56d1fccf426cda46278a33e74331803e3b5454c5 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 13:45:06 +0200 Subject: [PATCH 372/819] vscode: refactor inverted ternaries to if statements as per @matklad --- rust-analyzer/editors/code/src/config.ts | 4 +++- .../code/src/installation/fetch_latest_artifact_metadata.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 46394600..d5f3da2e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -97,7 +97,9 @@ export class Config { const prebuiltBinaryName = Config.prebuiltLangServerFileName(process.platform); - return !prebuiltBinaryName ? null : { + if (!prebuiltBinaryName) return null; + + return { type: BinarySource.Type.GithubRelease, dir: ctx.globalStoragePath, file: prebuiltBinaryName, diff --git a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts index f1019e08..9141c92e 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts @@ -26,7 +26,9 @@ export async function fetchLatestArtifactMetadata( const artifact = response.assets.find(artifact => artifact.name === artifactFileName); - return !artifact ? null : { + if (!artifact) return null; + + return { releaseName: response.name, downloadUrl: artifact.browser_download_url }; From c4da9a6679eb300f5750640244bd7955742a9e90 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 13:59:27 +0200 Subject: [PATCH 373/819] vscode: replaced unwrapNotNil() with ! as per @matklad --- rust-analyzer/editors/code/package-lock.json | 13 ------------- rust-analyzer/editors/code/package.json | 1 - .../code/src/installation/language_server.ts | 10 +++------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 1b7c8910..5c056463 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -753,19 +753,6 @@ "os-tmpdir": "~1.0.1" } }, - "ts-not-nil": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ts-not-nil/-/ts-not-nil-1.0.1.tgz", - "integrity": "sha512-19+u+3okJddVZlrIdTOdFBaMsHYDInIGDPiujxfRa0RS2Ch5055zVG4GAqa+CZ/Rd1a+7ORSm8O4+2kesPymtw==", - "requires": { - "ts-typedefs": ">=3.2.0" - } - }, - "ts-typedefs": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ts-typedefs/-/ts-typedefs-3.2.0.tgz", - "integrity": "sha512-NglEH2YiY40YxNAvwBISqqXRTKlQq6x+qoCF+tkjPxwrPbrkmq7V3LXavmxrD63fENtMhFkcqgMJtOirtow9iA==" - }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c0a62619..f687eb8d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,7 +27,6 @@ "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", "throttle-debounce": "^2.1.0", - "ts-not-nil": "^1.0.1", "vscode-languageclient": "^6.1.0" }, "devDependencies": { diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index e571cbc9..a169eae4 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -1,4 +1,3 @@ -import { unwrapNotNil } from "ts-not-nil"; import { spawnSync } from "child_process"; import * as vscode from "vscode"; import * as path from "path"; @@ -12,12 +11,9 @@ import { downloadFile } from "./download_file"; export async function downloadLatestLanguageServer( {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease ) { - const binaryMetadata = await fetchLatestArtifactMetadata(repo, artifactFileName); - - const { - releaseName, - downloadUrl - } = unwrapNotNil(binaryMetadata, `Latest GitHub release lacks "${artifactFileName}" file`); + const { releaseName, downloadUrl } = (await fetchLatestArtifactMetadata( + repo, artifactFileName + ))!; await fs.mkdir(installationDir).catch(err => assert.strictEqual( err?.code, From 276d33238ab10d3e3c0e5377b927331499a4864f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 14:18:05 +0200 Subject: [PATCH 374/819] vscode: move throtting of download progress to call site --- .../code/src/installation/download_file.ts | 8 +++--- .../code/src/installation/language_server.ts | 27 +++++++++++-------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index ec16dcd6..53bf46d7 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -1,20 +1,18 @@ import fetch from "node-fetch"; -import { throttle } from "throttle-debounce"; import * as fs from "fs"; import { strict as assert } from "assert"; /** * Downloads file from `url` and stores it at `destFilePath`. - * `onProgress` callback is periodically called to track the progress of downloading, - * it gets the already read and total amount of bytes to read as its parameters. + * `onProgress` callback is called on recieveing each chunk of bytes + * to track the progress of downloading, it gets the already read and total + * amount of bytes to read as its parameters. */ export async function downloadFile( url: string, destFilePath: fs.PathLike, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - onProgress = throttle(200, /* noTrailing: */ true, onProgress); - const response = await fetch(url); const totalBytes = Number(response.headers.get('content-length')); diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index a169eae4..c1f37f97 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -1,8 +1,9 @@ -import { spawnSync } from "child_process"; import * as vscode from "vscode"; import * as path from "path"; import { strict as assert } from "assert"; import { promises as fs } from "fs"; +import { spawnSync } from "child_process"; +import { throttle } from "throttle-debounce"; import { BinarySource } from "./interfaces"; import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata"; @@ -28,19 +29,23 @@ export async function downloadLatestLanguageServer( { location: vscode.ProgressLocation.Notification, cancellable: false, // FIXME: add support for canceling download? - title: `Downloading language server ${releaseName}` + title: `Downloading language server (${releaseName})` }, async (progress, _cancellationToken) => { let lastPrecentage = 0; - await downloadFile(downloadUrl, installationPath, (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPrecentage - }); - - lastPrecentage = newPercentage; - }); + await downloadFile(downloadUrl, installationPath, throttle( + 200, + /* noTrailing: */ true, + (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPrecentage + }); + + lastPrecentage = newPercentage; + }) + ); } ); From 6a68371f34066400eb982ae3bab2c906f65953f1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 15:01:00 +0200 Subject: [PATCH 375/819] vscode: added logging when donloading binaries --- .../code/src/installation/download_file.ts | 2 ++ .../fetch_latest_artifact_metadata.ts | 2 ++ .../code/src/installation/language_server.ts | 27 +++++++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 53bf46d7..b51602ef 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -20,6 +20,8 @@ export async function downloadFile( let readBytes = 0; + console.log("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); + return new Promise((resolve, reject) => response.body .on("data", (chunk: Buffer) => { readBytes += chunk.length; diff --git a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts index 9141c92e..7e370060 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_metadata.ts @@ -19,6 +19,8 @@ export async function fetchLatestArtifactMetadata( // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) + console.log("Issuing request for released artifacts metadata to", requestUrl); + const response: GithubRelease = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index c1f37f97..1ce67b8b 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -2,6 +2,7 @@ import * as vscode from "vscode"; import * as path from "path"; import { strict as assert } from "assert"; import { promises as fs } from "fs"; +import { promises as dns } from "dns"; import { spawnSync } from "child_process"; import { throttle } from "throttle-debounce"; @@ -25,6 +26,7 @@ export async function downloadLatestLanguageServer( const installationPath = path.join(installationDir, artifactFileName); + console.time("Downloading ra_lsp_server"); await vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, @@ -48,6 +50,7 @@ export async function downloadLatestLanguageServer( ); } ); + console.timeEnd("Downloading ra_lsp_server"); await fs.chmod(installationPath, 0o755); // Set (rwx, r_x, r_x) permissions } @@ -101,15 +104,21 @@ export async function ensureLanguageServerBinary( `Failed to download language server from ${langServerSource.repo.name} ` + `GitHub repository: ${err.message}` ); + + await dns.resolve('www.google.com').catch(err => { + console.error("DNS resolution failed, there might be an issue with Internet availability"); + console.error(err); + }); + return null; } - - assert( - isBinaryAvailable(prebuiltBinaryPath), - "Downloaded language server binary is not functional" + if (!isBinaryAvailable(prebuiltBinaryPath)) assert(false, + `Downloaded language server binary is not functional.` + + `Downloaded from: ${JSON.stringify(langServerSource)}` ); + vscode.window.showInformationMessage( "Rust analyzer language server was successfully installed 🦀" ); @@ -119,6 +128,14 @@ export async function ensureLanguageServerBinary( } function isBinaryAvailable(binaryPath: string) { - return spawnSync(binaryPath, ["--version"]).status === 0; + const res = spawnSync(binaryPath, ["--version"]); + + // ACHTUNG! `res` type declaration is inherently wrong, see + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 + + console.log("Checked binary availablity via --version", res); + console.log(binaryPath, "--version output:", res.output?.map(String)); + + return res.status === 0; } } From 39ecdd6b9fdcb3ba930123f2733a226459fa13cd Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 21:55:29 +0200 Subject: [PATCH 376/819] vscode: removed unnecessary awaits --- .../editors/code/src/installation/language_server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 1ce67b8b..9fb1ce42 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -100,12 +100,12 @@ export async function ensureLanguageServerBinary( try { await downloadLatestLanguageServer(langServerSource); } catch (err) { - await vscode.window.showErrorMessage( + vscode.window.showErrorMessage( `Failed to download language server from ${langServerSource.repo.name} ` + `GitHub repository: ${err.message}` ); - await dns.resolve('www.google.com').catch(err => { + dns.resolve('www.google.com').catch(err => { console.error("DNS resolution failed, there might be an issue with Internet availability"); console.error(err); }); From fba782dc43bde97998fdc254584c24e415ae80ec Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 22:00:33 +0200 Subject: [PATCH 377/819] vscode: add on-success logic to dns resolution sanity check --- .../editors/code/src/installation/language_server.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 9fb1ce42..fd8b2caa 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -105,10 +105,13 @@ export async function ensureLanguageServerBinary( `GitHub repository: ${err.message}` ); - dns.resolve('www.google.com').catch(err => { - console.error("DNS resolution failed, there might be an issue with Internet availability"); - console.error(err); - }); + dns.resolve('www.google.com').then( + addrs => console.log("DNS resolution was successful", addrs), + err => { + console.error("DNS resolution failed, there might be an issue with Internet availability"); + console.error(err); + } + ); return null; } From ea2bb2f30a1b7e3f176a08e6e5c513e2ea037f7b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 9 Feb 2020 22:27:01 +0200 Subject: [PATCH 378/819] vscode: changed dns sanity-check url from google.com to example.com --- .../editors/code/src/installation/language_server.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index fd8b2caa..3510f917 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -105,10 +105,13 @@ export async function ensureLanguageServerBinary( `GitHub repository: ${err.message}` ); - dns.resolve('www.google.com').then( - addrs => console.log("DNS resolution was successful", addrs), + dns.resolve('example.com').then( + addrs => console.log("DNS resolution for example.com was successful", addrs), err => { - console.error("DNS resolution failed, there might be an issue with Internet availability"); + console.error( + "DNS resolution for example.com failed, " + + "there might be an issue with Internet availability" + ); console.error(err); } ); From b86d7063a154df6f07336d557fd3f5b801da6ae3 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 10 Feb 2020 23:12:20 +0200 Subject: [PATCH 379/819] vscode: fix ebusy error on windows --- rust-analyzer/editors/code/src/installation/download_file.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index b51602ef..fe356c39 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -27,8 +27,7 @@ export async function downloadFile( readBytes += chunk.length; onProgress(readBytes, totalBytes); }) - .on("end", resolve) .on("error", reject) - .pipe(fs.createWriteStream(destFilePath)) + .pipe(fs.createWriteStream(destFilePath).on("close", resolve)) ); } From 3c7480583572ce4066c7881b6f2c7f093eb5fedf Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 11 Feb 2020 02:14:04 +0200 Subject: [PATCH 380/819] vscode: add error handling to downloadFile() --- .../editors/code/src/installation/download_file.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index b51602ef..9d37eaa0 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -13,16 +13,23 @@ export async function downloadFile( destFilePath: fs.PathLike, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - const response = await fetch(url); + const res = await fetch(url); - const totalBytes = Number(response.headers.get('content-length')); + if (!res.ok) { + console.log("Error", res.status, "while downloading file from", url); + console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 }); + + throw new Error(`Got response ${res.status} when trying to download a file`); + } + + const totalBytes = Number(res.headers.get('content-length')); assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol"); let readBytes = 0; console.log("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); - return new Promise((resolve, reject) => response.body + return new Promise((resolve, reject) => res.body .on("data", (chunk: Buffer) => { readBytes += chunk.length; onProgress(readBytes, totalBytes); From 7e94f750cfda035ff2c802990cc62c0267cd556f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 11 Feb 2020 02:29:11 +0200 Subject: [PATCH 381/819] vscode: filter out arm linux from using prebuilt binaries --- rust-analyzer/editors/code/src/config.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index d5f3da2e..41884543 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -64,9 +64,24 @@ export class Config { * `platform` on GitHub releases. (It is also stored under the same name when * downloaded by the extension). */ - private static prebuiltLangServerFileName(platform: NodeJS.Platform): null | string { + private static prebuiltLangServerFileName( + platform: NodeJS.Platform, + arch: string + ): null | string { + // See possible `arch` values here: + // https://nodejs.org/api/process.html#process_process_arch + switch (platform) { - case "linux": return "ra_lsp_server-linux"; + + case "linux": { + switch (arch) { + case "arm": + case "arm64": return null; + + default: return "ra_lsp_server-linux"; + } + } + case "darwin": return "ra_lsp_server-mac"; case "win32": return "ra_lsp_server-windows.exe"; @@ -95,7 +110,9 @@ export class Config { }; } - const prebuiltBinaryName = Config.prebuiltLangServerFileName(process.platform); + const prebuiltBinaryName = Config.prebuiltLangServerFileName( + process.platform, process.arch + ); if (!prebuiltBinaryName) return null; From 3c7ceca6c77180cc36ca389e118088f77a75918b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 11 Feb 2020 22:34:52 +0200 Subject: [PATCH 382/819] vscode: remove chmod in favour of an option to createWriteStream() --- .../editors/code/src/installation/download_file.ts | 8 ++++++-- .../editors/code/src/installation/language_server.ts | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 8a0766c6..f1f9f4a2 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; import { strict as assert } from "assert"; /** - * Downloads file from `url` and stores it at `destFilePath`. + * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`. * `onProgress` callback is called on recieveing each chunk of bytes * to track the progress of downloading, it gets the already read and total * amount of bytes to read as its parameters. @@ -11,6 +11,7 @@ import { strict as assert } from "assert"; export async function downloadFile( url: string, destFilePath: fs.PathLike, + destFilePermissions: number, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { const res = await fetch(url); @@ -35,6 +36,9 @@ export async function downloadFile( onProgress(readBytes, totalBytes); }) .on("error", reject) - .pipe(fs.createWriteStream(destFilePath).on("close", resolve)) + .pipe(fs + .createWriteStream(destFilePath, { mode: destFilePermissions }) + .on("close", resolve) + ) ); } diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 3510f917..52c5cbe7 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -35,7 +35,8 @@ export async function downloadLatestLanguageServer( }, async (progress, _cancellationToken) => { let lastPrecentage = 0; - await downloadFile(downloadUrl, installationPath, throttle( + const filePermissions = 0o755; // (rwx, r_x, r_x) + await downloadFile(downloadUrl, installationPath, filePermissions, throttle( 200, /* noTrailing: */ true, (readBytes, totalBytes) => { @@ -51,8 +52,6 @@ export async function downloadLatestLanguageServer( } ); console.timeEnd("Downloading ra_lsp_server"); - - await fs.chmod(installationPath, 0o755); // Set (rwx, r_x, r_x) permissions } export async function ensureLanguageServerBinary( langServerSource: null | BinarySource From 796907cf99705606e1d8bd57aed64c6680ffd36d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 11 Feb 2020 23:58:20 +0200 Subject: [PATCH 383/819] vscode: added error handling to download file streams --- rust-analyzer/editors/code/package-lock.json | 5 ++++ rust-analyzer/editors/code/package.json | 1 + .../code/src/installation/download_file.ts | 23 +++++++++++++------ .../code/src/installation/language_server.ts | 2 ++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5c056463..e737d6ac 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -753,6 +753,11 @@ "os-tmpdir": "~1.0.1" } }, + "ts-nested-error": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/ts-nested-error/-/ts-nested-error-1.1.3.tgz", + "integrity": "sha512-CJSRAhXr6phdkuu65U/ctkY/TBzjkg2g1sL9juSG/PP3ONQNCbeksMy54OfCBTUt13hSpHNbnTO1OBPunOHj/Q==" + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f687eb8d..ce7117c6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,6 +27,7 @@ "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", "throttle-debounce": "^2.1.0", + "ts-nested-error": "^1.1.3", "vscode-languageclient": "^6.1.0" }, "devDependencies": { diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index f1f9f4a2..71700ec8 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -1,6 +1,9 @@ import fetch from "node-fetch"; import * as fs from "fs"; import { strict as assert } from "assert"; +import { NestedError } from "ts-nested-error"; + +class DownloadFileError extends NestedError {} /** * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`. @@ -14,13 +17,13 @@ export async function downloadFile( destFilePermissions: number, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - const res = await fetch(url); + const res = await fetch(url).catch(DownloadFileError.rethrow("Failed at initial fetch")); if (!res.ok) { console.log("Error", res.status, "while downloading file from", url); console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 }); - throw new Error(`Got response ${res.status} when trying to download a file`); + throw new DownloadFileError(`Got response ${res.status}`); } const totalBytes = Number(res.headers.get('content-length')); @@ -30,15 +33,21 @@ export async function downloadFile( console.log("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); + // Here reject() may be called 2 times. As per ECMAScript standard, 2-d call is ignored + // https://tc39.es/ecma262/#sec-promise-reject-functions + return new Promise((resolve, reject) => res.body .on("data", (chunk: Buffer) => { readBytes += chunk.length; onProgress(readBytes, totalBytes); }) - .on("error", reject) - .pipe(fs - .createWriteStream(destFilePath, { mode: destFilePermissions }) - .on("close", resolve) - ) + .on("error", err => reject( + new DownloadFileError(`Read-stream error, read bytes: ${readBytes}`, err) + )) + .pipe(fs.createWriteStream(destFilePath, { mode: destFilePermissions })) + .on("error", err => reject( + new DownloadFileError(`Write-stream error, read bytes: ${readBytes}`, err) + )) + .on("close", resolve) ); } diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/language_server.ts index 52c5cbe7..4797c3f0 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/language_server.ts @@ -104,6 +104,8 @@ export async function ensureLanguageServerBinary( `GitHub repository: ${err.message}` ); + console.error(err); + dns.resolve('example.com').then( addrs => console.log("DNS resolution for example.com was successful", addrs), err => { From 011d5199343d0073d039442e9e287812c77f5d02 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 12 Feb 2020 21:40:35 +0200 Subject: [PATCH 384/819] vscode: switched to stream.pipeline with .on(close) workaround --- .../code/src/installation/download_file.ts | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 71700ec8..b31d2a73 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -1,8 +1,12 @@ import fetch from "node-fetch"; import * as fs from "fs"; +import * as stream from "stream"; +import * as util from "util"; import { strict as assert } from "assert"; import { NestedError } from "ts-nested-error"; +const pipeline = util.promisify(stream.pipeline); + class DownloadFileError extends NestedError {} /** @@ -29,25 +33,19 @@ export async function downloadFile( const totalBytes = Number(res.headers.get('content-length')); assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol"); - let readBytes = 0; - console.log("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); - // Here reject() may be called 2 times. As per ECMAScript standard, 2-d call is ignored - // https://tc39.es/ecma262/#sec-promise-reject-functions - - return new Promise((resolve, reject) => res.body - .on("data", (chunk: Buffer) => { - readBytes += chunk.length; - onProgress(readBytes, totalBytes); - }) - .on("error", err => reject( - new DownloadFileError(`Read-stream error, read bytes: ${readBytes}`, err) - )) - .pipe(fs.createWriteStream(destFilePath, { mode: destFilePermissions })) - .on("error", err => reject( - new DownloadFileError(`Write-stream error, read bytes: ${readBytes}`, err) - )) - .on("close", resolve) - ); + let readBytes = 0; + res.body.on("data", (chunk: Buffer) => { + readBytes += chunk.length; + onProgress(readBytes, totalBytes); + }); + + const destFileStream = fs.createWriteStream(destFilePath, { mode: destFilePermissions }); + + await pipeline(res.body, destFileStream).catch(DownloadFileError.rethrow("Piping file error")); + return new Promise(resolve => { + destFileStream.on("close", resolve); // details on workaround: https://github.com/rust-analyzer/rust-analyzer/pull/3092#discussion_r378191131 + destFileStream.destroy(); + }); } From 6f61960535973315ecd76a7daa228a3fcd2efebb Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 13 Feb 2020 22:21:19 +0200 Subject: [PATCH 385/819] vscode: replaced DownloadFileError with NestedError itself for simplicity --- .../editors/code/src/installation/download_file.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index b31d2a73..591de0d3 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -7,8 +7,6 @@ import { NestedError } from "ts-nested-error"; const pipeline = util.promisify(stream.pipeline); -class DownloadFileError extends NestedError {} - /** * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`. * `onProgress` callback is called on recieveing each chunk of bytes @@ -21,13 +19,13 @@ export async function downloadFile( destFilePermissions: number, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - const res = await fetch(url).catch(DownloadFileError.rethrow("Failed at initial fetch")); + const res = await fetch(url).catch(NestedError.rethrow("Failed at initial fetch")); if (!res.ok) { console.log("Error", res.status, "while downloading file from", url); console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 }); - throw new DownloadFileError(`Got response ${res.status}`); + throw new NestedError(`Got response ${res.status}`); } const totalBytes = Number(res.headers.get('content-length')); @@ -43,9 +41,12 @@ export async function downloadFile( const destFileStream = fs.createWriteStream(destFilePath, { mode: destFilePermissions }); - await pipeline(res.body, destFileStream).catch(DownloadFileError.rethrow("Piping file error")); + await pipeline(res.body, destFileStream).catch(NestedError.rethrow("Piping file error")); return new Promise(resolve => { - destFileStream.on("close", resolve); // details on workaround: https://github.com/rust-analyzer/rust-analyzer/pull/3092#discussion_r378191131 + destFileStream.on("close", resolve); destFileStream.destroy(); + + // Details on workaround: https://github.com/rust-analyzer/rust-analyzer/pull/3092#discussion_r378191131 + // Issue at nodejs repo: https://github.com/nodejs/node/issues/31776 }); } From 3e5c559f91b1470c444e071705fb1b0ba6c4214b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 13 Feb 2020 22:47:31 +0200 Subject: [PATCH 386/819] vscode: added more type safety to package.json config --- rust-analyzer/editors/code/package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f687eb8d..12d32cef 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -181,6 +181,9 @@ }, "rust-analyzer.excludeGlobs": { "type": "array", + "items": { + "type": "string" + }, "default": [], "description": "Paths to exclude from analysis" }, @@ -196,6 +199,9 @@ }, "rust-analyzer.cargo-watch.arguments": { "type": "array", + "items": { + "type": "string" + }, "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": [] }, @@ -241,6 +247,7 @@ "rust-analyzer.maxInlayHintLength": { "type": "number", "default": 20, + "exclusiveMinimum": 0, "description": "Maximum length for inlay hints" }, "rust-analyzer.cargoFeatures.noDefaultFeatures": { @@ -255,6 +262,9 @@ }, "rust-analyzer.cargoFeatures.features": { "type": "array", + "items": { + "type": "string" + }, "default": [], "description": "List of features to activate" } From b02d3664fa9fdc9c42ec6f7b3982a05ecfe1575d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 13 Feb 2020 22:48:20 +0200 Subject: [PATCH 387/819] vscode: redesigned config with simplicity and Dart extension config implementation in mind --- rust-analyzer/editors/code/src/client.ts | 36 +-- rust-analyzer/editors/code/src/config.ts | 258 +++++------------- .../editors/code/src/highlighting.ts | 6 +- rust-analyzer/editors/code/src/inlay_hints.ts | 6 +- .../editors/code/src/status_display.ts | 6 +- 5 files changed, 96 insertions(+), 216 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 2e3d4aba..a6fb0453 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -1,6 +1,6 @@ import * as lc from 'vscode-languageclient'; +import * as vscode from 'vscode'; -import { window, workspace } from 'vscode'; import { Config } from './config'; import { ensureLanguageServerBinary } from './installation/language_server'; @@ -8,37 +8,39 @@ export async function createClient(config: Config): Promise `${Config.rootSection}.${opt}`); + + private cfg!: vscode.WorkspaceConfiguration; + + private refreshConfig() { + this.cfg = vscode.workspace.getConfiguration(Config.rootSection); + console.log("Using configuration:", this.cfg); + } - highlightingOn = true; - rainbowHighlightingOn = false; - enableEnhancedTyping = true; - lruCapacity: null | number = null; - displayInlayHints = true; - maxInlayHintLength: null | number = null; - excludeGlobs: string[] = []; - useClientWatching = true; - featureFlags: Record = {}; - // for internal use - withSysroot: null | boolean = null; - cargoWatchOptions: CargoWatchOptions = { - enable: true, - arguments: [], - command: '', - allTargets: true, - }; - cargoFeatures: CargoFeatures = { - noDefaultFeatures: false, - allFeatures: true, - features: [], - }; + constructor(private ctx: vscode.ExtensionContext) { + vscode.workspace.onDidChangeConfiguration(this.onConfigChange, this, ctx.subscriptions); + this.refreshConfig(); + } + + async onConfigChange(event: vscode.ConfigurationChangeEvent) { + this.refreshConfig(); + + const requiresReloadOpt = Config.requiresReloadOpts.find( + opt => event.affectsConfiguration(opt) + ); - private prevEnhancedTyping: null | boolean = null; - private prevCargoFeatures: null | CargoFeatures = null; - private prevCargoWatchOptions: null | CargoWatchOptions = null; + if (!requiresReloadOpt) return; - constructor(ctx: vscode.ExtensionContext) { - vscode.workspace.onDidChangeConfiguration(_ => this.refresh(ctx), null, ctx.subscriptions); - this.refresh(ctx); + const userResponse = await vscode.window.showInformationMessage( + `Changing "${requiresReloadOpt}" requires a reload`, + "Reload now" + ); + + if (userResponse === "Reload now") { + vscode.commands.executeCommand("workbench.action.reloadWindow"); + } } - private static expandPathResolving(path: string) { - if (path.startsWith('~/')) { - return path.replace('~', os.homedir()); + private static replaceTildeWithHomeDir(path: string) { + if (path.startsWith("~/")) { + return os.homedir() + path.slice("~".length); } return path; } @@ -97,16 +100,13 @@ export class Config { } } - private static langServerBinarySource( - ctx: vscode.ExtensionContext, - config: vscode.WorkspaceConfiguration - ): null | BinarySource { - const langServerPath = RA_LSP_DEBUG ?? config.get("raLspServerPath"); + langServerBinarySource(): null | BinarySource { + const langServerPath = RA_LSP_DEBUG ?? this.cfg.get("raLspServerPath"); if (langServerPath) { return { type: BinarySource.Type.ExplicitPath, - path: Config.expandPathResolving(langServerPath) + path: Config.replaceTildeWithHomeDir(langServerPath) }; } @@ -118,7 +118,7 @@ export class Config { return { type: BinarySource.Type.GithubRelease, - dir: ctx.globalStoragePath, + dir: this.ctx.globalStoragePath, file: prebuiltBinaryName, repo: { name: "rust-analyzer", @@ -127,158 +127,36 @@ export class Config { }; } + // We don't do runtime config validation here for simplicity. More on stackoverflow: + // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - // FIXME: revisit the logic for `if (.has(...)) config.get(...)` set default - // values only in one place (i.e. remove default values from non-readonly members declarations) - private refresh(ctx: vscode.ExtensionContext) { - const config = vscode.workspace.getConfiguration('rust-analyzer'); - - let requireReloadMessage = null; - - if (config.has('highlightingOn')) { - this.highlightingOn = config.get('highlightingOn') as boolean; - } - - if (config.has('rainbowHighlightingOn')) { - this.rainbowHighlightingOn = config.get( - 'rainbowHighlightingOn', - ) as boolean; - } - - if (config.has('enableEnhancedTyping')) { - this.enableEnhancedTyping = config.get( - 'enableEnhancedTyping', - ) as boolean; - - if (this.prevEnhancedTyping === null) { - this.prevEnhancedTyping = this.enableEnhancedTyping; - } - } else if (this.prevEnhancedTyping === null) { - this.prevEnhancedTyping = this.enableEnhancedTyping; - } - - if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { - requireReloadMessage = - 'Changing enhanced typing setting requires a reload'; - this.prevEnhancedTyping = this.enableEnhancedTyping; - } - - this.langServerSource = Config.langServerBinarySource(ctx, config); - - if (config.has('cargo-watch.enable')) { - this.cargoWatchOptions.enable = config.get( - 'cargo-watch.enable', - true, - ); - } - - if (config.has('cargo-watch.arguments')) { - this.cargoWatchOptions.arguments = config.get( - 'cargo-watch.arguments', - [], - ); - } - - if (config.has('cargo-watch.command')) { - this.cargoWatchOptions.command = config.get( - 'cargo-watch.command', - '', - ); - } + // FIXME: add codegen for primitive configurations + highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } + rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } + lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } + displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } + maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } + excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } + useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } + featureFlags() { return this.cfg.get("featureFlags") as Record; } - if (config.has('cargo-watch.allTargets')) { - this.cargoWatchOptions.allTargets = config.get( - 'cargo-watch.allTargets', - true, - ); - } - - if (config.has('lruCapacity')) { - this.lruCapacity = config.get('lruCapacity') as number; - } - - if (config.has('displayInlayHints')) { - this.displayInlayHints = config.get('displayInlayHints') as boolean; - } - if (config.has('maxInlayHintLength')) { - this.maxInlayHintLength = config.get( - 'maxInlayHintLength', - ) as number; - } - if (config.has('excludeGlobs')) { - this.excludeGlobs = config.get('excludeGlobs') || []; - } - if (config.has('useClientWatching')) { - this.useClientWatching = config.get('useClientWatching') || true; - } - if (config.has('featureFlags')) { - this.featureFlags = config.get('featureFlags') || {}; - } - if (config.has('withSysroot')) { - this.withSysroot = config.get('withSysroot') || false; - } - - if (config.has('cargoFeatures.noDefaultFeatures')) { - this.cargoFeatures.noDefaultFeatures = config.get( - 'cargoFeatures.noDefaultFeatures', - false, - ); - } - if (config.has('cargoFeatures.allFeatures')) { - this.cargoFeatures.allFeatures = config.get( - 'cargoFeatures.allFeatures', - true, - ); - } - if (config.has('cargoFeatures.features')) { - this.cargoFeatures.features = config.get( - 'cargoFeatures.features', - [], - ); - } - - if ( - this.prevCargoFeatures !== null && - (this.cargoFeatures.allFeatures !== - this.prevCargoFeatures.allFeatures || - this.cargoFeatures.noDefaultFeatures !== - this.prevCargoFeatures.noDefaultFeatures || - this.cargoFeatures.features.length !== - this.prevCargoFeatures.features.length || - this.cargoFeatures.features.some( - (v, i) => v !== this.prevCargoFeatures!.features[i], - )) - ) { - requireReloadMessage = 'Changing cargo features requires a reload'; - } - this.prevCargoFeatures = { ...this.cargoFeatures }; - - if (this.prevCargoWatchOptions !== null) { - const changed = - this.cargoWatchOptions.enable !== this.prevCargoWatchOptions.enable || - this.cargoWatchOptions.command !== this.prevCargoWatchOptions.command || - this.cargoWatchOptions.allTargets !== this.prevCargoWatchOptions.allTargets || - this.cargoWatchOptions.arguments.length !== this.prevCargoWatchOptions.arguments.length || - this.cargoWatchOptions.arguments.some( - (v, i) => v !== this.prevCargoWatchOptions!.arguments[i], - ); - if (changed) { - requireReloadMessage = 'Changing cargo-watch options requires a reload'; - } - } - this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; + cargoWatchOptions(): CargoWatchOptions { + return { + enable: this.cfg.get("cargo-watch.enable") as boolean, + arguments: this.cfg.get("cargo-watch.arguments") as string[], + allTargets: this.cfg.get("cargo-watch.allTargets") as boolean, + command: this.cfg.get("cargo-watch.command") as string, + }; + } - if (requireReloadMessage !== null) { - const reloadAction = 'Reload now'; - vscode.window - .showInformationMessage(requireReloadMessage, reloadAction) - .then(selectedAction => { - if (selectedAction === reloadAction) { - vscode.commands.executeCommand( - 'workbench.action.reloadWindow', - ); - } - }); - } + cargoFeatures(): CargoFeatures { + return { + noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, + allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, + features: this.cfg.get("cargoFeatures.features") as string[], + }; } + + // for internal use + withSysroot() { return this.cfg.get("withSysroot", false); } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4fbbe3dd..e2ae31d2 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -11,7 +11,7 @@ export function activateHighlighting(ctx: Ctx) { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { - if (!ctx.config.highlightingOn) return; + if (!ctx.config.highlightingOn()) return; const targetEditor = vscode.window.visibleTextEditors.find( editor => { @@ -39,7 +39,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; - if (!ctx.config.highlightingOn) return; + if (!ctx.config.highlightingOn()) return; const client = ctx.client; if (!client) return; @@ -122,7 +122,7 @@ class Highlighter { string, [vscode.Range[], boolean] > = new Map(); - const rainbowTime = this.ctx.config.rainbowHighlightingOn; + const rainbowTime = this.ctx.config.rainbowHighlightingOn(); for (const tag of this.decorations.keys()) { byTag.set(tag, []); diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 1c019a51..3ff45a62 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -22,12 +22,12 @@ export function activateInlayHints(ctx: Ctx) { ); vscode.workspace.onDidChangeConfiguration( - async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints), + async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints()), null, ctx.subscriptions ); - ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); + ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints())); } interface InlayHintsParams { @@ -59,7 +59,7 @@ class HintsUpdater { constructor(ctx: Ctx) { this.ctx = ctx; - this.enabled = ctx.config.displayInlayHints; + this.enabled = ctx.config.displayInlayHints(); } async setEnabled(enabled: boolean) { diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 51dbf388..ae9a7b1b 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -7,7 +7,7 @@ import { Ctx } from './ctx'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export function activateStatusDisplay(ctx: Ctx) { - const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); + const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions().command); ctx.pushCleanup(statusDisplay); ctx.onDidRestart(client => ctx.pushCleanup(client.onProgress( WorkDoneProgress.type, @@ -66,9 +66,9 @@ class StatusDisplay implements Disposable { refreshLabel() { if (this.packageName) { - this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`; + this.statusBarItem.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`; } else { - this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command}`; + this.statusBarItem.text = `${spinnerFrames[this.i]} cargo ${this.command}`; } } From 0033cc2663cc9739d8851a23a3770d77f2a7f7c2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 13 Feb 2020 23:05:32 +0200 Subject: [PATCH 388/819] vscode: reordered config constructor before methods --- rust-analyzer/editors/code/src/config.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 6c474246..349f8027 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -26,16 +26,17 @@ export class Config { private cfg!: vscode.WorkspaceConfiguration; + constructor(private readonly ctx: vscode.ExtensionContext) { + vscode.workspace.onDidChangeConfiguration(this.onConfigChange, this, ctx.subscriptions); + this.refreshConfig(); + } + + private refreshConfig() { this.cfg = vscode.workspace.getConfiguration(Config.rootSection); console.log("Using configuration:", this.cfg); } - constructor(private ctx: vscode.ExtensionContext) { - vscode.workspace.onDidChangeConfiguration(this.onConfigChange, this, ctx.subscriptions); - this.refreshConfig(); - } - async onConfigChange(event: vscode.ConfigurationChangeEvent) { this.refreshConfig(); From f16537b1650d063ee9a3c90e0ebce38e5a63e7ba Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 14 Feb 2020 00:31:23 +0200 Subject: [PATCH 389/819] vscode: removed nested errors as per matklad --- rust-analyzer/editors/code/package-lock.json | 5 ----- rust-analyzer/editors/code/package.json | 1 - .../editors/code/src/installation/download_file.ts | 7 +++---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e737d6ac..5c056463 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -753,11 +753,6 @@ "os-tmpdir": "~1.0.1" } }, - "ts-nested-error": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/ts-nested-error/-/ts-nested-error-1.1.3.tgz", - "integrity": "sha512-CJSRAhXr6phdkuu65U/ctkY/TBzjkg2g1sL9juSG/PP3ONQNCbeksMy54OfCBTUt13hSpHNbnTO1OBPunOHj/Q==" - }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ce7117c6..f687eb8d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,7 +27,6 @@ "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", "throttle-debounce": "^2.1.0", - "ts-nested-error": "^1.1.3", "vscode-languageclient": "^6.1.0" }, "devDependencies": { diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 591de0d3..d154f481 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -3,7 +3,6 @@ import * as fs from "fs"; import * as stream from "stream"; import * as util from "util"; import { strict as assert } from "assert"; -import { NestedError } from "ts-nested-error"; const pipeline = util.promisify(stream.pipeline); @@ -19,13 +18,13 @@ export async function downloadFile( destFilePermissions: number, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { - const res = await fetch(url).catch(NestedError.rethrow("Failed at initial fetch")); + const res = await fetch(url); if (!res.ok) { console.log("Error", res.status, "while downloading file from", url); console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 }); - throw new NestedError(`Got response ${res.status}`); + throw new Error(`Got response ${res.status} when trying to download a file.`); } const totalBytes = Number(res.headers.get('content-length')); @@ -41,7 +40,7 @@ export async function downloadFile( const destFileStream = fs.createWriteStream(destFilePath, { mode: destFilePermissions }); - await pipeline(res.body, destFileStream).catch(NestedError.rethrow("Piping file error")); + await pipeline(res.body, destFileStream); return new Promise(resolve => { destFileStream.on("close", resolve); destFileStream.destroy(); From a7d4507c881cfbf88e3df7bf47e235e47b55499e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 14 Feb 2020 15:29:19 +0100 Subject: [PATCH 390/819] Prevent auto-update of dev extension --- rust-analyzer/editors/code/package-lock.json | 2 +- rust-analyzer/editors/code/package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 5c056463..a7a1829d 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.1.0", + "version": "0.2.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f687eb8d..2b8e5aec 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -5,7 +5,8 @@ "preview": true, "private": true, "icon": "icon.png", - "version": "0.1.0", + "//": "The real version is in release.yaml, this one just needs to be bigger", + "version": "0.2.0-dev", "publisher": "matklad", "repository": { "url": "https://github.com/rust-analyzer/rust-analyzer.git", From 63c387d2d4234ffeae7a42c2793a326408eaf7ee Mon Sep 17 00:00:00 2001 From: kjeremy Date: Fri, 14 Feb 2020 11:48:27 -0500 Subject: [PATCH 391/819] Do not register all proposed features Instead only opt-in to CallHierarchy since it has a vscode API but LSP support is still proposed. Discovered while working on SemanticTokens which does not have a vscode API and is still in the proposed state. Somehow enabling it would crash the language server. See https://github.com/microsoft/vscode-languageserver-node/issues/572 --- rust-analyzer/editors/code/src/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 2e3d4aba..d2759969 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import { window, workspace } from 'vscode'; import { Config } from './config'; import { ensureLanguageServerBinary } from './installation/language_server'; +import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; export async function createClient(config: Config): Promise { // '.' Is the fallback if no folder is open @@ -78,6 +79,10 @@ export async function createClient(config: Config): Promise Date: Fri, 14 Feb 2020 12:02:19 -0500 Subject: [PATCH 392/819] Expect vscode 1.42 --- rust-analyzer/editors/code/package-lock.json | 18 +++++++++--------- rust-analyzer/editors/code/package.json | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index a7a1829d..c7407873 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -107,9 +107,9 @@ "dev": true }, "@types/vscode": { - "version": "1.41.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.41.0.tgz", - "integrity": "sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A==", + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz", + "integrity": "sha512-ds6TceMsh77Fs0Mq0Vap6Y72JbGWB8Bay4DrnJlf5d9ui2RSe1wis13oQm+XhguOeH1HUfLGzaDAoupTUtgabw==", "dev": true }, "acorn": { @@ -662,9 +662,9 @@ } }, "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -860,9 +860,9 @@ "dev": true }, "vsce": { - "version": "1.71.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", - "integrity": "sha512-7k+LPC4oJYPyyxs0a5nh4A8CleQ6+2EMPiAiX/bDyN+PmwJFm2FFPqLRxdIsIWfFnkW4ZMQBf10+W62dCRd9kQ==", + "version": "1.73.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.73.0.tgz", + "integrity": "sha512-6W37Ebbkj3uF3WhT+SCfRtsneRQEFcGvf/XYz+b6OAgDCj4gPurWyDVrqw/HLsbP1WflGIyUfVZ8t5M7kQp6Uw==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2b8e5aec..db1fe518 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -16,7 +16,7 @@ "Other" ], "engines": { - "vscode": "^1.41.0" + "vscode": "^1.42.0" }, "scripts": { "vscode:prepublish": "tsc && rollup -c", @@ -36,13 +36,13 @@ "@types/node": "^12.12.25", "@types/node-fetch": "^2.5.4", "@types/throttle-debounce": "^2.1.0", - "@types/vscode": "^1.41.0", + "@types/vscode": "^1.42.0", "rollup": "^1.31.0", "tslib": "^1.10.0", "tslint": "^5.20.1", "typescript": "^3.7.5", "typescript-formatter": "^7.2.2", - "vsce": "^1.71.0" + "vsce": "^1.73.0" }, "activationEvents": [ "onLanguage:rust", From 98531ada29de3c57d29f6db33e2933489d35969f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 14 Feb 2020 23:04:50 +0200 Subject: [PATCH 393/819] vscode: moved to getters as per matklad --- rust-analyzer/editors/code/src/client.ts | 18 ++++----- rust-analyzer/editors/code/src/config.ts | 40 ++++++++----------- .../editors/code/src/highlighting.ts | 6 +-- rust-analyzer/editors/code/src/inlay_hints.ts | 6 +-- .../editors/code/src/status_display.ts | 2 +- 5 files changed, 33 insertions(+), 39 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index a6fb0453..4484b216 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -10,7 +10,7 @@ export async function createClient(config: Config): Promise("raLspServerPath"); if (langServerPath) { @@ -111,9 +108,7 @@ export class Config { }; } - const prebuiltBinaryName = Config.prebuiltLangServerFileName( - process.platform, process.arch - ); + const prebuiltBinaryName = this.prebuiltLangServerFileName; if (!prebuiltBinaryName) return null; @@ -131,17 +126,16 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - // FIXME: add codegen for primitive configurations - highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } - rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } - lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } - displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } - maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } - excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } - useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } - featureFlags() { return this.cfg.get("featureFlags") as Record; } - - cargoWatchOptions(): CargoWatchOptions { + get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } + get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } + get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } + get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } + get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } + get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } + get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } + get featureFlags() { return this.cfg.get("featureFlags") as Record; } + + get cargoWatchOptions(): CargoWatchOptions { return { enable: this.cfg.get("cargo-watch.enable") as boolean, arguments: this.cfg.get("cargo-watch.arguments") as string[], @@ -150,7 +144,7 @@ export class Config { }; } - cargoFeatures(): CargoFeatures { + get cargoFeatures(): CargoFeatures { return { noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, @@ -159,5 +153,5 @@ export class Config { } // for internal use - withSysroot() { return this.cfg.get("withSysroot", false); } + get withSysroot() { return this.cfg.get("withSysroot", false); } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index e2ae31d2..4fbbe3dd 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -11,7 +11,7 @@ export function activateHighlighting(ctx: Ctx) { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { - if (!ctx.config.highlightingOn()) return; + if (!ctx.config.highlightingOn) return; const targetEditor = vscode.window.visibleTextEditors.find( editor => { @@ -39,7 +39,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { if (!editor || editor.document.languageId !== 'rust') return; - if (!ctx.config.highlightingOn()) return; + if (!ctx.config.highlightingOn) return; const client = ctx.client; if (!client) return; @@ -122,7 +122,7 @@ class Highlighter { string, [vscode.Range[], boolean] > = new Map(); - const rainbowTime = this.ctx.config.rainbowHighlightingOn(); + const rainbowTime = this.ctx.config.rainbowHighlightingOn; for (const tag of this.decorations.keys()) { byTag.set(tag, []); diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 3ff45a62..1c019a51 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -22,12 +22,12 @@ export function activateInlayHints(ctx: Ctx) { ); vscode.workspace.onDidChangeConfiguration( - async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints()), + async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints), null, ctx.subscriptions ); - ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints())); + ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } interface InlayHintsParams { @@ -59,7 +59,7 @@ class HintsUpdater { constructor(ctx: Ctx) { this.ctx = ctx; - this.enabled = ctx.config.displayInlayHints(); + this.enabled = ctx.config.displayInlayHints; } async setEnabled(enabled: boolean) { diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index ae9a7b1b..993e79d7 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -7,7 +7,7 @@ import { Ctx } from './ctx'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export function activateStatusDisplay(ctx: Ctx) { - const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions().command); + const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); ctx.onDidRestart(client => ctx.pushCleanup(client.onProgress( WorkDoneProgress.type, From 2e302448f74350fbabc526e8783d60b768d3eb65 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 14 Feb 2020 23:06:11 +0200 Subject: [PATCH 394/819] make onConfigChange handler private --- rust-analyzer/editors/code/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 3ce66933..8cd89e11 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -37,7 +37,7 @@ export class Config { console.log("Using configuration:", this.cfg); } - async onConfigChange(event: vscode.ConfigurationChangeEvent) { + private async onConfigChange(event: vscode.ConfigurationChangeEvent) { this.refreshConfig(); const requiresReloadOpt = Config.requiresReloadOpts.find( From a7dc247fea7473033ca780c22f3794af0a38e1da Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Mon, 10 Feb 2020 22:45:38 +0000 Subject: [PATCH 395/819] Init implementation of structural search replace --- rust-analyzer/editors/code/package.json | 5 +++ .../editors/code/src/commands/index.ts | 1 + .../editors/code/src/commands/ssr.ts | 36 +++++++++++++++++++ rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 43 insertions(+) create mode 100644 rust-analyzer/editors/code/src/commands/ssr.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index db1fe518..e1a70f05 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -124,6 +124,11 @@ "command": "rust-analyzer.onEnter", "title": "Enhanced enter key", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.ssr", + "title": "Structural Search Replace", + "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index aee96943..b5ebec11 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -12,6 +12,7 @@ export * from './parent_module'; export * from './syntax_tree'; export * from './expand_macro'; export * from './runnables'; +export * from './ssr'; export function collectGarbage(ctx: Ctx): Cmd { return async () => { diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts new file mode 100644 index 00000000..6287bf47 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -0,0 +1,36 @@ +import { Ctx, Cmd } from '../ctx'; +import { applySourceChange, SourceChange } from '../source_change'; +import * as vscode from 'vscode'; + +export function ssr(ctx: Ctx): Cmd { + return async () => { + const client = ctx.client; + if (!client) return; + + const options: vscode.InputBoxOptions = { + placeHolder: "foo($a:expr, $b:expr) ==>> bar($a, foo($b))", + prompt: "Enter request", + validateInput: (x: string) => { + if (x.includes('==>>')) { + return null; + } + return "Enter request: pattern ==>> template" + } + } + const request = await vscode.window.showInputBox(options); + + if (!request) return; + + const ssrRequest: SsrRequest = { arg: request }; + const change = await client.sendRequest( + 'rust-analyzer/ssr', + ssrRequest, + ); + + await applySourceChange(ctx, change); + }; +} + +interface SsrRequest { + arg: string; +} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5efce41f..5a99e96f 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -22,6 +22,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('run', commands.run); ctx.registerCommand('reload', commands.reload); ctx.registerCommand('onEnter', commands.onEnter); + ctx.registerCommand('ssr', commands.ssr) // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); From 2854f68277b655d94a9a1099ccb9de52651a0025 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 15 Feb 2020 00:15:06 +0200 Subject: [PATCH 396/819] vscode: renmed ArtifactMetadata -> ArtifactReleaseInfo, languageServer -> langServer --- rust-analyzer/editors/code/src/client.ts | 4 ++-- ...tadata.ts => fetch_latest_artifact_release_info.ts} | 6 +++--- .../editors/code/src/installation/interfaces.ts | 2 +- .../{language_server.ts => lang_server.ts} | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) rename rust-analyzer/editors/code/src/installation/{fetch_latest_artifact_metadata.ts => fetch_latest_artifact_release_info.ts} (89%) rename rust-analyzer/editors/code/src/installation/{language_server.ts => lang_server.ts} (95%) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index dcf9d0c0..33d9b66d 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -2,7 +2,7 @@ import * as lc from 'vscode-languageclient'; import * as vscode from 'vscode'; import { Config } from './config'; -import { ensureLanguageServerBinary } from './installation/language_server'; +import { ensureLangServerBinary } from './installation/lang_server'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; export async function createClient(config: Config): Promise { @@ -11,7 +11,7 @@ export async function createClient(config: Config): Promise { +): Promise { const repoOwner = encodeURIComponent(repo.owner); const repoName = encodeURIComponent(repo.name); diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index 8039d0b9..93ea577d 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -6,7 +6,7 @@ export interface GithubRepo { /** * Metadata about particular artifact retrieved from GitHub releases. */ -export interface ArtifactMetadata { +export interface ArtifactReleaseInfo { releaseName: string; downloadUrl: string; } diff --git a/rust-analyzer/editors/code/src/installation/language_server.ts b/rust-analyzer/editors/code/src/installation/lang_server.ts similarity index 95% rename from rust-analyzer/editors/code/src/installation/language_server.ts rename to rust-analyzer/editors/code/src/installation/lang_server.ts index 4797c3f0..ccb936bf 100644 --- a/rust-analyzer/editors/code/src/installation/language_server.ts +++ b/rust-analyzer/editors/code/src/installation/lang_server.ts @@ -7,13 +7,13 @@ import { spawnSync } from "child_process"; import { throttle } from "throttle-debounce"; import { BinarySource } from "./interfaces"; -import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata"; +import { fetchLatestArtifactReleaseInfo } from "./fetch_latest_artifact_release_info"; import { downloadFile } from "./download_file"; -export async function downloadLatestLanguageServer( +export async function downloadLatestLangServer( {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease ) { - const { releaseName, downloadUrl } = (await fetchLatestArtifactMetadata( + const { releaseName, downloadUrl } = (await fetchLatestArtifactReleaseInfo( repo, artifactFileName ))!; @@ -53,7 +53,7 @@ export async function downloadLatestLanguageServer( ); console.timeEnd("Downloading ra_lsp_server"); } -export async function ensureLanguageServerBinary( +export async function ensureLangServerBinary( langServerSource: null | BinarySource ): Promise { @@ -97,7 +97,7 @@ export async function ensureLanguageServerBinary( if (userResponse !== "Download now") return null; try { - await downloadLatestLanguageServer(langServerSource); + await downloadLatestLangServer(langServerSource); } catch (err) { vscode.window.showErrorMessage( `Failed to download language server from ${langServerSource.repo.name} ` + From b32838940ac012c71db2820c221040cae221e68b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 15 Feb 2020 00:42:32 +0200 Subject: [PATCH 397/819] vscode: renamed langServer to server --- rust-analyzer/editors/code/src/client.ts | 8 +++---- rust-analyzer/editors/code/src/config.ts | 12 +++++----- .../{lang_server.ts => server.ts} | 24 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) rename rust-analyzer/editors/code/src/installation/{lang_server.ts => server.ts} (87%) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 33d9b66d..12c97be2 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -2,7 +2,7 @@ import * as lc from 'vscode-languageclient'; import * as vscode from 'vscode'; import { Config } from './config'; -import { ensureLangServerBinary } from './installation/lang_server'; +import { ensureServerBinary } from './installation/server'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; export async function createClient(config: Config): Promise { @@ -11,11 +11,11 @@ export async function createClient(config: Config): Promise("raLspServerPath"); + get serverBinarySource(): null | BinarySource { + const serverPath = RA_LSP_DEBUG ?? this.cfg.get("raLspServerPath"); - if (langServerPath) { + if (serverPath) { return { type: BinarySource.Type.ExplicitPath, - path: Config.replaceTildeWithHomeDir(langServerPath) + path: Config.replaceTildeWithHomeDir(serverPath) }; } - const prebuiltBinaryName = this.prebuiltLangServerFileName; + const prebuiltBinaryName = this.prebuiltServerFileName; if (!prebuiltBinaryName) return null; diff --git a/rust-analyzer/editors/code/src/installation/lang_server.ts b/rust-analyzer/editors/code/src/installation/server.ts similarity index 87% rename from rust-analyzer/editors/code/src/installation/lang_server.ts rename to rust-analyzer/editors/code/src/installation/server.ts index ccb936bf..406e2299 100644 --- a/rust-analyzer/editors/code/src/installation/lang_server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -10,7 +10,7 @@ import { BinarySource } from "./interfaces"; import { fetchLatestArtifactReleaseInfo } from "./fetch_latest_artifact_release_info"; import { downloadFile } from "./download_file"; -export async function downloadLatestLangServer( +export async function downloadLatestServer( {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease ) { const { releaseName, downloadUrl } = (await fetchLatestArtifactReleaseInfo( @@ -53,11 +53,11 @@ export async function downloadLatestLangServer( ); console.timeEnd("Downloading ra_lsp_server"); } -export async function ensureLangServerBinary( - langServerSource: null | BinarySource +export async function ensureServerBinary( + serverSource: null | BinarySource ): Promise { - if (!langServerSource) { + if (!serverSource) { vscode.window.showErrorMessage( "Unfortunately we don't ship binaries for your platform yet. " + "You need to manually clone rust-analyzer repository and " + @@ -69,21 +69,21 @@ export async function ensureLangServerBinary( return null; } - switch (langServerSource.type) { + switch (serverSource.type) { case BinarySource.Type.ExplicitPath: { - if (isBinaryAvailable(langServerSource.path)) { - return langServerSource.path; + if (isBinaryAvailable(serverSource.path)) { + return serverSource.path; } vscode.window.showErrorMessage( - `Unable to run ${langServerSource.path} binary. ` + + `Unable to run ${serverSource.path} binary. ` + `To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` + "value to `null` or remove it from the settings to use it by default." ); return null; } case BinarySource.Type.GithubRelease: { - const prebuiltBinaryPath = path.join(langServerSource.dir, langServerSource.file); + const prebuiltBinaryPath = path.join(serverSource.dir, serverSource.file); if (isBinaryAvailable(prebuiltBinaryPath)) { return prebuiltBinaryPath; @@ -97,10 +97,10 @@ export async function ensureLangServerBinary( if (userResponse !== "Download now") return null; try { - await downloadLatestLangServer(langServerSource); + await downloadLatestServer(serverSource); } catch (err) { vscode.window.showErrorMessage( - `Failed to download language server from ${langServerSource.repo.name} ` + + `Failed to download language server from ${serverSource.repo.name} ` + `GitHub repository: ${err.message}` ); @@ -122,7 +122,7 @@ export async function ensureLangServerBinary( if (!isBinaryAvailable(prebuiltBinaryPath)) assert(false, `Downloaded language server binary is not functional.` + - `Downloaded from: ${JSON.stringify(langServerSource)}` + `Downloaded from: ${JSON.stringify(serverSource)}` ); From acb75b619c6756e34b6d7dd44d5fe3b79bdbcc2e Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 16 Feb 2020 05:04:51 +0800 Subject: [PATCH 398/819] Disable rollup warning --- rust-analyzer/editors/code/rollup.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index f8d320f4..337385a2 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -18,6 +18,7 @@ export default { external: [...nodeBuiltins, 'vscode'], output: { file: './out/main.js', - format: 'cjs' + format: 'cjs', + exports: 'named' } }; From afa45a0966f011d70452eba547cf61c12a4ea926 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 03:08:36 +0200 Subject: [PATCH 399/819] vscode: add version and storage parameters to github binary source --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 17 ++++++++++++++++- rust-analyzer/editors/code/src/ctx.ts | 4 ++++ .../editors/code/src/installation/interfaces.ts | 13 +++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a607c214..96b8e9eb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -6,7 +6,7 @@ "private": true, "icon": "icon.png", "//": "The real version is in release.yaml, this one just needs to be bigger", - "version": "0.2.0-dev", + "version": "0.2.20200211-dev", "publisher": "matklad", "repository": { "url": "https://github.com/rust-analyzer/rust-analyzer.git", diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 12c97be2..efef820a 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -11,7 +11,7 @@ export async function createClient(config: Config): Promise `${Config.rootSection}.${opt}`); + private static readonly extensionVersion: string = (() => { + const packageJsonVersion = vscode + .extensions + .getExtension("matklad.rust-analyzer")! + .packageJSON + .version as string; // n.n.YYYYMMDD + + const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/; + const [, yyyy, mm, dd] = packageJsonVersion.match(realVersionRegexp)!; + + return `${yyyy}-${mm}-${dd}`; + })(); + private cfg!: vscode.WorkspaceConfiguration; constructor(private readonly ctx: vscode.ExtensionContext) { @@ -98,7 +111,7 @@ export class Config { } } - get serverBinarySource(): null | BinarySource { + get serverSource(): null | BinarySource { const serverPath = RA_LSP_DEBUG ?? this.cfg.get("raLspServerPath"); if (serverPath) { @@ -116,6 +129,8 @@ export class Config { type: BinarySource.Type.GithubRelease, dir: this.ctx.globalStoragePath, file: prebuiltBinaryName, + storage: this.ctx.globalState, + version: Config.extensionVersion, repo: { name: "rust-analyzer", owner: "rust-analyzer", diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 70042a47..9fcf2ec3 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -60,6 +60,10 @@ export class Ctx { this.pushCleanup(d); } + get globalState(): vscode.Memento { + return this.extCtx.globalState; + } + get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index 93ea577d..e40839e4 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -1,3 +1,5 @@ +import * as vscode from "vscode"; + export interface GithubRepo { name: string; owner: string; @@ -50,6 +52,17 @@ export namespace BinarySource { * and in local `.dir`. */ file: string; + + /** + * Tag of github release that denotes a version required by this extension. + */ + version: string; + + /** + * Object that provides `get()/update()` operations to store metadata + * about the actual binary, e.g. its actual version. + */ + storage: vscode.Memento; } } From 15fb3fa381ca959ad59b9dcd3c9a1b8b07fe10c5 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 03:12:25 +0200 Subject: [PATCH 400/819] vscode: add release tag option to fetchArtifactReleaseInfo() --- ...se_info.ts => fetch_artifact_release_info.ts} | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) rename rust-analyzer/editors/code/src/installation/{fetch_latest_artifact_release_info.ts => fetch_artifact_release_info.ts} (68%) diff --git a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts similarity index 68% rename from rust-analyzer/editors/code/src/installation/fetch_latest_artifact_release_info.ts rename to rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 29ee029a..7d497057 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_latest_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -3,24 +3,30 @@ import { GithubRepo, ArtifactReleaseInfo } from "./interfaces"; const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; + /** - * Fetches the latest release from GitHub `repo` and returns metadata about - * `artifactFileName` shipped with this release or `null` if no such artifact was published. + * Fetches the release with `releaseTag` (or just latest release when not specified) + * from GitHub `repo` and returns metadata about `artifactFileName` shipped with + * this release or `null` if no such artifact was published. */ -export async function fetchLatestArtifactReleaseInfo( - repo: GithubRepo, artifactFileName: string +export async function fetchArtifactReleaseInfo( + repo: GithubRepo, artifactFileName: string, releaseTag?: string ): Promise { const repoOwner = encodeURIComponent(repo.owner); const repoName = encodeURIComponent(repo.name); - const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/latest`; + const apiEndpointPath = releaseTag + ? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}` + : `/repos/${repoOwner}/${repoName}/releases/latest`; + const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) console.log("Issuing request for released artifacts metadata to", requestUrl); + // FIXME: handle non-ok response const response: GithubRelease = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }) From aed56ce7d233698f3a3768612be1799dd5457096 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 03:13:06 +0200 Subject: [PATCH 401/819] vscode: extract downloadArtifact() function --- .../src/installation/download_artifact.ts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 rust-analyzer/editors/code/src/installation/download_artifact.ts diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts new file mode 100644 index 00000000..de655f8f --- /dev/null +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -0,0 +1,58 @@ +import * as vscode from "vscode"; +import * as path from "path"; +import { promises as fs } from "fs"; +import { strict as assert } from "assert"; + +import { ArtifactReleaseInfo } from "./interfaces"; +import { downloadFile } from "./download_file"; +import { throttle } from "throttle-debounce"; + +/** + * Downloads artifact from given `downloadUrl`. + * Creates `installationDir` if it is not yet created and put the artifact under + * `artifactFileName`. + * Displays info about the download progress in an info message printing the name + * of the artifact as `displayName`. + */ +export async function downloadArtifact( + {downloadUrl, releaseName}: ArtifactReleaseInfo, + artifactFileName: string, + installationDir: string, + displayName: string, +) { + await fs.mkdir(installationDir).catch(err => assert.strictEqual( + err?.code, + "EEXIST", + `Couldn't create directory "${installationDir}" to download `+ + `${artifactFileName} artifact: ${err.message}` + )); + + const installationPath = path.join(installationDir, artifactFileName); + + console.time(`Downloading ${artifactFileName}`); + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, // FIXME: add support for canceling download? + title: `Downloading ${displayName} (${releaseName})` + }, + async (progress, _cancellationToken) => { + let lastPrecentage = 0; + const filePermissions = 0o755; // (rwx, r_x, r_x) + await downloadFile(downloadUrl, installationPath, filePermissions, throttle( + 200, + /* noTrailing: */ true, + (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPrecentage + }); + + lastPrecentage = newPercentage; + }) + ); + } + ); + console.timeEnd(`Downloading ${artifactFileName}`); +} From 7993bef2f33acf4c76c7feec660fa2a7c5aad9df Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 03:14:20 +0200 Subject: [PATCH 402/819] vscode: save binary version when downloading and download only version that matches TypeScript extension version --- .../editors/code/src/installation/server.ts | 168 ++++++++---------- 1 file changed, 72 insertions(+), 96 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 406e2299..80cb719e 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -1,63 +1,15 @@ import * as vscode from "vscode"; import * as path from "path"; import { strict as assert } from "assert"; -import { promises as fs } from "fs"; import { promises as dns } from "dns"; import { spawnSync } from "child_process"; -import { throttle } from "throttle-debounce"; import { BinarySource } from "./interfaces"; -import { fetchLatestArtifactReleaseInfo } from "./fetch_latest_artifact_release_info"; -import { downloadFile } from "./download_file"; - -export async function downloadLatestServer( - {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease -) { - const { releaseName, downloadUrl } = (await fetchLatestArtifactReleaseInfo( - repo, artifactFileName - ))!; - - await fs.mkdir(installationDir).catch(err => assert.strictEqual( - err?.code, - "EEXIST", - `Couldn't create directory "${installationDir}" to download `+ - `language server binary: ${err.message}` - )); - - const installationPath = path.join(installationDir, artifactFileName); - - console.time("Downloading ra_lsp_server"); - await vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - cancellable: false, // FIXME: add support for canceling download? - title: `Downloading language server (${releaseName})` - }, - async (progress, _cancellationToken) => { - let lastPrecentage = 0; - const filePermissions = 0o755; // (rwx, r_x, r_x) - await downloadFile(downloadUrl, installationPath, filePermissions, throttle( - 200, - /* noTrailing: */ true, - (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPrecentage - }); - - lastPrecentage = newPercentage; - }) - ); - } - ); - console.timeEnd("Downloading ra_lsp_server"); -} -export async function ensureServerBinary( - serverSource: null | BinarySource -): Promise { +import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; +import { downloadArtifact } from "./download_artifact"; - if (!serverSource) { +export async function ensureServerBinary(source: null | BinarySource): Promise { + if (!source) { vscode.window.showErrorMessage( "Unfortunately we don't ship binaries for your platform yet. " + "You need to manually clone rust-analyzer repository and " + @@ -69,80 +21,104 @@ export async function ensureServerBinary( return null; } - switch (serverSource.type) { + switch (source.type) { case BinarySource.Type.ExplicitPath: { - if (isBinaryAvailable(serverSource.path)) { - return serverSource.path; + if (isBinaryAvailable(source.path)) { + return source.path; } vscode.window.showErrorMessage( - `Unable to run ${serverSource.path} binary. ` + + `Unable to run ${source.path} binary. ` + `To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` + "value to `null` or remove it from the settings to use it by default." ); return null; } case BinarySource.Type.GithubRelease: { - const prebuiltBinaryPath = path.join(serverSource.dir, serverSource.file); + const prebuiltBinaryPath = path.join(source.dir, source.file); + + const installedVersion: null | string = getServerVersion(source.storage); + const requiredVersion: string = source.version; - if (isBinaryAvailable(prebuiltBinaryPath)) { + console.log("Installed version:", installedVersion, "required:", requiredVersion); + + if (isBinaryAvailable(prebuiltBinaryPath) && installedVersion == requiredVersion) { + // FIXME: check for new releases and notify the user to update if possible return prebuiltBinaryPath; } const userResponse = await vscode.window.showInformationMessage( - "Language server binary for rust-analyzer was not found. " + + `Language server version ${source.version} for rust-analyzer is not installed. ` + "Do you want to download it now?", "Download now", "Cancel" ); if (userResponse !== "Download now") return null; - try { - await downloadLatestServer(serverSource); - } catch (err) { - vscode.window.showErrorMessage( - `Failed to download language server from ${serverSource.repo.name} ` + - `GitHub repository: ${err.message}` - ); + if (!await downloadServer(source)) return null; - console.error(err); + return prebuiltBinaryPath; + } + } +} - dns.resolve('example.com').then( - addrs => console.log("DNS resolution for example.com was successful", addrs), - err => { - console.error( - "DNS resolution for example.com failed, " + - "there might be an issue with Internet availability" - ); - console.error(err); - } - ); +async function downloadServer(source: BinarySource.GithubRelease): Promise { + try { + const releaseInfo = (await fetchArtifactReleaseInfo(source.repo, source.file, source.version))!; + + await downloadArtifact(releaseInfo, source.file, source.dir, "language server"); + await setServerVersion(source.storage, releaseInfo.releaseName); + } catch (err) { + vscode.window.showErrorMessage( + `Failed to download language server from ${source.repo.name} ` + + `GitHub repository: ${err.message}` + ); + + console.error(err); - return null; + dns.resolve('example.com').then( + addrs => console.log("DNS resolution for example.com was successful", addrs), + err => { + console.error( + "DNS resolution for example.com failed, " + + "there might be an issue with Internet availability" + ); + console.error(err); } + ); + return false; + } - if (!isBinaryAvailable(prebuiltBinaryPath)) assert(false, - `Downloaded language server binary is not functional.` + - `Downloaded from: ${JSON.stringify(serverSource)}` - ); + if (!isBinaryAvailable(path.join(source.dir, source.file))) assert(false, + `Downloaded language server binary is not functional.` + + `Downloaded from: ${JSON.stringify(source, null, 4)}` + ); + vscode.window.showInformationMessage( + "Rust analyzer language server was successfully installed 🦀" + ); - vscode.window.showInformationMessage( - "Rust analyzer language server was successfully installed 🦀" - ); + return true; +} - return prebuiltBinaryPath; - } - } +function isBinaryAvailable(binaryPath: string): boolean { + const res = spawnSync(binaryPath, ["--version"]); - function isBinaryAvailable(binaryPath: string) { - const res = spawnSync(binaryPath, ["--version"]); + // ACHTUNG! `res` type declaration is inherently wrong, see + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 - // ACHTUNG! `res` type declaration is inherently wrong, see - // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 + console.log("Checked binary availablity via --version", res); + console.log(binaryPath, "--version output:", res.output?.map(String)); - console.log("Checked binary availablity via --version", res); - console.log(binaryPath, "--version output:", res.output?.map(String)); + return res.status === 0; +} - return res.status === 0; - } +function getServerVersion(storage: vscode.Memento): null | string { + const version = storage.get("server-version", null); + console.log("Get server-version:", version); + return version; +} + +async function setServerVersion(storage: vscode.Memento, version: string): Promise { + console.log("Set server-version:", version); + await storage.update("server-version", version.toString()); } From 6385bab7cee4d41c662f75da9740e27f77aef2a6 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 11:15:19 +0200 Subject: [PATCH 403/819] vscode: fix the default value for withSysroot --- rust-analyzer/editors/code/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 7866ed7e..8c033052 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -153,5 +153,5 @@ export class Config { } // for internal use - get withSysroot() { return this.cfg.get("withSysroot", false); } + get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } } From 3158746d367e55fb458f8fec98b2f1d937d0a8e1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 16:48:17 +0200 Subject: [PATCH 404/819] vscode: update exclusiveMinimum validation according to JSONSchemaV4 specs --- rust-analyzer/editors/code/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 96b8e9eb..614d36cf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -248,7 +248,8 @@ "rust-analyzer.maxInlayHintLength": { "type": "number", "default": 20, - "exclusiveMinimum": 0, + "minimum": 0, + "exclusiveMinimum": true, "description": "Maximum length for inlay hints" }, "rust-analyzer.cargoFeatures.noDefaultFeatures": { From fa895f41506d1561f58a76c106a1eb9bdac84cd2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 17:55:15 +0200 Subject: [PATCH 405/819] vscode: fix all integer -> number and add nullablitiy to maxInlayHintLength --- rust-analyzer/editors/code/package.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 614d36cf..97f2e63c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -233,10 +233,7 @@ "description": "Trace requests to the ra_lsp_server" }, "rust-analyzer.lruCapacity": { - "type": [ - "number", - "null" - ], + "type": [ "null", "integer" ], "default": null, "description": "Number of syntax trees rust-analyzer keeps in memory" }, @@ -246,7 +243,7 @@ "description": "Display additional type and parameter information in the editor" }, "rust-analyzer.maxInlayHintLength": { - "type": "number", + "type": [ "null", "integer" ], "default": 20, "minimum": 0, "exclusiveMinimum": true, From e7324327dc992c065b697b05d78633925a7f79e3 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 18:00:49 +0200 Subject: [PATCH 406/819] vscode: added minimum bound for lruCapacity option --- rust-analyzer/editors/code/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 97f2e63c..ed1cae2a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -235,6 +235,8 @@ "rust-analyzer.lruCapacity": { "type": [ "null", "integer" ], "default": null, + "minimum": 0, + "exclusiveMinimum": true, "description": "Number of syntax trees rust-analyzer keeps in memory" }, "rust-analyzer.displayInlayHints": { From aeff3eeb8cb6fde2f2d3a175f8b218bbc387b176 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 16 Feb 2020 19:30:13 +0200 Subject: [PATCH 407/819] vscode: fix stupid mistake --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 1c019a51..c317a921 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -13,7 +13,7 @@ export function activateInlayHints(ctx: Ctx) { vscode.workspace.onDidChangeTextDocument( async event => { - if (event.contentChanges.length !== 0) return; + if (event.contentChanges.length === 0) return; if (event.document.languageId !== 'rust') return; await hintsUpdater.refresh(); }, From 4cc4be5ff032adeac20afb3e580d3342682887e4 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 8 Feb 2020 21:38:29 +0200 Subject: [PATCH 408/819] vscode: add comment on possible UnhandledPromise rejection error --- rust-analyzer/editors/code/src/inlay_hints.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index c317a921..12d7ddf0 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -27,7 +27,9 @@ export function activateInlayHints(ctx: Ctx) { ctx.subscriptions ); - ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); + // We pass async function though it will not be awaited when called, + // thus Promise rejections won't be handled, but this should never throw in fact... + ctx.onDidRestart(async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } interface InlayHintsParams { From b01cecee336e0c778e9ef6fed2d787dcd34ed3d2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 17 Feb 2020 01:47:14 +0200 Subject: [PATCH 409/819] vscode: minor refactorings --- rust-analyzer/editors/code/src/config.ts | 1 - rust-analyzer/editors/code/src/ctx.ts | 12 ++--- rust-analyzer/editors/code/src/inlay_hints.ts | 45 ++++++++++--------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 70cb0a61..53e2a414 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -44,7 +44,6 @@ export class Config { this.refreshConfig(); } - private refreshConfig() { this.cfg = vscode.workspace.getConfiguration(Config.rootSection); console.log("Using configuration:", this.cfg); diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 9fcf2ec3..ff6245f7 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -91,15 +91,11 @@ export async function sendRequestWithRetry( for (const delay of [2, 4, 6, 8, 10, null]) { try { return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param)); - } catch (e) { - if ( - e.code === lc.ErrorCodes.ContentModified && - delay !== null - ) { - await sleep(10 * (1 << delay)); - continue; + } catch (err) { + if (delay === null || err.code !== lc.ErrorCodes.ContentModified) { + throw err; } - throw e; + await sleep(10 * (1 << delay)); } } throw 'unreachable'; diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 12d7ddf0..3896878c 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -38,7 +38,7 @@ interface InlayHintsParams { interface InlayHint { range: vscode.Range; - kind: string; + kind: "TypeHint" | "ParameterHint"; label: string; } @@ -55,7 +55,7 @@ const parameterHintDecorationType = vscode.window.createTextEditorDecorationType }); class HintsUpdater { - private pending: Map = new Map(); + private pending = new Map(); private ctx: Ctx; private enabled: boolean; @@ -64,30 +64,36 @@ class HintsUpdater { this.enabled = ctx.config.displayInlayHints; } - async setEnabled(enabled: boolean) { + async setEnabled(enabled: boolean): Promise { if (this.enabled == enabled) return; this.enabled = enabled; if (this.enabled) { - await this.refresh(); - } else { - this.allEditors.forEach(it => { - this.setTypeDecorations(it, []); - this.setParameterDecorations(it, []); - }); + return await this.refresh(); } + this.allEditors.forEach(it => { + this.setTypeDecorations(it, []); + this.setParameterDecorations(it, []); + }); } async refresh() { if (!this.enabled) return; - const promises = this.allEditors.map(it => this.refreshEditor(it)); - await Promise.all(promises); + await Promise.all(this.allEditors.map(it => this.refreshEditor(it))); + } + + private get allEditors(): vscode.TextEditor[] { + return vscode.window.visibleTextEditors.filter( + editor => editor.document.languageId === 'rust', + ); } private async refreshEditor(editor: vscode.TextEditor): Promise { const newHints = await this.queryHints(editor.document.uri.toString()); if (newHints == null) return; - const newTypeDecorations = newHints.filter(hint => hint.kind === 'TypeHint') + + const newTypeDecorations = newHints + .filter(hint => hint.kind === 'TypeHint') .map(hint => ({ range: hint.range, renderOptions: { @@ -98,7 +104,8 @@ class HintsUpdater { })); this.setTypeDecorations(editor, newTypeDecorations); - const newParameterDecorations = newHints.filter(hint => hint.kind === 'ParameterHint') + const newParameterDecorations = newHints + .filter(hint => hint.kind === 'ParameterHint') .map(hint => ({ range: hint.range, renderOptions: { @@ -110,12 +117,6 @@ class HintsUpdater { this.setParameterDecorations(editor, newParameterDecorations); } - private get allEditors(): vscode.TextEditor[] { - return vscode.window.visibleTextEditors.filter( - editor => editor.document.languageId === 'rust', - ); - } - private setTypeDecorations( editor: vscode.TextEditor, decorations: vscode.DecorationOptions[], @@ -139,12 +140,14 @@ class HintsUpdater { private async queryHints(documentUri: string): Promise { const client = this.ctx.client; if (!client) return null; + const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; const tokenSource = new vscode.CancellationTokenSource(); - const prev = this.pending.get(documentUri); - if (prev) prev.cancel(); + const prevHintsRequest = this.pending.get(documentUri); + prevHintsRequest?.cancel(); + this.pending.set(documentUri, tokenSource); try { return await sendRequestWithRetry( From cdd70772eada7c2423ea5c6fd3ee654c0e38ce6f Mon Sep 17 00:00:00 2001 From: Ilya Titkov Date: Mon, 17 Feb 2020 11:44:58 +0300 Subject: [PATCH 410/819] Add arguments to rustfmt --- rust-analyzer/editors/code/package.json | 18 ++++++++++++++++-- rust-analyzer/editors/code/src/client.ts | 1 + rust-analyzer/editors/code/src/config.ts | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ed1cae2a..46acbfe7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -188,6 +188,14 @@ "default": [], "description": "Paths to exclude from analysis" }, + "rust-analyzer.rustfmtArgs": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Additional arguments to rustfmt" + }, "rust-analyzer.useClientWatching": { "type": "boolean", "default": true, @@ -233,7 +241,10 @@ "description": "Trace requests to the ra_lsp_server" }, "rust-analyzer.lruCapacity": { - "type": [ "null", "integer" ], + "type": [ + "null", + "integer" + ], "default": null, "minimum": 0, "exclusiveMinimum": true, @@ -245,7 +256,10 @@ "description": "Display additional type and parameter information in the editor" }, "rust-analyzer.maxInlayHintLength": { - "type": [ "null", "integer" ], + "type": [ + "null", + "integer" + ], "default": 20, "minimum": 0, "exclusiveMinimum": true, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index efef820a..11894973 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -42,6 +42,7 @@ export async function createClient(config: Config): Promise; } - + get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } + get cargoWatchOptions(): CargoWatchOptions { return { enable: this.cfg.get("cargo-watch.enable") as boolean, From be6fabdb7b3cdc4443e861cdd7be28e02daed500 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 11:12:45 +0100 Subject: [PATCH 411/819] update lockfile --- rust-analyzer/editors/code/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index c7407873..88dfee6a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.2.0-dev", + "version": "0.2.20200211-dev", "lockfileVersion": 1, "requires": true, "dependencies": { From 5baf7d811c0272d0ee7c0adb54fdc1fb97352974 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 11:13:16 +0100 Subject: [PATCH 412/819] :arrow_up: npm deps --- rust-analyzer/editors/code/package-lock.json | 12 ++++++------ rust-analyzer/editors/code/package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 88dfee6a..22aa63c9 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -77,9 +77,9 @@ "dev": true }, "@types/node": { - "version": "12.12.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.25.tgz", - "integrity": "sha512-nf1LMGZvgFX186geVZR1xMZKKblJiRfiASTHw85zED2kI1yDKHDwTKMdkaCbTlXoRKlGKaDfYywt+V0As30q3w==", + "version": "12.12.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.27.tgz", + "integrity": "sha512-odQFl/+B9idbdS0e8IxDl2ia/LP8KZLXhV3BUeI98TrZp0uoIzQPhGd+5EtzHmT0SMOIaPd7jfz6pOHLWTtl7A==", "dev": true }, "@types/node-fetch": { @@ -682,9 +682,9 @@ } }, "rollup": { - "version": "1.31.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.0.tgz", - "integrity": "sha512-9C6ovSyNeEwvuRuUUmsTpJcXac1AwSL1a3x+O5lpmQKZqi5mmrjauLeqIjvREC+yNRR8fPdzByojDng+af3nVw==", + "version": "1.31.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.1.tgz", + "integrity": "sha512-2JREN1YdrS/kpPzEd33ZjtuNbOuBC3ePfuZBdKEybvqcEcszW1ckyVqzcEiEe0nE8sqHK+pbJg+PsAgRJ8+1dg==", "dev": true, "requires": { "@types/estree": "*", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 46acbfe7..8f7e67bb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -33,11 +33,11 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", - "@types/node": "^12.12.25", + "@types/node": "^12.12.27", "@types/node-fetch": "^2.5.4", "@types/throttle-debounce": "^2.1.0", "@types/vscode": "^1.42.0", - "rollup": "^1.31.0", + "rollup": "^1.31.1", "tslib": "^1.10.0", "tslint": "^5.20.1", "typescript": "^3.7.5", From be73a0e262001855fc09cb18162d387527b7d9a7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 12:17:01 +0100 Subject: [PATCH 413/819] Simplify TS reload logic Fixes #3164 --- .../editors/code/src/commands/index.ts | 7 ------ rust-analyzer/editors/code/src/ctx.ts | 23 +++++++++++-------- .../editors/code/src/highlighting.ts | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 19 +++++++++++++-- rust-analyzer/editors/code/src/main.ts | 21 +++++++++++++++-- .../editors/code/src/status_display.ts | 2 +- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index b5ebec11..d05f40d6 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -51,10 +51,3 @@ export function selectAndApplySourceChange(ctx: Ctx): Cmd { } }; } - -export function reload(ctx: Ctx): Cmd { - return async () => { - vscode.window.showInformationMessage('Reloading rust-analyzer...'); - await ctx.restartServer(); - }; -} diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index ff6245f7..1eff88df 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import { strict as assert } from "assert"; import { Config } from './config'; import { createClient } from './client'; @@ -16,19 +17,16 @@ export class Ctx { // on the event loop to get a better picture of what we can do here) client: lc.LanguageClient | null = null; private extCtx: vscode.ExtensionContext; - private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; + private onStartHooks: Array<(client: lc.LanguageClient) => void> = []; constructor(extCtx: vscode.ExtensionContext) { this.config = new Config(extCtx); this.extCtx = extCtx; } - async restartServer() { - const old = this.client; - if (old) { - await old.stop(); - } - this.client = null; + async startServer() { + assert(this.client == null); + const client = await createClient(this.config); if (!client) { throw new Error( @@ -41,7 +39,7 @@ export class Ctx { await client.onReady(); this.client = client; - for (const hook of this.onDidRestartHooks) { + for (const hook of this.onStartHooks) { hook(client); } } @@ -72,8 +70,13 @@ export class Ctx { this.extCtx.subscriptions.push(d); } - onDidRestart(hook: (client: lc.LanguageClient) => void) { - this.onDidRestartHooks.push(hook); + onStart(hook: (client: lc.LanguageClient) => void) { + const client = this.client; + if (client == null) { + this.onStartHooks.push(hook); + } else { + hook(client) + } } } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 4fbbe3dd..f693fb8b 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -7,7 +7,7 @@ import { Ctx, sendRequestWithRetry } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - ctx.onDidRestart(client => { + ctx.onStart(client => { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 3896878c..9e400fab 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -27,9 +27,15 @@ export function activateInlayHints(ctx: Ctx) { ctx.subscriptions ); + ctx.pushCleanup({ + dispose() { + hintsUpdater.clear() + } + }) + // We pass async function though it will not be awaited when called, // thus Promise rejections won't be handled, but this should never throw in fact... - ctx.onDidRestart(async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); + ctx.onStart(async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } interface InlayHintsParams { @@ -61,16 +67,23 @@ class HintsUpdater { constructor(ctx: Ctx) { this.ctx = ctx; - this.enabled = ctx.config.displayInlayHints; + this.enabled = false; } async setEnabled(enabled: boolean): Promise { + console.log({ enabled, prev: this.enabled }); + if (this.enabled == enabled) return; this.enabled = enabled; if (this.enabled) { return await this.refresh(); + } else { + return this.clear(); } + } + + clear() { this.allEditors.forEach(it => { this.setTypeDecorations(it, []); this.setParameterDecorations(it, []); @@ -79,6 +92,8 @@ class HintsUpdater { async refresh() { if (!this.enabled) return; + console.log("freshin!"); + await Promise.all(this.allEditors.map(it => this.refreshEditor(it))); } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5a99e96f..ec488c34 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,6 +11,23 @@ let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); + ctx.registerCommand('reload', (ctx) => { + return async () => { + vscode.window.showInformationMessage('Reloading rust-analyzer...'); + // @DanTup maneuver + // https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895 + await deactivate() + for (const sub of ctx.subscriptions) { + try { + sub.dispose(); + } catch (e) { + console.error(e); + } + } + await activate(context) + } + }) + // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); @@ -20,7 +37,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); - ctx.registerCommand('reload', commands.reload); ctx.registerCommand('onEnter', commands.onEnter); ctx.registerCommand('ssr', commands.ssr) @@ -38,7 +54,7 @@ export async function activate(context: vscode.ExtensionContext) { // // This a horribly, horribly wrong way to deal with this problem. try { - await ctx.restartServer(); + await ctx.startServer(); } catch (e) { vscode.window.showErrorMessage(e.message); } @@ -47,4 +63,5 @@ export async function activate(context: vscode.ExtensionContext) { export async function deactivate() { await ctx?.client?.stop(); + ctx = undefined; } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 993e79d7..326b5217 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -9,7 +9,7 @@ const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', ' export function activateStatusDisplay(ctx: Ctx) { const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); - ctx.onDidRestart(client => ctx.pushCleanup(client.onProgress( + ctx.onStart(client => ctx.pushCleanup(client.onProgress( WorkDoneProgress.type, 'rustAnalyzer/cargoWatcher', params => statusDisplay.handleProgressNotification(params) From 5d7a568ac9feb301ff99f6d9b028205851fe43d5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 13:40:20 +0100 Subject: [PATCH 414/819] Simplify startup --- rust-analyzer/editors/code/src/ctx.ts | 13 ------------ .../editors/code/src/highlighting.ts | 5 +++-- rust-analyzer/editors/code/src/inlay_hints.ts | 6 +++--- rust-analyzer/editors/code/src/main.ts | 21 ++++++++++--------- .../editors/code/src/status_display.ts | 13 +++++++----- 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 1eff88df..c06d8ac3 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -17,7 +17,6 @@ export class Ctx { // on the event loop to get a better picture of what we can do here) client: lc.LanguageClient | null = null; private extCtx: vscode.ExtensionContext; - private onStartHooks: Array<(client: lc.LanguageClient) => void> = []; constructor(extCtx: vscode.ExtensionContext) { this.config = new Config(extCtx); @@ -39,9 +38,6 @@ export class Ctx { await client.onReady(); this.client = client; - for (const hook of this.onStartHooks) { - hook(client); - } } get activeRustEditor(): vscode.TextEditor | undefined { @@ -69,15 +65,6 @@ export class Ctx { pushCleanup(d: Disposable) { this.extCtx.subscriptions.push(d); } - - onStart(hook: (client: lc.LanguageClient) => void) { - const client = this.client; - if (client == null) { - this.onStartHooks.push(hook); - } else { - hook(client) - } - } } export interface Disposable { diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index f693fb8b..a2db04de 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -7,7 +7,8 @@ import { Ctx, sendRequestWithRetry } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - ctx.onStart(client => { + const client = ctx.client; + if (client != null) { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { @@ -28,7 +29,7 @@ export function activateHighlighting(ctx: Ctx) { highlighter.setHighlights(targetEditor, params.decorations); }, ); - }); + }; vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 9e400fab..55bbd7f0 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -33,9 +33,9 @@ export function activateInlayHints(ctx: Ctx) { } }) - // We pass async function though it will not be awaited when called, - // thus Promise rejections won't be handled, but this should never throw in fact... - ctx.onStart(async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); + // XXX: we don't await this, thus Promise rejections won't be handled, but + // this should never throw in fact... + hintsUpdater.setEnabled(ctx.config.displayInlayHints) } interface InlayHintsParams { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ec488c34..0bf2c482 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,6 +11,17 @@ let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); + // Note: we try to start the server before we activate type hints so that it + // registers its `onDidChangeDocument` handler before us. + // + // This a horribly, horribly wrong way to deal with this problem. + try { + await ctx.startServer(); + } catch (e) { + vscode.window.showErrorMessage(e.message); + } + + // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('reload', (ctx) => { return async () => { vscode.window.showInformationMessage('Reloading rust-analyzer...'); @@ -28,7 +39,6 @@ export async function activate(context: vscode.ExtensionContext) { } }) - // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace); @@ -49,15 +59,6 @@ export async function activate(context: vscode.ExtensionContext) { activateStatusDisplay(ctx); activateHighlighting(ctx); - // Note: we try to start the server before we activate type hints so that it - // registers its `onDidChangeDocument` handler before us. - // - // This a horribly, horribly wrong way to deal with this problem. - try { - await ctx.startServer(); - } catch (e) { - vscode.window.showErrorMessage(e.message); - } activateInlayHints(ctx); } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 326b5217..ed0d8216 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -9,11 +9,14 @@ const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', ' export function activateStatusDisplay(ctx: Ctx) { const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); ctx.pushCleanup(statusDisplay); - ctx.onStart(client => ctx.pushCleanup(client.onProgress( - WorkDoneProgress.type, - 'rustAnalyzer/cargoWatcher', - params => statusDisplay.handleProgressNotification(params) - ))); + const client = ctx.client; + if (client != null) { + ctx.pushCleanup(client.onProgress( + WorkDoneProgress.type, + 'rustAnalyzer/cargoWatcher', + params => statusDisplay.handleProgressNotification(params) + )) + } } class StatusDisplay implements Disposable { From c71e1549c09dfa9d061962337cab04269a3bc301 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:03:33 +0100 Subject: [PATCH 415/819] Push IO and error handling up --- rust-analyzer/editors/code/src/client.ts | 6 +----- rust-analyzer/editors/code/src/ctx.ts | 10 ++-------- rust-analyzer/editors/code/src/main.ts | 11 ++++++++++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 11894973..aaf2ef40 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -2,18 +2,14 @@ import * as lc from 'vscode-languageclient'; import * as vscode from 'vscode'; import { Config } from './config'; -import { ensureServerBinary } from './installation/server'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; -export async function createClient(config: Config): Promise { +export async function createClient(config: Config, serverPath: string): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. const workspaceFolderPath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.'; - const serverPath = await ensureServerBinary(config.serverSource); - if (!serverPath) return null; - const run: lc.Executable = { command: serverPath, options: { cwd: workspaceFolderPath }, diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index c06d8ac3..935a6f2b 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -23,16 +23,10 @@ export class Ctx { this.extCtx = extCtx; } - async startServer() { + async startServer(serverPath: string) { assert(this.client == null); - const client = await createClient(this.config); - if (!client) { - throw new Error( - "Rust Analyzer Language Server is not available. " + - "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)." - ); - } + const client = await createClient(this.config, serverPath); this.pushCleanup(client.start()); await client.onReady(); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0bf2c482..ece4883b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -5,18 +5,27 @@ import { activateInlayHints } from './inlay_hints'; import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; +import { ensureServerBinary } from './installation/server'; let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); + const serverPath = await ensureServerBinary(ctx.config.serverSource); + if (serverPath == null) { + throw new Error( + "Rust Analyzer Language Server is not available. " + + "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)." + ); + } + // Note: we try to start the server before we activate type hints so that it // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. try { - await ctx.startServer(); + await ctx.startServer(serverPath); } catch (e) { vscode.window.showErrorMessage(e.message); } From 37d1d1bb3fa9605664359ef2025cb0f0f0a3b4cc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:04:32 +0100 Subject: [PATCH 416/819] Fix link to the manual --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ece4883b..947d5eb9 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -16,7 +16,7 @@ export async function activate(context: vscode.ExtensionContext) { if (serverPath == null) { throw new Error( "Rust Analyzer Language Server is not available. " + - "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)." + "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)." ); } From e4fb6a2e38ee6ff42d7828dcf8245ee97f61794c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:11:01 +0100 Subject: [PATCH 417/819] Remove two stage constuction --- rust-analyzer/editors/code/src/ctx.ts | 25 +++++++++++-------------- rust-analyzer/editors/code/src/main.ts | 11 ++++------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 935a6f2b..21f1025c 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { strict as assert } from "assert"; import { Config } from './config'; import { createClient } from './client'; @@ -15,23 +14,21 @@ export class Ctx { // FIXME: this actually needs syncronization of some kind (check how // vscode deals with `deactivate()` call when extension has some work scheduled // on the event loop to get a better picture of what we can do here) - client: lc.LanguageClient | null = null; + client: lc.LanguageClient; private extCtx: vscode.ExtensionContext; - constructor(extCtx: vscode.ExtensionContext) { - this.config = new Config(extCtx); - this.extCtx = extCtx; - } - - async startServer(serverPath: string) { - assert(this.client == null); - - const client = await createClient(this.config, serverPath); - - this.pushCleanup(client.start()); + static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { + const client = await createClient(config, serverPath); + const res = new Ctx(config, extCtx, client); + res.pushCleanup(client.start()); await client.onReady(); + return res; + } - this.client = client; + private constructor(config: Config, extCtx: vscode.ExtensionContext, client: lc.LanguageClient) { + this.config = config; + this.extCtx = extCtx; + this.client = client } get activeRustEditor(): vscode.TextEditor | undefined { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 947d5eb9..0ad7ef1b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -6,13 +6,14 @@ import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; import { ensureServerBinary } from './installation/server'; +import { Config } from './config'; let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { - ctx = new Ctx(context); + const config = new Config(context) - const serverPath = await ensureServerBinary(ctx.config.serverSource); + const serverPath = await ensureServerBinary(config.serverSource); if (serverPath == null) { throw new Error( "Rust Analyzer Language Server is not available. " + @@ -24,11 +25,7 @@ export async function activate(context: vscode.ExtensionContext) { // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - try { - await ctx.startServer(serverPath); - } catch (e) { - vscode.window.showErrorMessage(e.message); - } + ctx = await Ctx.create(config, context, serverPath); // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('reload', (ctx) => { From f557cf37f2c38f0830484f3a99f211258d26eb6a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:20:18 +0100 Subject: [PATCH 418/819] remove debug print --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 55bbd7f0..f82df66a 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -92,8 +92,6 @@ class HintsUpdater { async refresh() { if (!this.enabled) return; - console.log("freshin!"); - await Promise.all(this.allEditors.map(it => this.refreshEditor(it))); } From 31dbae180b5882047409fede799ac9c047b49722 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:21:50 +0100 Subject: [PATCH 419/819] Simplify ctor --- rust-analyzer/editors/code/src/ctx.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 21f1025c..dfc8aa7b 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -5,17 +5,13 @@ import { Config } from './config'; import { createClient } from './client'; export class Ctx { - readonly config: Config; - // Because we have "reload server" action, various listeners **will** face a - // situation where the client is not ready yet, and should be prepared to - // deal with it. - // - // Ideally, this should be replaced with async getter though. - // FIXME: this actually needs syncronization of some kind (check how - // vscode deals with `deactivate()` call when extension has some work scheduled - // on the event loop to get a better picture of what we can do here) - client: lc.LanguageClient; - private extCtx: vscode.ExtensionContext; + private constructor( + readonly config: Config, + private readonly extCtx: vscode.ExtensionContext, + readonly client: lc.LanguageClient + ) { + + } static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { const client = await createClient(config, serverPath); @@ -25,12 +21,6 @@ export class Ctx { return res; } - private constructor(config: Config, extCtx: vscode.ExtensionContext, client: lc.LanguageClient) { - this.config = config; - this.extCtx = extCtx; - this.client = client - } - get activeRustEditor(): vscode.TextEditor | undefined { const editor = vscode.window.activeTextEditor; return editor && editor.document.languageId === 'rust' From c5af1adfc66ef90fb4e0b4c290b6925312a5a63c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:23:23 +0100 Subject: [PATCH 420/819] Simplify some more ctors --- rust-analyzer/editors/code/src/commands/analyzer_status.ts | 4 +--- rust-analyzer/editors/code/src/commands/expand_macro.ts | 4 +--- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index cfe7d1af..6631e8db 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -37,12 +37,10 @@ export function analyzerStatus(ctx: Ctx): Cmd { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } provideTextDocumentContent( diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index dcdde78a..6fee6eb4 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -42,12 +42,10 @@ function code_format(expanded: ExpandedMacro): string { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } async provideTextDocumentContent(_uri: vscode.Uri): Promise { diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 7dde66ad..2887c96c 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -68,12 +68,10 @@ interface SyntaxTreeParams { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { From b8c928b9a06be15f4165f8100b93ca6488df0fe7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 15:33:31 +0100 Subject: [PATCH 421/819] Fix extension name --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8f24a13f..d54b1750 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -20,7 +20,7 @@ }, "scripts": { "vscode:prepublish": "tsc && rollup -c", - "package": "vsce package", + "package": "vsce package -o rust-analyzer.vsix", "watch": "tsc --watch", "fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix" }, From 3339c3131cf5236529f5a5f0944f93771498b272 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 17 Feb 2020 22:09:44 +0200 Subject: [PATCH 422/819] vscode: press ; to respect semicolons --- rust-analyzer/editors/code/src/commands/index.ts | 2 +- rust-analyzer/editors/code/src/commands/ssr.ts | 4 ++-- rust-analyzer/editors/code/src/highlighting.ts | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 8 ++++---- .../code/src/installation/download_artifact.ts | 4 ++-- rust-analyzer/editors/code/src/main.ts | 12 ++++++------ rust-analyzer/editors/code/src/status_display.ts | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index d05f40d6..bebd99ca 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -16,7 +16,7 @@ export * from './ssr'; export function collectGarbage(ctx: Ctx): Cmd { return async () => { - ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); + await ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); }; } diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index 6287bf47..9b814612 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -14,9 +14,9 @@ export function ssr(ctx: Ctx): Cmd { if (x.includes('==>>')) { return null; } - return "Enter request: pattern ==>> template" + return "Enter request: pattern ==>> template"; } - } + }; const request = await vscode.window.showInputBox(options); if (!request) return; diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index a2db04de..c4d286ae 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -29,7 +29,7 @@ export function activateHighlighting(ctx: Ctx) { highlighter.setHighlights(targetEditor, params.decorations); }, ); - }; + } vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index f82df66a..26705067 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -29,13 +29,13 @@ export function activateInlayHints(ctx: Ctx) { ctx.pushCleanup({ dispose() { - hintsUpdater.clear() + hintsUpdater.clear(); } - }) + }); // XXX: we don't await this, thus Promise rejections won't be handled, but // this should never throw in fact... - hintsUpdater.setEnabled(ctx.config.displayInlayHints) + void hintsUpdater.setEnabled(ctx.config.displayInlayHints); } interface InlayHintsParams { @@ -57,7 +57,7 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ before: { color: new vscode.ThemeColor('rust_analyzer.inlayHint'), - } + }, }); class HintsUpdater { diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts index de655f8f..9996c556 100644 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -15,7 +15,7 @@ import { throttle } from "throttle-debounce"; * of the artifact as `displayName`. */ export async function downloadArtifact( - {downloadUrl, releaseName}: ArtifactReleaseInfo, + { downloadUrl, releaseName }: ArtifactReleaseInfo, artifactFileName: string, installationDir: string, displayName: string, @@ -23,7 +23,7 @@ export async function downloadArtifact( await fs.mkdir(installationDir).catch(err => assert.strictEqual( err?.code, "EEXIST", - `Couldn't create directory "${installationDir}" to download `+ + `Couldn't create directory "${installationDir}" to download ` + `${artifactFileName} artifact: ${err.message}` )); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0ad7ef1b..a22e0bc6 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -11,7 +11,7 @@ import { Config } from './config'; let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { - const config = new Config(context) + const config = new Config(context); const serverPath = await ensureServerBinary(config.serverSource); if (serverPath == null) { @@ -33,7 +33,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.window.showInformationMessage('Reloading rust-analyzer...'); // @DanTup maneuver // https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895 - await deactivate() + await deactivate(); for (const sub of ctx.subscriptions) { try { sub.dispose(); @@ -41,9 +41,9 @@ export async function activate(context: vscode.ExtensionContext) { console.error(e); } } - await activate(context) - } - }) + await activate(context); + }; + }); ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); @@ -54,7 +54,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); ctx.registerCommand('onEnter', commands.onEnter); - ctx.registerCommand('ssr', commands.ssr) + ctx.registerCommand('ssr', commands.ssr); // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index ed0d8216..0f5f6ef9 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -15,7 +15,7 @@ export function activateStatusDisplay(ctx: Ctx) { WorkDoneProgress.type, 'rustAnalyzer/cargoWatcher', params => statusDisplay.handleProgressNotification(params) - )) + )); } } From c84a394bb698740963adeb5a57ea23e858a2fc23 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 17 Feb 2020 22:19:00 +0200 Subject: [PATCH 423/819] vscode: remove comment about updates notification --- rust-analyzer/editors/code/src/installation/server.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 80cb719e..6f69af69 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -43,7 +43,6 @@ export async function ensureServerBinary(source: null | BinarySource): Promise Date: Mon, 17 Feb 2020 23:42:25 +0100 Subject: [PATCH 424/819] Migrate to eslint --- rust-analyzer/editors/code/.eslintrc.js | 35 + rust-analyzer/editors/code/package-lock.json | 890 +++++++++++++++++- rust-analyzer/editors/code/package.json | 6 +- rust-analyzer/editors/code/src/config.ts | 34 +- .../fetch_artifact_release_info.ts | 6 +- rust-analyzer/editors/code/tslint.json | 10 - 6 files changed, 901 insertions(+), 80 deletions(-) create mode 100644 rust-analyzer/editors/code/.eslintrc.js delete mode 100644 rust-analyzer/editors/code/tslint.json diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js new file mode 100644 index 00000000..157aa3ec --- /dev/null +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -0,0 +1,35 @@ +module.exports = { + "env": { + "es6": true, + "node": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/member-delimiter-style": [ + "error", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/semi": [ + "error", + "always" + ], + "prefer-const": "error" + } +}; diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 22aa63c9..3f6bbdbd 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -70,12 +70,24 @@ "estree-walker": "^1.0.1" } }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, "@types/node": { "version": "12.12.27", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.27.tgz", @@ -112,12 +124,118 @@ "integrity": "sha512-ds6TceMsh77Fs0Mq0Vap6Y72JbGWB8Bay4DrnJlf5d9ui2RSe1wis13oQm+XhguOeH1HUfLGzaDAoupTUtgabw==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.20.0.tgz", + "integrity": "sha512-cimIdVDV3MakiGJqMXw51Xci6oEDEoPkvh8ggJe2IIzcc0fYqAxOXN6Vbeanahz6dLZq64W+40iUEc9g32FLDQ==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "2.20.0", + "eslint-utils": "^1.4.3", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz", + "integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.20.0", + "eslint-scope": "^5.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.20.0.tgz", + "integrity": "sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.20.0", + "@typescript-eslint/typescript-estree": "2.20.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz", + "integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, "acorn": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", "dev": true }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "dev": true + }, + "ajv": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", + "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", + "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -136,6 +254,12 @@ "sprintf-js": "~1.0.2" } }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -182,6 +306,12 @@ "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", "dev": true }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -193,6 +323,12 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "cheerio": { "version": "1.0.0-rc.3", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", @@ -207,6 +343,21 @@ "parse5": "^3.0.1" } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -240,6 +391,27 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -258,6 +430,21 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", @@ -270,11 +457,14 @@ "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", "dev": true }, - "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", - "dev": true + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } }, "dom-serializer": { "version": "0.1.1", @@ -331,6 +521,12 @@ } } }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -343,12 +539,125 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + } + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "dev": true, + "requires": { + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz", + "integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, "estree-walker": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", @@ -361,6 +670,46 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "dependencies": { + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + } + } + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -370,12 +719,53 @@ "pend": "~1.2.0" } }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -390,6 +780,24 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", + "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -410,6 +818,37 @@ "readable-stream": "^3.1.1" } }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -426,12 +865,60 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "inquirer": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz", + "integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.2", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.2.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, "is-reference": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", @@ -441,6 +928,12 @@ "@types/estree": "0.0.39" } }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -457,11 +950,33 @@ "esprima": "^4.0.0" } }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "jsonc-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, "linkify-it": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", @@ -521,6 +1036,12 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -545,12 +1066,30 @@ "minimist": "0.0.8" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node-fetch": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", @@ -574,6 +1113,29 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, "os": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", @@ -602,6 +1164,15 @@ "os-tmpdir": "^1.0.0" } }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-semver": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", @@ -634,6 +1205,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -646,12 +1223,30 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -672,6 +1267,12 @@ "util-deprecate": "^1.0.1" } }, + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + }, "resolve": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", @@ -681,6 +1282,31 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rollup": { "version": "1.31.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.1.tgz", @@ -692,23 +1318,87 @@ "acorn": "^7.1.0" } }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, "sourcemap-codec": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", @@ -721,6 +1411,28 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -730,6 +1442,29 @@ "safe-buffer": "~5.2.0" } }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -739,11 +1474,60 @@ "has-flag": "^3.0.0" } }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "throttle-debounce": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.1.0.tgz", "integrity": "sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg==" }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, "tmp": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", @@ -759,54 +1543,25 @@ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } + "tunnel": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", + "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", + "dev": true }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "tslib": "^1.8.1" + "prelude-ls": "~1.1.2" } }, - "tunnel": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", - "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "typed-rest-client": { @@ -847,6 +1602,15 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", @@ -859,6 +1623,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, "vsce": { "version": "1.73.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.73.0.tgz", @@ -923,12 +1693,36 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d54b1750..f2be5fb3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -22,7 +22,7 @@ "vscode:prepublish": "tsc && rollup -c", "package": "vsce package -o rust-analyzer.vsix", "watch": "tsc --watch", - "fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix" + "fmt": "tsfmt -r && eslint -c .eslintrc.js --ext ts ./src/ --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", @@ -37,9 +37,11 @@ "@types/node-fetch": "^2.5.4", "@types/throttle-debounce": "^2.1.0", "@types/vscode": "^1.42.0", + "@typescript-eslint/eslint-plugin": "^2.20.0", + "@typescript-eslint/parser": "^2.20.0", + "eslint": "^6.8.0", "rollup": "^1.31.1", "tslib": "^1.10.0", - "tslint": "^5.20.1", "typescript": "^3.7.5", "typescript-formatter": "^7.2.2", "vsce": "^1.73.0" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c3fa788c..fab062dd 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -22,7 +22,7 @@ export class Config { "cargoFeatures", "cargo-watch", ] - .map(opt => `${Config.rootSection}.${opt}`); + .map(opt => `${Config.rootSection}.${opt}`); private static readonly extensionVersion: string = (() => { const packageJsonVersion = vscode @@ -96,7 +96,7 @@ export class Config { } case "darwin": return "ra_lsp_server-mac"; - case "win32": return "ra_lsp_server-windows.exe"; + case "win32": return "ra_lsp_server-windows.exe"; // Users on these platforms yet need to manually build from sources case "aix": @@ -126,7 +126,7 @@ export class Config { return { type: BinarySource.Type.GithubRelease, - dir: this.ctx.globalStoragePath, + dir: this.ctx.globalStoragePath, file: prebuiltBinaryName, storage: this.ctx.globalState, version: Config.extensionVersion, @@ -140,30 +140,30 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } + get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } - get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } - get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } - get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } - get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } - get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } - get featureFlags() { return this.cfg.get("featureFlags") as Record; } - get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } - + get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } + get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } + get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } + get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } + get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } + get featureFlags() { return this.cfg.get("featureFlags") as Record; } + get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } + get cargoWatchOptions(): CargoWatchOptions { return { - enable: this.cfg.get("cargo-watch.enable") as boolean, - arguments: this.cfg.get("cargo-watch.arguments") as string[], + enable: this.cfg.get("cargo-watch.enable") as boolean, + arguments: this.cfg.get("cargo-watch.arguments") as string[], allTargets: this.cfg.get("cargo-watch.allTargets") as boolean, - command: this.cfg.get("cargo-watch.command") as string, + command: this.cfg.get("cargo-watch.command") as string, }; } get cargoFeatures(): CargoFeatures { return { noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, - allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, - features: this.cfg.get("cargoFeatures.features") as string[], + allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, + features: this.cfg.get("cargoFeatures.features") as string[], }; } diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 7d497057..71889e82 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -14,7 +14,7 @@ export async function fetchArtifactReleaseInfo( ): Promise { const repoOwner = encodeURIComponent(repo.owner); - const repoName = encodeURIComponent(repo.name); + const repoName = encodeURIComponent(repo.name); const apiEndpointPath = releaseTag ? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}` @@ -28,8 +28,8 @@ export async function fetchArtifactReleaseInfo( // FIXME: handle non-ok response const response: GithubRelease = await fetch(requestUrl, { - headers: { Accept: "application/vnd.github.v3+json" } - }) + headers: { Accept: "application/vnd.github.v3+json" } + }) .then(res => res.json()); const artifact = response.assets.find(artifact => artifact.name === artifactFileName); diff --git a/rust-analyzer/editors/code/tslint.json b/rust-analyzer/editors/code/tslint.json deleted file mode 100644 index 333e2a32..00000000 --- a/rust-analyzer/editors/code/tslint.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "rules": { - "semicolon": [ - true, - "always" - ], - "prefer-const": true, - "no-floating-promises": true - } -} From 58ad2ddbb7112224b7ae27f269554b641cdfeb5a Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 17 Feb 2020 18:57:19 -0500 Subject: [PATCH 425/819] vscode-languageclient 6.1.1 --- rust-analyzer/editors/code/package-lock.json | 14 +++++++------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 22aa63c9..73e77e84 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -901,18 +901,18 @@ "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.0.tgz", - "integrity": "sha512-Tcp0VoOaa0YzxL4nEfK9tsmcy76Eo8jNLvFQZwh2c8oMm02luL8uGYPLQNAiZ3XGgegfcwiQFZMqbW7DNV0vxA==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz", + "integrity": "sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.2" + "vscode-languageserver-protocol": "^3.15.3" } }, "vscode-languageserver-protocol": { - "version": "3.15.2", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.2.tgz", - "integrity": "sha512-GdL05JKOgZ76RDg3suiGCl9enESM7iQgGw4x93ibTh4sldvZmakHmTeZ4iUApPPGKf6O3OVBtrsksBXnHYaxNg==", + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz", + "integrity": "sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw==", "requires": { "vscode-jsonrpc": "^5.0.1", "vscode-languageserver-types": "3.15.1" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d54b1750..fe9495ce 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -28,7 +28,7 @@ "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", "throttle-debounce": "^2.1.0", - "vscode-languageclient": "^6.1.0" + "vscode-languageclient": "^6.1.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", From be9cd4e61c712af7ce2f2622515124df639a0594 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Feb 2020 00:53:27 +0100 Subject: [PATCH 426/819] Allow floating promises This backfires for message-showing functions --- rust-analyzer/editors/code/.eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js index 157aa3ec..113a8a78 100644 --- a/rust-analyzer/editors/code/.eslintrc.js +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -25,7 +25,6 @@ module.exports = { } } ], - "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/semi": [ "error", "always" From 077ffc5faa817c0acf951e9ea9c6f7eb6fb127b9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Feb 2020 12:33:16 +0100 Subject: [PATCH 427/819] Rename the binary to rust-analyzer --- rust-analyzer/editors/code/package.json | 4 ++-- rust-analyzer/editors/code/src/config.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 002293b2..2a030437 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -185,7 +185,7 @@ "string" ], "default": null, - "description": "Path to ra_lsp_server executable (points to bundled binary by default)" + "description": "Path to rust-analyzer executable (points to bundled binary by default)" }, "rust-analyzer.excludeGlobs": { "type": "array", @@ -245,7 +245,7 @@ "Full log" ], "default": "off", - "description": "Trace requests to the ra_lsp_server" + "description": "Trace requests to the rust-analyzer" }, "rust-analyzer.lruCapacity": { "type": [ diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index fab062dd..7142f72a 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -76,7 +76,7 @@ export class Config { } /** - * Name of the binary artifact for `ra_lsp_server` that is published for + * Name of the binary artifact for `rust-analyzer` that is published for * `platform` on GitHub releases. (It is also stored under the same name when * downloaded by the extension). */ @@ -91,12 +91,12 @@ export class Config { case "arm": case "arm64": return null; - default: return "ra_lsp_server-linux"; + default: return "rust-analyzer-linux"; } } - case "darwin": return "ra_lsp_server-mac"; - case "win32": return "ra_lsp_server-windows.exe"; + case "darwin": return "rust-analyzer-mac"; + case "win32": return "rust-analyzer-windows.exe"; // Users on these platforms yet need to manually build from sources case "aix": From f68c629929a0b1919acfd5a4231942e4a4bee0fc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Feb 2020 12:35:44 +0100 Subject: [PATCH 428/819] Rename config value for server Path --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 2 +- rust-analyzer/editors/code/src/installation/server.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2a030437..c498c14b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -179,7 +179,7 @@ "default": {}, "description": "Fine grained feature flags to disable annoying features" }, - "rust-analyzer.raLspServerPath": { + "rust-analyzer.serverPath": { "type": [ "null", "string" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 7142f72a..347c989c 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -111,7 +111,7 @@ export class Config { } get serverSource(): null | BinarySource { - const serverPath = RA_LSP_DEBUG ?? this.cfg.get("raLspServerPath"); + const serverPath = RA_LSP_DEBUG ?? this.cfg.get("serverPath"); if (serverPath) { return { diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 80cb719e..6e730fbf 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -29,7 +29,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise Date: Thu, 20 Feb 2020 12:40:12 -0500 Subject: [PATCH 429/819] Improved compatibility with themes --- rust-analyzer/editors/code/src/color_theme.ts | 8 ++++++-- rust-analyzer/editors/code/src/highlighting.ts | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index a6957a76..2f2a3987 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -83,8 +83,12 @@ function loadThemeNamed(themeName: string): ColorTheme { res.mergeFrom(loadThemeFile(themePath)); } - const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); + const global_customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + res.mergeFrom(ColorTheme.fromRules(global_customizations?.textMateRules ?? [])); + + const theme_customizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); + res.mergeFrom(ColorTheme.fromRules(theme_customizations?.textMateRules ?? [])); + return res; } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index c4d286ae..b34e49c1 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -233,16 +233,16 @@ const TAG_TO_SCOPES = new Map([ ["type", ["entity.name.type"]], ["type.builtin", ["entity.name.type", "support.type.primitive"]], ["type.self", ["entity.name.type.parameter.self"]], - ["type.param", ["entity.name.type.parameter"]], - ["type.lifetime", ["entity.name.type.lifetime"]], + ["type.param", ["entity.name.type.parameter", "entity.name.type.param.rust"]], + ["type.lifetime", ["entity.name.type.lifetime", "entity.name.lifetime.rust"]], ["literal.byte", ["constant.character.byte"]], - ["literal.char", ["constant.character"]], + ["literal.char", ["constant.character.rust"]], ["literal.numeric", ["constant.numeric"]], ["comment", ["comment"]], ["string", ["string.quoted"]], - ["attribute", ["meta.attribute"]], + ["attribute", ["meta.attribute.rust"]], ["keyword", ["keyword"]], ["keyword.unsafe", ["keyword.other.unsafe"]], From 395ad4ddfd2f0da7932f4880a5756b20db3d9a99 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 21 Feb 2020 11:22:45 +0100 Subject: [PATCH 430/819] enforce camel case --- rust-analyzer/editors/code/.eslintrc.js | 1 + rust-analyzer/editors/code/src/color_theme.ts | 8 ++++---- rust-analyzer/editors/code/src/commands/expand_macro.ts | 4 ++-- .../code/src/installation/fetch_artifact_release_info.ts | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js index 113a8a78..5cda886e 100644 --- a/rust-analyzer/editors/code/.eslintrc.js +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -12,6 +12,7 @@ module.exports = { "@typescript-eslint" ], "rules": { + "camelcase": ["error"], "@typescript-eslint/member-delimiter-style": [ "error", { diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts index 2f2a3987..5b9327b2 100644 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ b/rust-analyzer/editors/code/src/color_theme.ts @@ -83,11 +83,11 @@ function loadThemeNamed(themeName: string): ColorTheme { res.mergeFrom(loadThemeFile(themePath)); } - const global_customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(global_customizations?.textMateRules ?? [])); + const globalCustomizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + res.mergeFrom(ColorTheme.fromRules(globalCustomizations?.textMateRules ?? [])); - const theme_customizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); - res.mergeFrom(ColorTheme.fromRules(theme_customizations?.textMateRules ?? [])); + const themeCustomizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); + res.mergeFrom(ColorTheme.fromRules(themeCustomizations?.textMateRules ?? [])); return res; diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index 6fee6eb4..edec9bbc 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -31,7 +31,7 @@ interface ExpandedMacro { expansion: string; } -function code_format(expanded: ExpandedMacro): string { +function codeFormat(expanded: ExpandedMacro): string { let result = `// Recursive expansion of ${expanded.name}! macro\n`; result += '// ' + '='.repeat(result.length - 3); result += '\n\n'; @@ -65,7 +65,7 @@ class TextDocumentContentProvider if (expanded == null) return 'Not available'; - return code_format(expanded); + return codeFormat(expanded); } get onDidChange(): vscode.Event { diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 71889e82..1e764718 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -46,6 +46,7 @@ export async function fetchArtifactReleaseInfo( name: string; assets: Array<{ name: string; + // eslint-disable-next-line camelcase browser_download_url: string; }>; } From 29556b45d6f9bafd4897e27d6a361d5295b71642 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 21 Feb 2020 10:04:03 +0800 Subject: [PATCH 431/819] Improve server version info --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/commands/index.ts | 1 + .../editors/code/src/commands/server_version.ts | 9 +++++++++ rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 16 insertions(+) create mode 100644 rust-analyzer/editors/code/src/commands/server_version.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c498c14b..72befe2b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -131,6 +131,11 @@ "command": "rust-analyzer.ssr", "title": "Structural Search Replace", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.serverVersion", + "title": "Show RA Version", + "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index bebd99ca..839245f4 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -13,6 +13,7 @@ export * from './syntax_tree'; export * from './expand_macro'; export * from './runnables'; export * from './ssr'; +export * from './server_version'; export function collectGarbage(ctx: Ctx): Cmd { return async () => { diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts new file mode 100644 index 00000000..3a982a41 --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -0,0 +1,9 @@ +import * as vscode from 'vscode'; +import { ServerVersion } from '../installation/server'; +import { Cmd } from '../ctx'; + +export function serverVersion(): Cmd { + return () => { + vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion); + }; +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a22e0bc6..de19a44e 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -55,6 +55,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('run', commands.run); ctx.registerCommand('onEnter', commands.onEnter); ctx.registerCommand('ssr', commands.ssr); + ctx.registerCommand('serverVersion', commands.serverVersion); // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); From 861a339040c286f12aef70713394553439642010 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 20 Feb 2020 16:49:31 +0800 Subject: [PATCH 432/819] Add trailing newline --- rust-analyzer/editors/code/src/commands/server_version.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 3a982a41..307408a3 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -6,4 +6,5 @@ export function serverVersion(): Cmd { return () => { vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion); }; -} \ No newline at end of file +} + From 7a9282ed6b816b4d87e22de7de28f2877844385a Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 21 Feb 2020 09:57:24 +0800 Subject: [PATCH 433/819] Use ensureServerBinary instead --- .../code/src/commands/server_version.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 307408a3..34c18bf3 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -1,10 +1,22 @@ import * as vscode from 'vscode'; -import { ServerVersion } from '../installation/server'; -import { Cmd } from '../ctx'; +import { ensureServerBinary } from '../installation/server'; +import { Ctx, Cmd } from '../ctx'; +import { spawnSync } from 'child_process'; -export function serverVersion(): Cmd { - return () => { - vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion); +export function serverVersion(ctx: Ctx): Cmd { + return async () => { + const binaryPath = await ensureServerBinary(ctx.config.serverSource); + + if (binaryPath == null) { + throw new Error( + "Rust Analyzer Language Server is not available. " + + "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)." + ); + } + + const res = spawnSync(binaryPath, ["--version"]); + const version = res.output?.filter(x => x !== null).map(String).join(" "); + vscode.window.showInformationMessage('rust-analyzer version : ' + version); }; } From 6baa150afb7a902d20279c7bffd19b8fb0b6523e Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 21 Feb 2020 15:51:55 +0800 Subject: [PATCH 434/819] Use stdout directly --- rust-analyzer/editors/code/src/commands/server_version.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 34c18bf3..421301b4 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -14,8 +14,7 @@ export function serverVersion(ctx: Ctx): Cmd { ); } - const res = spawnSync(binaryPath, ["--version"]); - const version = res.output?.filter(x => x !== null).map(String).join(" "); + const version = spawnSync(binaryPath, ["--version"], { encoding: "utf8" }).stdout; vscode.window.showInformationMessage('rust-analyzer version : ' + version); }; } From 2366e97d130dce5efd0774f89145348e3a59186e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 17 Feb 2020 22:35:37 +0200 Subject: [PATCH 435/819] vscode: migrate to tripple equals --- rust-analyzer/editors/code/.eslintrc.js | 1 + rust-analyzer/editors/code/package-lock.json | 14 +++++++------- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- .../editors/code/src/installation/server.ts | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js index 5cda886e..d494ebce 100644 --- a/rust-analyzer/editors/code/.eslintrc.js +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -12,6 +12,7 @@ module.exports = { "@typescript-eslint" ], "rules": { + "eqeqeq": ["error", "always", { "null": "ignore" }], "camelcase": ["error"], "@typescript-eslint/member-delimiter-style": [ "error", diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d7da4708..76ef2aae 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -5,18 +5,18 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" } }, "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", "dev": true, "requires": { "chalk": "^2.0.0", diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 26705067..641ec15c 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -73,7 +73,7 @@ class HintsUpdater { async setEnabled(enabled: boolean): Promise { console.log({ enabled, prev: this.enabled }); - if (this.enabled == enabled) return; + if (this.enabled === enabled) return; this.enabled = enabled; if (this.enabled) { diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 63ab104a..75085292 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -42,7 +42,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise Date: Fri, 21 Feb 2020 15:59:46 +0100 Subject: [PATCH 436/819] Extract client-side logging --- rust-analyzer/editors/code/.eslintrc.js | 7 ++++--- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 5 ++++- rust-analyzer/editors/code/src/inlay_hints.ts | 3 ++- .../src/installation/download_artifact.ts | 2 -- .../code/src/installation/download_file.ts | 7 ++++--- .../fetch_artifact_release_info.ts | 3 ++- .../editors/code/src/installation/server.ts | 19 ++++++++++--------- rust-analyzer/editors/code/src/main.ts | 3 ++- rust-analyzer/editors/code/src/util.ts | 18 ++++++++++++++++++ 10 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 rust-analyzer/editors/code/src/util.ts diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js index d494ebce..16f18ab2 100644 --- a/rust-analyzer/editors/code/.eslintrc.js +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -12,8 +12,10 @@ module.exports = { "@typescript-eslint" ], "rules": { - "eqeqeq": ["error", "always", { "null": "ignore" }], "camelcase": ["error"], + "eqeqeq": ["error", "always", { "null": "ignore" }], + "no-console": ["error"], + "prefer-const": "error", "@typescript-eslint/member-delimiter-style": [ "error", { @@ -30,7 +32,6 @@ module.exports = { "@typescript-eslint/semi": [ "error", "always" - ], - "prefer-const": "error" + ] } }; diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 72befe2b..9ef6c698 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -252,6 +252,11 @@ "default": "off", "description": "Trace requests to the rust-analyzer" }, + "rust-analyzer.trace.extension": { + "description": "Enable logging of VS Code extensions itself", + "type": "boolean", + "default": false + }, "rust-analyzer.lruCapacity": { "type": [ "null", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 347c989c..47e8cd45 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,6 +1,7 @@ import * as os from "os"; import * as vscode from 'vscode'; import { BinarySource } from "./installation/interfaces"; +import { log } from "./util"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -46,7 +47,9 @@ export class Config { private refreshConfig() { this.cfg = vscode.workspace.getConfiguration(Config.rootSection); - console.log("Using configuration:", this.cfg); + const enableLogging = this.cfg.get("trace.extension") as boolean; + log.setEnabled(enableLogging); + log.debug("Using configuration:", this.cfg); } private async onConfigChange(event: vscode.ConfigurationChangeEvent) { diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 641ec15c..7e6c310a 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Ctx, sendRequestWithRetry } from './ctx'; +import { log } from './util'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); @@ -71,7 +72,7 @@ class HintsUpdater { } async setEnabled(enabled: boolean): Promise { - console.log({ enabled, prev: this.enabled }); + log.debug({ enabled, prev: this.enabled }); if (this.enabled === enabled) return; this.enabled = enabled; diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts index 9996c556..356723ab 100644 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -29,7 +29,6 @@ export async function downloadArtifact( const installationPath = path.join(installationDir, artifactFileName); - console.time(`Downloading ${artifactFileName}`); await vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, @@ -54,5 +53,4 @@ export async function downloadArtifact( ); } ); - console.timeEnd(`Downloading ${artifactFileName}`); } diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index d154f481..319cb995 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -3,6 +3,7 @@ import * as fs from "fs"; import * as stream from "stream"; import * as util from "util"; import { strict as assert } from "assert"; +import { log } from "../util"; const pipeline = util.promisify(stream.pipeline); @@ -21,8 +22,8 @@ export async function downloadFile( const res = await fetch(url); if (!res.ok) { - console.log("Error", res.status, "while downloading file from", url); - console.dir({ body: await res.text(), headers: res.headers }, { depth: 3 }); + log.error("Error", res.status, "while downloading file from", url); + log.error({ body: await res.text(), headers: res.headers }); throw new Error(`Got response ${res.status} when trying to download a file.`); } @@ -30,7 +31,7 @@ export async function downloadFile( const totalBytes = Number(res.headers.get('content-length')); assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol"); - console.log("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); + log.debug("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); let readBytes = 0; res.body.on("data", (chunk: Buffer) => { diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 1e764718..1b6fc8d4 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -1,5 +1,6 @@ import fetch from "node-fetch"; import { GithubRepo, ArtifactReleaseInfo } from "./interfaces"; +import { log } from "../util"; const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; @@ -24,7 +25,7 @@ export async function fetchArtifactReleaseInfo( // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) - console.log("Issuing request for released artifacts metadata to", requestUrl); + log.debug("Issuing request for released artifacts metadata to", requestUrl); // FIXME: handle non-ok response const response: GithubRelease = await fetch(requestUrl, { diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 75085292..685abfdc 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -7,6 +7,7 @@ import { spawnSync } from "child_process"; import { BinarySource } from "./interfaces"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; import { downloadArtifact } from "./download_artifact"; +import { log } from "../util"; export async function ensureServerBinary(source: null | BinarySource): Promise { if (!source) { @@ -40,7 +41,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise console.log("DNS resolution for example.com was successful", addrs), + addrs => log.debug("DNS resolution for example.com was successful", addrs), err => { - console.error( + log.error( "DNS resolution for example.com failed, " + "there might be an issue with Internet availability" ); - console.error(err); + log.error(err); } ); return false; @@ -105,19 +106,19 @@ function isBinaryAvailable(binaryPath: string): boolean { // ACHTUNG! `res` type declaration is inherently wrong, see // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 - console.log("Checked binary availablity via --version", res); - console.log(binaryPath, "--version output:", res.output?.map(String)); + log.debug("Checked binary availablity via --version", res); + log.debug(binaryPath, "--version output:", res.output?.map(String)); return res.status === 0; } function getServerVersion(storage: vscode.Memento): null | string { const version = storage.get("server-version", null); - console.log("Get server-version:", version); + log.debug("Get server-version:", version); return version; } async function setServerVersion(storage: vscode.Memento, version: string): Promise { - console.log("Set server-version:", version); + log.debug("Set server-version:", version); await storage.update("server-version", version.toString()); } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index de19a44e..7b3bb630 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -7,6 +7,7 @@ import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; import { ensureServerBinary } from './installation/server'; import { Config } from './config'; +import { log } from './util'; let ctx: Ctx | undefined; @@ -38,7 +39,7 @@ export async function activate(context: vscode.ExtensionContext) { try { sub.dispose(); } catch (e) { - console.error(e); + log.error(e); } } await activate(context); diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts new file mode 100644 index 00000000..7a665775 --- /dev/null +++ b/rust-analyzer/editors/code/src/util.ts @@ -0,0 +1,18 @@ +let enabled: boolean = false; + +export const log = { + debug(message?: any, ...optionalParams: any[]): void { + if (!enabled) return; + // eslint-disable-next-line no-console + console.log(message, ...optionalParams); + }, + error(message?: any, ...optionalParams: any[]): void { + if (!enabled) return; + debugger; + // eslint-disable-next-line no-console + console.error(message, ...optionalParams); + }, + setEnabled(yes: boolean): void { + enabled = yes; + } +}; From b8b08902074fe7c928403ccc656b1b008a2c864c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 22 Feb 2020 20:58:00 +0200 Subject: [PATCH 437/819] vscode: gracefully handle cancellation errors --- rust-analyzer/editors/code/src/ctx.ts | 21 ---------- .../editors/code/src/highlighting.ts | 3 +- rust-analyzer/editors/code/src/inlay_hints.ts | 40 +++++++++---------- rust-analyzer/editors/code/src/util.ts | 40 +++++++++++++++++++ 4 files changed, 60 insertions(+), 44 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index dfc8aa7b..43540e0d 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -52,24 +52,3 @@ export interface Disposable { dispose(): void; } export type Cmd = (...args: any[]) => unknown; - -export async function sendRequestWithRetry( - client: lc.LanguageClient, - method: string, - param: unknown, - token?: vscode.CancellationToken, -): Promise { - for (const delay of [2, 4, 6, 8, 10, null]) { - try { - return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param)); - } catch (err) { - if (delay === null || err.code !== lc.ErrorCodes.ContentModified) { - throw err; - } - await sleep(10 * (1 << delay)); - } - } - throw 'unreachable'; -} - -const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index b34e49c1..77b4a1a6 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -3,7 +3,8 @@ import * as lc from 'vscode-languageclient'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; -import { Ctx, sendRequestWithRetry } from './ctx'; +import { Ctx } from './ctx'; +import { sendRequestWithRetry } from './util'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 7e6c310a..5f9229ef 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import { Ctx, sendRequestWithRetry } from './ctx'; -import { log } from './util'; +import { Ctx } from './ctx'; +import { log, sendRequestWithRetry } from './util'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); @@ -152,28 +152,24 @@ class HintsUpdater { } private async queryHints(documentUri: string): Promise { - const client = this.ctx.client; - if (!client) return null; + this.pending.get(documentUri)?.cancel(); - const request: InlayHintsParams = { - textDocument: { uri: documentUri }, - }; const tokenSource = new vscode.CancellationTokenSource(); - const prevHintsRequest = this.pending.get(documentUri); - prevHintsRequest?.cancel(); - this.pending.set(documentUri, tokenSource); - try { - return await sendRequestWithRetry( - client, - 'rust-analyzer/inlayHints', - request, - tokenSource.token, - ); - } finally { - if (!tokenSource.token.isCancellationRequested) { - this.pending.delete(documentUri); - } - } + + const request: InlayHintsParams = { textDocument: { uri: documentUri } }; + + return sendRequestWithRetry( + this.ctx.client, + 'rust-analyzer/inlayHints', + request, + tokenSource.token + ) + .catch(_ => null) + .finally(() => { + if (!tokenSource.token.isCancellationRequested) { + this.pending.delete(documentUri); + } + }); } } diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 7a665775..2f18f85a 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,3 +1,6 @@ +import * as lc from "vscode-languageclient"; +import * as vscode from "vscode"; + let enabled: boolean = false; export const log = { @@ -16,3 +19,40 @@ export const log = { enabled = yes; } }; + +export async function sendRequestWithRetry( + client: lc.LanguageClient, + method: string, + param: unknown, + token?: vscode.CancellationToken, +): Promise { + for (const delay of [2, 4, 6, 8, 10, null]) { + try { + return await (token + ? client.sendRequest(method, param, token) + : client.sendRequest(method, param) + ); + } catch (error) { + if (delay === null) { + log.error("LSP request timed out", { method, param, error }); + throw error; + } + + if (error.code === lc.ErrorCodes.RequestCancelled) { + throw error; + } + + if (error.code !== lc.ErrorCodes.ContentModified) { + log.error("LSP request failed", { method, param, error }); + throw error; + } + + await sleep(10 * (1 << delay)); + } + } + throw 'unreachable'; +} + +function sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); +} From 6cc0cb4c432f1411703366227e834d2fdb1c4921 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 24 Feb 2020 11:56:52 +0200 Subject: [PATCH 438/819] Quick fix circular json error when sanity-check fails Related issue: #3280 --- rust-analyzer/editors/code/src/installation/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 685abfdc..5afce410 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -88,9 +88,12 @@ async function downloadServer(source: BinarySource.GithubRelease): Promise Date: Mon, 24 Feb 2020 12:32:15 +0100 Subject: [PATCH 439/819] Don't break onEnter if rust-analyzer fails to start closes #3253 --- rust-analyzer/editors/code/src/main.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 7b3bb630..424ff1ac 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -12,6 +12,26 @@ import { log } from './util'; let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { + // Register a "dumb" onEnter command for the case where server fails to + // start. + // + // FIXME: refactor command registration code such that commands are + // **always** registered, even if the server does not start. Use API like + // this perhaps? + // + // ```TypeScript + // registerCommand( + // factory: (Ctx) => ((Ctx) => any), + // fallback: () => any = () => vscode.window.showErrorMessage( + // "rust-analyzer is not available" + // ), + // ) + const defaultOnEnter = vscode.commands.registerCommand( + 'rust-analyzer.onEnter', + () => vscode.commands.executeCommand('default:type', { text: '\n' }), + ); + context.subscriptions.push(defaultOnEnter); + const config = new Config(context); const serverPath = await ensureServerBinary(config.serverSource); @@ -54,7 +74,10 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); + + defaultOnEnter.dispose(); ctx.registerCommand('onEnter', commands.onEnter); + ctx.registerCommand('ssr', commands.ssr); ctx.registerCommand('serverVersion', commands.serverVersion); From 64ebce36af000d1a2b4c3bd8114c2e5b73fe8bf0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 24 Feb 2020 12:45:34 +0100 Subject: [PATCH 440/819] Don't block onEnter if request fails closes #3286 --- rust-analyzer/editors/code/src/commands/on_enter.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 25eaebcb..27ae8ec2 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -19,6 +19,12 @@ async function handleKeypress(ctx: Ctx) { const change = await client.sendRequest( 'rust-analyzer/onEnter', request, + ).catch( + (_error: any) => { + // FIXME: switch to the more modern (?) typed request infrastructure + // client.logFailedRequest(OnEnterRequest.type, error); + return Promise.resolve(null); + } ); if (!change) return false; From 1de4e676bebe71d25c4d107bd35831ebfaca5e64 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 24 Feb 2020 15:41:13 +0100 Subject: [PATCH 441/819] Cleanp --- rust-analyzer/editors/code/src/installation/server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 5afce410..9de257dd 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -89,8 +89,8 @@ async function downloadServer(source: BinarySource.GithubRelease): Promise Date: Mon, 24 Feb 2020 21:13:10 +0200 Subject: [PATCH 442/819] add error handling to fetchArtifactReleaseInfo(), throw Error when no artifact found --- .../fetch_artifact_release_info.ts | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 1b6fc8d4..5e201afb 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -4,41 +4,59 @@ import { log } from "../util"; const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; - /** - * Fetches the release with `releaseTag` (or just latest release when not specified) - * from GitHub `repo` and returns metadata about `artifactFileName` shipped with - * this release or `null` if no such artifact was published. + * Fetches the release with `releaseTag` from GitHub `repo` and + * returns metadata about `artifactFileName` shipped with + * this release. + * + * @throws Error upon network failure or if no such repository, release, or artifact exists. */ export async function fetchArtifactReleaseInfo( - repo: GithubRepo, artifactFileName: string, releaseTag?: string -): Promise { + repo: GithubRepo, + artifactFileName: string, + releaseTag: string +): Promise { const repoOwner = encodeURIComponent(repo.owner); const repoName = encodeURIComponent(repo.name); - const apiEndpointPath = releaseTag - ? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}` - : `/repos/${repoOwner}/${repoName}/releases/latest`; + const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}`; const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; - // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) - log.debug("Issuing request for released artifacts metadata to", requestUrl); - // FIXME: handle non-ok response - const response: GithubRelease = await fetch(requestUrl, { - headers: { Accept: "application/vnd.github.v3+json" } - }) - .then(res => res.json()); + const response = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }); + + if (!response.ok) { + log.error("Error fetching artifact release info", { + requestUrl, + releaseTag, + artifactFileName, + response: { + headers: response.headers, + status: response.status, + body: await response.text(), + } + }); + + throw new Error( + `Got response ${response.status} when trying to fetch ` + + `"${artifactFileName}" artifact release info for ${releaseTag} release` + ); + } + + // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) + const release: GithubRelease = await response.json(); - const artifact = response.assets.find(artifact => artifact.name === artifactFileName); + const artifact = release.assets.find(artifact => artifact.name === artifactFileName); - if (!artifact) return null; + if (!artifact) throw new Error( + `Artifact ${artifactFileName} was not found in ${release.name} release!` + ); return { - releaseName: response.name, + releaseName: release.name, downloadUrl: artifact.browser_download_url }; From 8cad34d5b41386b61f6f9e01dad1f0e595a0d560 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 24 Feb 2020 21:23:48 +0200 Subject: [PATCH 443/819] vscode: remove type assertion --- rust-analyzer/editors/code/.eslintrc.js | 3 ++- rust-analyzer/editors/code/src/installation/server.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/.eslintrc.js b/rust-analyzer/editors/code/.eslintrc.js index 16f18ab2..c6bf410f 100644 --- a/rust-analyzer/editors/code/.eslintrc.js +++ b/rust-analyzer/editors/code/.eslintrc.js @@ -32,6 +32,7 @@ module.exports = { "@typescript-eslint/semi": [ "error", "always" - ] + ], + "@typescript-eslint/no-unnecessary-type-assertion": "error" } }; diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 9de257dd..cb5e5684 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -63,7 +63,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise { try { - const releaseInfo = (await fetchArtifactReleaseInfo(source.repo, source.file, source.version))!; + const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.version); await downloadArtifact(releaseInfo, source.file, source.dir, "language server"); await setServerVersion(source.storage, releaseInfo.releaseName); From 30eda08aa61f0264afcea8a4996a001fe4f5579f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 24 Feb 2020 21:37:53 +0200 Subject: [PATCH 444/819] vscode: bump TypeScript version --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 76ef2aae..0288a468 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1575,9 +1575,9 @@ } }, "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz", + "integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==", "dev": true }, "typescript-formatter": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9ef6c698..dff535fc 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -42,7 +42,7 @@ "eslint": "^6.8.0", "rollup": "^1.31.1", "tslib": "^1.10.0", - "typescript": "^3.7.5", + "typescript": "^3.8.2", "typescript-formatter": "^7.2.2", "vsce": "^1.73.0" }, From 8289cc80d80d1d271c1f18c6ca18e2d4d9682b42 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:48:44 +0200 Subject: [PATCH 445/819] vscode: create rust-analyzer-api.ts --- .../editors/code/src/rust-analyzer-api.ts | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 rust-analyzer/editors/code/src/rust-analyzer-api.ts diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts new file mode 100644 index 00000000..d2738fef --- /dev/null +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -0,0 +1,117 @@ +/** + * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. + */ + +import { RequestType, TextDocumentIdentifier, Position, Range, TextDocumentPositionParams, Location, NotificationType, WorkspaceEdit } from "vscode-languageclient"; + +type Option = null | T; +type Vec = T[]; +type FxHashMap = Record; + +function request(method: string) { + return new RequestType(`rust-analyzer/${method}`); +} +function notification(method: string) { + return new NotificationType(method); +} + + +export const analyzerStatus = request("analyzerStatus"); + + +export const collectGarbage = request("collectGarbage"); + + +export interface SyntaxTreeParams { + textDocument: TextDocumentIdentifier; + range: Option; +} +export const syntaxTree = request("syntaxTree"); + + +export interface ExpandMacroParams { + textDocument: TextDocumentIdentifier; + position: Option; +} +export interface ExpandedMacro { + name: string; + expansion: string; +} +export const expandMacro = request>("expandMacro"); + + +export interface FindMatchingBraceParams { + textDocument: TextDocumentIdentifier; + offsets: Vec; +} +export const findMatchingBrace = request>("findMatchingBrace"); + + +export interface PublishDecorationsParams { + uri: string; + decorations: Vec; +} +export interface Decoration { + range: Range; + tag: string; + bindingHash: Option; +} +export const decorationsRequest = request>("decorationsRequest"); + + +export const parentModule = request>("parentModule"); + + +export interface JoinLinesParams { + textDocument: TextDocumentIdentifier; + range: Range; +} +export const joinLines = request("joinLines"); + + +export const onEnter = request>("onEnter"); + +export interface RunnablesParams { + textDocument: TextDocumentIdentifier; + position: Option; +} +export interface Runnable { + range: Range; + label: string; + bin: string; + args: Vec; + env: FxHashMap; + cwd: Option; +} +export const runnables = request>("runnables"); + + +export const enum InlayKind { + TypeHint = "TypeHint", + ParameterHint = "ParameterHint", +} +export interface InlayHint { + range: Range; + kind: InlayKind; + label: string; +} +export interface InlayHintsParams { + textDocument: TextDocumentIdentifier; +} +export const inlayHints = request>("inlayHints"); + + +export interface SsrParams { + arg: string; +} +export const ssr = request("ssr"); + + +export const publishDecorations = notification("publishDecorations"); + + +export interface SourceChange { + label: string; + workspaceEdit: WorkspaceEdit; + cursorPosition: Option; +} From 456307e99393995fa41b6c2a6ae1838c404c634a Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:49:19 +0200 Subject: [PATCH 446/819] vscode: migrate source_cnage.rs to rust-analyzer-api.rs --- rust-analyzer/editors/code/src/source_change.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index a336269b..399a150c 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -1,15 +1,10 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; -export interface SourceChange { - label: string; - workspaceEdit: lc.WorkspaceEdit; - cursorPosition?: lc.TextDocumentPositionParams; -} - -export async function applySourceChange(ctx: Ctx, change: SourceChange) { +export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) { const client = ctx.client; if (!client) return; From 350223e43e5faaae5a6ee270de8bbe5be61586d7 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:49:54 +0200 Subject: [PATCH 447/819] vscode: migrate highlighting to rust-analyzer-api.ts --- .../editors/code/src/highlighting.ts | 60 +++++++------------ 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 77b4a1a6..3e0cbdc5 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from './rust-analyzer-api'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; @@ -8,29 +8,25 @@ import { sendRequestWithRetry } from './util'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - const client = ctx.client; - if (client != null) { - client.onNotification( - 'rust-analyzer/publishDecorations', - (params: PublishDecorationsParams) => { - if (!ctx.config.highlightingOn) return; - - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape( - editor.document.uri.toString(), - ); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri; - }, - ); - if (!targetEditor) return; - highlighter.setHighlights(targetEditor, params.decorations); + ctx.client.onNotification(ra.publishDecorations, params => { + if (!ctx.config.highlightingOn) return; + + const targetEditor = vscode.window.visibleTextEditors.find( + editor => { + const unescapedUri = unescape( + editor.document.uri.toString(), + ); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; }, ); - } + if (!targetEditor) return; + + highlighter.setHighlights(targetEditor, params.decorations); + }); + vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), @@ -45,13 +41,10 @@ export function activateHighlighting(ctx: Ctx) { const client = ctx.client; if (!client) return; - const params: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString(), - }; - const decorations = await sendRequestWithRetry( + const decorations = await sendRequestWithRetry( client, - 'rust-analyzer/decorationsRequest', - params, + ra.decorationsRequest, + { uri: editor.document.uri.toString() }, ); highlighter.setHighlights(editor, decorations); }, @@ -60,17 +53,6 @@ export function activateHighlighting(ctx: Ctx) { ); } -interface PublishDecorationsParams { - uri: string; - decorations: Decoration[]; -} - -interface Decoration { - range: lc.Range; - tag: string; - bindingHash?: string; -} - // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 function fancify(seed: string, shade: 'light' | 'dark') { const random = randomU32Numbers(hashString(seed)); @@ -108,7 +90,7 @@ class Highlighter { this.decorations = null; } - public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) { + public setHighlights(editor: vscode.TextEditor, highlights: ra.Decoration[]) { const client = this.ctx.client; if (!client) return; // Initialize decorations if necessary From a1611ea68375dc1c2cf05006e0e81e2bbf2c2871 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:50:14 +0200 Subject: [PATCH 448/819] vscode: migrate analyzer_status to rust-analyzer-api.ts --- rust-analyzer/editors/code/src/commands/analyzer_status.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 6631e8db..1c6ea399 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; // Shows status of rust-analyzer (for debugging) @@ -50,10 +51,7 @@ class TextDocumentContentProvider const client = this.ctx.client; if (!editor || !client) return ''; - return client.sendRequest( - 'rust-analyzer/analyzerStatus', - null, - ); + return client.sendRequest(ra.analyzerStatus, null); } get onDidChange(): vscode.Event { From 66ea59e97d18125d6dba26fc45e71869f0d6ca0b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:50:36 +0200 Subject: [PATCH 449/819] vscode: migrate expand_macro to rust-analyzer-api.ts --- .../editors/code/src/commands/expand_macro.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts index edec9bbc..23f2ef1d 100644 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ b/rust-analyzer/editors/code/src/commands/expand_macro.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -26,12 +26,7 @@ export function expandMacro(ctx: Ctx): Cmd { }; } -interface ExpandedMacro { - name: string; - expansion: string; -} - -function codeFormat(expanded: ExpandedMacro): string { +function codeFormat(expanded: ra.ExpandedMacro): string { let result = `// Recursive expansion of ${expanded.name}! macro\n`; result += '// ' + '='.repeat(result.length - 3); result += '\n\n'; @@ -54,14 +49,11 @@ class TextDocumentContentProvider if (!editor || !client) return ''; const position = editor.selection.active; - const request: lc.TextDocumentPositionParams = { + + const expanded = await client.sendRequest(ra.expandMacro, { textDocument: { uri: editor.document.uri.toString() }, position, - }; - const expanded = await client.sendRequest( - 'rust-analyzer/expandMacro', - request, - ); + }); if (expanded == null) return 'Not available'; From 85386cab8a13e57acb9155ed834ee0c0008ab3e2 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:50:57 +0200 Subject: [PATCH 450/819] vscode: migrate collectGarbage to rust-analyzer-api.ts --- rust-analyzer/editors/code/src/commands/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 839245f4..bdb7fc3b 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; import * as sourceChange from '../source_change'; @@ -16,9 +17,7 @@ export * from './ssr'; export * from './server_version'; export function collectGarbage(ctx: Ctx): Cmd { - return async () => { - await ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); - }; + return async () => ctx.client.sendRequest(ra.collectGarbage, null); } export function showReferences(ctx: Ctx): Cmd { @@ -36,13 +35,13 @@ export function showReferences(ctx: Ctx): Cmd { } export function applySourceChange(ctx: Ctx): Cmd { - return async (change: sourceChange.SourceChange) => { + return async (change: ra.SourceChange) => { await sourceChange.applySourceChange(ctx, change); }; } export function selectAndApplySourceChange(ctx: Ctx): Cmd { - return async (changes: sourceChange.SourceChange[]) => { + return async (changes: ra.SourceChange[]) => { if (changes.length === 1) { await sourceChange.applySourceChange(ctx, changes[0]); } else if (changes.length > 0) { From 5a7561582ecbe3c6781a72d3318af4f8d01b4e5c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:54:50 +0200 Subject: [PATCH 451/819] vscode: migrate join_lines to rust-analyzer-api.ts --- .../editors/code/src/commands/join_lines.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index 7b08c325..de061465 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,7 +1,7 @@ -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; -import { applySourceChange, SourceChange } from '../source_change'; +import { applySourceChange } from '../source_change'; export function joinLines(ctx: Ctx): Cmd { return async () => { @@ -9,19 +9,10 @@ export function joinLines(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const request: JoinLinesParams = { + const change = await client.sendRequest(ra.joinLines, { range: client.code2ProtocolConverter.asRange(editor.selection), textDocument: { uri: editor.document.uri.toString() }, - }; - const change = await client.sendRequest( - 'rust-analyzer/joinLines', - request, - ); + }); await applySourceChange(ctx, change); }; } - -interface JoinLinesParams { - textDocument: lc.TextDocumentIdentifier; - range: lc.Range; -} From d608fa928f4957c5b6fd83c60ca773231d2cf132 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:55:13 +0200 Subject: [PATCH 452/819] vscode: migrate matching_brace to rust-analyzer-api.ts --- .../editors/code/src/commands/matching_brace.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index 7c58bb7e..a60776e2 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -9,16 +9,12 @@ export function matchingBrace(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const request: FindMatchingBraceParams = { + const response = await client.sendRequest(ra.findMatchingBrace, { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map(s => client.code2ProtocolConverter.asPosition(s.active), ), - }; - const response = await client.sendRequest( - 'rust-analyzer/findMatchingBrace', - request, - ); + }); editor.selections = editor.selections.map((sel, idx) => { const active = client.protocol2CodeConverter.asPosition( response[idx], @@ -29,8 +25,3 @@ export function matchingBrace(ctx: Ctx): Cmd { editor.revealRange(editor.selection); }; } - -interface FindMatchingBraceParams { - textDocument: lc.TextDocumentIdentifier; - offsets: lc.Position[]; -} From e224f49056ceb817caa5e7c7986f081ab722659f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:55:48 +0200 Subject: [PATCH 453/819] vscode: migrate on_enter to rust-analyzer-api.ts --- .../editors/code/src/commands/on_enter.ts | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 27ae8ec2..285849db 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; -import { applySourceChange, SourceChange } from '../source_change'; +import { applySourceChange } from '../source_change'; import { Cmd, Ctx } from '../ctx'; async function handleKeypress(ctx: Ctx) { @@ -10,22 +10,15 @@ async function handleKeypress(ctx: Ctx) { if (!editor || !client) return false; - const request: lc.TextDocumentPositionParams = { + const change = await client.sendRequest(ra.onEnter, { textDocument: { uri: editor.document.uri.toString() }, position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), - }; - const change = await client.sendRequest( - 'rust-analyzer/onEnter', - request, - ).catch( - (_error: any) => { - // FIXME: switch to the more modern (?) typed request infrastructure - // client.logFailedRequest(OnEnterRequest.type, error); - return Promise.resolve(null); - } - ); + }).catch(_error => { + // client.logFailedRequest(OnEnterRequest.type, error); + return null; + }); if (!change) return false; await applySourceChange(ctx, change); From 167cc84b6c0187ea4e13b1e35331af4886fcc78f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:56:19 +0200 Subject: [PATCH 454/819] vscode: migrate parent_module to rust-analyzer-api.ts --- .../editors/code/src/commands/parent_module.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts index bf40b402..8f78ddd7 100644 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ b/rust-analyzer/editors/code/src/commands/parent_module.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -9,16 +9,12 @@ export function parentModule(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const request: lc.TextDocumentPositionParams = { + const response = await client.sendRequest(ra.parentModule, { textDocument: { uri: editor.document.uri.toString() }, position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), - }; - const response = await client.sendRequest( - 'rust-analyzer/parentModule', - request, - ); + }); const loc = response[0]; if (loc == null) return; From bf527b4bfaabd3a6ba69756f0fb281cfa3db04a7 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:56:38 +0200 Subject: [PATCH 455/819] vscode: migrate runnables to rust-analyzer-api.ts --- .../editors/code/src/commands/runnables.ts | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 7919997c..06b51346 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -14,16 +15,13 @@ export function run(ctx: Ctx): Cmd { const textDocument: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; - const params: RunnablesParams = { + + const runnables = await client.sendRequest(ra.runnables, { textDocument, position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), - }; - const runnables = await client.sendRequest( - 'rust-analyzer/runnables', - params, - ); + }); const items: RunnableQuickPick[] = []; if (prevRunnable) { items.push(prevRunnable); @@ -48,7 +46,7 @@ export function run(ctx: Ctx): Cmd { } export function runSingle(ctx: Ctx): Cmd { - return async (runnable: Runnable) => { + return async (runnable: ra.Runnable) => { const editor = ctx.activeRustEditor; if (!editor) return; @@ -64,26 +62,13 @@ export function runSingle(ctx: Ctx): Cmd { }; } -interface RunnablesParams { - textDocument: lc.TextDocumentIdentifier; - position?: lc.Position; -} - -interface Runnable { - label: string; - bin: string; - args: string[]; - env: { [index: string]: string }; - cwd?: string; -} - class RunnableQuickPick implements vscode.QuickPickItem { public label: string; public description?: string | undefined; public detail?: string | undefined; public picked?: boolean | undefined; - constructor(public runnable: Runnable) { + constructor(public runnable: ra.Runnable) { this.label = runnable.label; } } @@ -96,7 +81,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { env?: { [key: string]: string }; } -function createTask(spec: Runnable): vscode.Task { +function createTask(spec: ra.Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; const definition: CargoTaskDefinition = { type: 'cargo', From 9ac4d99bd621921bff81127ceb342dbcea93e147 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:56:57 +0200 Subject: [PATCH 456/819] vscode: migrate ssr to rust-analyzer-api.ts --- rust-analyzer/editors/code/src/commands/ssr.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index 9b814612..63c36ce8 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -1,6 +1,8 @@ -import { Ctx, Cmd } from '../ctx'; -import { applySourceChange, SourceChange } from '../source_change'; import * as vscode from 'vscode'; +import * as ra from "../rust-analyzer-api"; + +import { Ctx, Cmd } from '../ctx'; +import { applySourceChange } from '../source_change'; export function ssr(ctx: Ctx): Cmd { return async () => { @@ -21,16 +23,8 @@ export function ssr(ctx: Ctx): Cmd { if (!request) return; - const ssrRequest: SsrRequest = { arg: request }; - const change = await client.sendRequest( - 'rust-analyzer/ssr', - ssrRequest, - ); + const change = await client.sendRequest(ra.ssr, { arg: request },); await applySourceChange(ctx, change); }; } - -interface SsrRequest { - arg: string; -} From d3f290989cd5d8490444c0c85313f9d94d574393 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:57:14 +0200 Subject: [PATCH 457/819] vscode: migrate syntax_tree to rust-analyzer-api.ts --- .../editors/code/src/commands/syntax_tree.ts | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 2887c96c..7218bfb9 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -61,13 +61,8 @@ function afterLs(f: () => void) { setTimeout(f, 10); } -interface SyntaxTreeParams { - textDocument: lc.TextDocumentIdentifier; - range?: lc.Range; -} -class TextDocumentContentProvider - implements vscode.TextDocumentContentProvider { +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); eventEmitter = new vscode.EventEmitter(); @@ -79,23 +74,15 @@ class TextDocumentContentProvider const client = this.ctx.client; if (!editor || !client) return ''; - let range: lc.Range | undefined; - // When the range based query is enabled we take the range of the selection - if (uri.query === 'range=true') { - range = editor.selection.isEmpty - ? undefined - : client.code2ProtocolConverter.asRange(editor.selection); - } + const range = uri.query === 'range=true' && !editor.selection.isEmpty + ? client.code2ProtocolConverter.asRange(editor.selection) + : null; - const request: SyntaxTreeParams = { + return client.sendRequest(ra.syntaxTree, { textDocument: { uri: editor.document.uri.toString() }, range, - }; - return client.sendRequest( - 'rust-analyzer/syntaxTree', - request, - ); + }); } get onDidChange(): vscode.Event { From 5d3fa5a22c83ff2c589be337492f5daf8776c23e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 00:57:49 +0200 Subject: [PATCH 458/819] vscode: migrate inlay_hints to rust-analyzer-api.ts --- rust-analyzer/editors/code/src/inlay_hints.ts | 31 +++++-------------- rust-analyzer/editors/code/src/util.ts | 16 +++++----- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 5f9229ef..5951cf1b 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; import { log, sendRequestWithRetry } from './util'; @@ -39,16 +39,6 @@ export function activateInlayHints(ctx: Ctx) { void hintsUpdater.setEnabled(ctx.config.displayInlayHints); } -interface InlayHintsParams { - textDocument: lc.TextDocumentIdentifier; -} - -interface InlayHint { - range: vscode.Range; - kind: "TypeHint" | "ParameterHint"; - label: string; -} - const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { color: new vscode.ThemeColor('rust_analyzer.inlayHint'), @@ -107,9 +97,9 @@ class HintsUpdater { if (newHints == null) return; const newTypeDecorations = newHints - .filter(hint => hint.kind === 'TypeHint') + .filter(hint => hint.kind === ra.InlayKind.TypeHint) .map(hint => ({ - range: hint.range, + range: this.ctx.client.protocol2CodeConverter.asRange(hint.range), renderOptions: { after: { contentText: `: ${hint.label}`, @@ -119,9 +109,9 @@ class HintsUpdater { this.setTypeDecorations(editor, newTypeDecorations); const newParameterDecorations = newHints - .filter(hint => hint.kind === 'ParameterHint') + .filter(hint => hint.kind === ra.InlayKind.ParameterHint) .map(hint => ({ - range: hint.range, + range: this.ctx.client.protocol2CodeConverter.asRange(hint.range), renderOptions: { before: { contentText: `${hint.label}: `, @@ -151,20 +141,15 @@ class HintsUpdater { ); } - private async queryHints(documentUri: string): Promise { + private async queryHints(documentUri: string): Promise { this.pending.get(documentUri)?.cancel(); const tokenSource = new vscode.CancellationTokenSource(); this.pending.set(documentUri, tokenSource); - const request: InlayHintsParams = { textDocument: { uri: documentUri } }; + const request = { textDocument: { uri: documentUri } }; - return sendRequestWithRetry( - this.ctx.client, - 'rust-analyzer/inlayHints', - request, - tokenSource.token - ) + return sendRequestWithRetry(this.ctx.client, ra.inlayHints, request, tokenSource.token) .catch(_ => null) .finally(() => { if (!tokenSource.token.isCancellationRequested) { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 2f18f85a..68c2a94d 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -20,21 +20,21 @@ export const log = { } }; -export async function sendRequestWithRetry( +export async function sendRequestWithRetry( client: lc.LanguageClient, - method: string, - param: unknown, + reqType: lc.RequestType, + param: TParam, token?: vscode.CancellationToken, -): Promise { +): Promise { for (const delay of [2, 4, 6, 8, 10, null]) { try { return await (token - ? client.sendRequest(method, param, token) - : client.sendRequest(method, param) + ? client.sendRequest(reqType, param, token) + : client.sendRequest(reqType, param) ); } catch (error) { if (delay === null) { - log.error("LSP request timed out", { method, param, error }); + log.error("LSP request timed out", { method: reqType.method, param, error }); throw error; } @@ -43,7 +43,7 @@ export async function sendRequestWithRetry( } if (error.code !== lc.ErrorCodes.ContentModified) { - log.error("LSP request failed", { method, param, error }); + log.error("LSP request failed", { method: reqType.method, param, error }); throw error; } From 9da912921fff13c671f6e7f870c3211346e47540 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 01:00:00 +0200 Subject: [PATCH 459/819] vscode: run fmt --- rust-analyzer/editors/code/src/commands/ssr.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index 63c36ce8..eee48c69 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -23,7 +23,7 @@ export function ssr(ctx: Ctx): Cmd { if (!request) return; - const change = await client.sendRequest(ra.ssr, { arg: request },); + const change = await client.sendRequest(ra.ssr, { arg: request }); await applySourceChange(ctx, change); }; From 7e2b6c8fdd23bc772cccd6cebe5f7e6b84ae4eb8 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 01:43:52 +0200 Subject: [PATCH 460/819] vscode: migrate rust-analyzer-api to import * as lc as per matklad and kjeremy --- .../editors/code/src/rust-analyzer-api.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index d2738fef..c5a010e9 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -2,17 +2,17 @@ * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. */ -import { RequestType, TextDocumentIdentifier, Position, Range, TextDocumentPositionParams, Location, NotificationType, WorkspaceEdit } from "vscode-languageclient"; +import * as lc from "vscode-languageclient"; type Option = null | T; type Vec = T[]; type FxHashMap = Record; function request(method: string) { - return new RequestType(`rust-analyzer/${method}`); + return new lc.RequestType(`rust-analyzer/${method}`); } function notification(method: string) { - return new NotificationType(method); + return new lc.NotificationType(method); } @@ -23,15 +23,15 @@ export const collectGarbage = request("collectGarbage"); export interface SyntaxTreeParams { - textDocument: TextDocumentIdentifier; - range: Option; + textDocument: lc.TextDocumentIdentifier; + range: Option; } export const syntaxTree = request("syntaxTree"); export interface ExpandMacroParams { - textDocument: TextDocumentIdentifier; - position: Option; + textDocument: lc.TextDocumentIdentifier; + position: Option; } export interface ExpandedMacro { name: string; @@ -41,10 +41,10 @@ export const expandMacro = request>("ex export interface FindMatchingBraceParams { - textDocument: TextDocumentIdentifier; - offsets: Vec; + textDocument: lc.TextDocumentIdentifier; + offsets: Vec; } -export const findMatchingBrace = request>("findMatchingBrace"); +export const findMatchingBrace = request>("findMatchingBrace"); export interface PublishDecorationsParams { @@ -52,31 +52,31 @@ export interface PublishDecorationsParams { decorations: Vec; } export interface Decoration { - range: Range; + range: lc.Range; tag: string; bindingHash: Option; } -export const decorationsRequest = request>("decorationsRequest"); +export const decorationsRequest = request>("decorationsRequest"); -export const parentModule = request>("parentModule"); +export const parentModule = request>("parentModule"); export interface JoinLinesParams { - textDocument: TextDocumentIdentifier; - range: Range; + textDocument: lc.TextDocumentIdentifier; + range: lc.Range; } export const joinLines = request("joinLines"); -export const onEnter = request>("onEnter"); +export const onEnter = request>("onEnter"); export interface RunnablesParams { - textDocument: TextDocumentIdentifier; - position: Option; + textDocument: lc.TextDocumentIdentifier; + position: Option; } export interface Runnable { - range: Range; + range: lc.Range; label: string; bin: string; args: Vec; @@ -91,12 +91,12 @@ export const enum InlayKind { ParameterHint = "ParameterHint", } export interface InlayHint { - range: Range; + range: lc.Range; kind: InlayKind; label: string; } export interface InlayHintsParams { - textDocument: TextDocumentIdentifier; + textDocument: lc.TextDocumentIdentifier; } export const inlayHints = request>("inlayHints"); @@ -112,6 +112,6 @@ export const publishDecorations = notification("publis export interface SourceChange { label: string; - workspaceEdit: WorkspaceEdit; - cursorPosition: Option; + workspaceEdit: lc.WorkspaceEdit; + cursorPosition: Option; } From 0284216ddacd0349482a1ed2fce6f7643b1bd449 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 01:58:43 +0200 Subject: [PATCH 461/819] vscode: wrap non-single-line if body with curlies as per matklad --- .../code/src/installation/fetch_artifact_release_info.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index 5e201afb..b1b5a348 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -51,9 +51,11 @@ export async function fetchArtifactReleaseInfo( const artifact = release.assets.find(artifact => artifact.name === artifactFileName); - if (!artifact) throw new Error( - `Artifact ${artifactFileName} was not found in ${release.name} release!` - ); + if (!artifact) { + throw new Error( + `Artifact ${artifactFileName} was not found in ${release.name} release!` + ); + } return { releaseName: release.name, From 684290d1e0de8cff59e958a9f9933f1ea51ce50e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 25 Feb 2020 23:20:07 +0200 Subject: [PATCH 462/819] vscode: fix vscode-vim keybindings conflict vscode-vim extension overrides the `type` command so that it prevents some keypresses to reach the text document editor. It conflicts with our `onEnter` keybinding that is used to support automatic doc comments extending and indentation insertion. The VSCode-native way to implement this would be to use regular expressions, but as per matklad it is considered not acceptable for the language server. Thus we implement it via a `Enter` keybinding that invokes our `onEnter` command which sends a request to rust-analyzer process and applies the appropriate source change recieved from it. At the end of the day we may only apply ad hoc workarounds for conflicting extensions. But vscode has another bug for that. You either cannot use parantheses in `when` condition of a keybinding or it just malfunctions. See an issue about that here: https://github.com/microsoft/vscode/issues/91473 To get the ultimate context, follow this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index dff535fc..925e8bbe 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -162,7 +162,7 @@ { "command": "rust-analyzer.onEnter", "key": "enter", - "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust" + "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust" } ], "configuration": { From 2189c7bf4129f5554041864979e4a5b15302723d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 14:21:23 +0100 Subject: [PATCH 463/819] Remove unnecessary dep --- rust-analyzer/editors/code/package-lock.json | 11 ---------- rust-analyzer/editors/code/package.json | 2 -- .../src/installation/download_artifact.ts | 21 +++++++------------ 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 0288a468..6901363f 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -112,12 +112,6 @@ "@types/node": "*" } }, - "@types/throttle-debounce": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz", - "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==", - "dev": true - }, "@types/vscode": { "version": "1.42.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz", @@ -1517,11 +1511,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "throttle-debounce": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.1.0.tgz", - "integrity": "sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg==" - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index dff535fc..27e2bbfc 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,7 +27,6 @@ "dependencies": { "jsonc-parser": "^2.1.0", "node-fetch": "^2.6.0", - "throttle-debounce": "^2.1.0", "vscode-languageclient": "^6.1.1" }, "devDependencies": { @@ -35,7 +34,6 @@ "@rollup/plugin-node-resolve": "^7.1.1", "@types/node": "^12.12.27", "@types/node-fetch": "^2.5.4", - "@types/throttle-debounce": "^2.1.0", "@types/vscode": "^1.42.0", "@typescript-eslint/eslint-plugin": "^2.20.0", "@typescript-eslint/parser": "^2.20.0", diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts index 356723ab..8ed99bf0 100644 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -5,7 +5,6 @@ import { strict as assert } from "assert"; import { ArtifactReleaseInfo } from "./interfaces"; import { downloadFile } from "./download_file"; -import { throttle } from "throttle-debounce"; /** * Downloads artifact from given `downloadUrl`. @@ -38,19 +37,15 @@ export async function downloadArtifact( async (progress, _cancellationToken) => { let lastPrecentage = 0; const filePermissions = 0o755; // (rwx, r_x, r_x) - await downloadFile(downloadUrl, installationPath, filePermissions, throttle( - 200, - /* noTrailing: */ true, - (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPrecentage - }); + await downloadFile(downloadUrl, installationPath, filePermissions, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPrecentage + }); - lastPrecentage = newPercentage; - }) - ); + lastPrecentage = newPercentage; + }); } ); } From 0d274b0f25ad2148d356cc17f67d2df4fb7918bb Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Wed, 26 Feb 2020 08:42:26 -0500 Subject: [PATCH 464/819] Enable SemanticTokens on the client This will crash the extension on stable and insiders without the "--enable-proposed-api matklad.rust-analyzer" command line switch. --- rust-analyzer/editors/code/package.json | 1 + rust-analyzer/editors/code/src/client.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index dff535fc..16466faf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -18,6 +18,7 @@ "engines": { "vscode": "^1.42.0" }, + "enableProposedApi": true, "scripts": { "vscode:prepublish": "tsc && rollup -c", "package": "vsce package -o rust-analyzer.vsix", diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index aaf2ef40..f9dbe34c 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -3,6 +3,7 @@ import * as vscode from 'vscode'; import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; +import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed'; export async function createClient(config: Config, serverPath: string): Promise { // '.' Is the fallback if no folder is open @@ -83,5 +84,7 @@ export async function createClient(config: Config, serverPath: string): Promise< // Here we want to just enable CallHierarchyFeature since it is available on stable. // Note that while the CallHierarchyFeature is stable the LSP protocol is not. res.registerFeature(new CallHierarchyFeature(res)); + res.registerFeature(new SemanticTokensFeature(res)); + return res; } From c3384d662ae373b91f1ef24999cea4edf1315fb4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 16:03:30 +0100 Subject: [PATCH 465/819] Config to switch to semantic tokens --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/client.ts | 7 +++++-- rust-analyzer/editors/code/src/config.ts | 2 ++ rust-analyzer/editors/code/src/main.ts | 4 +++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8a8a74f7..2a89987e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -168,6 +168,11 @@ "type": "object", "title": "Rust Analyzer", "properties": { + "rust-analyzer.highlighting.semanticTokens": { + "type": "boolean", + "default": false, + "description": "Use proposed semantic tokens API for syntax highlighting" + }, "rust-analyzer.highlightingOn": { "type": "boolean", "default": false, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index f9dbe34c..44bd04c2 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -27,7 +27,7 @@ export async function createClient(config: Config, serverPath: string): Promise< const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { - publishDecorations: true, + publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, maxInlayHintLength: config.maxInlayHintLength, cargoWatchEnable: cargoWatchOpts.enable, @@ -84,7 +84,10 @@ export async function createClient(config: Config, serverPath: string): Promise< // Here we want to just enable CallHierarchyFeature since it is available on stable. // Note that while the CallHierarchyFeature is stable the LSP protocol is not. res.registerFeature(new CallHierarchyFeature(res)); - res.registerFeature(new SemanticTokensFeature(res)); + + if (config.highlightingSemanticTokens) { + res.registerFeature(new SemanticTokensFeature(res)); + } return res; } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 47e8cd45..bf915102 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -22,6 +22,7 @@ export class Config { private static readonly requiresReloadOpts = [ "cargoFeatures", "cargo-watch", + "highlighting.semanticTokens" ] .map(opt => `${Config.rootSection}.${opt}`); @@ -143,6 +144,7 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension + get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 424ff1ac..ecf53cf7 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -89,7 +89,9 @@ export async function activate(context: vscode.ExtensionContext) { activateStatusDisplay(ctx); - activateHighlighting(ctx); + if (!ctx.config.highlightingSemanticTokens) { + activateHighlighting(ctx); + } activateInlayHints(ctx); } From abbba33ade5e4102eed3107cdbba4a775823f585 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 18:20:38 +0100 Subject: [PATCH 466/819] wip --- rust-analyzer/editors/code/package.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2a89987e..c5f9d50a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -379,6 +379,20 @@ "highContrast": "#BEBEBE" } } + ], + "semanticTokenStyleDefaults": [ + { + "selector": "*.mutable", + "light": { + "fontStyle": "underline" + }, + "dark": { + "fontStyle": "underline" + }, + "highContrast": { + "fontStyle": "underline" + } + } ] } } From e4bb9dd61244a4985bf94a32a93d1b856e85c80f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 19:39:32 +0100 Subject: [PATCH 467/819] Better highlightign API --- rust-analyzer/editors/code/package.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c5f9d50a..3fbf3f0b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -380,6 +380,25 @@ } } ], + "semanticTokenTypes": [ + { + "id": "attribute" + } + ], + "semanticTokenModifiers": [ + { + "id": "mutable" + }, + { + "id": "unsafe" + }, + { + "id": "control" + }, + { + "id": "builtin" + } + ], "semanticTokenStyleDefaults": [ { "selector": "*.mutable", From f01bc4371ba0d7ec8828159956090725694d892e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 26 Feb 2020 23:16:57 +0100 Subject: [PATCH 468/819] Color constants --- rust-analyzer/editors/code/package.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3fbf3f0b..ad110160 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -383,6 +383,9 @@ "semanticTokenTypes": [ { "id": "attribute" + }, + { + "id": "constant" } ], "semanticTokenModifiers": [ @@ -411,6 +414,12 @@ "highContrast": { "fontStyle": "underline" } + }, + { + "selector": "constant", + "scope": [ + "entity.name.constant" + ] } ] } From 6e91efbc5ebf347a46efdfae94d0b9be3013927d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 10:19:56 +0100 Subject: [PATCH 469/819] Fix flickering with new syntax highlighting --- rust-analyzer/editors/code/src/client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 44bd04c2..1f90af89 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; -import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; export async function createClient(config: Config, serverPath: string): Promise { // '.' Is the fallback if no folder is open @@ -42,6 +42,14 @@ export async function createClient(config: Config, serverPath: string): Promise< rustfmtArgs: config.rustfmtArgs, }, traceOutputChannel, + middleware: { + // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 + async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) { + let res = await next(document, token); + if (res === undefined) throw new Error('busy'); + return res; + } + } as any }; const res = new lc.LanguageClient( From 737fbee5aafcc0da65b414d4c4df8a988a7ba6c9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 10:40:53 +0100 Subject: [PATCH 470/819] Actually gate CI on eslint --- rust-analyzer/editors/code/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8e58d6b7..8892f56e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -23,7 +23,8 @@ "vscode:prepublish": "tsc && rollup -c", "package": "vsce package -o rust-analyzer.vsix", "watch": "tsc --watch", - "fmt": "tsfmt -r && eslint -c .eslintrc.js --ext ts ./src/ --fix" + "lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src", + "fix": "tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", From 795edfb134429fcf5d85e6b6c94b07358cf36271 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 10:46:43 +0100 Subject: [PATCH 471/819] Fix lint --- rust-analyzer/editors/code/src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 1f90af89..540f7c9e 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -45,7 +45,7 @@ export async function createClient(config: Config, serverPath: string): Promise< middleware: { // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 async provideDocumentSemanticTokens(document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) { - let res = await next(document, token); + const res = await next(document, token); if (res === undefined) throw new Error('busy'); return res; } From d027f45fc74228ee3d030f5911cb071fe18b0d63 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 11:09:48 +0100 Subject: [PATCH 472/819] Fix style --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8892f56e..50c50fe0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -24,7 +24,7 @@ "package": "vsce package -o rust-analyzer.vsix", "watch": "tsc --watch", "lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src", - "fix": "tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" + "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" }, "dependencies": { "jsonc-parser": "^2.1.0", From af5d2b0c1337762bfb9559a508720d07bc92a4ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 17:28:59 +0100 Subject: [PATCH 473/819] Map unsafe keyword --- rust-analyzer/editors/code/package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 50c50fe0..934dea16 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -421,6 +421,12 @@ "scope": [ "entity.name.constant" ] + }, + { + "selector": "keyword.unsafe", + "scope": [ + "keyword.other.unsafe" + ] } ] } From e1bdc4abe68b89962945f6755f10d0956b0bdca7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 18:31:54 +0100 Subject: [PATCH 474/819] Set attr scope --- rust-analyzer/editors/code/package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 934dea16..36cbf1cb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -404,6 +404,12 @@ } ], "semanticTokenStyleDefaults": [ + { + "selector": "attribute", + "scope": [ + "meta.attribute" + ] + }, { "selector": "*.mutable", "light": { From f9da5e83d27c750dc435f158988b657ece8ef42f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 18:37:25 +0100 Subject: [PATCH 475/819] Map builtin --- rust-analyzer/editors/code/package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 36cbf1cb..5effa3e1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -433,6 +433,12 @@ "scope": [ "keyword.other.unsafe" ] + }, + { + "selector": "type.builtin", + "scope": [ + "support.type.builtin" + ] } ] } From f112b316e2b76e58b0fd8158b0785c0f7219c0bc Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 27 Feb 2020 22:04:57 +0200 Subject: [PATCH 476/819] vscode: added feature flags for better short-term ux --- rust-analyzer/editors/code/package.json | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5effa3e1..e484467b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -187,7 +187,29 @@ "rust-analyzer.featureFlags": { "type": "object", "default": {}, - "description": "Fine grained feature flags to disable annoying features" + "description": "Fine grained feature flags to disable annoying features", + "properties": { + "lsp.diagnostics": { + "type": "boolean", + "description": "Whether to show diagnostics from `cargo check`" + }, + "completion.insertion.add-call-parenthesis": { + "type": "boolean", + "description": "Whether to add parenthesis when completing functions" + }, + "completion.enable-postfix": { + "type": "boolean", + "description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." + }, + "notifications.workspace-loaded": { + "type": "boolean", + "description": "Whether to show `workspace loaded` message" + }, + "notifications.cargo-toml-not-found": { + "type": "boolean", + "description": "Whether to show `can't find Cargo.toml` error message" + } + } }, "rust-analyzer.serverPath": { "type": [ From 4ae136d982893ecb79a17d8ff70a0bcabfbb8ed3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Feb 2020 19:00:10 +0100 Subject: [PATCH 477/819] add more tags --- rust-analyzer/editors/code/package.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5effa3e1..fd29710b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -398,9 +398,6 @@ }, { "id": "control" - }, - { - "id": "builtin" } ], "semanticTokenStyleDefaults": [ @@ -433,12 +430,6 @@ "scope": [ "keyword.other.unsafe" ] - }, - { - "selector": "type.builtin", - "scope": [ - "support.type.builtin" - ] } ] } From fbe54a69923c0433fdc81474eb8a9eaf9ac85d81 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Feb 2020 11:30:46 +0100 Subject: [PATCH 478/819] Reset fontStyle for inlay hints Otherwise, we get bold hints on `true` and `false` --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 5951cf1b..6871bc11 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -42,12 +42,14 @@ export function activateInlayHints(ctx: Ctx) { const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ after: { color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + fontStyle: "normal", }, }); const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ before: { color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + fontStyle: "normal", }, }); From c6e91d322234723d95ffca5e31d9381662a7a408 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Feb 2020 12:06:54 +0100 Subject: [PATCH 479/819] Cleanup highlighting tags --- rust-analyzer/editors/code/package.json | 87 ++++++++++++++++++++----- 1 file changed, 70 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fd29710b..df8265be 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -383,21 +383,42 @@ ], "semanticTokenTypes": [ { - "id": "attribute" + "id": "attribute", + "description": "Style for attributes" }, { - "id": "constant" + "id": "builtinType", + "description": "Style for builtin types" + }, + { + "id": "lifetime", + "description": "Style for lifetimes" + }, + { + "id": "typeAlias", + "description": "Style for type aliases" + }, + { + "id": "union", + "description": "Style for C-style untagged unions" } ], "semanticTokenModifiers": [ { - "id": "mutable" + "id": "constant", + "description": "Style for compile-time constants" }, { - "id": "unsafe" + "id": "control", + "description": "Style for control flow keywords" }, { - "id": "control" + "id": "mutable", + "description": "Style for mutable bindings" + }, + { + "id": "unsafe", + "description": "Style for unsafe operations" } ], "semanticTokenStyleDefaults": [ @@ -408,21 +429,29 @@ ] }, { - "selector": "*.mutable", - "light": { - "fontStyle": "underline" - }, - "dark": { - "fontStyle": "underline" - }, - "highContrast": { - "fontStyle": "underline" - } + "selector": "builtinType", + "scope": [ + "support.type.primitive" + ] }, { - "selector": "constant", + "selector": "lifetime", "scope": [ - "entity.name.constant" + "entity.name.lifetime.rust" + ] + }, + { + "selector": "typeAlias", + "scope": [ + "entity.name.type", + "entity.name.typeAlias" + ] + }, + { + "selector": "union", + "scope": [ + "entity.name.type", + "entity.name.union" ] }, { @@ -430,6 +459,30 @@ "scope": [ "keyword.other.unsafe" ] + }, + { + "selector": "keyword.control", + "scope": [ + "keyword.control" + ] + }, + { + "selector": "variable.constant", + "scope": [ + "entity.name.constant" + ] + }, + { + "selector": "*.mutable", + "light": { + "fontStyle": "underline" + }, + "dark": { + "fontStyle": "underline" + }, + "highContrast": { + "fontStyle": "underline" + } } ] } From bf8cabc28fe376195a64778806d3d23221fdf7c6 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Fri, 28 Feb 2020 12:50:11 +0000 Subject: [PATCH 480/819] removing ctrl+r key binding fixes #2733 --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e484467b..6fc123ac 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -154,11 +154,6 @@ "key": "ctrl+shift+j", "when": "editorTextFocus && editorLangId == rust" }, - { - "command": "rust-analyzer.run", - "key": "ctrl+r", - "when": "editorTextFocus && editorLangId == rust" - }, { "command": "rust-analyzer.onEnter", "key": "enter", From 8f38ab03b71d146a579174e578fb3d68fcebba1d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Feb 2020 15:03:09 +0100 Subject: [PATCH 481/819] Fix union classification --- rust-analyzer/editors/code/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b013c3f4..862de321 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -460,14 +460,12 @@ { "selector": "typeAlias", "scope": [ - "entity.name.type", "entity.name.typeAlias" ] }, { "selector": "union", "scope": [ - "entity.name.type", "entity.name.union" ] }, From 594491d33651abb1b7503c8f9fab6da05d5d5a9b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 28 Feb 2020 23:56:17 +0200 Subject: [PATCH 482/819] vscode: migrate to more type-safe assert impl --- .../editors/code/src/installation/download_file.ts | 3 +-- .../editors/code/src/installation/server.ts | 3 +-- rust-analyzer/editors/code/src/util.ts | 12 ++++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/download_file.ts index 319cb995..ee8949d6 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/download_file.ts @@ -2,8 +2,7 @@ import fetch from "node-fetch"; import * as fs from "fs"; import * as stream from "stream"; import * as util from "util"; -import { strict as assert } from "assert"; -import { log } from "../util"; +import { log, assert } from "../util"; const pipeline = util.promisify(stream.pipeline); diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index cb5e5684..6a6cf4f8 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -1,13 +1,12 @@ import * as vscode from "vscode"; import * as path from "path"; -import { strict as assert } from "assert"; import { promises as dns } from "dns"; import { spawnSync } from "child_process"; import { BinarySource } from "./interfaces"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; import { downloadArtifact } from "./download_artifact"; -import { log } from "../util"; +import { log, assert } from "../util"; export async function ensureServerBinary(source: null | BinarySource): Promise { if (!source) { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 68c2a94d..acf78898 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,22 +1,26 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; +import { strict as nodeAssert } from "assert"; -let enabled: boolean = false; +export function assert(condition: unknown, explanation: string): asserts condition { + nodeAssert(condition, explanation); +} export const log = { + enabled: true, debug(message?: any, ...optionalParams: any[]): void { - if (!enabled) return; + if (!log.enabled) return; // eslint-disable-next-line no-console console.log(message, ...optionalParams); }, error(message?: any, ...optionalParams: any[]): void { - if (!enabled) return; + if (!log.enabled) return; debugger; // eslint-disable-next-line no-console console.error(message, ...optionalParams); }, setEnabled(yes: boolean): void { - enabled = yes; + log.enabled = yes; } }; From 6710303f3f8aa356e61271a3421cc6594450d14e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 00:02:19 +0200 Subject: [PATCH 483/819] vscode: add error loging on failed assertion --- rust-analyzer/editors/code/src/util.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index acf78898..20349445 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -3,7 +3,12 @@ import * as vscode from "vscode"; import { strict as nodeAssert } from "assert"; export function assert(condition: unknown, explanation: string): asserts condition { - nodeAssert(condition, explanation); + try { + nodeAssert(condition, explanation); + } catch (err) { + log.error(`Assertion failed:`, explanation); + throw err; + } } export const log = { From 0007a96a7786c0e557ad661ddcc97c4a16000e91 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 00:07:29 +0200 Subject: [PATCH 484/819] vscode: rename nodeAssert -> nativeAssert --- rust-analyzer/editors/code/src/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 20349445..733bdc8c 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,10 +1,10 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; -import { strict as nodeAssert } from "assert"; +import { strict as nativeAssert } from "assert"; export function assert(condition: unknown, explanation: string): asserts condition { try { - nodeAssert(condition, explanation); + nativeAssert(condition, explanation); } catch (err) { log.error(`Assertion failed:`, explanation); throw err; From cd48930a9ad2c8c8885998498e4674f80ecc759d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 00:26:22 +0200 Subject: [PATCH 485/819] vscode: add equality assertion --- .../editors/code/src/installation/download_artifact.ts | 4 ++-- rust-analyzer/editors/code/src/util.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts index 8ed99bf0..c60014c8 100644 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -1,10 +1,10 @@ import * as vscode from "vscode"; import * as path from "path"; import { promises as fs } from "fs"; -import { strict as assert } from "assert"; import { ArtifactReleaseInfo } from "./interfaces"; import { downloadFile } from "./download_file"; +import { assert } from "../util"; /** * Downloads artifact from given `downloadUrl`. @@ -19,7 +19,7 @@ export async function downloadArtifact( installationDir: string, displayName: string, ) { - await fs.mkdir(installationDir).catch(err => assert.strictEqual( + await fs.mkdir(installationDir).catch(err => assert.eq( err?.code, "EEXIST", `Couldn't create directory "${installationDir}" to download ` + diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 733bdc8c..5a5f11a1 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -11,6 +11,16 @@ export function assert(condition: unknown, explanation: string): asserts conditi } } +assert.eq = (bibba: unknown, bobba: T, explanation: string): asserts bibba is T => { + try { + nativeAssert.strictEqual(bibba, bobba, explanation); + } catch (err) { + log.error(`Equality assertion failed:`, explanation); + throw err; + } +} + + export const log = { enabled: true, debug(message?: any, ...optionalParams: any[]): void { From 6787f5977b6bd5594defae2d024729465a6c9152 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 00:33:34 +0200 Subject: [PATCH 486/819] vscode: add dat semicolon --- rust-analyzer/editors/code/src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 5a5f11a1..5c89bc62 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -18,7 +18,7 @@ assert.eq = (bibba: unknown, bobba: T, explanation: string): asserts bibba is log.error(`Equality assertion failed:`, explanation); throw err; } -} +}; export const log = { From 5acf33629ee2d0130a7e8706b0907c293b5773f8 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 00:46:48 +0200 Subject: [PATCH 487/819] vscode: simplify assert.eq() to assert() as per matklad --- .../code/src/installation/download_artifact.ts | 7 +++---- rust-analyzer/editors/code/src/util.ts | 12 +----------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts index c60014c8..97e4d67c 100644 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ b/rust-analyzer/editors/code/src/installation/download_artifact.ts @@ -19,11 +19,10 @@ export async function downloadArtifact( installationDir: string, displayName: string, ) { - await fs.mkdir(installationDir).catch(err => assert.eq( - err?.code, - "EEXIST", + await fs.mkdir(installationDir).catch(err => assert( + err?.code === "EEXIST", `Couldn't create directory "${installationDir}" to download ` + - `${artifactFileName} artifact: ${err.message}` + `${artifactFileName} artifact: ${err?.message}` )); const installationPath = path.join(installationDir, artifactFileName); diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 5c89bc62..f56c6bad 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -2,7 +2,7 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; -export function assert(condition: unknown, explanation: string): asserts condition { +export function assert(condition: boolean, explanation: string): asserts condition { try { nativeAssert(condition, explanation); } catch (err) { @@ -11,16 +11,6 @@ export function assert(condition: unknown, explanation: string): asserts conditi } } -assert.eq = (bibba: unknown, bobba: T, explanation: string): asserts bibba is T => { - try { - nativeAssert.strictEqual(bibba, bobba, explanation); - } catch (err) { - log.error(`Equality assertion failed:`, explanation); - throw err; - } -}; - - export const log = { enabled: true, debug(message?: any, ...optionalParams: any[]): void { From 98dd7290d3bf071f744d2c346d7d91dff652ba02 Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 1 Mar 2020 16:46:32 +0100 Subject: [PATCH 488/819] Remove inlay in diff views If the left side of a diff view that contain the old version of the file apply inlays they are misplaced. The detection is done by blacklisting the url schemes used by git and subversion scm extensions. --- rust-analyzer/editors/code/src/inlay_hints.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 6871bc11..46e5f7c0 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -4,6 +4,8 @@ import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; import { log, sendRequestWithRetry } from './util'; +const noInlayUriSchemes = ['git', 'svn']; + export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); vscode.window.onDidChangeVisibleTextEditors( @@ -90,7 +92,14 @@ class HintsUpdater { private get allEditors(): vscode.TextEditor[] { return vscode.window.visibleTextEditors.filter( - editor => editor.document.languageId === 'rust', + editor => { + if (editor.document.languageId !== 'rust') { + return false; + } + const scheme = editor.document.uri.scheme; + const hasBlacklistedScheme = noInlayUriSchemes.some(s => s === scheme); + return !hasBlacklistedScheme; + }, ); } From 4b73531d3b13828bdd8bd542504cf0c46f6c88f1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 2 Mar 2020 14:27:26 +0100 Subject: [PATCH 489/819] Minimal viable meta --- rust-analyzer/editors/code/README.md | 5 +++++ rust-analyzer/editors/code/package.json | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/README.md diff --git a/rust-analyzer/editors/code/README.md b/rust-analyzer/editors/code/README.md new file mode 100644 index 00000000..336695d9 --- /dev/null +++ b/rust-analyzer/editors/code/README.md @@ -0,0 +1,5 @@ +# rust-analyzer + +Provides support for rust-analyzer: novel LSP server for the Rust programming language. + +See https://rust-analyzer.github.io/ for more information. diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 862de321..daccb31f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -12,8 +12,13 @@ "url": "https://github.com/rust-analyzer/rust-analyzer.git", "type": "git" }, + "homepage": "https://rust-analyzer.github.io/", + "license": "MIT OR Apache-2.0", + "keywords": [ + "rust" + ], "categories": [ - "Other" + "Programming Languages" ], "engines": { "vscode": "^1.42.0" From c322b7a53b104fd2bb94b178c5a8731ea1e60b69 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 2 Mar 2020 14:45:20 +0100 Subject: [PATCH 490/819] Don't fail loudly if the old highlighting breaks --- rust-analyzer/editors/code/src/highlighting.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 3e0cbdc5..d7d0e910 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -159,7 +159,9 @@ function initDecorations(): Map { const theme = ColorTheme.load(); const res = new Map(); TAG_TO_SCOPES.forEach((scopes, tag) => { - if (!scopes) throw `unmapped tag: ${tag}`; + // We are going to axe this soon, so don't try to detect unknown tags. + // Users should switch to the new semantic tokens implementation. + if (!scopes) return; const rule = theme.lookup(scopes); const decor = createDecorationFromTextmate(rule); res.set(tag, decor); @@ -211,7 +213,7 @@ const TAG_TO_SCOPES = new Map([ ["macro", ["entity.name.macro"]], ["variable", ["variable"]], - ["variable.mut", ["variable", "meta.mutable"]], + ["variable.mutable", ["variable", "meta.mutable"]], ["type", ["entity.name.type"]], ["type.builtin", ["entity.name.type", "support.type.primitive"]], @@ -221,10 +223,10 @@ const TAG_TO_SCOPES = new Map([ ["literal.byte", ["constant.character.byte"]], ["literal.char", ["constant.character.rust"]], - ["literal.numeric", ["constant.numeric"]], + ["numeric_literal", ["constant.numeric"]], ["comment", ["comment"]], - ["string", ["string.quoted"]], + ["string_literal", ["string.quoted"]], ["attribute", ["meta.attribute.rust"]], ["keyword", ["keyword"]], From 1f53a8f434100b19c55b12f279653d8d8e3bb72d Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Mon, 2 Mar 2020 22:54:29 +0100 Subject: [PATCH 491/819] Centralize the check for languageId on document Also move visibleRustEditors to Ctx --- .../editors/code/src/commands/syntax_tree.ts | 5 ++-- rust-analyzer/editors/code/src/ctx.ts | 9 +++++++- .../editors/code/src/highlighting.ts | 4 ++-- rust-analyzer/editors/code/src/inlay_hints.ts | 23 ++++--------------- rust-analyzer/editors/code/src/util.ts | 8 +++++++ 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 7218bfb9..2e08e8f1 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; +import { isRustDocument } from '../util'; // Opens the virtual file that will show the syntax tree // @@ -19,7 +20,7 @@ export function syntaxTree(ctx: Ctx): Cmd { vscode.workspace.onDidChangeTextDocument( (event: vscode.TextDocumentChangeEvent) => { const doc = event.document; - if (doc.languageId !== 'rust') return; + if (!isRustDocument(doc)) return; afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); }, null, @@ -28,7 +29,7 @@ export function syntaxTree(ctx: Ctx): Cmd { vscode.window.onDidChangeActiveTextEditor( (editor: vscode.TextEditor | undefined) => { - if (!editor || editor.document.languageId !== 'rust') return; + if (!editor || !isRustDocument(editor.document)) return; tdcp.eventEmitter.fire(tdcp.uri); }, null, diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 43540e0d..b4e983a0 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import { Config } from './config'; import { createClient } from './client'; +import { isRustDocument } from './util'; export class Ctx { private constructor( @@ -23,11 +24,17 @@ export class Ctx { get activeRustEditor(): vscode.TextEditor | undefined { const editor = vscode.window.activeTextEditor; - return editor && editor.document.languageId === 'rust' + return editor && isRustDocument(editor.document) ? editor : undefined; } + get visibleRustEditors(): vscode.TextEditor[] { + return vscode.window.visibleTextEditors.filter( + editor => isRustDocument(editor.document), + ); + } + registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { const fullName = `rust-analyzer.${name}`; const cmd = factory(this); diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts index 3e0cbdc5..03618383 100644 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ b/rust-analyzer/editors/code/src/highlighting.ts @@ -4,7 +4,7 @@ import * as ra from './rust-analyzer-api'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; import { Ctx } from './ctx'; -import { sendRequestWithRetry } from './util'; +import { sendRequestWithRetry, isRustDocument } from './util'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); @@ -36,7 +36,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { - if (!editor || editor.document.languageId !== 'rust') return; + if (!editor || !isRustDocument(editor.document)) return; if (!ctx.config.highlightingOn) return; const client = ctx.client; if (!client) return; diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 46e5f7c0..08d3a64a 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -2,9 +2,7 @@ import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; -import { log, sendRequestWithRetry } from './util'; - -const noInlayUriSchemes = ['git', 'svn']; +import { log, sendRequestWithRetry, isRustDocument } from './util'; export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); @@ -17,7 +15,7 @@ export function activateInlayHints(ctx: Ctx) { vscode.workspace.onDidChangeTextDocument( async event => { if (event.contentChanges.length === 0) return; - if (event.document.languageId !== 'rust') return; + if (!isRustDocument(event.document)) return; await hintsUpdater.refresh(); }, null, @@ -79,7 +77,7 @@ class HintsUpdater { } clear() { - this.allEditors.forEach(it => { + this.ctx.visibleRustEditors.forEach(it => { this.setTypeDecorations(it, []); this.setParameterDecorations(it, []); }); @@ -87,20 +85,7 @@ class HintsUpdater { async refresh() { if (!this.enabled) return; - await Promise.all(this.allEditors.map(it => this.refreshEditor(it))); - } - - private get allEditors(): vscode.TextEditor[] { - return vscode.window.visibleTextEditors.filter( - editor => { - if (editor.document.languageId !== 'rust') { - return false; - } - const scheme = editor.document.uri.scheme; - const hasBlacklistedScheme = noInlayUriSchemes.some(s => s === scheme); - return !hasBlacklistedScheme; - }, - ); + await Promise.all(this.ctx.visibleRustEditors.map(it => this.refreshEditor(it))); } private async refreshEditor(editor: vscode.TextEditor): Promise { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index f56c6bad..7c95769b 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,6 +1,7 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; +import { TextDocument } from "vscode"; export function assert(condition: boolean, explanation: string): asserts condition { try { @@ -65,3 +66,10 @@ export async function sendRequestWithRetry( function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } + +export function isRustDocument(document: TextDocument) { + return document.languageId === 'rust' + // SCM diff views have the same URI as the on-disk document but not the same content + && document.uri.scheme !== 'git' + && document.uri.scheme !== 'svn'; +} \ No newline at end of file From 67baaaa88170e2a6ee1fe341f6114bf3b6cb2117 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Tue, 3 Mar 2020 08:05:59 -0500 Subject: [PATCH 492/819] Update code dependencies --- rust-analyzer/editors/code/package-lock.json | 157 ++++++++++++------- rust-analyzer/editors/code/package.json | 18 +-- 2 files changed, 105 insertions(+), 70 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 6901363f..b07caf03 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -89,18 +89,19 @@ "dev": true }, "@types/node": { - "version": "12.12.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.27.tgz", - "integrity": "sha512-odQFl/+B9idbdS0e8IxDl2ia/LP8KZLXhV3BUeI98TrZp0uoIzQPhGd+5EtzHmT0SMOIaPd7jfz6pOHLWTtl7A==", + "version": "12.12.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.29.tgz", + "integrity": "sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ==", "dev": true }, "@types/node-fetch": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.4.tgz", - "integrity": "sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ==", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.5.tgz", + "integrity": "sha512-IWwjsyYjGw+em3xTvWVQi5MgYKbRs0du57klfTaZkv/B24AEQ/p/IopNeqIYNy3EsfHOpg8ieQSDomPcsYMHpA==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "*", + "form-data": "^3.0.0" } }, "@types/resolve": { @@ -119,56 +120,45 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.20.0.tgz", - "integrity": "sha512-cimIdVDV3MakiGJqMXw51Xci6oEDEoPkvh8ggJe2IIzcc0fYqAxOXN6Vbeanahz6dLZq64W+40iUEc9g32FLDQ==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.22.0.tgz", + "integrity": "sha512-BvxRLaTDVQ3N+Qq8BivLiE9akQLAOUfxNHIEhedOcg8B2+jY8Rc4/D+iVprvuMX1AdezFYautuGDwr9QxqSxBQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.20.0", + "@typescript-eslint/experimental-utils": "2.22.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" - }, - "dependencies": { - "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "@typescript-eslint/experimental-utils": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz", - "integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz", + "integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.20.0", + "@typescript-eslint/typescript-estree": "2.22.0", "eslint-scope": "^5.0.0" } }, "@typescript-eslint/parser": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.20.0.tgz", - "integrity": "sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz", + "integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.20.0", - "@typescript-eslint/typescript-estree": "2.20.0", + "@typescript-eslint/experimental-utils": "2.22.0", + "@typescript-eslint/typescript-estree": "2.22.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz", - "integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz", + "integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==", "dev": true, "requires": { "debug": "^4.1.1", @@ -178,17 +168,6 @@ "lodash": "^4.17.15", "semver": "^6.3.0", "tsutils": "^3.17.1" - }, - "dependencies": { - "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "acorn": { @@ -254,6 +233,12 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -367,6 +352,15 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -439,6 +433,12 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", @@ -748,6 +748,17 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -957,9 +968,9 @@ "dev": true }, "jsonc-parser": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", - "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz", + "integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==" }, "levn": { "version": "0.3.0", @@ -1030,6 +1041,21 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "dev": true, + "requires": { + "mime-db": "1.43.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -1302,9 +1328,9 @@ } }, "rollup": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.1.tgz", - "integrity": "sha512-2JREN1YdrS/kpPzEd33ZjtuNbOuBC3ePfuZBdKEybvqcEcszW1ckyVqzcEiEe0nE8sqHK+pbJg+PsAgRJ8+1dg==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.0.tgz", + "integrity": "sha512-ab2tF5pdDqm2zuI8j02ceyrJSScl9V2C24FgWQ1v1kTFTu1UrG5H0hpP++mDZlEFyZX4k0chtGEHU2i+pAzBgA==", "dev": true, "requires": { "@types/estree": "*", @@ -1527,11 +1553,20 @@ } }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", "dev": true }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tunnel": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", @@ -1564,9 +1599,9 @@ } }, "typescript": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz", - "integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==", + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "dev": true }, "typescript-formatter": { @@ -1619,9 +1654,9 @@ "dev": true }, "vsce": { - "version": "1.73.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.73.0.tgz", - "integrity": "sha512-6W37Ebbkj3uF3WhT+SCfRtsneRQEFcGvf/XYz+b6OAgDCj4gPurWyDVrqw/HLsbP1WflGIyUfVZ8t5M7kQp6Uw==", + "version": "1.74.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.74.0.tgz", + "integrity": "sha512-8zWM9bZBNn9my40kkxAxdY4nhb9ADfazXsyDgx1thbRaLPbmPTlmqQ55vCAyWYFEi6XbJv8w599vzVUqsU1gHg==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", @@ -1631,7 +1666,7 @@ "denodeify": "^1.2.1", "didyoumean": "^1.2.1", "glob": "^7.0.6", - "lodash": "^4.17.10", + "lodash": "^4.17.15", "markdown-it": "^8.3.1", "mime": "^1.3.4", "minimatch": "^3.0.3", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index daccb31f..83035860 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -32,24 +32,24 @@ "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" }, "dependencies": { - "jsonc-parser": "^2.1.0", + "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", "vscode-languageclient": "^6.1.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", - "@types/node": "^12.12.27", - "@types/node-fetch": "^2.5.4", + "@types/node": "^12.12.29", + "@types/node-fetch": "^2.5.5", "@types/vscode": "^1.42.0", - "@typescript-eslint/eslint-plugin": "^2.20.0", - "@typescript-eslint/parser": "^2.20.0", + "@typescript-eslint/eslint-plugin": "^2.22.0", + "@typescript-eslint/parser": "^2.22.0", "eslint": "^6.8.0", - "rollup": "^1.31.1", - "tslib": "^1.10.0", - "typescript": "^3.8.2", + "rollup": "^1.32.0", + "tslib": "^1.11.1", + "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", - "vsce": "^1.73.0" + "vsce": "^1.74.0" }, "activationEvents": [ "onLanguage:rust", From f5532766aabcfd44a53a95547ec396cd72603c90 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 3 Mar 2020 18:37:57 +0100 Subject: [PATCH 493/819] Actually include readme into .vsix --- rust-analyzer/editors/code/.vscodeignore | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index 3d1156d3..17c378a4 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -3,3 +3,4 @@ !package.json !package-lock.json !icon.png +!README.md From 4b362b9a917384a2fca7f63c008c598b27d9e4b5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Mar 2020 17:51:10 +0100 Subject: [PATCH 494/819] Feature flag for arg snippets --- rust-analyzer/editors/code/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 83035860..2f442aae 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -197,6 +197,10 @@ "type": "boolean", "description": "Whether to add parenthesis when completing functions" }, + "completion.insertion.add-argument-sippets": { + "type": "boolean", + "description": "Whether to add argument snippets when completing functions" + }, "completion.enable-postfix": { "type": "boolean", "description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." From 597ad441d0f20cf923438302db2314e8d9bd1dc9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Mar 2020 18:32:40 +0100 Subject: [PATCH 495/819] Concise mode for parameter hints This works around VS Code bug where it tries to cram everything in a tiny popup, and brings experience closer to Intellij. --- rust-analyzer/editors/code/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2f442aae..f1ed51d1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -205,6 +205,10 @@ "type": "boolean", "description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." }, + "call-info.full": { + "type": "boolean", + "description": "Show function name and docs in parameter hints" + }, "notifications.workspace-loaded": { "type": "boolean", "description": "Whether to show `workspace loaded` message" From 6ad4b264ad04437520bdeb47b23a4f4c6c348689 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Mar 2020 18:38:56 +0100 Subject: [PATCH 496/819] Don't creat public APIs with typos --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f1ed51d1..3a1e6cf2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -197,7 +197,7 @@ "type": "boolean", "description": "Whether to add parenthesis when completing functions" }, - "completion.insertion.add-argument-sippets": { + "completion.insertion.add-argument-snippets": { "type": "boolean", "description": "Whether to add argument snippets when completing functions" }, From 2d54868b6642ae24e31690dc5ffcf247b88d60d4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Mar 2020 23:22:58 +0100 Subject: [PATCH 497/819] :arrow_up: npm deps --- rust-analyzer/editors/code/package-lock.json | 12 ++++++------ rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b07caf03..77ee5a0c 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -171,9 +171,9 @@ } }, "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true }, "acorn-jsx": { @@ -1328,9 +1328,9 @@ } }, "rollup": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.0.tgz", - "integrity": "sha512-ab2tF5pdDqm2zuI8j02ceyrJSScl9V2C24FgWQ1v1kTFTu1UrG5H0hpP++mDZlEFyZX4k0chtGEHU2i+pAzBgA==", + "version": "1.32.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", + "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", "dev": true, "requires": { "@types/estree": "*", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3a1e6cf2..22573932 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -45,7 +45,7 @@ "@typescript-eslint/eslint-plugin": "^2.22.0", "@typescript-eslint/parser": "^2.22.0", "eslint": "^6.8.0", - "rollup": "^1.32.0", + "rollup": "^1.32.1", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From ca21c1266b95d45383788fa4a48642947c6289de Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 19:27:52 +0200 Subject: [PATCH 498/819] vscode: extract Type and Param hint cases of InlayHint at type level (needed further) --- .../editors/code/src/rust-analyzer-api.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index c5a010e9..6a7aeb60 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -86,14 +86,20 @@ export interface Runnable { export const runnables = request>("runnables"); -export const enum InlayKind { - TypeHint = "TypeHint", - ParameterHint = "ParameterHint", -} -export interface InlayHint { - range: lc.Range; - kind: InlayKind; - label: string; + +export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint; + +export namespace InlayHint { + export const enum Kind { + TypeHint = "TypeHint", + ParamHint = "ParameterHint", + } + interface Common { + range: lc.Range; + label: string; + } + export type TypeHint = Common & { kind: Kind.TypeHint; } + export type ParamHint = Common & { kind: Kind.ParamHint; } } export interface InlayHintsParams { textDocument: lc.TextDocumentIdentifier; From 83b56fd72f72773d4b4e6582cd047e3d4e515a66 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 19:28:26 +0200 Subject: [PATCH 499/819] vscode: redesign inlay hints to be capable of handling multiple editors --- rust-analyzer/editors/code/src/inlay_hints.ts | 375 +++++++++++++----- .../editors/code/src/rust-analyzer-api.ts | 4 +- 2 files changed, 273 insertions(+), 106 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 08d3a64a..bbe8f67e 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,156 +1,323 @@ +import * as lc from "vscode-languageclient"; import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; -import { log, sendRequestWithRetry, isRustDocument } from './util'; +import { sendRequestWithRetry, assert } from './util'; export function activateInlayHints(ctx: Ctx) { - const hintsUpdater = new HintsUpdater(ctx); + const hintsUpdater = new HintsUpdater(ctx.client); + vscode.window.onDidChangeVisibleTextEditors( - async _ => hintsUpdater.refresh(), + visibleEditors => hintsUpdater.refreshVisibleRustEditors( + visibleEditors.filter(isRustTextEditor) + ), null, ctx.subscriptions ); vscode.workspace.onDidChangeTextDocument( - async event => { - if (event.contentChanges.length === 0) return; - if (!isRustDocument(event.document)) return; - await hintsUpdater.refresh(); + ({ contentChanges, document }) => { + if (contentChanges.length === 0) return; + if (!isRustTextDocument(document)) return; + + hintsUpdater.refreshRustDocument(document); }, null, ctx.subscriptions ); vscode.workspace.onDidChangeConfiguration( - async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints), + async _ => { + // FIXME: ctx.config may have not been refreshed at this point of time, i.e. + // it's on onDidChangeConfiguration() handler may've not executed yet + // (order of invokation is unspecified) + // To fix this we should expose an event emitter from our `Config` itself. + await hintsUpdater.setEnabled(ctx.config.displayInlayHints); + }, null, ctx.subscriptions ); ctx.pushCleanup({ dispose() { - hintsUpdater.clear(); + hintsUpdater.clearHints(); } }); - // XXX: we don't await this, thus Promise rejections won't be handled, but - // this should never throw in fact... - void hintsUpdater.setEnabled(ctx.config.displayInlayHints); + hintsUpdater.setEnabled(ctx.config.displayInlayHints); } -const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ - after: { - color: new vscode.ThemeColor('rust_analyzer.inlayHint'), - fontStyle: "normal", - }, -}); -const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ - before: { - color: new vscode.ThemeColor('rust_analyzer.inlayHint'), - fontStyle: "normal", - }, -}); +const typeHints = { + decorationType: vscode.window.createTextEditorDecorationType({ + after: { + color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + fontStyle: "normal", + } + }), -class HintsUpdater { - private pending = new Map(); - private ctx: Ctx; - private enabled: boolean; + toDecoration(hint: ra.InlayHint.TypeHint, conv: lc.Protocol2CodeConverter): vscode.DecorationOptions { + return { + range: conv.asRange(hint.range), + renderOptions: { after: { contentText: `: ${hint.label}` } } + }; + } +}; + +const paramHints = { + decorationType: vscode.window.createTextEditorDecorationType({ + before: { + color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + fontStyle: "normal", + } + }), - constructor(ctx: Ctx) { - this.ctx = ctx; - this.enabled = false; + toDecoration(hint: ra.InlayHint.ParamHint, conv: lc.Protocol2CodeConverter): vscode.DecorationOptions { + return { + range: conv.asRange(hint.range), + renderOptions: { before: { contentText: `${hint.label}: ` } } + }; } +}; + +class HintsUpdater { + private sourceFiles = new RustSourceFiles(); + private enabled = false; - async setEnabled(enabled: boolean): Promise { - log.debug({ enabled, prev: this.enabled }); + constructor(readonly client: lc.LanguageClient) { } + setEnabled(enabled: boolean) { if (this.enabled === enabled) return; this.enabled = enabled; if (this.enabled) { - return await this.refresh(); + this.refreshVisibleRustEditors(vscode.window.visibleTextEditors.filter(isRustTextEditor)); } else { - return this.clear(); + this.clearHints(); } } - clear() { - this.ctx.visibleRustEditors.forEach(it => { - this.setTypeDecorations(it, []); - this.setParameterDecorations(it, []); - }); + clearHints() { + for (const file of this.sourceFiles) { + file.inlaysRequest?.cancel(); + this.renderHints(file, []); + } + } + + private renderHints(file: RustSourceFile, hints: ra.InlayHint[]) { + file.renderHints(hints, this.client.protocol2CodeConverter); } - async refresh() { + refreshRustDocument(document: RustTextDocument) { if (!this.enabled) return; - await Promise.all(this.ctx.visibleRustEditors.map(it => this.refreshEditor(it))); - } - - private async refreshEditor(editor: vscode.TextEditor): Promise { - const newHints = await this.queryHints(editor.document.uri.toString()); - if (newHints == null) return; - - const newTypeDecorations = newHints - .filter(hint => hint.kind === ra.InlayKind.TypeHint) - .map(hint => ({ - range: this.ctx.client.protocol2CodeConverter.asRange(hint.range), - renderOptions: { - after: { - contentText: `: ${hint.label}`, - }, - }, - })); - this.setTypeDecorations(editor, newTypeDecorations); - - const newParameterDecorations = newHints - .filter(hint => hint.kind === ra.InlayKind.ParameterHint) - .map(hint => ({ - range: this.ctx.client.protocol2CodeConverter.asRange(hint.range), - renderOptions: { - before: { - contentText: `${hint.label}: `, - }, - }, - })); - this.setParameterDecorations(editor, newParameterDecorations); - } - - private setTypeDecorations( - editor: vscode.TextEditor, - decorations: vscode.DecorationOptions[], - ) { - editor.setDecorations( - typeHintDecorationType, - this.enabled ? decorations : [], - ); - } - - private setParameterDecorations( - editor: vscode.TextEditor, - decorations: vscode.DecorationOptions[], - ) { - editor.setDecorations( - parameterHintDecorationType, - this.enabled ? decorations : [], - ); - } - - private async queryHints(documentUri: string): Promise { - this.pending.get(documentUri)?.cancel(); - const tokenSource = new vscode.CancellationTokenSource(); - this.pending.set(documentUri, tokenSource); + const file = this.sourceFiles.getSourceFile(document.uri.toString()); + + assert(!!file, "Document must be opened in some text editor!"); + + void file.fetchAndRenderHints(this.client); + } + + refreshVisibleRustEditors(visibleEditors: RustTextEditor[]) { + if (!this.enabled) return; + + const visibleSourceFiles = this.sourceFiles.drainEditors(visibleEditors); - const request = { textDocument: { uri: documentUri } }; + // Cancel requests for source files whose editors were disposed (leftovers after drain). + for (const { inlaysRequest } of this.sourceFiles) inlaysRequest?.cancel(); - return sendRequestWithRetry(this.ctx.client, ra.inlayHints, request, tokenSource.token) - .catch(_ => null) - .finally(() => { - if (!tokenSource.token.isCancellationRequested) { - this.pending.delete(documentUri); + this.sourceFiles = visibleSourceFiles; + + for (const file of this.sourceFiles) { + if (!file.rerenderHints()) { + void file.fetchAndRenderHints(this.client); + } + } + } +} + + +/** + * This class encapsulates a map of file uris to respective inlay hints + * request cancellation token source (cts) and an array of editors. + * E.g. + * ``` + * { + * file1.rs -> (cts, (typeDecor, paramDecor), [editor1, editor2]) + * ^-- there is a cts to cancel the in-flight request + * file2.rs -> (cts, null, [editor3]) + * ^-- no decorations are applied to this source file yet + * file3.rs -> (null, (typeDecor, paramDecor), [editor4]) + * } ^-- there is no inflight request + * ``` + * + * Invariants: each stored source file has at least 1 editor. + */ +class RustSourceFiles { + private files = new Map(); + + /** + * Removes `editors` from `this` source files and puts them into a returned + * source files object. cts and decorations are moved to the returned source files. + */ + drainEditors(editors: RustTextEditor[]): RustSourceFiles { + const result = new RustSourceFiles; + + for (const editor of editors) { + const oldFile = this.removeEditor(editor); + const newFile = result.addEditor(editor); + + if (oldFile) newFile.stealCacheFrom(oldFile); + } + + return result; + } + + /** + * Remove the editor and if it was the only editor for a source file, + * the source file is removed altogether. + * + * @returns A reference to the source file for this editor or + * null if no such source file was not found. + */ + private removeEditor(editor: RustTextEditor): null | RustSourceFile { + const uri = editor.document.uri.toString(); + + const file = this.files.get(uri); + if (!file) return null; + + const editorIndex = file.editors.findIndex(suspect => areEditorsEqual(suspect, editor)); + + if (editorIndex >= 0) { + file.editors.splice(editorIndex, 1); + + if (file.editors.length === 0) this.files.delete(uri); + } + + return file; + } + + /** + * @returns A reference to an existing source file or newly created one for the editor. + */ + private addEditor(editor: RustTextEditor): RustSourceFile { + const uri = editor.document.uri.toString(); + const file = this.files.get(uri); + + if (!file) { + const newFile = new RustSourceFile([editor]); + this.files.set(uri, newFile); + return newFile; + } + + if (!file.editors.find(suspect => areEditorsEqual(suspect, editor))) { + file.editors.push(editor); + } + return file; + } + + getSourceFile(uri: string): undefined | RustSourceFile { + return this.files.get(uri); + } + + [Symbol.iterator](): IterableIterator { + return this.files.values(); + } +} +class RustSourceFile { + constructor( + /** + * Editors for this source file (one text document may be opened in multiple editors). + * We keep this just an array, because most of the time we have 1 editor for 1 source file. + */ + readonly editors: RustTextEditor[], + /** + * Source of the token to cancel in-flight inlay hints request if any. + */ + public inlaysRequest: null | vscode.CancellationTokenSource = null, + + public decorations: null | { + type: vscode.DecorationOptions[]; + param: vscode.DecorationOptions[]; + } = null + ) { } + + stealCacheFrom(other: RustSourceFile) { + if (other.inlaysRequest) this.inlaysRequest = other.inlaysRequest; + if (other.decorations) this.decorations = other.decorations; + + other.inlaysRequest = null; + other.decorations = null; + } + + rerenderHints(): boolean { + if (!this.decorations) return false; + + for (const editor of this.editors) { + editor.setDecorations(typeHints.decorationType, this.decorations.type); + editor.setDecorations(paramHints.decorationType, this.decorations.param); + } + return true; + } + + renderHints(hints: ra.InlayHint[], conv: lc.Protocol2CodeConverter) { + this.decorations = { type: [], param: [] }; + + for (const hint of hints) { + switch (hint.kind) { + case ra.InlayHint.Kind.TypeHint: { + this.decorations.type.push(typeHints.toDecoration(hint, conv)); + continue; + } + case ra.InlayHint.Kind.ParamHint: { + this.decorations.param.push(paramHints.toDecoration(hint, conv)); + continue; } - }); + } + } + this.rerenderHints(); + } + + async fetchAndRenderHints(client: lc.LanguageClient): Promise { + this.inlaysRequest?.cancel(); + + const tokenSource = new vscode.CancellationTokenSource(); + this.inlaysRequest = tokenSource; + + const request = { textDocument: { uri: this.editors[0].document.uri.toString() } }; + + try { + const hints = await sendRequestWithRetry(client, ra.inlayHints, request, tokenSource.token); + this.renderHints(hints, client.protocol2CodeConverter); + } catch { + /* ignore */ + } finally { + if (this.inlaysRequest === tokenSource) { + this.inlaysRequest = null; + } + } } } + +type RustTextDocument = vscode.TextDocument & { languageId: "rust" }; +type RustTextEditor = vscode.TextEditor & { document: RustTextDocument; id: string }; + +function areEditorsEqual(a: RustTextEditor, b: RustTextEditor): boolean { + return a.id === b.id; +} + +function isRustTextEditor(suspect: vscode.TextEditor & { id?: unknown }): suspect is RustTextEditor { + // Dirty hack, we need to access private vscode editor id, + // see https://github.com/microsoft/vscode/issues/91788 + assert( + typeof suspect.id === "string", + "Private text editor id is no longer available, please update the workaround!" + ); + + return isRustTextDocument(suspect.document); +} + +function isRustTextDocument(suspect: vscode.TextDocument): suspect is RustTextDocument { + return suspect.languageId === "rust"; +} diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 6a7aeb60..bd6e3ada 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -98,8 +98,8 @@ export namespace InlayHint { range: lc.Range; label: string; } - export type TypeHint = Common & { kind: Kind.TypeHint; } - export type ParamHint = Common & { kind: Kind.ParamHint; } + export type TypeHint = Common & { kind: Kind.TypeHint }; + export type ParamHint = Common & { kind: Kind.ParamHint }; } export interface InlayHintsParams { textDocument: lc.TextDocumentIdentifier; From 68fb2bc84b539fe42a50b37779453942fd73f0df Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 21:10:16 +0200 Subject: [PATCH 500/819] vscode: simpify --- rust-analyzer/editors/code/src/inlay_hints.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index bbe8f67e..ac07b2ea 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -101,14 +101,10 @@ class HintsUpdater { clearHints() { for (const file of this.sourceFiles) { file.inlaysRequest?.cancel(); - this.renderHints(file, []); + file.renderHints([], this.client.protocol2CodeConverter) } } - private renderHints(file: RustSourceFile, hints: ra.InlayHint[]) { - file.renderHints(hints, this.client.protocol2CodeConverter); - } - refreshRustDocument(document: RustTextDocument) { if (!this.enabled) return; From d935fda8a9242af15708413d8da951a5ecc01cdc Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 21:14:10 +0200 Subject: [PATCH 501/819] vscode: add dat semicolon --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index ac07b2ea..7b9dcfb2 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -101,7 +101,7 @@ class HintsUpdater { clearHints() { for (const file of this.sourceFiles) { file.inlaysRequest?.cancel(); - file.renderHints([], this.client.protocol2CodeConverter) + file.renderHints([], this.client.protocol2CodeConverter); } } From c5e4b023c9e19ef8e004d596172de5d8ff496f73 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 29 Feb 2020 23:19:58 +0200 Subject: [PATCH 502/819] vscode: refresh all editors on text changes, simplify inlays api --- rust-analyzer/editors/code/src/inlay_hints.ts | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 7b9dcfb2..161b3403 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -9,9 +9,7 @@ export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx.client); vscode.window.onDidChangeVisibleTextEditors( - visibleEditors => hintsUpdater.refreshVisibleRustEditors( - visibleEditors.filter(isRustTextEditor) - ), + () => hintsUpdater.refreshVisibleRustEditors(), null, ctx.subscriptions ); @@ -21,7 +19,7 @@ export function activateInlayHints(ctx: Ctx) { if (contentChanges.length === 0) return; if (!isRustTextDocument(document)) return; - hintsUpdater.refreshRustDocument(document); + hintsUpdater.forceRefreshVisibleRustEditors(); }, null, ctx.subscriptions @@ -92,7 +90,7 @@ class HintsUpdater { this.enabled = enabled; if (this.enabled) { - this.refreshVisibleRustEditors(vscode.window.visibleTextEditors.filter(isRustTextEditor)); + this.refreshVisibleRustEditors(); } else { this.clearHints(); } @@ -105,20 +103,20 @@ class HintsUpdater { } } - refreshRustDocument(document: RustTextDocument) { + forceRefreshVisibleRustEditors() { if (!this.enabled) return; - const file = this.sourceFiles.getSourceFile(document.uri.toString()); - - assert(!!file, "Document must be opened in some text editor!"); - - void file.fetchAndRenderHints(this.client); + for (const file of this.sourceFiles) { + void file.fetchAndRenderHints(this.client); + } } - refreshVisibleRustEditors(visibleEditors: RustTextEditor[]) { + refreshVisibleRustEditors() { if (!this.enabled) return; - const visibleSourceFiles = this.sourceFiles.drainEditors(visibleEditors); + const visibleSourceFiles = this.sourceFiles.drainEditors( + vscode.window.visibleTextEditors.filter(isRustTextEditor) + ); // Cancel requests for source files whose editors were disposed (leftovers after drain). for (const { inlaysRequest } of this.sourceFiles) inlaysRequest?.cancel(); From ec04cf4098265ec22666681bb80e7eb7587e2e73 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:07:44 +0200 Subject: [PATCH 503/819] vscode: prerefactor util.ts and ctx.ts --- rust-analyzer/editors/code/src/ctx.ts | 12 +++++------- rust-analyzer/editors/code/src/util.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index b4e983a0..25ef38ae 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import { Config } from './config'; import { createClient } from './client'; -import { isRustDocument } from './util'; +import { isRustEditor, RustEditor } from './util'; export class Ctx { private constructor( @@ -22,17 +22,15 @@ export class Ctx { return res; } - get activeRustEditor(): vscode.TextEditor | undefined { + get activeRustEditor(): RustEditor | undefined { const editor = vscode.window.activeTextEditor; - return editor && isRustDocument(editor.document) + return editor && isRustEditor(editor) ? editor : undefined; } - get visibleRustEditors(): vscode.TextEditor[] { - return vscode.window.visibleTextEditors.filter( - editor => isRustDocument(editor.document), - ); + get visibleRustEditors(): RustEditor[] { + return vscode.window.visibleTextEditors.filter(isRustEditor); } registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 7c95769b..95a5f122 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,7 +1,6 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; -import { TextDocument } from "vscode"; export function assert(condition: boolean, explanation: string): asserts condition { try { @@ -67,9 +66,16 @@ function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } -export function isRustDocument(document: TextDocument) { +export type RustDocument = vscode.TextDocument & { languageId: "rust" }; +export type RustEditor = vscode.TextEditor & { document: RustDocument; id: string }; + +export function isRustDocument(document: vscode.TextDocument): document is RustDocument { return document.languageId === 'rust' // SCM diff views have the same URI as the on-disk document but not the same content && document.uri.scheme !== 'git' && document.uri.scheme !== 'svn'; -} \ No newline at end of file +} + +export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { + return isRustDocument(editor.document); +} From fd4e4984460e5d90ca026b3b9c23d22b71dbfd5c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:08:08 +0200 Subject: [PATCH 504/819] vscode: remove logic for caching editors as per @matklad --- rust-analyzer/editors/code/src/inlay_hints.ts | 358 +++++++----------- 1 file changed, 136 insertions(+), 222 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 161b3403..6d084362 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -2,48 +2,32 @@ import * as lc from "vscode-languageclient"; import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; -import { Ctx } from './ctx'; -import { sendRequestWithRetry, assert } from './util'; +import { Ctx, Disposable } from './ctx'; +import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, log } from './util'; -export function activateInlayHints(ctx: Ctx) { - const hintsUpdater = new HintsUpdater(ctx.client); - - vscode.window.onDidChangeVisibleTextEditors( - () => hintsUpdater.refreshVisibleRustEditors(), - null, - ctx.subscriptions - ); - - vscode.workspace.onDidChangeTextDocument( - ({ contentChanges, document }) => { - if (contentChanges.length === 0) return; - if (!isRustTextDocument(document)) return; - hintsUpdater.forceRefreshVisibleRustEditors(); +export function activateInlayHints(ctx: Ctx) { + const maybeUpdater = { + updater: null as null | HintsUpdater, + onConfigChange() { + if (!ctx.config.displayInlayHints) { + return this.dispose(); + } + if (!this.updater) this.updater = HintsUpdater.create(ctx); }, - null, - ctx.subscriptions - ); + dispose() { + this.updater?.dispose(); + this.updater = null; + } + }; + + ctx.pushCleanup(maybeUpdater); vscode.workspace.onDidChangeConfiguration( - async _ => { - // FIXME: ctx.config may have not been refreshed at this point of time, i.e. - // it's on onDidChangeConfiguration() handler may've not executed yet - // (order of invokation is unspecified) - // To fix this we should expose an event emitter from our `Config` itself. - await hintsUpdater.setEnabled(ctx.config.displayInlayHints); - }, - null, - ctx.subscriptions + maybeUpdater.onConfigChange, maybeUpdater, ctx.subscriptions ); - ctx.pushCleanup({ - dispose() { - hintsUpdater.clearHints(); - } - }); - - hintsUpdater.setEnabled(ctx.config.displayInlayHints); + maybeUpdater.onConfigChange(); } @@ -79,239 +63,169 @@ const paramHints = { } }; -class HintsUpdater { - private sourceFiles = new RustSourceFiles(); - private enabled = false; - - constructor(readonly client: lc.LanguageClient) { } +class HintsUpdater implements Disposable { + private sourceFiles = new Map(); // map Uri -> RustSourceFile + private readonly disposables: Disposable[] = []; - setEnabled(enabled: boolean) { - if (this.enabled === enabled) return; - this.enabled = enabled; + private constructor(readonly ctx: Ctx) { } - if (this.enabled) { - this.refreshVisibleRustEditors(); - } else { - this.clearHints(); - } - } - - clearHints() { - for (const file of this.sourceFiles) { - file.inlaysRequest?.cancel(); - file.renderHints([], this.client.protocol2CodeConverter); - } - } - - forceRefreshVisibleRustEditors() { - if (!this.enabled) return; + static create(ctx: Ctx) { + const self = new HintsUpdater(ctx); - for (const file of this.sourceFiles) { - void file.fetchAndRenderHints(this.client); - } - } - - refreshVisibleRustEditors() { - if (!this.enabled) return; + vscode.window.onDidChangeVisibleTextEditors( + self.onDidChangeVisibleTextEditors, + self, + self.disposables + ); - const visibleSourceFiles = this.sourceFiles.drainEditors( - vscode.window.visibleTextEditors.filter(isRustTextEditor) + vscode.workspace.onDidChangeTextDocument( + self.onDidChangeTextDocument, + self, + self.disposables ); - // Cancel requests for source files whose editors were disposed (leftovers after drain). - for (const { inlaysRequest } of this.sourceFiles) inlaysRequest?.cancel(); + // Set up initial cache shape + ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set( + editor.document.uri.toString(), { + document: editor.document, + inlaysRequest: null, + cachedDecorations: null + } + )); - this.sourceFiles = visibleSourceFiles; + self.syncCacheAndRenderHints(); - for (const file of this.sourceFiles) { - if (!file.rerenderHints()) { - void file.fetchAndRenderHints(this.client); - } - } + return self; } -} - -/** - * This class encapsulates a map of file uris to respective inlay hints - * request cancellation token source (cts) and an array of editors. - * E.g. - * ``` - * { - * file1.rs -> (cts, (typeDecor, paramDecor), [editor1, editor2]) - * ^-- there is a cts to cancel the in-flight request - * file2.rs -> (cts, null, [editor3]) - * ^-- no decorations are applied to this source file yet - * file3.rs -> (null, (typeDecor, paramDecor), [editor4]) - * } ^-- there is no inflight request - * ``` - * - * Invariants: each stored source file has at least 1 editor. - */ -class RustSourceFiles { - private files = new Map(); + dispose() { + this.sourceFiles.forEach(file => file.inlaysRequest?.cancel()); + this.ctx.visibleRustEditors.forEach(editor => this.renderDecorations(editor, { param: [], type: [] })); + this.disposables.forEach(d => d.dispose()); + } - /** - * Removes `editors` from `this` source files and puts them into a returned - * source files object. cts and decorations are moved to the returned source files. - */ - drainEditors(editors: RustTextEditor[]): RustSourceFiles { - const result = new RustSourceFiles; + onDidChangeTextDocument({contentChanges, document}: vscode.TextDocumentChangeEvent) { + if (contentChanges.length === 0 || !isRustDocument(document)) return; + log.debug(`[inlays]: changed text doc!`); + this.syncCacheAndRenderHints(); + } - for (const editor of editors) { - const oldFile = this.removeEditor(editor); - const newFile = result.addEditor(editor); + private syncCacheAndRenderHints() { + // FIXME: make inlayHints request pass an array of files? + this.sourceFiles.forEach((file, uri) => this.fetchHints(file).then(hints => { + if (!hints) return; - if (oldFile) newFile.stealCacheFrom(oldFile); - } + file.cachedDecorations = this.hintsToDecorations(hints); - return result; + for (const editor of this.ctx.visibleRustEditors) { + if (editor.document.uri.toString() === uri) { + this.renderDecorations(editor, file.cachedDecorations); + } + } + })); } - /** - * Remove the editor and if it was the only editor for a source file, - * the source file is removed altogether. - * - * @returns A reference to the source file for this editor or - * null if no such source file was not found. - */ - private removeEditor(editor: RustTextEditor): null | RustSourceFile { - const uri = editor.document.uri.toString(); + onDidChangeVisibleTextEditors() { + log.debug(`[inlays]: changed visible text editors`); + const newSourceFiles = new Map(); - const file = this.files.get(uri); - if (!file) return null; + // Rerendering all, even up-to-date editors for simplicity + this.ctx.visibleRustEditors.forEach(async editor => { + const uri = editor.document.uri.toString(); + const file = this.sourceFiles.get(uri) ?? { + document: editor.document, + inlaysRequest: null, + cachedDecorations: null + }; + newSourceFiles.set(uri, file); - const editorIndex = file.editors.findIndex(suspect => areEditorsEqual(suspect, editor)); + // No text documents changed, so we may try to use the cache + if (!file.cachedDecorations) { + file.inlaysRequest?.cancel(); - if (editorIndex >= 0) { - file.editors.splice(editorIndex, 1); + const hints = await this.fetchHints(file); + if (!hints) return; - if (file.editors.length === 0) this.files.delete(uri); - } - - return file; - } - - /** - * @returns A reference to an existing source file or newly created one for the editor. - */ - private addEditor(editor: RustTextEditor): RustSourceFile { - const uri = editor.document.uri.toString(); - const file = this.files.get(uri); - - if (!file) { - const newFile = new RustSourceFile([editor]); - this.files.set(uri, newFile); - return newFile; - } + file.cachedDecorations = this.hintsToDecorations(hints); + } - if (!file.editors.find(suspect => areEditorsEqual(suspect, editor))) { - file.editors.push(editor); - } - return file; - } + this.renderDecorations(editor, file.cachedDecorations); + }); - getSourceFile(uri: string): undefined | RustSourceFile { - return this.files.get(uri); - } + // Cancel requests for no longer visible (disposed) source files + this.sourceFiles.forEach((file, uri) => { + if (!newSourceFiles.has(uri)) file.inlaysRequest?.cancel(); + }); - [Symbol.iterator](): IterableIterator { - return this.files.values(); - } -} -class RustSourceFile { - constructor( - /** - * Editors for this source file (one text document may be opened in multiple editors). - * We keep this just an array, because most of the time we have 1 editor for 1 source file. - */ - readonly editors: RustTextEditor[], - /** - * Source of the token to cancel in-flight inlay hints request if any. - */ - public inlaysRequest: null | vscode.CancellationTokenSource = null, - - public decorations: null | { - type: vscode.DecorationOptions[]; - param: vscode.DecorationOptions[]; - } = null - ) { } - - stealCacheFrom(other: RustSourceFile) { - if (other.inlaysRequest) this.inlaysRequest = other.inlaysRequest; - if (other.decorations) this.decorations = other.decorations; - - other.inlaysRequest = null; - other.decorations = null; + this.sourceFiles = newSourceFiles; } - rerenderHints(): boolean { - if (!this.decorations) return false; - - for (const editor of this.editors) { - editor.setDecorations(typeHints.decorationType, this.decorations.type); - editor.setDecorations(paramHints.decorationType, this.decorations.param); - } - return true; + private renderDecorations(editor: RustEditor, decorations: InlaysDecorations) { + editor.setDecorations(typeHints.decorationType, decorations.type); + editor.setDecorations(paramHints.decorationType, decorations.param); } - renderHints(hints: ra.InlayHint[], conv: lc.Protocol2CodeConverter) { - this.decorations = { type: [], param: [] }; + private hintsToDecorations(hints: ra.InlayHint[]): InlaysDecorations { + const decorations: InlaysDecorations = { type: [], param: [] }; + const conv = this.ctx.client.protocol2CodeConverter; for (const hint of hints) { switch (hint.kind) { case ra.InlayHint.Kind.TypeHint: { - this.decorations.type.push(typeHints.toDecoration(hint, conv)); + decorations.type.push(typeHints.toDecoration(hint, conv)); continue; } case ra.InlayHint.Kind.ParamHint: { - this.decorations.param.push(paramHints.toDecoration(hint, conv)); + decorations.param.push(paramHints.toDecoration(hint, conv)); continue; } } } - this.rerenderHints(); + return decorations; } - async fetchAndRenderHints(client: lc.LanguageClient): Promise { - this.inlaysRequest?.cancel(); + lastReqId = 0; + private async fetchHints(file: RustSourceFile): Promise { + const reqId = ++this.lastReqId; + + log.debug(`[inlays]: ${reqId} requesting`); + file.inlaysRequest?.cancel(); const tokenSource = new vscode.CancellationTokenSource(); - this.inlaysRequest = tokenSource; - - const request = { textDocument: { uri: this.editors[0].document.uri.toString() } }; - - try { - const hints = await sendRequestWithRetry(client, ra.inlayHints, request, tokenSource.token); - this.renderHints(hints, client.protocol2CodeConverter); - } catch { - /* ignore */ - } finally { - if (this.inlaysRequest === tokenSource) { - this.inlaysRequest = null; - } - } + file.inlaysRequest = tokenSource; + + const request = { textDocument: { uri: file.document.uri.toString() } }; + + return sendRequestWithRetry(this.ctx.client, ra.inlayHints, request, tokenSource.token) + .catch(_ => { + log.debug(`[inlays]: ${reqId} err`); + return null; + }) + .finally(() => { + if (file.inlaysRequest === tokenSource) { + file.inlaysRequest = null; + log.debug(`[inlays]: ${reqId} got response!`); + } else { + log.debug(`[inlays]: ${reqId} cancelled!`); + } + }) } } -type RustTextDocument = vscode.TextDocument & { languageId: "rust" }; -type RustTextEditor = vscode.TextEditor & { document: RustTextDocument; id: string }; - -function areEditorsEqual(a: RustTextEditor, b: RustTextEditor): boolean { - return a.id === b.id; +interface InlaysDecorations { + type: vscode.DecorationOptions[]; + param: vscode.DecorationOptions[]; } -function isRustTextEditor(suspect: vscode.TextEditor & { id?: unknown }): suspect is RustTextEditor { - // Dirty hack, we need to access private vscode editor id, - // see https://github.com/microsoft/vscode/issues/91788 - assert( - typeof suspect.id === "string", - "Private text editor id is no longer available, please update the workaround!" - ); - - return isRustTextDocument(suspect.document); -} +interface RustSourceFile { + /* + * Source of the token to cancel in-flight inlay hints request if any. + */ + inlaysRequest: null | vscode.CancellationTokenSource; + /** + * Last applied decorations. + */ + cachedDecorations: null | InlaysDecorations; -function isRustTextDocument(suspect: vscode.TextDocument): suspect is RustTextDocument { - return suspect.languageId === "rust"; + document: RustDocument } From a63ed1da95db3414e88071261426330d35b31eef Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:34:09 +0200 Subject: [PATCH 505/819] vscode: remove logging from inlays, run fix lint issues --- rust-analyzer/editors/code/src/inlay_hints.ts | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 6d084362..d7fabe79 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; import { Ctx, Disposable } from './ctx'; -import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, log } from './util'; +import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor } from './util'; export function activateInlayHints(ctx: Ctx) { @@ -86,7 +86,8 @@ class HintsUpdater implements Disposable { // Set up initial cache shape ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set( - editor.document.uri.toString(), { + editor.document.uri.toString(), + { document: editor.document, inlaysRequest: null, cachedDecorations: null @@ -104,9 +105,8 @@ class HintsUpdater implements Disposable { this.disposables.forEach(d => d.dispose()); } - onDidChangeTextDocument({contentChanges, document}: vscode.TextDocumentChangeEvent) { + onDidChangeTextDocument({ contentChanges, document }: vscode.TextDocumentChangeEvent) { if (contentChanges.length === 0 || !isRustDocument(document)) return; - log.debug(`[inlays]: changed text doc!`); this.syncCacheAndRenderHints(); } @@ -126,7 +126,6 @@ class HintsUpdater implements Disposable { } onDidChangeVisibleTextEditors() { - log.debug(`[inlays]: changed visible text editors`); const newSourceFiles = new Map(); // Rerendering all, even up-to-date editors for simplicity @@ -184,11 +183,7 @@ class HintsUpdater implements Disposable { return decorations; } - lastReqId = 0; private async fetchHints(file: RustSourceFile): Promise { - const reqId = ++this.lastReqId; - - log.debug(`[inlays]: ${reqId} requesting`); file.inlaysRequest?.cancel(); const tokenSource = new vscode.CancellationTokenSource(); @@ -197,18 +192,12 @@ class HintsUpdater implements Disposable { const request = { textDocument: { uri: file.document.uri.toString() } }; return sendRequestWithRetry(this.ctx.client, ra.inlayHints, request, tokenSource.token) - .catch(_ => { - log.debug(`[inlays]: ${reqId} err`); - return null; - }) + .catch(_ => null) .finally(() => { if (file.inlaysRequest === tokenSource) { file.inlaysRequest = null; - log.debug(`[inlays]: ${reqId} got response!`); - } else { - log.debug(`[inlays]: ${reqId} cancelled!`); } - }) + }); } } @@ -227,5 +216,5 @@ interface RustSourceFile { */ cachedDecorations: null | InlaysDecorations; - document: RustDocument + document: RustDocument; } From 3bdbea1b2a028a0031ab480733d92f2bd0c6d047 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:37:15 +0200 Subject: [PATCH 506/819] vscode: more privacy for HintsUpdater --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index d7fabe79..fd7c49c8 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -67,7 +67,7 @@ class HintsUpdater implements Disposable { private sourceFiles = new Map(); // map Uri -> RustSourceFile private readonly disposables: Disposable[] = []; - private constructor(readonly ctx: Ctx) { } + private constructor(private readonly ctx: Ctx) { } static create(ctx: Ctx) { const self = new HintsUpdater(ctx); From 7f4a3c1f896948d509d212f528d731affad0b989 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:39:42 +0200 Subject: [PATCH 507/819] vscode: post refactor HintsUpdater (simplify create() -> constructor call) --- rust-analyzer/editors/code/src/inlay_hints.ts | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index fd7c49c8..e1a82e03 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -13,7 +13,7 @@ export function activateInlayHints(ctx: Ctx) { if (!ctx.config.displayInlayHints) { return this.dispose(); } - if (!this.updater) this.updater = HintsUpdater.create(ctx); + if (!this.updater) this.updater = new HintsUpdater(ctx); }, dispose() { this.updater?.dispose(); @@ -67,25 +67,21 @@ class HintsUpdater implements Disposable { private sourceFiles = new Map(); // map Uri -> RustSourceFile private readonly disposables: Disposable[] = []; - private constructor(private readonly ctx: Ctx) { } - - static create(ctx: Ctx) { - const self = new HintsUpdater(ctx); - + constructor(private readonly ctx: Ctx) { vscode.window.onDidChangeVisibleTextEditors( - self.onDidChangeVisibleTextEditors, - self, - self.disposables + this.onDidChangeVisibleTextEditors, + this, + this.disposables ); vscode.workspace.onDidChangeTextDocument( - self.onDidChangeTextDocument, - self, - self.disposables + this.onDidChangeTextDocument, + this, + this.disposables ); // Set up initial cache shape - ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set( + ctx.visibleRustEditors.forEach(editor => this.sourceFiles.set( editor.document.uri.toString(), { document: editor.document, @@ -94,9 +90,7 @@ class HintsUpdater implements Disposable { } )); - self.syncCacheAndRenderHints(); - - return self; + this.syncCacheAndRenderHints(); } dispose() { From e8d10c44a528059d6bb4060d6cc01d9ac2024c49 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 23:59:33 +0200 Subject: [PATCH 508/819] vscode: contribute "alwaysDownloadServer" option to config --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 22573932..7bcd45e1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -219,6 +219,11 @@ } } }, + "rust-analyzer.alwaysDownloadServer": { + "type": "boolean", + "default": false, + "description": "Whether to ask before downloading the language server binary" + }, "rust-analyzer.serverPath": { "type": [ "null", From 0e37d073e724697b64363873e3b5c6aa80bf353d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 8 Mar 2020 00:01:48 +0200 Subject: [PATCH 509/819] vscode: care about alwaysDownloadServer option before asking Also renamed BinarySource to ArtifactSource in anticipation of nightlies installation that requires downloading not a binary itself but .vsix package, thus generalized to `artifact` term --- rust-analyzer/editors/code/src/config.ts | 11 ++++---- .../code/src/installation/interfaces.ts | 15 ++++++---- .../editors/code/src/installation/server.ts | 28 ++++++++++--------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index bf915102..c4acb632 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,6 +1,6 @@ import * as os from "os"; import * as vscode from 'vscode'; -import { BinarySource } from "./installation/interfaces"; +import { ArtifactSource } from "./installation/interfaces"; import { log } from "./util"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -114,12 +114,12 @@ export class Config { } } - get serverSource(): null | BinarySource { + get serverSource(): null | ArtifactSource { const serverPath = RA_LSP_DEBUG ?? this.cfg.get("serverPath"); if (serverPath) { return { - type: BinarySource.Type.ExplicitPath, + type: ArtifactSource.Type.ExplicitPath, path: Config.replaceTildeWithHomeDir(serverPath) }; } @@ -129,11 +129,12 @@ export class Config { if (!prebuiltBinaryName) return null; return { - type: BinarySource.Type.GithubRelease, + type: ArtifactSource.Type.GithubRelease, dir: this.ctx.globalStoragePath, file: prebuiltBinaryName, storage: this.ctx.globalState, - version: Config.extensionVersion, + tag: Config.extensionVersion, + askBeforeDownload: !(this.cfg.get("alwaysDownloadServer") as boolean), repo: { name: "rust-analyzer", owner: "rust-analyzer", diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index e40839e4..50b63592 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -14,14 +14,14 @@ export interface ArtifactReleaseInfo { } /** - * Represents the source of a binary artifact which is either specified by the user + * Represents the source of a an artifact which is either specified by the user * explicitly, or bundled by this extension from GitHub releases. */ -export type BinarySource = BinarySource.ExplicitPath | BinarySource.GithubRelease; +export type ArtifactSource = ArtifactSource.ExplicitPath | ArtifactSource.GithubRelease; -export namespace BinarySource { +export namespace ArtifactSource { /** - * Type tag for `BinarySource` discriminated union. + * Type tag for `ArtifactSource` discriminated union. */ export const enum Type { ExplicitPath, GithubRelease } @@ -56,13 +56,18 @@ export namespace BinarySource { /** * Tag of github release that denotes a version required by this extension. */ - version: string; + tag: string; /** * Object that provides `get()/update()` operations to store metadata * about the actual binary, e.g. its actual version. */ storage: vscode.Memento; + + /** + * Ask for the user permission before downloading the artifact. + */ + askBeforeDownload: boolean; } } diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 6a6cf4f8..ef1c45ff 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -3,12 +3,12 @@ import * as path from "path"; import { promises as dns } from "dns"; import { spawnSync } from "child_process"; -import { BinarySource } from "./interfaces"; +import { ArtifactSource } from "./interfaces"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; import { downloadArtifact } from "./download_artifact"; import { log, assert } from "../util"; -export async function ensureServerBinary(source: null | BinarySource): Promise { +export async function ensureServerBinary(source: null | ArtifactSource): Promise { if (!source) { vscode.window.showErrorMessage( "Unfortunately we don't ship binaries for your platform yet. " + @@ -22,7 +22,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise { +async function downloadServer(source: ArtifactSource.GithubRelease): Promise { try { - const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.version); + const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.tag); await downloadArtifact(releaseInfo, source.file, source.dir, "language server"); await setServerVersion(source.storage, releaseInfo.releaseName); From bf69139af21e328b75ee0bb258108af29457ee54 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 8 Mar 2020 18:58:02 +0200 Subject: [PATCH 510/819] vscode: rename alwaysDownloadServer -> askBeforeDownload The new name seems much simpler and it doesn't limit this config value only to downloading the server binary. Thus we wouldn't need to create another config properties to handle other downloads whatsoever. Anyway, I believe (heuristically) that most of the users would want to set "askBeforeDownload": false once and never bother clicking on the notification again (because otherwise there is no big point in installing rust-analyzer if it cannot install the server) --- rust-analyzer/editors/code/package.json | 6 +++--- rust-analyzer/editors/code/src/config.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7bcd45e1..430a61c6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -219,10 +219,10 @@ } } }, - "rust-analyzer.alwaysDownloadServer": { + "rust-analyzer.askBeforeDownload": { "type": "boolean", - "default": false, - "description": "Whether to ask before downloading the language server binary" + "default": true, + "description": "Whether to ask for permission before downloading any files from the Internet" }, "rust-analyzer.serverPath": { "type": [ diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c4acb632..cb9af86c 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -134,7 +134,7 @@ export class Config { file: prebuiltBinaryName, storage: this.ctx.globalState, tag: Config.extensionVersion, - askBeforeDownload: !(this.cfg.get("alwaysDownloadServer") as boolean), + askBeforeDownload: !(this.cfg.get("askBeforeDownload") as boolean), repo: { name: "rust-analyzer", owner: "rust-analyzer", From 91b310876ef1996eb246ddc647a5a200a8bae725 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 8 Mar 2020 21:47:35 +0200 Subject: [PATCH 511/819] vscode: fix inversion of askBeforeDownload --- rust-analyzer/editors/code/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index cb9af86c..948c12c2 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -134,7 +134,7 @@ export class Config { file: prebuiltBinaryName, storage: this.ctx.globalState, tag: Config.extensionVersion, - askBeforeDownload: !(this.cfg.get("askBeforeDownload") as boolean), + askBeforeDownload: this.cfg.get("askBeforeDownload") as boolean, repo: { name: "rust-analyzer", owner: "rust-analyzer", From da2a9eb3589dce2fae6610a83b317882d58e8bfa Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 8 Mar 2020 22:46:42 +0100 Subject: [PATCH 512/819] Use markdown description in vscode --- rust-analyzer/editors/code/package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 22573932..fd44d2bd 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -191,7 +191,7 @@ "properties": { "lsp.diagnostics": { "type": "boolean", - "description": "Whether to show diagnostics from `cargo check`" + "markdownDescription": "Whether to show diagnostics from `cargo check`" }, "completion.insertion.add-call-parenthesis": { "type": "boolean", @@ -203,7 +203,7 @@ }, "completion.enable-postfix": { "type": "boolean", - "description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." + "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." }, "call-info.full": { "type": "boolean", @@ -211,11 +211,11 @@ }, "notifications.workspace-loaded": { "type": "boolean", - "description": "Whether to show `workspace loaded` message" + "markdownDescription": "Whether to show `workspace loaded` message" }, "notifications.cargo-toml-not-found": { "type": "boolean", - "description": "Whether to show `can't find Cargo.toml` error message" + "markdownDescription": "Whether to show `can't find Cargo.toml` error message" } } }, @@ -251,24 +251,24 @@ "rust-analyzer.cargo-watch.enable": { "type": "boolean", "default": true, - "description": "Run `cargo check` for diagnostics on save" + "markdownDescription": "Run `cargo check` for diagnostics on save" }, "rust-analyzer.cargo-watch.arguments": { "type": "array", "items": { "type": "string" }, - "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", + "markdownDescription": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": [] }, "rust-analyzer.cargo-watch.command": { "type": "string", - "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", + "markdownDescription": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", "default": "check" }, "rust-analyzer.cargo-watch.allTargets": { "type": "boolean", - "description": "Check all targets and tests (will be passed as `--all-targets`)", + "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)", "default": true }, "rust-analyzer.trace.server": { @@ -320,7 +320,7 @@ "rust-analyzer.cargoFeatures.noDefaultFeatures": { "type": "boolean", "default": false, - "description": "Do not activate the `default` feature" + "markdownDescription": "Do not activate the `default` feature" }, "rust-analyzer.cargoFeatures.allFeatures": { "type": "boolean", From 06d59918cad57aaecfb8721c994701caea098473 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 10:59:36 +0200 Subject: [PATCH 513/819] vscode: groupd updates-related config under `updates` section as per @matklad --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 430a61c6..6827c822 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -219,7 +219,7 @@ } } }, - "rust-analyzer.askBeforeDownload": { + "rust-analyzer.updates.askBeforeDownload": { "type": "boolean", "default": true, "description": "Whether to ask for permission before downloading any files from the Internet" diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 948c12c2..b72206d3 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -134,7 +134,7 @@ export class Config { file: prebuiltBinaryName, storage: this.ctx.globalState, tag: Config.extensionVersion, - askBeforeDownload: this.cfg.get("askBeforeDownload") as boolean, + askBeforeDownload: this.cfg.get("updates.askBeforeDownload") as boolean, repo: { name: "rust-analyzer", owner: "rust-analyzer", From a90aaa679fa4c0e5777bd1fbf6b4845513c6f4ee Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 10 Mar 2020 21:58:15 +0800 Subject: [PATCH 514/819] Add additional_outdirs in config --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/client.ts | 1 + rust-analyzer/editors/code/src/config.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7a4a93e3..b856729d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -224,6 +224,11 @@ "default": true, "description": "Whether to ask for permission before downloading any files from the Internet" }, + "rust-analyzer.additionalOutDirs": { + "type": "object", + "default": {}, + "markdownDescription": "Fine grained controls for OUT_DIR `env!(\"OUT_DIR\")` variable. e.g. `{\"foo\":\"/path/to/foo\"}`, " + }, "rust-analyzer.serverPath": { "type": [ "null", diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 540f7c9e..6ce3b923 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -37,6 +37,7 @@ export async function createClient(config: Config, serverPath: string): Promise< excludeGlobs: config.excludeGlobs, useClientWatching: config.useClientWatching, featureFlags: config.featureFlags, + additionalOutDirs: config.additionalOutDirs, withSysroot: config.withSysroot, cargoFeatures: config.cargoFeatures, rustfmtArgs: config.rustfmtArgs, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b72206d3..3ade7e90 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -154,6 +154,7 @@ export class Config { get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } get featureFlags() { return this.cfg.get("featureFlags") as Record; } + get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record; } get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } get cargoWatchOptions(): CargoWatchOptions { From ada7c848b99d36113d4f97c146198fda3a9520b0 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 10 Mar 2020 13:31:13 -0400 Subject: [PATCH 515/819] Force latest stable --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 77ee5a0c..b0796454 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -114,9 +114,9 @@ } }, "@types/vscode": { - "version": "1.42.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz", - "integrity": "sha512-ds6TceMsh77Fs0Mq0Vap6Y72JbGWB8Bay4DrnJlf5d9ui2RSe1wis13oQm+XhguOeH1HUfLGzaDAoupTUtgabw==", + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.43.0.tgz", + "integrity": "sha512-kIaR9qzd80rJOxePKpCB/mdy00mz8Apt2QA5Y6rdrKFn13QNFNeP3Hzmsf37Bwh/3cS7QjtAeGSK7wSqAU0sYQ==", "dev": true }, "@typescript-eslint/eslint-plugin": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7a4a93e3..51288545 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "Programming Languages" ], "engines": { - "vscode": "^1.42.0" + "vscode": "^1.43.0" }, "enableProposedApi": true, "scripts": { @@ -41,7 +41,7 @@ "@rollup/plugin-node-resolve": "^7.1.1", "@types/node": "^12.12.29", "@types/node-fetch": "^2.5.5", - "@types/vscode": "^1.42.0", + "@types/vscode": "^1.43.0", "@typescript-eslint/eslint-plugin": "^2.22.0", "@typescript-eslint/parser": "^2.22.0", "eslint": "^6.8.0", From 7de71146b35f6d2c15d5c2ef0cb4a4e17c688e3f Mon Sep 17 00:00:00 2001 From: Steffen Lyngbaek Date: Tue, 10 Mar 2020 00:55:46 -0700 Subject: [PATCH 516/819] Parameter inlay hint separate from variable type inlay? #2876 Add setting to allow enabling either type inlay hints or parameter inlay hints or both. Group the the max inlay hint length option into the object. - Add a new type for the inlayHint options. - Add tests to ensure the inlays don't happen on the server side --- rust-analyzer/editors/code/package.json | 20 +++++++++++++++---- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 13 ++++++++++-- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 51288545..6f227506 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -307,12 +307,24 @@ "exclusiveMinimum": true, "description": "Number of syntax trees rust-analyzer keeps in memory" }, - "rust-analyzer.displayInlayHints": { - "type": "boolean", - "default": true, + "rust-analyzer.inlayHintOpts.displayType": { + "type": "string", + "enum": [ + "off", + "typeHints", + "parameterHints", + "full" + ], + "enumDescriptions": [ + "No type inlay hints", + "Type inlays hints only", + "Parameter inlays hints only", + "All inlay hints types" + ], + "default": "full", "description": "Display additional type and parameter information in the editor" }, - "rust-analyzer.maxInlayHintLength": { + "rust-analyzer.inlayHintOpts.maxLength": { "type": [ "null", "integer" diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 540f7c9e..ac4417c6 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -29,7 +29,7 @@ export async function createClient(config: Config, serverPath: string): Promise< initializationOptions: { publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, - maxInlayHintLength: config.maxInlayHintLength, + inlayHintOpts: config.inlayHintOpts, cargoWatchEnable: cargoWatchOpts.enable, cargoWatchArgs: cargoWatchOpts.arguments, cargoWatchCommand: cargoWatchOpts.command, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b72206d3..5acce075 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -5,6 +5,11 @@ import { log } from "./util"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; +export interface InlayHintOptions { + displayType: string; + maxLength: number; +} + export interface CargoWatchOptions { enable: boolean; arguments: string[]; @@ -149,8 +154,12 @@ export class Config { get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } - get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } - get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } + get inlayHintOpts(): InlayHintOptions { + return { + displayType: this.cfg.get("inlayHintOpts.displayType") as string, + maxLength: this.cfg.get("inlayHintOpts.maxLength") as number, + }; + } get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } get featureFlags() { return this.cfg.get("featureFlags") as Record; } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index e1a82e03..8d291406 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -10,7 +10,7 @@ export function activateInlayHints(ctx: Ctx) { const maybeUpdater = { updater: null as null | HintsUpdater, onConfigChange() { - if (!ctx.config.displayInlayHints) { + if (ctx.config.inlayHintOpts.displayType === 'off') { return this.dispose(); } if (!this.updater) this.updater = new HintsUpdater(ctx); From 1d350f9307f792fe1fa0f76188579cc9458b2ebf Mon Sep 17 00:00:00 2001 From: Steffen Lyngbaek Date: Tue, 10 Mar 2020 11:21:56 -0700 Subject: [PATCH 517/819] Address Issues from Github - Updated naming of config - Define struct in ra_ide and use remote derive in rust-analyzer/config - Make inlayConfig type more flexible to support more future types - Remove constructor only used in tests --- rust-analyzer/editors/code/src/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 5acce075..b26bf10d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -27,7 +27,9 @@ export class Config { private static readonly requiresReloadOpts = [ "cargoFeatures", "cargo-watch", - "highlighting.semanticTokens" + "highlighting.semanticTokens", + "inlayHintOpts.maxLength", + "inlayHintOpts.displayType", ] .map(opt => `${Config.rootSection}.${opt}`); From a5e46deb5a782365cf4aada700196bbad06135c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 11 Mar 2020 12:32:24 +0100 Subject: [PATCH 518/819] settings: rust-analyzer.cargo-watch.enable: clarify that the setting enables the cargo-watch command and not "cargo check" --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1fe8e9f8..09dfc404 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -261,7 +261,7 @@ "rust-analyzer.cargo-watch.enable": { "type": "boolean", "default": true, - "markdownDescription": "Run `cargo check` for diagnostics on save" + "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save" }, "rust-analyzer.cargo-watch.arguments": { "type": "array", From 92844956542fafeab4ff76ea7b71cdd58791cf82 Mon Sep 17 00:00:00 2001 From: Hannes De Valkeneer Date: Mon, 9 Mar 2020 22:06:45 +0100 Subject: [PATCH 519/819] feat: add debug code lens Refs #3539 --- rust-analyzer/editors/code/package.json | 3 ++ .../editors/code/src/commands/runnables.ts | 28 ++++++++++++++++++- rust-analyzer/editors/code/src/main.ts | 1 + .../editors/code/src/rust-analyzer-api.ts | 3 +- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1fe8e9f8..74458572 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -51,6 +51,9 @@ "typescript-formatter": "^7.2.2", "vsce": "^1.74.0" }, + "extensionDependencies": [ + "vadimcn.vscode-lldb" + ], "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 06b51346..faa92799 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; +import { debug } from 'vscode'; export function run(ctx: Ctx): Cmd { let prevRunnable: RunnableQuickPick | undefined; @@ -62,6 +63,31 @@ export function runSingle(ctx: Ctx): Cmd { }; } +export function debugSingle(ctx: Ctx): Cmd { + return async (config: ra.Runnable) => { + const editor = ctx.activeRustEditor; + if (!editor) return; + + if (config.args[0] === 'run') { + config.args[0] = 'build'; + } else { + config.args.push('--no-run'); + } + + const debugConfig = { + type: "lldb", + request: "launch", + name: config.label, + cargo: { + args: config.args, + }, + args: config.extraArgs, + cwd: config.cwd + }; + return debug.startDebugging(undefined, debugConfig); + }; +} + class RunnableQuickPick implements vscode.QuickPickItem { public label: string; public description?: string | undefined; @@ -87,7 +113,7 @@ function createTask(spec: ra.Runnable): vscode.Task { type: 'cargo', label: spec.label, command: spec.bin, - args: spec.args, + args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, env: spec.env, }; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ecf53cf7..e01c89cc 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -83,6 +83,7 @@ export async function activate(context: vscode.ExtensionContext) { // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); + ctx.registerCommand('debugSingle', commands.debugSingle); ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index bd6e3ada..e09a203c 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -80,13 +80,12 @@ export interface Runnable { label: string; bin: string; args: Vec; + extraArgs: Vec; env: FxHashMap; cwd: Option; } export const runnables = request>("runnables"); - - export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint; export namespace InlayHint { From fce1e252e8951d65938882916b3b91a5c7a551f1 Mon Sep 17 00:00:00 2001 From: Steffen Lyngbaek Date: Wed, 11 Mar 2020 20:14:39 -0700 Subject: [PATCH 520/819] Switch from Vec to object with props - Instead of a single object type, use several individual nested types to allow toggling from the settings GUI - Remove unused struct definitions - Install and test that the toggles work --- rust-analyzer/editors/code/package.json | 32 +++++++------------ rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 13 ++++---- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6f227506..296d6fe8 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -307,28 +307,18 @@ "exclusiveMinimum": true, "description": "Number of syntax trees rust-analyzer keeps in memory" }, - "rust-analyzer.inlayHintOpts.displayType": { - "type": "string", - "enum": [ - "off", - "typeHints", - "parameterHints", - "full" - ], - "enumDescriptions": [ - "No type inlay hints", - "Type inlays hints only", - "Parameter inlays hints only", - "All inlay hints types" - ], - "default": "full", - "description": "Display additional type and parameter information in the editor" + "rust-analyzer.inlayHints.typeHints": { + "type": "boolean", + "default": true, + "description": "Whether to show inlay type hints" }, - "rust-analyzer.inlayHintOpts.maxLength": { - "type": [ - "null", - "integer" - ], + "rust-analyzer.inlayHints.parameterHints": { + "type": "boolean", + "default": true, + "description": "Whether to show function parameter name inlay hints at the call site" + }, + "rust-analyzer.inlayHints.maxLength": { + "type": "integer", "default": 20, "minimum": 0, "exclusiveMinimum": true, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index ac4417c6..3b8ea6f7 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -29,7 +29,7 @@ export async function createClient(config: Config, serverPath: string): Promise< initializationOptions: { publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, - inlayHintOpts: config.inlayHintOpts, + inlayHints: config.inlayHints, cargoWatchEnable: cargoWatchOpts.enable, cargoWatchArgs: cargoWatchOpts.arguments, cargoWatchCommand: cargoWatchOpts.command, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b26bf10d..2668c964 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -6,7 +6,8 @@ import { log } from "./util"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; export interface InlayHintOptions { - displayType: string; + typeHints: boolean; + parameterHints: boolean; maxLength: number; } @@ -28,8 +29,7 @@ export class Config { "cargoFeatures", "cargo-watch", "highlighting.semanticTokens", - "inlayHintOpts.maxLength", - "inlayHintOpts.displayType", + "inlayHints", ] .map(opt => `${Config.rootSection}.${opt}`); @@ -156,10 +156,11 @@ export class Config { get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } - get inlayHintOpts(): InlayHintOptions { + get inlayHints(): InlayHintOptions { return { - displayType: this.cfg.get("inlayHintOpts.displayType") as string, - maxLength: this.cfg.get("inlayHintOpts.maxLength") as number, + typeHints: this.cfg.get("inlayHints.typeHints") as boolean, + parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean, + maxLength: this.cfg.get("inlayHints.maxLength") as number, }; } get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 8d291406..b19b09ad 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -10,7 +10,7 @@ export function activateInlayHints(ctx: Ctx) { const maybeUpdater = { updater: null as null | HintsUpdater, onConfigChange() { - if (ctx.config.inlayHintOpts.displayType === 'off') { + if (!ctx.config.inlayHints.typeHints && !ctx.config.inlayHints.parameterHints) { return this.dispose(); } if (!this.updater) this.updater = new HintsUpdater(ctx); From 7e5595531cc34b58d06b120b38969c033008b6c7 Mon Sep 17 00:00:00 2001 From: Steffen Lyngbaek Date: Thu, 12 Mar 2020 08:43:07 -0700 Subject: [PATCH 521/819] Make maxLength nullable again --- rust-analyzer/editors/code/package.json | 5 ++++- rust-analyzer/editors/code/src/config.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 296d6fe8..78f3539e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -318,7 +318,10 @@ "description": "Whether to show function parameter name inlay hints at the call site" }, "rust-analyzer.inlayHints.maxLength": { - "type": "integer", + "type": [ + "null", + "integer" + ], "default": 20, "minimum": 0, "exclusiveMinimum": true, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 2668c964..c3b3ecab 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -8,7 +8,7 @@ const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; export interface InlayHintOptions { typeHints: boolean; parameterHints: boolean; - maxLength: number; + maxLength: number | null; } export interface CargoWatchOptions { @@ -160,7 +160,7 @@ export class Config { return { typeHints: this.cfg.get("inlayHints.typeHints") as boolean, parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean, - maxLength: this.cfg.get("inlayHints.maxLength") as number, + maxLength: this.cfg.get("inlayHints.maxLength") as null | number, }; } get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } From 7b91edffc9d938b07c5efb84c5f82c255475e1a2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 Mar 2020 18:01:36 +0100 Subject: [PATCH 522/819] Simpler deserialization --- rust-analyzer/editors/code/src/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index e9f261c2..b2c830b3 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -29,11 +29,16 @@ export async function createClient(config: Config, serverPath: string): Promise< initializationOptions: { publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, - inlayHints: config.inlayHints, + + inlayHintsType: config.inlayHints.typeHints, + inlayHintsParameter: config.inlayHints.parameterHints, + inlayHintsMaxLength: config.inlayHints.maxLength, + cargoWatchEnable: cargoWatchOpts.enable, cargoWatchArgs: cargoWatchOpts.arguments, cargoWatchCommand: cargoWatchOpts.command, cargoWatchAllTargets: cargoWatchOpts.allTargets, + excludeGlobs: config.excludeGlobs, useClientWatching: config.useClientWatching, featureFlags: config.featureFlags, From bb09457bf66d1154d363bc5d339c1f7ea9626f20 Mon Sep 17 00:00:00 2001 From: Hannes De Valkeneer Date: Thu, 12 Mar 2020 21:00:40 +0100 Subject: [PATCH 523/819] fixup! feat: add debug code lens --- rust-analyzer/editors/code/src/commands/runnables.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index faa92799..51cfb37d 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -3,7 +3,6 @@ import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; -import { debug } from 'vscode'; export function run(ctx: Ctx): Cmd { let prevRunnable: RunnableQuickPick | undefined; @@ -84,7 +83,7 @@ export function debugSingle(ctx: Ctx): Cmd { args: config.extraArgs, cwd: config.cwd }; - return debug.startDebugging(undefined, debugConfig); + return vscode.debug.startDebugging(undefined, debugConfig); }; } From b9aaf722439cee65b36b09b7aea61419ade2e194 Mon Sep 17 00:00:00 2001 From: Hannes De Valkeneer Date: Thu, 12 Mar 2020 21:28:26 +0100 Subject: [PATCH 524/819] fixup! feat: add debug code lens avoid repetition of `--no-run` --- rust-analyzer/editors/code/src/commands/runnables.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 51cfb37d..35715516 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -67,12 +67,6 @@ export function debugSingle(ctx: Ctx): Cmd { const editor = ctx.activeRustEditor; if (!editor) return; - if (config.args[0] === 'run') { - config.args[0] = 'build'; - } else { - config.args.push('--no-run'); - } - const debugConfig = { type: "lldb", request: "launch", @@ -83,6 +77,7 @@ export function debugSingle(ctx: Ctx): Cmd { args: config.extraArgs, cwd: config.cwd }; + return vscode.debug.startDebugging(undefined, debugConfig); }; } From 6e9d5d39ca43c01a68e31232575ccab0bafec10a Mon Sep 17 00:00:00 2001 From: Hannes De Valkeneer Date: Thu, 12 Mar 2020 22:31:47 +0100 Subject: [PATCH 525/819] fixup! feat: add debug code lens autodetect vscode-lldb --- rust-analyzer/editors/code/package.json | 3 --- rust-analyzer/editors/code/src/client.ts | 1 + rust-analyzer/editors/code/src/config.ts | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 74458572..1fe8e9f8 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -51,9 +51,6 @@ "typescript-formatter": "^7.2.2", "vsce": "^1.74.0" }, - "extensionDependencies": [ - "vadimcn.vscode-lldb" - ], "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 6ce3b923..99c9c5ae 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -41,6 +41,7 @@ export async function createClient(config: Config, serverPath: string): Promise< withSysroot: config.withSysroot, cargoFeatures: config.cargoFeatures, rustfmtArgs: config.rustfmtArgs, + vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null, }, traceOutputChannel, middleware: { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 3ade7e90..40f4c7a0 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -156,6 +156,7 @@ export class Config { get featureFlags() { return this.cfg.get("featureFlags") as Record; } get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record; } get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } + get vscodeLldb() { return this.cfg.get("vscodeLldb") as boolean; } get cargoWatchOptions(): CargoWatchOptions { return { From b5fa861513c3276327bc2a4f5ff8d0e9c809b52f Mon Sep 17 00:00:00 2001 From: hdevalke <2261239+hdevalke@users.noreply.github.com> Date: Thu, 12 Mar 2020 22:56:37 +0100 Subject: [PATCH 526/819] Update editors/code/src/config.ts Co-Authored-By: Veetaha --- rust-analyzer/editors/code/src/config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 40f4c7a0..3ade7e90 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -156,7 +156,6 @@ export class Config { get featureFlags() { return this.cfg.get("featureFlags") as Record; } get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record; } get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } - get vscodeLldb() { return this.cfg.get("vscodeLldb") as boolean; } get cargoWatchOptions(): CargoWatchOptions { return { From 6bdbba82668e39f8af3ce6c58d88cb188bf72281 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:54:40 +0200 Subject: [PATCH 527/819] vscode-prerefactor: merge two files into downloads.ts --- .../src/installation/download_artifact.ts | 50 ------------------- .../{download_file.ts => downloads.ts} | 46 +++++++++++++++++ 2 files changed, 46 insertions(+), 50 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/installation/download_artifact.ts rename rust-analyzer/editors/code/src/installation/{download_file.ts => downloads.ts} (51%) diff --git a/rust-analyzer/editors/code/src/installation/download_artifact.ts b/rust-analyzer/editors/code/src/installation/download_artifact.ts deleted file mode 100644 index 97e4d67c..00000000 --- a/rust-analyzer/editors/code/src/installation/download_artifact.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as vscode from "vscode"; -import * as path from "path"; -import { promises as fs } from "fs"; - -import { ArtifactReleaseInfo } from "./interfaces"; -import { downloadFile } from "./download_file"; -import { assert } from "../util"; - -/** - * Downloads artifact from given `downloadUrl`. - * Creates `installationDir` if it is not yet created and put the artifact under - * `artifactFileName`. - * Displays info about the download progress in an info message printing the name - * of the artifact as `displayName`. - */ -export async function downloadArtifact( - { downloadUrl, releaseName }: ArtifactReleaseInfo, - artifactFileName: string, - installationDir: string, - displayName: string, -) { - await fs.mkdir(installationDir).catch(err => assert( - err?.code === "EEXIST", - `Couldn't create directory "${installationDir}" to download ` + - `${artifactFileName} artifact: ${err?.message}` - )); - - const installationPath = path.join(installationDir, artifactFileName); - - await vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - cancellable: false, // FIXME: add support for canceling download? - title: `Downloading ${displayName} (${releaseName})` - }, - async (progress, _cancellationToken) => { - let lastPrecentage = 0; - const filePermissions = 0o755; // (rwx, r_x, r_x) - await downloadFile(downloadUrl, installationPath, filePermissions, (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPrecentage - }); - - lastPrecentage = newPercentage; - }); - } - ); -} diff --git a/rust-analyzer/editors/code/src/installation/download_file.ts b/rust-analyzer/editors/code/src/installation/downloads.ts similarity index 51% rename from rust-analyzer/editors/code/src/installation/download_file.ts rename to rust-analyzer/editors/code/src/installation/downloads.ts index ee8949d6..7ce2e296 100644 --- a/rust-analyzer/editors/code/src/installation/download_file.ts +++ b/rust-analyzer/editors/code/src/installation/downloads.ts @@ -1,8 +1,11 @@ import fetch from "node-fetch"; +import * as vscode from "vscode"; +import * as path from "path"; import * as fs from "fs"; import * as stream from "stream"; import * as util from "util"; import { log, assert } from "../util"; +import { ArtifactReleaseInfo } from "./interfaces"; const pipeline = util.promisify(stream.pipeline); @@ -49,3 +52,46 @@ export async function downloadFile( // Issue at nodejs repo: https://github.com/nodejs/node/issues/31776 }); } + +/** + * Downloads artifact from given `downloadUrl`. + * Creates `installationDir` if it is not yet created and puts the artifact under + * `artifactFileName`. + * Displays info about the download progress in an info message printing the name + * of the artifact as `displayName`. + */ +export async function downloadArtifactWithProgressUi( + { downloadUrl, releaseName }: ArtifactReleaseInfo, + artifactFileName: string, + installationDir: string, + displayName: string, +) { + await fs.promises.mkdir(installationDir).catch(err => assert( + err?.code === "EEXIST", + `Couldn't create directory "${installationDir}" to download ` + + `${artifactFileName} artifact: ${err?.message}` + )); + + const installationPath = path.join(installationDir, artifactFileName); + + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, // FIXME: add support for canceling download? + title: `Downloading rust-analyzer ${displayName} (${releaseName})` + }, + async (progress, _cancellationToken) => { + let lastPrecentage = 0; + const filePermissions = 0o755; // (rwx, r_x, r_x) + await downloadFile(downloadUrl, installationPath, filePermissions, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPrecentage + }); + + lastPrecentage = newPercentage; + }); + } + ); +} From b5c6c298c491e56c47defda45ee5f4dd5b0b59b1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:54:54 +0200 Subject: [PATCH 528/819] vscode-prerefactor: add some utility functions --- rust-analyzer/editors/code/src/util.ts | 69 +++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 95a5f122..2bfc145e 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,5 +1,6 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; +import { promises as dns } from "dns"; import { strict as nativeAssert } from "assert"; export function assert(condition: boolean, explanation: string): asserts condition { @@ -11,21 +12,40 @@ export function assert(condition: boolean, explanation: string): asserts conditi } } -export const log = { - enabled: true, +export const log = new class { + private enabled = true; + + setEnabled(yes: boolean): void { + log.enabled = yes; + } + debug(message?: any, ...optionalParams: any[]): void { if (!log.enabled) return; // eslint-disable-next-line no-console console.log(message, ...optionalParams); - }, + } + error(message?: any, ...optionalParams: any[]): void { if (!log.enabled) return; debugger; // eslint-disable-next-line no-console console.error(message, ...optionalParams); - }, - setEnabled(yes: boolean): void { - log.enabled = yes; + } + + downloadError(err: Error, artifactName: string, repoName: string) { + vscode.window.showErrorMessage( + `Failed to download the rust-analyzer ${artifactName} from ${repoName} ` + + `GitHub repository: ${err.message}` + ); + log.error(err); + dns.resolve('example.com').then( + addrs => log.debug("DNS resolution for example.com was successful", addrs), + err => log.error( + "DNS resolution for example.com failed, " + + "there might be an issue with Internet availability", + err + ) + ); } }; @@ -66,6 +86,17 @@ function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } +export function notReentrant( + fn: (this: TThis, ...params: TParams) => Promise +): typeof fn { + let entered = false; + return function(...params) { + assert(!entered, `Reentrancy invariant for ${fn.name} is violated`); + entered = true; + return fn.apply(this, params).finally(() => entered = false); + }; +} + export type RustDocument = vscode.TextDocument & { languageId: "rust" }; export type RustEditor = vscode.TextEditor & { document: RustDocument; id: string }; @@ -79,3 +110,29 @@ export function isRustDocument(document: vscode.TextDocument): document is RustD export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { return isRustDocument(editor.document); } + +/** + * @param extensionId The canonical extension identifier in the form of: `publisher.name` + */ +export async function vscodeReinstallExtension(extensionId: string) { + // Unfortunately there is no straightforward way as of now, these commands + // were found in vscode source code. + + log.debug("Uninstalling extension", extensionId); + await vscode.commands.executeCommand("workbench.extensions.uninstallExtension", extensionId); + log.debug("Installing extension", extensionId); + await vscode.commands.executeCommand("workbench.extensions.installExtension", extensionId); +} + +export async function vscodeReloadWindow(): Promise { + await vscode.commands.executeCommand("workbench.action.reloadWindow"); + + assert(false, "unreachable"); +} + +export async function vscodeInstallExtensionFromVsix(vsixPath: string) { + await vscode.commands.executeCommand( + "workbench.extensions.installExtension", + vscode.Uri.file(vsixPath) + ); +} From 62c952ac66e38b7ca50411884bea7afbe19a799a Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:55:26 +0200 Subject: [PATCH 529/819] vscode: get release date from release info --- .../fetch_artifact_release_info.ts | 3 +++ .../code/src/installation/interfaces.ts | 18 ++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts index b1b5a348..1ad3b833 100644 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts @@ -59,12 +59,15 @@ export async function fetchArtifactReleaseInfo( return { releaseName: release.name, + releaseDate: new Date(release.published_at), downloadUrl: artifact.browser_download_url }; // We omit declaration of tremendous amount of fields that we are not using here interface GithubRelease { name: string; + // eslint-disable-next-line camelcase + published_at: string; assets: Array<{ name: string; // eslint-disable-next-line camelcase diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts index 50b63592..1a8ea088 100644 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ b/rust-analyzer/editors/code/src/installation/interfaces.ts @@ -1,5 +1,3 @@ -import * as vscode from "vscode"; - export interface GithubRepo { name: string; owner: string; @@ -9,6 +7,7 @@ export interface GithubRepo { * Metadata about particular artifact retrieved from GitHub releases. */ export interface ArtifactReleaseInfo { + releaseDate: Date; releaseName: string; downloadUrl: string; } @@ -42,6 +41,9 @@ export namespace ArtifactSource { */ repo: GithubRepo; + + // FIXME: add installationPath: string; + /** * Directory on the filesystem where the bundled binary is stored. */ @@ -57,17 +59,5 @@ export namespace ArtifactSource { * Tag of github release that denotes a version required by this extension. */ tag: string; - - /** - * Object that provides `get()/update()` operations to store metadata - * about the actual binary, e.g. its actual version. - */ - storage: vscode.Memento; - - /** - * Ask for the user permission before downloading the artifact. - */ - askBeforeDownload: boolean; } - } From e8e28b148265e873c576494274972fc29f0aeb80 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:56:51 +0200 Subject: [PATCH 530/819] vscode: prepare package.json for nightlies --- rust-analyzer/editors/code/package-lock.json | 2 +- rust-analyzer/editors/code/package.json | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b0796454..575dc7c4 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.2.20200211-dev", + "version": "0.2.20200309-nightly", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3aaae357..faf10528 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -6,7 +6,7 @@ "private": true, "icon": "icon.png", "//": "The real version is in release.yaml, this one just needs to be bigger", - "version": "0.2.20200211-dev", + "version": "0.2.20200309-nightly", "publisher": "matklad", "repository": { "url": "https://github.com/rust-analyzer/rust-analyzer.git", @@ -219,6 +219,19 @@ } } }, + "rust-analyzer.updates.channel": { + "type": "string", + "enum": [ + "stable", + "nightly" + ], + "default": "stable", + "markdownEnumDescriptions": [ + "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general", + "`\"nightly\"` updates are shipped daily, they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" + ], + "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs" + }, "rust-analyzer.updates.askBeforeDownload": { "type": "boolean", "default": true, @@ -235,7 +248,7 @@ "string" ], "default": null, - "description": "Path to rust-analyzer executable (points to bundled binary by default)" + "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" }, "rust-analyzer.excludeGlobs": { "type": "array", From f42a049dd811ff143b2501b1a36ad654e9899c6c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:57:13 +0200 Subject: [PATCH 531/819] vscode: prepare config for nightlies --- rust-analyzer/editors/code/src/config.ts | 111 ++++++++++++++++++++--- 1 file changed, 96 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 6db073be..e2b0f6f8 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,22 +23,36 @@ export interface CargoFeatures { allFeatures: boolean; features: string[]; } + +export const enum UpdatesChannel { + Stable = "stable", + Nightly = "nightly" +} + +export const NIGHTLY_TAG = "nightly"; export class Config { - private static readonly rootSection = "rust-analyzer"; - private static readonly requiresReloadOpts = [ + readonly extensionId = "matklad.rust-analyzer"; + + private readonly rootSection = "rust-analyzer"; + private readonly requiresReloadOpts = [ "cargoFeatures", "cargo-watch", "highlighting.semanticTokens", "inlayHints", ] - .map(opt => `${Config.rootSection}.${opt}`); + .map(opt => `${this.rootSection}.${opt}`); - private static readonly extensionVersion: string = (() => { + /** + * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) + */ + private readonly extensionVersion: string = (() => { const packageJsonVersion = vscode .extensions - .getExtension("matklad.rust-analyzer")! + .getExtension(this.extensionId)! .packageJSON - .version as string; // n.n.YYYYMMDD + .version as string; + + if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/; const [, yyyy, mm, dd] = packageJsonVersion.match(realVersionRegexp)!; @@ -54,7 +68,7 @@ export class Config { } private refreshConfig() { - this.cfg = vscode.workspace.getConfiguration(Config.rootSection); + this.cfg = vscode.workspace.getConfiguration(this.rootSection); const enableLogging = this.cfg.get("trace.extension") as boolean; log.setEnabled(enableLogging); log.debug("Using configuration:", this.cfg); @@ -63,7 +77,7 @@ export class Config { private async onConfigChange(event: vscode.ConfigurationChangeEvent) { this.refreshConfig(); - const requiresReloadOpt = Config.requiresReloadOpts.find( + const requiresReloadOpt = this.requiresReloadOpts.find( opt => event.affectsConfiguration(opt) ); @@ -121,8 +135,16 @@ export class Config { } } + get installedExtensionUpdateChannel() { + if (this.serverPath !== null) return null; + + return this.extensionVersion === NIGHTLY_TAG + ? UpdatesChannel.Nightly + : UpdatesChannel.Stable; + } + get serverSource(): null | ArtifactSource { - const serverPath = RA_LSP_DEBUG ?? this.cfg.get("serverPath"); + const serverPath = RA_LSP_DEBUG ?? this.serverPath; if (serverPath) { return { @@ -135,23 +157,47 @@ export class Config { if (!prebuiltBinaryName) return null; + return this.createGithubReleaseSource( + prebuiltBinaryName, + this.extensionVersion + ); + } + + private createGithubReleaseSource(file: string, tag: string): ArtifactSource.GithubRelease { return { type: ArtifactSource.Type.GithubRelease, + file, + tag, dir: this.ctx.globalStoragePath, - file: prebuiltBinaryName, - storage: this.ctx.globalState, - tag: Config.extensionVersion, - askBeforeDownload: this.cfg.get("updates.askBeforeDownload") as boolean, repo: { name: "rust-analyzer", - owner: "rust-analyzer", + owner: "rust-analyzer" } - }; + } } + get nightlyVsixSource(): ArtifactSource.GithubRelease { + return this.createGithubReleaseSource("rust-analyzer.vsix", NIGHTLY_TAG); + } + + readonly installedNightlyExtensionReleaseDate = new DateStorage( + "rust-analyzer-installed-nightly-extension-release-date", + this.ctx.globalState + ); + readonly serverReleaseDate = new DateStorage( + "rust-analyzer-server-release-date", + this.ctx.globalState + ); + readonly serverReleaseTag = new StringStorage( + "rust-analyzer-release-tag", this.ctx.globalState + ); + // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension + private get serverPath() { return this.cfg.get("serverPath") as null | string; } + get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } + get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } @@ -189,3 +235,38 @@ export class Config { // for internal use get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } } + +export class StringStorage { + constructor( + private readonly key: string, + private readonly storage: vscode.Memento + ) {} + + get(): null | string { + const tag = this.storage.get(this.key, null); + log.debug(this.key, "==", tag); + return tag; + } + async set(tag: string) { + log.debug(this.key, "=", tag); + await this.storage.update(this.key, tag); + } +} +export class DateStorage { + + constructor( + private readonly key: string, + private readonly storage: vscode.Memento + ) {} + + get(): null | Date { + const date = this.storage.get(this.key, null); + log.debug(this.key, "==", date); + return date ? new Date(date) : null; + } + + async set(date: null | Date) { + log.debug(this.key, "=", date); + await this.storage.update(this.key, date); + } +} From 021d88cb96ca5a33d19b5f97676444e7ccabaced Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:57:34 +0200 Subject: [PATCH 532/819] vscode: add nightly extension installation logic --- .../code/src/installation/extension.ts | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 rust-analyzer/editors/code/src/installation/extension.ts diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts new file mode 100644 index 00000000..7709cd3c --- /dev/null +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -0,0 +1,131 @@ +import * as vscode from "vscode"; +import * as path from "path"; +import { promises as fs } from 'fs'; + +import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util"; +import { Config, UpdatesChannel } from "../config"; +import { ArtifactReleaseInfo } from "./interfaces"; +import { downloadArtifactWithProgressUi } from "./downloads"; +import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; + +const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; + +/** + * Installs `stable` or latest `nightly` version or does nothing if the current + * extension version is what's needed according to `desiredUpdateChannel`. + */ +export async function ensureProperExtensionVersion(config: Config): Promise { + const currentUpdChannel = config.installedExtensionUpdateChannel; + const desiredUpdChannel = config.updatesChannel; + + if (currentUpdChannel === UpdatesChannel.Stable) { + // Release date is present only when we are on nightly + config.installedNightlyExtensionReleaseDate.set(null); + } + + // User has built lsp server from sources, she should manage updates manually + if (currentUpdChannel === null) return; + + if (desiredUpdChannel === UpdatesChannel.Stable) { + // VSCode should handle updates for stable channel + if (currentUpdChannel === UpdatesChannel.Stable) return; + + if (!await askToDownloadProperExtensionVersion(config)) return; + + await vscodeReinstallExtension(config.extensionId); + await vscodeReloadWindow(); // never returns + } + + if (currentUpdChannel === UpdatesChannel.Stable) { + if (!await askToDownloadProperExtensionVersion(config)) return; + + return await tryDownloadNightlyExtension(config); + } + + const currentExtReleaseDate = config.installedNightlyExtensionReleaseDate.get(); + + assert(currentExtReleaseDate !== null, "nightly release date must've been set during installation"); + + const hoursSinceLastUpdate = diffInHours(currentExtReleaseDate, new Date()); + log.debug(`Current rust-analyzer nightly was downloaded ${hoursSinceLastUpdate} hours ago`); + + if (hoursSinceLastUpdate < HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS) { + return; + } + if (!await askToDownloadProperExtensionVersion(config, "The installed nightly version is most likely outdated. ")) { + return; + } + + await tryDownloadNightlyExtension(config, releaseInfo => { + assert( + currentExtReleaseDate === config.installedNightlyExtensionReleaseDate.get(), + "Other active VSCode instance has reinstalled the extension" + ); + + if (releaseInfo.releaseDate === currentExtReleaseDate) { + vscode.window.showInformationMessage( + "Whoops, it appears that your nightly version is up-to-date. " + + "There might be some problems with the upcomming nightly release " + + "or you traveled too far into the future. Sorry for that 😅! " + ); + return false; + } + return true; + }); +} + +async function askToDownloadProperExtensionVersion(config: Config, reason = "") { + if (!config.askBeforeDownload) return true; + + const stableOrNightly = config.updatesChannel === UpdatesChannel.Stable ? "stable" : "latest nightly"; + + // In case of reentering this function and showing the same info message + // (e.g. after we had shown this message, the user changed the config) + // vscode will dismiss the already shown one (i.e. return undefined). + // This behaviour is what we want, but likely it is not documented + + const userResponse = await vscode.window.showInformationMessage( + reason + `Do you want to download the ${stableOrNightly} rust-analyzer extension ` + + `version and reload the window now?`, + "Download now", "Cancel" + ); + log.debug("Response: ", userResponse); + return userResponse === "Download now"; +} + +/** + * Shutdowns the process in case of success (i.e. reloads the window) or throws an error. + */ +const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( + config: Config, + shouldDownload: (releaseInfo: ArtifactReleaseInfo) => boolean = () => true +): Promise { + const vsixSource = config.nightlyVsixSource; + try { + const releaseInfo = await fetchArtifactReleaseInfo(vsixSource.repo, vsixSource.file, vsixSource.tag); + + if (!shouldDownload(releaseInfo)) return; + + await downloadArtifactWithProgressUi(releaseInfo, vsixSource.file, vsixSource.dir, "nightly extension"); + + const vsixPath = path.join(vsixSource.dir, vsixSource.file); + + await vscodeInstallExtensionFromVsix(vsixPath) + await config.installedNightlyExtensionReleaseDate.set(releaseInfo.releaseDate); + await fs.unlink(vsixPath); + + await vscodeReloadWindow(); // never returns + } catch (err) { + log.downloadError(err, "nightly extension", vsixSource.repo.name); + } +}); + +function diffInHours(a: Date, b: Date): number { + // Discard the time and time-zone information (to abstract from daylight saving time bugs) + // https://stackoverflow.com/a/15289883/9259330 + + const utcA = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()); + const utcB = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate()); + + return (utcA - utcB) / (1000 * 60 * 60); +} From 38504cdfa24fb4b1ad61c90408bac899a498e753 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 19:57:55 +0200 Subject: [PATCH 533/819] vscode: amend server installation logic to account for nightlies --- .../code/src/commands/server_version.ts | 3 +- .../editors/code/src/installation/server.ts | 97 +++++++++---------- rust-analyzer/editors/code/src/main.ts | 9 +- 3 files changed, 57 insertions(+), 52 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 421301b4..c4d84b44 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -5,7 +5,7 @@ import { spawnSync } from 'child_process'; export function serverVersion(ctx: Ctx): Cmd { return async () => { - const binaryPath = await ensureServerBinary(ctx.config.serverSource); + const binaryPath = await ensureServerBinary(ctx.config); if (binaryPath == null) { throw new Error( @@ -18,4 +18,3 @@ export function serverVersion(ctx: Ctx): Cmd { vscode.window.showInformationMessage('rust-analyzer version : ' + version); }; } - diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index ef1c45ff..345f30d4 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -1,14 +1,16 @@ import * as vscode from "vscode"; import * as path from "path"; -import { promises as dns } from "dns"; import { spawnSync } from "child_process"; import { ArtifactSource } from "./interfaces"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; -import { downloadArtifact } from "./download_artifact"; +import { downloadArtifactWithProgressUi } from "./downloads"; import { log, assert } from "../util"; +import { Config, NIGHTLY_TAG } from "../config"; + +export async function ensureServerBinary(config: Config): Promise { + const source = config.serverSource; -export async function ensureServerBinary(source: null | ArtifactSource): Promise { if (!source) { vscode.window.showErrorMessage( "Unfortunately we don't ship binaries for your platform yet. " + @@ -35,18 +37,11 @@ export async function ensureServerBinary(source: null | ArtifactSource): Promise return null; } case ArtifactSource.Type.GithubRelease: { - const prebuiltBinaryPath = path.join(source.dir, source.file); - - const installedVersion: null | string = getServerVersion(source.storage); - const requiredVersion: string = source.tag; - - log.debug("Installed version:", installedVersion, "required:", requiredVersion); - - if (isBinaryAvailable(prebuiltBinaryPath) && installedVersion === requiredVersion) { - return prebuiltBinaryPath; + if (!shouldDownloadServer(source, config)) { + return path.join(source.dir, source.file); } - if (source.askBeforeDownload) { + if (config.askBeforeDownload) { const userResponse = await vscode.window.showInformationMessage( `Language server version ${source.tag} for rust-analyzer is not installed. ` + "Do you want to download it now?", @@ -55,38 +50,53 @@ export async function ensureServerBinary(source: null | ArtifactSource): Promise if (userResponse !== "Download now") return null; } - if (!await downloadServer(source)) return null; - - return prebuiltBinaryPath; + return await downloadServer(source, config); } } } -async function downloadServer(source: ArtifactSource.GithubRelease): Promise { +function shouldDownloadServer( + source: ArtifactSource.GithubRelease, + config: Config +): boolean { + if (!isBinaryAvailable(path.join(source.dir, source.file))) return true; + + const installed = { + tag: config.serverReleaseTag.get(), + date: config.serverReleaseDate.get() + }; + const required = { + tag: source.tag, + date: config.installedNightlyExtensionReleaseDate.get() + }; + + log.debug("Installed server:", installed, "required:", required); + + if (required.tag !== NIGHTLY_TAG || installed.tag !== NIGHTLY_TAG) { + return required.tag !== installed.tag; + } + + assert(required.date !== null, "Extension release date should have been saved during its installation"); + assert(installed.date !== null, "Server release date should have been saved during its installation"); + + return installed.date.getTime() !== required.date.getTime(); +} + +async function downloadServer( + source: ArtifactSource.GithubRelease, + config: Config, +): Promise { try { const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.tag); - await downloadArtifact(releaseInfo, source.file, source.dir, "language server"); - await setServerVersion(source.storage, releaseInfo.releaseName); + await downloadArtifactWithProgressUi(releaseInfo, source.file, source.dir, "language server"); + await Promise.all([ + config.serverReleaseTag.set(releaseInfo.releaseName), + config.serverReleaseDate.set(releaseInfo.releaseDate) + ]); } catch (err) { - vscode.window.showErrorMessage( - `Failed to download language server from ${source.repo.name} ` + - `GitHub repository: ${err.message}` - ); - - log.error(err); - - dns.resolve('example.com').then( - addrs => log.debug("DNS resolution for example.com was successful", addrs), - err => { - log.error( - "DNS resolution for example.com failed, " + - "there might be an issue with Internet availability" - ); - log.error(err); - } - ); - return false; + log.downloadError(err, "language server", source.repo.name); + return null; } const binaryPath = path.join(source.dir, source.file); @@ -101,7 +111,7 @@ async function downloadServer(source: ArtifactSource.GithubRelease): Promise("server-version", null); - log.debug("Get server-version:", version); - return version; -} - -async function setServerVersion(storage: vscode.Memento, version: string): Promise { - log.debug("Set server-version:", version); - await storage.update("server-version", version.toString()); -} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ecf53cf7..ee67c750 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -8,6 +8,7 @@ import { activateHighlighting } from './highlighting'; import { ensureServerBinary } from './installation/server'; import { Config } from './config'; import { log } from './util'; +import { ensureProperExtensionVersion } from './installation/extension'; let ctx: Ctx | undefined; @@ -34,7 +35,13 @@ export async function activate(context: vscode.ExtensionContext) { const config = new Config(context); - const serverPath = await ensureServerBinary(config.serverSource); + vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config)); + + // Don't await the user response here, otherwise we will block the lsp server bootstrap + void ensureProperExtensionVersion(config); + + const serverPath = await ensureServerBinary(config); + if (serverPath == null) { throw new Error( "Rust Analyzer Language Server is not available. " + From f78040e0de3707bd4fcc7127a6792c9239369156 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:04:11 +0200 Subject: [PATCH 534/819] vscode: npm run fix --- rust-analyzer/editors/code/src/config.ts | 6 +++--- rust-analyzer/editors/code/src/installation/extension.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e2b0f6f8..b5c07876 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -173,7 +173,7 @@ export class Config { name: "rust-analyzer", owner: "rust-analyzer" } - } + }; } get nightlyVsixSource(): ArtifactSource.GithubRelease { @@ -240,7 +240,7 @@ export class StringStorage { constructor( private readonly key: string, private readonly storage: vscode.Memento - ) {} + ) { } get(): null | string { const tag = this.storage.get(this.key, null); @@ -257,7 +257,7 @@ export class DateStorage { constructor( private readonly key: string, private readonly storage: vscode.Memento - ) {} + ) { } get(): null | Date { const date = this.storage.get(this.key, null); diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 7709cd3c..7eab6885 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -110,7 +110,7 @@ const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNight const vsixPath = path.join(vsixSource.dir, vsixSource.file); - await vscodeInstallExtensionFromVsix(vsixPath) + await vscodeInstallExtensionFromVsix(vsixPath); await config.installedNightlyExtensionReleaseDate.set(releaseInfo.releaseDate); await fs.unlink(vsixPath); From 610b8450de9fb9e3e0edc9bda2c60390bc8ab07c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:14:55 +0200 Subject: [PATCH 535/819] vscode: make bailing out on custom serverPath more evident --- rust-analyzer/editors/code/src/config.ts | 12 +++++------- .../editors/code/src/installation/extension.ts | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b5c07876..345c9e21 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -45,7 +45,7 @@ export class Config { /** * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) */ - private readonly extensionVersion: string = (() => { + readonly extensionReleaseTag: string = (() => { const packageJsonVersion = vscode .extensions .getExtension(this.extensionId)! @@ -135,10 +135,8 @@ export class Config { } } - get installedExtensionUpdateChannel() { - if (this.serverPath !== null) return null; - - return this.extensionVersion === NIGHTLY_TAG + get installedExtensionUpdateChannel(): UpdatesChannel { + return this.extensionReleaseTag === NIGHTLY_TAG ? UpdatesChannel.Nightly : UpdatesChannel.Stable; } @@ -159,7 +157,7 @@ export class Config { return this.createGithubReleaseSource( prebuiltBinaryName, - this.extensionVersion + this.extensionReleaseTag ); } @@ -195,7 +193,7 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - private get serverPath() { return this.cfg.get("serverPath") as null | string; } + get serverPath() { return this.cfg.get("serverPath") as null | string; } get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 7eab6885..a0925aca 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -15,6 +15,9 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; * extension version is what's needed according to `desiredUpdateChannel`. */ export async function ensureProperExtensionVersion(config: Config): Promise { + // User has built lsp server from sources, she should manage updates manually + if (config.serverPath !== null) return; + const currentUpdChannel = config.installedExtensionUpdateChannel; const desiredUpdChannel = config.updatesChannel; @@ -23,9 +26,6 @@ export async function ensureProperExtensionVersion(config: Config): Promise Date: Mon, 9 Mar 2020 20:17:50 +0200 Subject: [PATCH 536/819] vscode: put comma back --- rust-analyzer/editors/code/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 345c9e21..a05d8ac0 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -169,7 +169,7 @@ export class Config { dir: this.ctx.globalStoragePath, repo: { name: "rust-analyzer", - owner: "rust-analyzer" + owner: "rust-analyzer", } }; } From d7a965868aef0ab3e62b8e43e2991d00e51c976f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:28:12 +0200 Subject: [PATCH 537/819] vscode-postrefactor: global storages --- rust-analyzer/editors/code/src/config.ts | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index a05d8ac0..5371384b 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -186,8 +186,8 @@ export class Config { "rust-analyzer-server-release-date", this.ctx.globalState ); - readonly serverReleaseTag = new StringStorage( - "rust-analyzer-release-tag", this.ctx.globalState + readonly serverReleaseTag = new Storage( + "rust-analyzer-release-tag", this.ctx.globalState, null ); // We don't do runtime config validation here for simplicity. More on stackoverflow: @@ -234,37 +234,36 @@ export class Config { get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } } -export class StringStorage { +export class Storage { constructor( private readonly key: string, - private readonly storage: vscode.Memento + private readonly storage: vscode.Memento, + private readonly defaultVal: T ) { } - get(): null | string { - const tag = this.storage.get(this.key, null); - log.debug(this.key, "==", tag); - return tag; + get(): T { + const val = this.storage.get(this.key, this.defaultVal); + log.debug(this.key, "==", val); + return val; } - async set(tag: string) { - log.debug(this.key, "=", tag); - await this.storage.update(this.key, tag); + async set(val: T) { + log.debug(this.key, "=", val); + await this.storage.update(this.key, val); } } export class DateStorage { + inner: Storage; - constructor( - private readonly key: string, - private readonly storage: vscode.Memento - ) { } + constructor(key: string, storage: vscode.Memento) { + this.inner = new Storage(key, storage, null); + } get(): null | Date { - const date = this.storage.get(this.key, null); - log.debug(this.key, "==", date); - return date ? new Date(date) : null; + const dateStr = this.inner.get(); + return dateStr ? new Date(dateStr) : null; } async set(date: null | Date) { - log.debug(this.key, "=", date); - await this.storage.update(this.key, date); + await this.inner.set(date ? date.toString() : null); } } From 6a1a1d6faf63b897c9ed19504ff5b9b51216a4d3 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:35:21 +0200 Subject: [PATCH 538/819] vscode-postrefactor: eliminate my-mistake floating promise @matklad --- rust-analyzer/editors/code/src/installation/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index a0925aca..d0782ad1 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -23,7 +23,7 @@ export async function ensureProperExtensionVersion(config: Config): Promise Date: Mon, 9 Mar 2020 20:41:23 +0200 Subject: [PATCH 539/819] vscode-postrefactor: compare dates by value, not by reference --- rust-analyzer/editors/code/src/installation/extension.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index d0782ad1..3a1481a8 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -58,11 +58,11 @@ export async function ensureProperExtensionVersion(config: Config): Promise { assert( - currentExtReleaseDate === config.installedNightlyExtensionReleaseDate.get(), + currentExtReleaseDate.getTime() === config.installedNightlyExtensionReleaseDate.get()?.getTime(), "Other active VSCode instance has reinstalled the extension" ); - if (releaseInfo.releaseDate === currentExtReleaseDate) { + if (releaseInfo.releaseDate.getTime() === currentExtReleaseDate.getTime()) { vscode.window.showInformationMessage( "Whoops, it appears that your nightly version is up-to-date. " + "There might be some problems with the upcomming nightly release " + From d14b7fdc1b2b8524749875c44d0efbe1dc54789f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:53:01 +0200 Subject: [PATCH 540/819] vscode-postrefactor: unhandled promise rejections shall not pass --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ee67c750..4f46345d 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -35,7 +35,7 @@ export async function activate(context: vscode.ExtensionContext) { const config = new Config(context); - vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config)); + vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config).catch(log.error)); // Don't await the user response here, otherwise we will block the lsp server bootstrap void ensureProperExtensionVersion(config); From 28cbffa740a7c72a9c5d6f6991fb0a062f1e7592 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:57:20 +0200 Subject: [PATCH 541/819] vscode-postrefactor: remove remainders of debug logging --- rust-analyzer/editors/code/src/installation/extension.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 3a1481a8..eb6acc34 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -89,7 +89,6 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") `version and reload the window now?`, "Download now", "Cancel" ); - log.debug("Response: ", userResponse); return userResponse === "Download now"; } From 325ab069704aadab58924d3160fa98cbd7984d7c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 21:02:19 +0200 Subject: [PATCH 542/819] vscode-postrefactor: add achtung comment --- rust-analyzer/editors/code/src/installation/extension.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index eb6acc34..87a58740 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -94,6 +94,10 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") /** * Shutdowns the process in case of success (i.e. reloads the window) or throws an error. + * + * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during + * each of them would result in a ton of code (especially accounting for cross-process + * shared mutable `globalState` access). Enforcing reentrancy for this is best-effort. */ const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( config: Config, From 646d7b511a47246cdbd89fa817e916b0273d60d0 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 21:15:07 +0200 Subject: [PATCH 543/819] vscode-postrefactor: unhandled promise rejections shall not pass 2 --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 4f46345d..8a7c8172 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -38,7 +38,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config).catch(log.error)); // Don't await the user response here, otherwise we will block the lsp server bootstrap - void ensureProperExtensionVersion(config); + void ensureProperExtensionVersion(config).catch(log.error); const serverPath = await ensureServerBinary(config); From 75d8a4f9d8e49be9a826c1b362b7570115c3b4ae Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 14 Mar 2020 02:00:34 +0200 Subject: [PATCH 544/819] vscode-postrefactor: minor config refactorings --- rust-analyzer/editors/code/src/config.ts | 5 +++-- rust-analyzer/editors/code/src/installation/extension.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 5371384b..93f72409 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -35,6 +35,7 @@ export class Config { private readonly rootSection = "rust-analyzer"; private readonly requiresReloadOpts = [ + "serverPath", "cargoFeatures", "cargo-watch", "highlighting.semanticTokens", @@ -50,7 +51,7 @@ export class Config { .extensions .getExtension(this.extensionId)! .packageJSON - .version as string; + .version as string; // n.n.YYYYMMDD[-nightly] if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; @@ -193,7 +194,7 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - get serverPath() { return this.cfg.get("serverPath") as null | string; } + private get serverPath() { return this.cfg.get("serverPath") as null | string; } get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 87a58740..2022d090 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'fs'; import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util"; import { Config, UpdatesChannel } from "../config"; -import { ArtifactReleaseInfo } from "./interfaces"; +import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces"; import { downloadArtifactWithProgressUi } from "./downloads"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; @@ -16,7 +16,7 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; */ export async function ensureProperExtensionVersion(config: Config): Promise { // User has built lsp server from sources, she should manage updates manually - if (config.serverPath !== null) return; + if (config.serverSource?.type === ArtifactSource.Type.ExplicitPath) return; const currentUpdChannel = config.installedExtensionUpdateChannel; const desiredUpdChannel = config.updatesChannel; From dee7261b2345f2f24b9c8b7f706b3c85cd7c62e5 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 14 Mar 2020 02:01:28 +0200 Subject: [PATCH 545/819] vscode-postrefactor: enforcing more reentrancy --- rust-analyzer/editors/code/src/installation/extension.ts | 2 +- rust-analyzer/editors/code/src/installation/server.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 2022d090..f6dd20d8 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -97,7 +97,7 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") * * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during * each of them would result in a ton of code (especially accounting for cross-process - * shared mutable `globalState` access). Enforcing reentrancy for this is best-effort. + * shared mutable `globalState` access). Enforcing no reentrancy for this is best-effort. */ const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( config: Config, diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 345f30d4..f3595847 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -5,7 +5,7 @@ import { spawnSync } from "child_process"; import { ArtifactSource } from "./interfaces"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; import { downloadArtifactWithProgressUi } from "./downloads"; -import { log, assert } from "../util"; +import { log, assert, notReentrant } from "../util"; import { Config, NIGHTLY_TAG } from "../config"; export async function ensureServerBinary(config: Config): Promise { @@ -82,7 +82,10 @@ function shouldDownloadServer( return installed.date.getTime() !== required.date.getTime(); } -async function downloadServer( +/** + * Enforcing no reentrancy for this is best-effort. + */ +const downloadServer = notReentrant(async function downloadServer( source: ArtifactSource.GithubRelease, config: Config, ): Promise { @@ -112,7 +115,7 @@ async function downloadServer( ); return binaryPath; -} +}); function isBinaryAvailable(binaryPath: string): boolean { const res = spawnSync(binaryPath, ["--version"]); From 706ae194d3d9dc46a1581cb833051017e1adbd64 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 14 Mar 2020 03:01:14 +0200 Subject: [PATCH 546/819] vscode-postrefactor: more logging and better error handling --- rust-analyzer/editors/code/package-lock.json | 2 +- rust-analyzer/editors/code/src/config.ts | 36 +++++++++---------- .../code/src/installation/extension.ts | 16 +++++++-- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 575dc7c4..1b497edd 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.2.20200309-nightly", + "version": "0.2.20200309", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 93f72409..f63e1d20 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,7 +1,7 @@ import * as os from "os"; import * as vscode from 'vscode'; import { ArtifactSource } from "./installation/interfaces"; -import { log } from "./util"; +import { log, vscodeReloadWindow } from "./util"; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; @@ -43,20 +43,20 @@ export class Config { ] .map(opt => `${this.rootSection}.${opt}`); + readonly packageJsonVersion = vscode + .extensions + .getExtension(this.extensionId)! + .packageJSON + .version as string; // n.n.YYYYMMDD[-nightly] + /** * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) */ readonly extensionReleaseTag: string = (() => { - const packageJsonVersion = vscode - .extensions - .getExtension(this.extensionId)! - .packageJSON - .version as string; // n.n.YYYYMMDD[-nightly] - - if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; + if (this.packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/; - const [, yyyy, mm, dd] = packageJsonVersion.match(realVersionRegexp)!; + const [, yyyy, mm, dd] = this.packageJsonVersion.match(realVersionRegexp)!; return `${yyyy}-${mm}-${dd}`; })(); @@ -72,7 +72,10 @@ export class Config { this.cfg = vscode.workspace.getConfiguration(this.rootSection); const enableLogging = this.cfg.get("trace.extension") as boolean; log.setEnabled(enableLogging); - log.debug("Using configuration:", this.cfg); + log.debug( + "Extension version:", this.packageJsonVersion, + "using configuration:", this.cfg + ); } private async onConfigChange(event: vscode.ConfigurationChangeEvent) { @@ -90,7 +93,7 @@ export class Config { ); if (userResponse === "Reload now") { - vscode.commands.executeCommand("workbench.action.reloadWindow"); + await vscodeReloadWindow(); } } @@ -180,16 +183,11 @@ export class Config { } readonly installedNightlyExtensionReleaseDate = new DateStorage( - "rust-analyzer-installed-nightly-extension-release-date", + "installed-nightly-extension-release-date", this.ctx.globalState ); - readonly serverReleaseDate = new DateStorage( - "rust-analyzer-server-release-date", - this.ctx.globalState - ); - readonly serverReleaseTag = new Storage( - "rust-analyzer-release-tag", this.ctx.globalState, null - ); + readonly serverReleaseDate = new DateStorage("server-release-date", this.ctx.globalState); + readonly serverReleaseTag = new Storage("server-release-tag", this.ctx.globalState, null); // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index f6dd20d8..0d69b8d0 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -44,10 +44,20 @@ export async function ensureProperExtensionVersion(config: Config): Promise Date: Sat, 14 Mar 2020 03:20:39 +0200 Subject: [PATCH 547/819] vscode: sync package-lock.json version with package.json --- rust-analyzer/editors/code/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 1b497edd..575dc7c4 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.2.20200309", + "version": "0.2.20200309-nightly", "lockfileVersion": 1, "requires": true, "dependencies": { From cdc0c95aa15441fe1e9641cb6fa815a1b06a03da Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Sun, 15 Mar 2020 21:23:18 +0000 Subject: [PATCH 548/819] Swtches to rust SSR query check --- rust-analyzer/editors/code/src/commands/ssr.ts | 16 +++++++++------- .../editors/code/src/rust-analyzer-api.ts | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index eee48c69..6fee051f 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -10,20 +10,22 @@ export function ssr(ctx: Ctx): Cmd { if (!client) return; const options: vscode.InputBoxOptions = { - placeHolder: "foo($a:expr, $b:expr) ==>> bar($a, foo($b))", - prompt: "Enter request", - validateInput: (x: string) => { - if (x.includes('==>>')) { - return null; + value: "() ==>> ()", + prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", + validateInput: async (x: string) => { + try { + await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); + } catch (e) { + return e.toString(); } - return "Enter request: pattern ==>> template"; + return null; } }; const request = await vscode.window.showInputBox(options); if (!request) return; - const change = await client.sendRequest(ra.ssr, { arg: request }); + const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); await applySourceChange(ctx, change); }; diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index bd6e3ada..6ad93715 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -108,7 +108,8 @@ export const inlayHints = request>("inlayHints" export interface SsrParams { - arg: string; + query: string; + parseOnly: boolean; } export const ssr = request("ssr"); From d5d47c7b57c1e352a245a42e34a5d47df5a09c6c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 16 Mar 2020 12:17:36 +0200 Subject: [PATCH 549/819] vscode-postrefactor: prefer arrow functions --- rust-analyzer/editors/code/src/installation/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index 0d69b8d0..e0aa5317 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -109,7 +109,7 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") * each of them would result in a ton of code (especially accounting for cross-process * shared mutable `globalState` access). Enforcing no reentrancy for this is best-effort. */ -const tryDownloadNightlyExtension = notReentrant(async function tryDownloadNightlyExtension( +const tryDownloadNightlyExtension = notReentrant(async ( config: Config, shouldDownload: (releaseInfo: ArtifactReleaseInfo) => boolean = () => true ): Promise { From a0c7497b5f82b363a21c3e4d53be0b2e8e9d8102 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 16 Mar 2020 12:18:30 +0200 Subject: [PATCH 550/819] vscode-postrefactor: fix syntax error --- rust-analyzer/editors/code/src/installation/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index e0aa5317..eea6fded 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -112,7 +112,7 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") const tryDownloadNightlyExtension = notReentrant(async ( config: Config, shouldDownload: (releaseInfo: ArtifactReleaseInfo) => boolean = () => true -): Promise { +): Promise => { const vsixSource = config.nightlyVsixSource; try { const releaseInfo = await fetchArtifactReleaseInfo(vsixSource.repo, vsixSource.file, vsixSource.tag); From 7f9054bdf252a383c20ce765ab195e0ab4b0bca0 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 16 Mar 2020 12:19:26 +0200 Subject: [PATCH 551/819] vscode-postrefactor: migrate to arrow functions --- rust-analyzer/editors/code/src/installation/server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index f3595847..05730a77 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -85,10 +85,10 @@ function shouldDownloadServer( /** * Enforcing no reentrancy for this is best-effort. */ -const downloadServer = notReentrant(async function downloadServer( +const downloadServer = notReentrant(async ( source: ArtifactSource.GithubRelease, config: Config, -): Promise { +): Promise => { try { const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.tag); From fa40cb211a234af6a161cec5a3d3be30047bb310 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Mar 2020 14:57:32 +0100 Subject: [PATCH 552/819] :arrow_up: npm --- rust-analyzer/editors/code/package-lock.json | 38 ++++++++++---------- rust-analyzer/editors/code/package.json | 6 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 575dc7c4..c1fe620e 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -89,9 +89,9 @@ "dev": true }, "@types/node": { - "version": "12.12.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.29.tgz", - "integrity": "sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ==", + "version": "12.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.30.tgz", + "integrity": "sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg==", "dev": true }, "@types/node-fetch": { @@ -120,12 +120,12 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.22.0.tgz", - "integrity": "sha512-BvxRLaTDVQ3N+Qq8BivLiE9akQLAOUfxNHIEhedOcg8B2+jY8Rc4/D+iVprvuMX1AdezFYautuGDwr9QxqSxBQ==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz", + "integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.22.0", + "@typescript-eslint/experimental-utils": "2.23.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -133,32 +133,32 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz", - "integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz", + "integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.22.0", + "@typescript-eslint/typescript-estree": "2.23.0", "eslint-scope": "^5.0.0" } }, "@typescript-eslint/parser": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz", - "integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz", + "integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.22.0", - "@typescript-eslint/typescript-estree": "2.22.0", + "@typescript-eslint/experimental-utils": "2.23.0", + "@typescript-eslint/typescript-estree": "2.23.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz", - "integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz", + "integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==", "dev": true, "requires": { "debug": "^4.1.1", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index faf10528..48f28b28 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,11 +39,11 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", - "@types/node": "^12.12.29", + "@types/node": "^12.12.30", "@types/node-fetch": "^2.5.5", "@types/vscode": "^1.43.0", - "@typescript-eslint/eslint-plugin": "^2.22.0", - "@typescript-eslint/parser": "^2.22.0", + "@typescript-eslint/eslint-plugin": "^2.23.0", + "@typescript-eslint/parser": "^2.23.0", "eslint": "^6.8.0", "rollup": "^1.32.1", "tslib": "^1.11.1", From aab6eaad8c1b42331e3673022d3d22728e4a610a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Mar 2020 19:23:38 +0100 Subject: [PATCH 553/819] Separate persistent mutable state from config That way, we clearly see which things are not change, and we also clearly see which things are persistent. --- .../code/src/commands/server_version.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 41 ---------------- rust-analyzer/editors/code/src/ctx.ts | 6 ++- .../code/src/installation/extension.ts | 16 +++--- .../editors/code/src/installation/server.ts | 21 ++++---- rust-analyzer/editors/code/src/main.ts | 10 ++-- .../editors/code/src/persistent_state.ts | 49 +++++++++++++++++++ 7 files changed, 80 insertions(+), 65 deletions(-) create mode 100644 rust-analyzer/editors/code/src/persistent_state.ts diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index c4d84b44..83b1acf6 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -5,7 +5,7 @@ import { spawnSync } from 'child_process'; export function serverVersion(ctx: Ctx): Cmd { return async () => { - const binaryPath = await ensureServerBinary(ctx.config); + const binaryPath = await ensureServerBinary(ctx.config, ctx.state); if (binaryPath == null) { throw new Error( diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index f63e1d20..bd8096dd 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -182,13 +182,6 @@ export class Config { return this.createGithubReleaseSource("rust-analyzer.vsix", NIGHTLY_TAG); } - readonly installedNightlyExtensionReleaseDate = new DateStorage( - "installed-nightly-extension-release-date", - this.ctx.globalState - ); - readonly serverReleaseDate = new DateStorage("server-release-date", this.ctx.globalState); - readonly serverReleaseTag = new Storage("server-release-tag", this.ctx.globalState, null); - // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension @@ -232,37 +225,3 @@ export class Config { // for internal use get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } } - -export class Storage { - constructor( - private readonly key: string, - private readonly storage: vscode.Memento, - private readonly defaultVal: T - ) { } - - get(): T { - const val = this.storage.get(this.key, this.defaultVal); - log.debug(this.key, "==", val); - return val; - } - async set(val: T) { - log.debug(this.key, "=", val); - await this.storage.update(this.key, val); - } -} -export class DateStorage { - inner: Storage; - - constructor(key: string, storage: vscode.Memento) { - this.inner = new Storage(key, storage, null); - } - - get(): null | Date { - const dateStr = this.inner.get(); - return dateStr ? new Date(dateStr) : null; - } - - async set(date: null | Date) { - await this.inner.set(date ? date.toString() : null); - } -} diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 25ef38ae..c929ab06 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -4,19 +4,21 @@ import * as lc from 'vscode-languageclient'; import { Config } from './config'; import { createClient } from './client'; import { isRustEditor, RustEditor } from './util'; +import { PersistentState } from './persistent_state'; export class Ctx { private constructor( readonly config: Config, + readonly state: PersistentState, private readonly extCtx: vscode.ExtensionContext, readonly client: lc.LanguageClient ) { } - static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { + static async create(config: Config, state: PersistentState, extCtx: vscode.ExtensionContext, serverPath: string): Promise { const client = await createClient(config, serverPath); - const res = new Ctx(config, extCtx, client); + const res = new Ctx(config, state, extCtx, client); res.pushCleanup(client.start()); await client.onReady(); return res; diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts index eea6fded..a1db96f0 100644 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ b/rust-analyzer/editors/code/src/installation/extension.ts @@ -7,6 +7,7 @@ import { Config, UpdatesChannel } from "../config"; import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces"; import { downloadArtifactWithProgressUi } from "./downloads"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; +import { PersistentState } from "../persistent_state"; const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; @@ -14,7 +15,7 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; * Installs `stable` or latest `nightly` version or does nothing if the current * extension version is what's needed according to `desiredUpdateChannel`. */ -export async function ensureProperExtensionVersion(config: Config): Promise { +export async function ensureProperExtensionVersion(config: Config, state: PersistentState): Promise { // User has built lsp server from sources, she should manage updates manually if (config.serverSource?.type === ArtifactSource.Type.ExplicitPath) return; @@ -23,7 +24,7 @@ export async function ensureProperExtensionVersion(config: Config): Promise { + await tryDownloadNightlyExtension(config, state, releaseInfo => { assert( - currentExtReleaseDate.getTime() === config.installedNightlyExtensionReleaseDate.get()?.getTime(), + currentExtReleaseDate.getTime() === state.installedNightlyExtensionReleaseDate.get()?.getTime(), "Other active VSCode instance has reinstalled the extension" ); @@ -111,6 +112,7 @@ async function askToDownloadProperExtensionVersion(config: Config, reason = "") */ const tryDownloadNightlyExtension = notReentrant(async ( config: Config, + state: PersistentState, shouldDownload: (releaseInfo: ArtifactReleaseInfo) => boolean = () => true ): Promise => { const vsixSource = config.nightlyVsixSource; @@ -124,7 +126,7 @@ const tryDownloadNightlyExtension = notReentrant(async ( const vsixPath = path.join(vsixSource.dir, vsixSource.file); await vscodeInstallExtensionFromVsix(vsixPath); - await config.installedNightlyExtensionReleaseDate.set(releaseInfo.releaseDate); + await state.installedNightlyExtensionReleaseDate.set(releaseInfo.releaseDate); await fs.unlink(vsixPath); await vscodeReloadWindow(); // never returns diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts index 05730a77..05d32613 100644 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ b/rust-analyzer/editors/code/src/installation/server.ts @@ -7,8 +7,9 @@ import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; import { downloadArtifactWithProgressUi } from "./downloads"; import { log, assert, notReentrant } from "../util"; import { Config, NIGHTLY_TAG } from "../config"; +import { PersistentState } from "../persistent_state"; -export async function ensureServerBinary(config: Config): Promise { +export async function ensureServerBinary(config: Config, state: PersistentState): Promise { const source = config.serverSource; if (!source) { @@ -37,7 +38,7 @@ export async function ensureServerBinary(config: Config): Promise return null; } case ArtifactSource.Type.GithubRelease: { - if (!shouldDownloadServer(source, config)) { + if (!shouldDownloadServer(state, source)) { return path.join(source.dir, source.file); } @@ -50,24 +51,24 @@ export async function ensureServerBinary(config: Config): Promise if (userResponse !== "Download now") return null; } - return await downloadServer(source, config); + return await downloadServer(state, source); } } } function shouldDownloadServer( + state: PersistentState, source: ArtifactSource.GithubRelease, - config: Config ): boolean { if (!isBinaryAvailable(path.join(source.dir, source.file))) return true; const installed = { - tag: config.serverReleaseTag.get(), - date: config.serverReleaseDate.get() + tag: state.serverReleaseTag.get(), + date: state.serverReleaseDate.get() }; const required = { tag: source.tag, - date: config.installedNightlyExtensionReleaseDate.get() + date: state.installedNightlyExtensionReleaseDate.get() }; log.debug("Installed server:", installed, "required:", required); @@ -86,16 +87,16 @@ function shouldDownloadServer( * Enforcing no reentrancy for this is best-effort. */ const downloadServer = notReentrant(async ( + state: PersistentState, source: ArtifactSource.GithubRelease, - config: Config, ): Promise => { try { const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.tag); await downloadArtifactWithProgressUi(releaseInfo, source.file, source.dir, "language server"); await Promise.all([ - config.serverReleaseTag.set(releaseInfo.releaseName), - config.serverReleaseDate.set(releaseInfo.releaseDate) + state.serverReleaseTag.set(releaseInfo.releaseName), + state.serverReleaseDate.set(releaseInfo.releaseDate) ]); } catch (err) { log.downloadError(err, "language server", source.repo.name); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index bd4661a3..94ecd4da 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -9,6 +9,7 @@ import { ensureServerBinary } from './installation/server'; import { Config } from './config'; import { log } from './util'; import { ensureProperExtensionVersion } from './installation/extension'; +import { PersistentState } from './persistent_state'; let ctx: Ctx | undefined; @@ -34,13 +35,14 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push(defaultOnEnter); const config = new Config(context); + const state = new PersistentState(context); - vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config).catch(log.error)); + vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config, state).catch(log.error)); // Don't await the user response here, otherwise we will block the lsp server bootstrap - void ensureProperExtensionVersion(config).catch(log.error); + void ensureProperExtensionVersion(config, state).catch(log.error); - const serverPath = await ensureServerBinary(config); + const serverPath = await ensureServerBinary(config, state); if (serverPath == null) { throw new Error( @@ -53,7 +55,7 @@ export async function activate(context: vscode.ExtensionContext) { // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - ctx = await Ctx.create(config, context, serverPath); + ctx = await Ctx.create(config, state, context, serverPath); // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('reload', (ctx) => { diff --git a/rust-analyzer/editors/code/src/persistent_state.ts b/rust-analyzer/editors/code/src/persistent_state.ts new file mode 100644 index 00000000..13095b80 --- /dev/null +++ b/rust-analyzer/editors/code/src/persistent_state.ts @@ -0,0 +1,49 @@ +import * as vscode from 'vscode'; +import { log } from "./util"; + +export class PersistentState { + constructor(private readonly ctx: vscode.ExtensionContext) { + } + + readonly installedNightlyExtensionReleaseDate = new DateStorage( + "installed-nightly-extension-release-date", + this.ctx.globalState + ); + readonly serverReleaseDate = new DateStorage("server-release-date", this.ctx.globalState); + readonly serverReleaseTag = new Storage("server-release-tag", this.ctx.globalState, null); +} + + +export class Storage { + constructor( + private readonly key: string, + private readonly storage: vscode.Memento, + private readonly defaultVal: T + ) { } + + get(): T { + const val = this.storage.get(this.key, this.defaultVal); + log.debug(this.key, "==", val); + return val; + } + async set(val: T) { + log.debug(this.key, "=", val); + await this.storage.update(this.key, val); + } +} +export class DateStorage { + inner: Storage; + + constructor(key: string, storage: vscode.Memento) { + this.inner = new Storage(key, storage, null); + } + + get(): null | Date { + const dateStr = this.inner.get(); + return dateStr ? new Date(dateStr) : null; + } + + async set(date: null | Date) { + await this.inner.set(date ? date.toString() : null); + } +} From 17c3e7cbd919d79ba61c92642cb62c1fbd86fd9a Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 16 Mar 2020 13:43:29 +0100 Subject: [PATCH 554/819] Support loading OUT_DIR from cargo check at launch --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 48f28b28..188a2f9c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -362,6 +362,11 @@ }, "default": [], "description": "List of features to activate" + }, + "rust-analyzer.cargoFeatures.loadOutDirsFromCheck": { + "type": "boolean", + "default": false, + "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index bd8096dd..84ec81ec 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -22,6 +22,7 @@ export interface CargoFeatures { noDefaultFeatures: boolean; allFeatures: boolean; features: string[]; + loadOutDirsFromCheck: boolean; } export const enum UpdatesChannel { @@ -204,6 +205,7 @@ export class Config { get featureFlags() { return this.cfg.get("featureFlags") as Record; } get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record; } get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } + get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck") as boolean; } get cargoWatchOptions(): CargoWatchOptions { return { @@ -219,6 +221,7 @@ export class Config { noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, features: this.cfg.get("cargoFeatures.features") as string[], + loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck") as boolean, }; } From b35d2205e9bdb6fdc5a6040ea46999e1a3624aa6 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 16 Mar 2020 14:10:13 +0100 Subject: [PATCH 555/819] Change existing OUT_DIR override config to make use of new infrastructure --- rust-analyzer/editors/code/package.json | 10 +++++----- rust-analyzer/editors/code/src/config.ts | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 188a2f9c..b4128acf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,11 +237,6 @@ "default": true, "description": "Whether to ask for permission before downloading any files from the Internet" }, - "rust-analyzer.additionalOutDirs": { - "type": "object", - "default": {}, - "markdownDescription": "Fine grained controls for OUT_DIR `env!(\"OUT_DIR\")` variable. e.g. `{\"foo\":\"/path/to/foo\"}`, " - }, "rust-analyzer.serverPath": { "type": [ "null", @@ -367,6 +362,11 @@ "type": "boolean", "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" + }, + "rust-analyzer.cargoFeatures.outDirOverrides": { + "type": "object", + "default": {}, + "markdownDescription": "Fine grained controls for OUT_DIR `env!(\"OUT_DIR\")` variable. e.g. `{\"foo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\":\"/path/to/foo\"}`, " } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 84ec81ec..c7323f6e 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,6 +23,7 @@ export interface CargoFeatures { allFeatures: boolean; features: string[]; loadOutDirsFromCheck: boolean; + outDirOverrides: Record; } export const enum UpdatesChannel { @@ -203,7 +204,6 @@ export class Config { get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } get featureFlags() { return this.cfg.get("featureFlags") as Record; } - get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record; } get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck") as boolean; } @@ -222,6 +222,7 @@ export class Config { allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, features: this.cfg.get("cargoFeatures.features") as string[], loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck") as boolean, + outDirOverrides: this.cfg.get("cargoFeatures.outDirOverrides") as Record, }; } From 6c2c3a0dc27f5a768a345956b40990d38ece360b Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Mon, 16 Mar 2020 14:22:25 +0100 Subject: [PATCH 556/819] Remove unused config from VSCode ext --- rust-analyzer/editors/code/src/client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index d6545427..08d821dd 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -42,7 +42,6 @@ export async function createClient(config: Config, serverPath: string): Promise< excludeGlobs: config.excludeGlobs, useClientWatching: config.useClientWatching, featureFlags: config.featureFlags, - additionalOutDirs: config.additionalOutDirs, withSysroot: config.withSysroot, cargoFeatures: config.cargoFeatures, rustfmtArgs: config.rustfmtArgs, From d9a6d8fbabfeed3aa7f9ab93e0eb4bf95e800a1a Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Tue, 17 Mar 2020 14:55:44 +0100 Subject: [PATCH 557/819] Remove outDirOverrides --- rust-analyzer/editors/code/package.json | 5 ----- rust-analyzer/editors/code/src/config.ts | 2 -- 2 files changed, 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b4128acf..b9e0ffd2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -362,11 +362,6 @@ "type": "boolean", "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" - }, - "rust-analyzer.cargoFeatures.outDirOverrides": { - "type": "object", - "default": {}, - "markdownDescription": "Fine grained controls for OUT_DIR `env!(\"OUT_DIR\")` variable. e.g. `{\"foo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\":\"/path/to/foo\"}`, " } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c7323f6e..b45b14be 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -23,7 +23,6 @@ export interface CargoFeatures { allFeatures: boolean; features: string[]; loadOutDirsFromCheck: boolean; - outDirOverrides: Record; } export const enum UpdatesChannel { @@ -222,7 +221,6 @@ export class Config { allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, features: this.cfg.get("cargoFeatures.features") as string[], loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck") as boolean, - outDirOverrides: this.cfg.get("cargoFeatures.outDirOverrides") as Record, }; } From 6b75b3be710ba9b02312a5f41c3ebffa1c1c3b5b Mon Sep 17 00:00:00 2001 From: Darin Morrison Date: Wed, 18 Mar 2020 10:24:39 -0600 Subject: [PATCH 558/819] Update deps; regen lock file; fix minimist CVE --- rust-analyzer/editors/code/package-lock.json | 243 ++++++++++++------- rust-analyzer/editors/code/package.json | 6 +- 2 files changed, 158 insertions(+), 91 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index c1fe620e..787f1b17 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -48,17 +48,6 @@ "builtin-modules": "^3.1.0", "is-module": "^1.0.0", "resolve": "^1.14.2" - }, - "dependencies": { - "resolve": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz", - "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - } } }, "@rollup/pluginutils": { @@ -70,6 +59,12 @@ "estree-walker": "^1.0.1" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, "@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -120,12 +115,12 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz", - "integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.24.0.tgz", + "integrity": "sha512-wJRBeaMeT7RLQ27UQkDFOu25MqFOBus8PtOa9KaT5ZuxC1kAsd7JEHqWt4YXuY9eancX0GK9C68i5OROnlIzBA==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.23.0", + "@typescript-eslint/experimental-utils": "2.24.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -133,32 +128,32 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz", - "integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.24.0.tgz", + "integrity": "sha512-DXrwuXTdVh3ycNCMYmWhUzn/gfqu9N0VzNnahjiDJvcyhfBy4gb59ncVZVxdp5XzBC77dCncu0daQgOkbvPwBw==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.23.0", + "@typescript-eslint/typescript-estree": "2.24.0", "eslint-scope": "^5.0.0" } }, "@typescript-eslint/parser": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz", - "integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.24.0.tgz", + "integrity": "sha512-H2Y7uacwSSg8IbVxdYExSI3T7uM1DzmOn2COGtCahCC3g8YtM1xYAPi2MAHyfPs61VKxP/J/UiSctcRgw4G8aw==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.23.0", - "@typescript-eslint/typescript-estree": "2.23.0", + "@typescript-eslint/experimental-utils": "2.24.0", + "@typescript-eslint/typescript-estree": "2.24.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz", - "integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==", + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.24.0.tgz", + "integrity": "sha512-RJ0yMe5owMSix55qX7Mi9V6z2FDuuDpN6eR5fzRJrp+8in9UF41IGNQHbg5aMK4/PjVaEQksLvz0IA8n+Mr/FA==", "dev": true, "requires": { "debug": "^4.1.1", @@ -177,15 +172,15 @@ "dev": true }, "acorn-jsx": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", - "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", "dev": true }, "ajv": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", - "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -195,12 +190,20 @@ } }, "ansi-escapes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", - "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", "dev": true, "requires": { - "type-fest": "^0.8.1" + "type-fest": "^0.11.0" + }, + "dependencies": { + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + } } }, "ansi-regex": { @@ -612,13 +615,13 @@ "dev": true }, "espree": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", - "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "dev": true, "requires": { - "acorn": "^7.1.0", - "acorn-jsx": "^5.1.0", + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", "eslint-visitor-keys": "^1.1.0" } }, @@ -673,17 +676,6 @@ "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" - }, - "dependencies": { - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - } } }, "fast-deep-equal": { @@ -765,6 +757,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -795,9 +794,9 @@ } }, "globals": { - "version": "12.3.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", - "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", "dev": true, "requires": { "type-fest": "^0.8.1" @@ -871,24 +870,85 @@ "dev": true }, "inquirer": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz", - "integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", "dev": true, "requires": { "ansi-escapes": "^4.2.1", - "chalk": "^2.4.2", + "chalk": "^3.0.0", "cli-cursor": "^3.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", "figures": "^3.0.0", "lodash": "^4.17.15", "mute-stream": "0.0.8", - "run-async": "^2.2.0", + "run-async": "^2.4.0", "rxjs": "^6.5.3", "string-width": "^4.1.0", - "strip-ansi": "^5.1.0", + "strip-ansi": "^6.0.0", "through": "^2.3.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "is-extglob": { @@ -1008,9 +1068,9 @@ } }, "magic-string": { - "version": "0.25.6", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.6.tgz", - "integrity": "sha512-3a5LOMSGoCTH5rbqobC2HuDNRtE2glHZ8J7pK+QZYppyWA36yuNpsX994rIY2nCuyP7CZYy7lQq/X2jygiZ89g==", + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", "dev": true, "requires": { "sourcemap-codec": "^1.4.4" @@ -1072,18 +1132,18 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", "dev": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "ms": { @@ -1294,9 +1354,9 @@ "dev": true }, "resolve": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", - "integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -1328,20 +1388,18 @@ } }, "rollup": { - "version": "1.32.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", - "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.1.0.tgz", + "integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==", "dev": true, "requires": { - "@types/estree": "*", - "@types/node": "*", - "acorn": "^7.1.0" + "fsevents": "~2.1.2" } }, "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", + "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", "dev": true, "requires": { "is-promise": "^2.1.0" @@ -1544,12 +1602,12 @@ "dev": true }, "tmp": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", - "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { - "os-tmpdir": "~1.0.1" + "os-tmpdir": "~1.0.2" } }, "tslib": { @@ -1686,6 +1744,15 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } } } }, diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9e0ffd2..84642d11 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -42,10 +42,10 @@ "@types/node": "^12.12.30", "@types/node-fetch": "^2.5.5", "@types/vscode": "^1.43.0", - "@typescript-eslint/eslint-plugin": "^2.23.0", - "@typescript-eslint/parser": "^2.23.0", + "@typescript-eslint/eslint-plugin": "^2.24.0", + "@typescript-eslint/parser": "^2.24.0", "eslint": "^6.8.0", - "rollup": "^1.32.1", + "rollup": "^2.1.0", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From cc0cc2c1355e82f62ce1c247130b9c28877a8ed3 Mon Sep 17 00:00:00 2001 From: Darin Morrison Date: Wed, 18 Mar 2020 10:51:17 -0600 Subject: [PATCH 559/819] Add typing annotations for rollup config --- rust-analyzer/editors/code/rollup.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 337385a2..2ca27694 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -1,7 +1,10 @@ +// @ts-check + import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import nodeBuiltins from 'builtin-modules'; +/** @type { import('rollup').RollupOptions } */ export default { input: 'out/main.js', plugins: [ From 59f3e844c63b5d445b07c8645c66b9e5834b9b29 Mon Sep 17 00:00:00 2001 From: Darin Morrison Date: Wed, 18 Mar 2020 12:43:25 -0600 Subject: [PATCH 560/819] Target es2019 (code 1.43 uses chromium 78) --- rust-analyzer/editors/code/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 0c770297..ad134865 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es2018", + "target": "es2019", "outDir": "out", "lib": [ "es2019" From ffaf273f7bc4b997caffaee0648398a79be04cd0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 17 Mar 2020 12:44:31 +0100 Subject: [PATCH 561/819] Rewrite auto-update Everything now happens in main.ts, in the bootstrap family of functions. The current flow is: * check everything only on extension installation. * if the user is on nightly channel, try to download the nightly extension and reload. * when we install nightly extension, we persist its release id, so that we can check if the current release is different. * if server binary was not downloaded by the current version of the extension, redownload it (we persist the version of ext that downloaded the server). --- rust-analyzer/editors/code/package.json | 2 +- .../code/src/commands/server_version.ts | 16 +- rust-analyzer/editors/code/src/config.ts | 103 +----------- rust-analyzer/editors/code/src/ctx.ts | 9 +- .../code/src/installation/extension.ts | 146 ---------------- .../fetch_artifact_release_info.ts | 77 --------- .../code/src/installation/interfaces.ts | 63 ------- .../editors/code/src/installation/server.ts | 131 --------------- rust-analyzer/editors/code/src/main.ts | 158 +++++++++++++++--- .../src/{installation/downloads.ts => net.ts} | 132 +++++++++------ .../editors/code/src/persistent_state.ts | 64 ++++--- rust-analyzer/editors/code/src/util.ts | 54 ------ 12 files changed, 264 insertions(+), 691 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/installation/extension.ts delete mode 100644 rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts delete mode 100644 rust-analyzer/editors/code/src/installation/interfaces.ts delete mode 100644 rust-analyzer/editors/code/src/installation/server.ts rename rust-analyzer/editors/code/src/{installation/downloads.ts => net.ts} (50%) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9e0ffd2..6528ff07 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -228,7 +228,7 @@ "default": "stable", "markdownEnumDescriptions": [ "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general", - "`\"nightly\"` updates are shipped daily, they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" + "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" ], "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs" }, diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 83b1acf6..03528b82 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -1,20 +1,10 @@ -import * as vscode from 'vscode'; -import { ensureServerBinary } from '../installation/server'; +import * as vscode from "vscode"; +import { spawnSync } from "child_process"; import { Ctx, Cmd } from '../ctx'; -import { spawnSync } from 'child_process'; export function serverVersion(ctx: Ctx): Cmd { return async () => { - const binaryPath = await ensureServerBinary(ctx.config, ctx.state); - - if (binaryPath == null) { - throw new Error( - "Rust Analyzer Language Server is not available. " + - "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)." - ); - } - - const version = spawnSync(binaryPath, ["--version"], { encoding: "utf8" }).stdout; + const version = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }).stdout; vscode.window.showInformationMessage('rust-analyzer version : ' + version); }; } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index b45b14be..28698ab8 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,9 +1,5 @@ -import * as os from "os"; import * as vscode from 'vscode'; -import { ArtifactSource } from "./installation/interfaces"; -import { log, vscodeReloadWindow } from "./util"; - -const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; +import { log } from "./util"; export interface InlayHintOptions { typeHints: boolean; @@ -25,10 +21,7 @@ export interface CargoFeatures { loadOutDirsFromCheck: boolean; } -export const enum UpdatesChannel { - Stable = "stable", - Nightly = "nightly" -} +export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; export class Config { @@ -41,6 +34,7 @@ export class Config { "cargo-watch", "highlighting.semanticTokens", "inlayHints", + "updates.channel", ] .map(opt => `${this.rootSection}.${opt}`); @@ -94,100 +88,17 @@ export class Config { ); if (userResponse === "Reload now") { - await vscodeReloadWindow(); + await vscode.commands.executeCommand("workbench.action.reloadWindow"); } } - private static replaceTildeWithHomeDir(path: string) { - if (path.startsWith("~/")) { - return os.homedir() + path.slice("~".length); - } - return path; - } - - /** - * Name of the binary artifact for `rust-analyzer` that is published for - * `platform` on GitHub releases. (It is also stored under the same name when - * downloaded by the extension). - */ - get prebuiltServerFileName(): null | string { - // See possible `arch` values here: - // https://nodejs.org/api/process.html#process_process_arch - - switch (process.platform) { - - case "linux": { - switch (process.arch) { - case "arm": - case "arm64": return null; - - default: return "rust-analyzer-linux"; - } - } - - case "darwin": return "rust-analyzer-mac"; - case "win32": return "rust-analyzer-windows.exe"; - - // Users on these platforms yet need to manually build from sources - case "aix": - case "android": - case "freebsd": - case "openbsd": - case "sunos": - case "cygwin": - case "netbsd": return null; - // The list of platforms is exhaustive (see `NodeJS.Platform` type definition) - } - } - - get installedExtensionUpdateChannel(): UpdatesChannel { - return this.extensionReleaseTag === NIGHTLY_TAG - ? UpdatesChannel.Nightly - : UpdatesChannel.Stable; - } - - get serverSource(): null | ArtifactSource { - const serverPath = RA_LSP_DEBUG ?? this.serverPath; - - if (serverPath) { - return { - type: ArtifactSource.Type.ExplicitPath, - path: Config.replaceTildeWithHomeDir(serverPath) - }; - } - - const prebuiltBinaryName = this.prebuiltServerFileName; - - if (!prebuiltBinaryName) return null; - - return this.createGithubReleaseSource( - prebuiltBinaryName, - this.extensionReleaseTag - ); - } - - private createGithubReleaseSource(file: string, tag: string): ArtifactSource.GithubRelease { - return { - type: ArtifactSource.Type.GithubRelease, - file, - tag, - dir: this.ctx.globalStoragePath, - repo: { - name: "rust-analyzer", - owner: "rust-analyzer", - } - }; - } - - get nightlyVsixSource(): ArtifactSource.GithubRelease { - return this.createGithubReleaseSource("rust-analyzer.vsix", NIGHTLY_TAG); - } + get globalStoragePath(): string { return this.ctx.globalStoragePath; } // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - private get serverPath() { return this.cfg.get("serverPath") as null | string; } - get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } + get serverPath() { return this.cfg.get("serverPath") as null | string; } + get channel() { return this.cfg.get<"stable" | "nightly">("updates.channel")!; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index c929ab06..84c170ea 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -4,21 +4,20 @@ import * as lc from 'vscode-languageclient'; import { Config } from './config'; import { createClient } from './client'; import { isRustEditor, RustEditor } from './util'; -import { PersistentState } from './persistent_state'; export class Ctx { private constructor( readonly config: Config, - readonly state: PersistentState, private readonly extCtx: vscode.ExtensionContext, - readonly client: lc.LanguageClient + readonly client: lc.LanguageClient, + readonly serverPath: string, ) { } - static async create(config: Config, state: PersistentState, extCtx: vscode.ExtensionContext, serverPath: string): Promise { + static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { const client = await createClient(config, serverPath); - const res = new Ctx(config, state, extCtx, client); + const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); return res; diff --git a/rust-analyzer/editors/code/src/installation/extension.ts b/rust-analyzer/editors/code/src/installation/extension.ts deleted file mode 100644 index a1db96f0..00000000 --- a/rust-analyzer/editors/code/src/installation/extension.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as vscode from "vscode"; -import * as path from "path"; -import { promises as fs } from 'fs'; - -import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util"; -import { Config, UpdatesChannel } from "../config"; -import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces"; -import { downloadArtifactWithProgressUi } from "./downloads"; -import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; -import { PersistentState } from "../persistent_state"; - -const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; - -/** - * Installs `stable` or latest `nightly` version or does nothing if the current - * extension version is what's needed according to `desiredUpdateChannel`. - */ -export async function ensureProperExtensionVersion(config: Config, state: PersistentState): Promise { - // User has built lsp server from sources, she should manage updates manually - if (config.serverSource?.type === ArtifactSource.Type.ExplicitPath) return; - - const currentUpdChannel = config.installedExtensionUpdateChannel; - const desiredUpdChannel = config.updatesChannel; - - if (currentUpdChannel === UpdatesChannel.Stable) { - // Release date is present only when we are on nightly - await state.installedNightlyExtensionReleaseDate.set(null); - } - - if (desiredUpdChannel === UpdatesChannel.Stable) { - // VSCode should handle updates for stable channel - if (currentUpdChannel === UpdatesChannel.Stable) return; - - if (!await askToDownloadProperExtensionVersion(config)) return; - - await vscodeReinstallExtension(config.extensionId); - await vscodeReloadWindow(); // never returns - } - - if (currentUpdChannel === UpdatesChannel.Stable) { - if (!await askToDownloadProperExtensionVersion(config)) return; - - return await tryDownloadNightlyExtension(config, state); - } - - const currentExtReleaseDate = state.installedNightlyExtensionReleaseDate.get(); - - if (currentExtReleaseDate === null) { - void vscode.window.showErrorMessage( - "Nightly release date must've been set during the installation. " + - "Did you download and install the nightly .vsix package manually?" - ); - throw new Error("Nightly release date was not set in globalStorage"); - } - - const dateNow = new Date; - const hoursSinceLastUpdate = diffInHours(currentExtReleaseDate, dateNow); - log.debug( - "Current rust-analyzer nightly was downloaded", hoursSinceLastUpdate, - "hours ago, namely:", currentExtReleaseDate, "and now is", dateNow - ); - - if (hoursSinceLastUpdate < HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS) { - return; - } - if (!await askToDownloadProperExtensionVersion(config, "The installed nightly version is most likely outdated. ")) { - return; - } - - await tryDownloadNightlyExtension(config, state, releaseInfo => { - assert( - currentExtReleaseDate.getTime() === state.installedNightlyExtensionReleaseDate.get()?.getTime(), - "Other active VSCode instance has reinstalled the extension" - ); - - if (releaseInfo.releaseDate.getTime() === currentExtReleaseDate.getTime()) { - vscode.window.showInformationMessage( - "Whoops, it appears that your nightly version is up-to-date. " + - "There might be some problems with the upcomming nightly release " + - "or you traveled too far into the future. Sorry for that 😅! " - ); - return false; - } - return true; - }); -} - -async function askToDownloadProperExtensionVersion(config: Config, reason = "") { - if (!config.askBeforeDownload) return true; - - const stableOrNightly = config.updatesChannel === UpdatesChannel.Stable ? "stable" : "latest nightly"; - - // In case of reentering this function and showing the same info message - // (e.g. after we had shown this message, the user changed the config) - // vscode will dismiss the already shown one (i.e. return undefined). - // This behaviour is what we want, but likely it is not documented - - const userResponse = await vscode.window.showInformationMessage( - reason + `Do you want to download the ${stableOrNightly} rust-analyzer extension ` + - `version and reload the window now?`, - "Download now", "Cancel" - ); - return userResponse === "Download now"; -} - -/** - * Shutdowns the process in case of success (i.e. reloads the window) or throws an error. - * - * ACHTUNG!: this function has a crazy amount of state transitions, handling errors during - * each of them would result in a ton of code (especially accounting for cross-process - * shared mutable `globalState` access). Enforcing no reentrancy for this is best-effort. - */ -const tryDownloadNightlyExtension = notReentrant(async ( - config: Config, - state: PersistentState, - shouldDownload: (releaseInfo: ArtifactReleaseInfo) => boolean = () => true -): Promise => { - const vsixSource = config.nightlyVsixSource; - try { - const releaseInfo = await fetchArtifactReleaseInfo(vsixSource.repo, vsixSource.file, vsixSource.tag); - - if (!shouldDownload(releaseInfo)) return; - - await downloadArtifactWithProgressUi(releaseInfo, vsixSource.file, vsixSource.dir, "nightly extension"); - - const vsixPath = path.join(vsixSource.dir, vsixSource.file); - - await vscodeInstallExtensionFromVsix(vsixPath); - await state.installedNightlyExtensionReleaseDate.set(releaseInfo.releaseDate); - await fs.unlink(vsixPath); - - await vscodeReloadWindow(); // never returns - } catch (err) { - log.downloadError(err, "nightly extension", vsixSource.repo.name); - } -}); - -function diffInHours(a: Date, b: Date): number { - // Discard the time and time-zone information (to abstract from daylight saving time bugs) - // https://stackoverflow.com/a/15289883/9259330 - - const utcA = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()); - const utcB = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate()); - - return (utcA - utcB) / (1000 * 60 * 60); -} diff --git a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts b/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts deleted file mode 100644 index 1ad3b833..00000000 --- a/rust-analyzer/editors/code/src/installation/fetch_artifact_release_info.ts +++ /dev/null @@ -1,77 +0,0 @@ -import fetch from "node-fetch"; -import { GithubRepo, ArtifactReleaseInfo } from "./interfaces"; -import { log } from "../util"; - -const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; - -/** - * Fetches the release with `releaseTag` from GitHub `repo` and - * returns metadata about `artifactFileName` shipped with - * this release. - * - * @throws Error upon network failure or if no such repository, release, or artifact exists. - */ -export async function fetchArtifactReleaseInfo( - repo: GithubRepo, - artifactFileName: string, - releaseTag: string -): Promise { - - const repoOwner = encodeURIComponent(repo.owner); - const repoName = encodeURIComponent(repo.name); - - const apiEndpointPath = `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}`; - - const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; - - log.debug("Issuing request for released artifacts metadata to", requestUrl); - - const response = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }); - - if (!response.ok) { - log.error("Error fetching artifact release info", { - requestUrl, - releaseTag, - artifactFileName, - response: { - headers: response.headers, - status: response.status, - body: await response.text(), - } - }); - - throw new Error( - `Got response ${response.status} when trying to fetch ` + - `"${artifactFileName}" artifact release info for ${releaseTag} release` - ); - } - - // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) - const release: GithubRelease = await response.json(); - - const artifact = release.assets.find(artifact => artifact.name === artifactFileName); - - if (!artifact) { - throw new Error( - `Artifact ${artifactFileName} was not found in ${release.name} release!` - ); - } - - return { - releaseName: release.name, - releaseDate: new Date(release.published_at), - downloadUrl: artifact.browser_download_url - }; - - // We omit declaration of tremendous amount of fields that we are not using here - interface GithubRelease { - name: string; - // eslint-disable-next-line camelcase - published_at: string; - assets: Array<{ - name: string; - // eslint-disable-next-line camelcase - browser_download_url: string; - }>; - } -} diff --git a/rust-analyzer/editors/code/src/installation/interfaces.ts b/rust-analyzer/editors/code/src/installation/interfaces.ts deleted file mode 100644 index 1a8ea088..00000000 --- a/rust-analyzer/editors/code/src/installation/interfaces.ts +++ /dev/null @@ -1,63 +0,0 @@ -export interface GithubRepo { - name: string; - owner: string; -} - -/** - * Metadata about particular artifact retrieved from GitHub releases. - */ -export interface ArtifactReleaseInfo { - releaseDate: Date; - releaseName: string; - downloadUrl: string; -} - -/** - * Represents the source of a an artifact which is either specified by the user - * explicitly, or bundled by this extension from GitHub releases. - */ -export type ArtifactSource = ArtifactSource.ExplicitPath | ArtifactSource.GithubRelease; - -export namespace ArtifactSource { - /** - * Type tag for `ArtifactSource` discriminated union. - */ - export const enum Type { ExplicitPath, GithubRelease } - - export interface ExplicitPath { - type: Type.ExplicitPath; - - /** - * Filesystem path to the binary specified by the user explicitly. - */ - path: string; - } - - export interface GithubRelease { - type: Type.GithubRelease; - - /** - * Repository where the binary is stored. - */ - repo: GithubRepo; - - - // FIXME: add installationPath: string; - - /** - * Directory on the filesystem where the bundled binary is stored. - */ - dir: string; - - /** - * Name of the binary file. It is stored under the same name on GitHub releases - * and in local `.dir`. - */ - file: string; - - /** - * Tag of github release that denotes a version required by this extension. - */ - tag: string; - } -} diff --git a/rust-analyzer/editors/code/src/installation/server.ts b/rust-analyzer/editors/code/src/installation/server.ts deleted file mode 100644 index 05d32613..00000000 --- a/rust-analyzer/editors/code/src/installation/server.ts +++ /dev/null @@ -1,131 +0,0 @@ -import * as vscode from "vscode"; -import * as path from "path"; -import { spawnSync } from "child_process"; - -import { ArtifactSource } from "./interfaces"; -import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; -import { downloadArtifactWithProgressUi } from "./downloads"; -import { log, assert, notReentrant } from "../util"; -import { Config, NIGHTLY_TAG } from "../config"; -import { PersistentState } from "../persistent_state"; - -export async function ensureServerBinary(config: Config, state: PersistentState): Promise { - const source = config.serverSource; - - if (!source) { - vscode.window.showErrorMessage( - "Unfortunately we don't ship binaries for your platform yet. " + - "You need to manually clone rust-analyzer repository and " + - "run `cargo xtask install --server` to build the language server from sources. " + - "If you feel that your platform should be supported, please create an issue " + - "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " + - "will consider it." - ); - return null; - } - - switch (source.type) { - case ArtifactSource.Type.ExplicitPath: { - if (isBinaryAvailable(source.path)) { - return source.path; - } - - vscode.window.showErrorMessage( - `Unable to run ${source.path} binary. ` + - `To use the pre-built language server, set "rust-analyzer.serverPath" ` + - "value to `null` or remove it from the settings to use it by default." - ); - return null; - } - case ArtifactSource.Type.GithubRelease: { - if (!shouldDownloadServer(state, source)) { - return path.join(source.dir, source.file); - } - - if (config.askBeforeDownload) { - const userResponse = await vscode.window.showInformationMessage( - `Language server version ${source.tag} for rust-analyzer is not installed. ` + - "Do you want to download it now?", - "Download now", "Cancel" - ); - if (userResponse !== "Download now") return null; - } - - return await downloadServer(state, source); - } - } -} - -function shouldDownloadServer( - state: PersistentState, - source: ArtifactSource.GithubRelease, -): boolean { - if (!isBinaryAvailable(path.join(source.dir, source.file))) return true; - - const installed = { - tag: state.serverReleaseTag.get(), - date: state.serverReleaseDate.get() - }; - const required = { - tag: source.tag, - date: state.installedNightlyExtensionReleaseDate.get() - }; - - log.debug("Installed server:", installed, "required:", required); - - if (required.tag !== NIGHTLY_TAG || installed.tag !== NIGHTLY_TAG) { - return required.tag !== installed.tag; - } - - assert(required.date !== null, "Extension release date should have been saved during its installation"); - assert(installed.date !== null, "Server release date should have been saved during its installation"); - - return installed.date.getTime() !== required.date.getTime(); -} - -/** - * Enforcing no reentrancy for this is best-effort. - */ -const downloadServer = notReentrant(async ( - state: PersistentState, - source: ArtifactSource.GithubRelease, -): Promise => { - try { - const releaseInfo = await fetchArtifactReleaseInfo(source.repo, source.file, source.tag); - - await downloadArtifactWithProgressUi(releaseInfo, source.file, source.dir, "language server"); - await Promise.all([ - state.serverReleaseTag.set(releaseInfo.releaseName), - state.serverReleaseDate.set(releaseInfo.releaseDate) - ]); - } catch (err) { - log.downloadError(err, "language server", source.repo.name); - return null; - } - - const binaryPath = path.join(source.dir, source.file); - - assert(isBinaryAvailable(binaryPath), - `Downloaded language server binary is not functional.` + - `Downloaded from GitHub repo ${source.repo.owner}/${source.repo.name} ` + - `to ${binaryPath}` - ); - - vscode.window.showInformationMessage( - "Rust analyzer language server was successfully installed 🦀" - ); - - return binaryPath; -}); - -function isBinaryAvailable(binaryPath: string): boolean { - const res = spawnSync(binaryPath, ["--version"]); - - // ACHTUNG! `res` type declaration is inherently wrong, see - // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 - - log.debug("Checked binary availablity via --version", res); - log.debug(binaryPath, "--version output:", res.output?.map(String)); - - return res.status === 0; -} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 94ecd4da..d907f3e6 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -1,15 +1,18 @@ import * as vscode from 'vscode'; +import * as path from "path"; +import * as os from "os"; +import { promises as fs } from "fs"; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; -import { ensureServerBinary } from './installation/server'; -import { Config } from './config'; -import { log } from './util'; -import { ensureProperExtensionVersion } from './installation/extension'; +import { Config, NIGHTLY_TAG } from './config'; +import { log, assert } from './util'; import { PersistentState } from './persistent_state'; +import { fetchRelease, download } from './net'; +import { spawnSync } from 'child_process'; let ctx: Ctx | undefined; @@ -35,27 +38,14 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push(defaultOnEnter); const config = new Config(context); - const state = new PersistentState(context); - - vscode.workspace.onDidChangeConfiguration(() => ensureProperExtensionVersion(config, state).catch(log.error)); - - // Don't await the user response here, otherwise we will block the lsp server bootstrap - void ensureProperExtensionVersion(config, state).catch(log.error); - - const serverPath = await ensureServerBinary(config, state); - - if (serverPath == null) { - throw new Error( - "Rust Analyzer Language Server is not available. " + - "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)." - ); - } + const state = new PersistentState(context.globalState); + const serverPath = await bootstrap(config, state); // Note: we try to start the server before we activate type hints so that it // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - ctx = await Ctx.create(config, state, context, serverPath); + ctx = await Ctx.create(config, context, serverPath); // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('reload', (ctx) => { @@ -109,3 +99,131 @@ export async function deactivate() { await ctx?.client?.stop(); ctx = undefined; } + +async function bootstrap(config: Config, state: PersistentState): Promise { + await fs.mkdir(config.globalStoragePath, { recursive: true }); + + await bootstrapExtension(config, state); + const path = await bootstrapServer(config, state); + + return path; +} + +async function bootstrapExtension(config: Config, state: PersistentState): Promise { + if (config.channel === "stable") { + if (config.extensionReleaseTag === NIGHTLY_TAG) { + vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension. +To switch to stable, uninstall the extension and re-install it from the marketplace`); + } + return; + }; + + const lastCheck = state.lastCheck; + const now = Date.now(); + + const anHour = 60 * 60 * 1000; + const shouldDownloadNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour; + + if (!shouldDownloadNightly) return; + + const release = await fetchRelease("nightly").catch((e) => { + log.error(e); + if (state.releaseId === undefined) { // Show error only for the initial download + vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`); + } + return undefined; + }); + if (release === undefined || release.id === state.releaseId) return; + + const userResponse = await vscode.window.showInformationMessage( + "New version of rust-analyzer (nightly) is available (requires reload).", + "Update" + ); + if (userResponse !== "Update") return; + + const artifact = release.assets.find(artifact => artifact.name === "rust-analyzer.vsix"); + assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); + + const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); + await download(artifact.browser_download_url, dest, "Downloading rust-analyzer extension"); + + await vscode.commands.executeCommand("workbench.extensions.installExtension", vscode.Uri.file(dest)); + await fs.unlink(dest); + + await state.updateReleaseId(release.id); + await state.updateLastCheck(now); + await vscode.commands.executeCommand("workbench.action.reloadWindow"); +} + +async function bootstrapServer(config: Config, state: PersistentState): Promise { + const path = await getServer(config, state); + if (!path) { + throw new Error( + "Rust Analyzer Language Server is not available. " + + "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)." + ); + } + + const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); + log.debug("Checked binary availability via --version", res); + log.debug(res, "--version output:", res.output); + if (res.status !== 0) { + throw new Error( + `Failed to execute ${path} --version` + ); + } + + return path; +} + +async function getServer(config: Config, state: PersistentState): Promise { + const explicitPath = process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; + if (explicitPath) { + if (explicitPath.startsWith("~/")) { + return os.homedir() + explicitPath.slice("~".length); + } + return explicitPath; + }; + + let binaryName: string | undefined = undefined; + if (process.arch === "x64" || process.arch === "x32") { + if (process.platform === "linux") binaryName = "rust-analyzer-linux"; + if (process.platform === "darwin") binaryName = "rust-analyzer-mac"; + if (process.platform === "win32") binaryName = "rust-analyzer-windows.exe"; + } + if (binaryName === undefined) { + vscode.window.showErrorMessage( + "Unfortunately we don't ship binaries for your platform yet. " + + "You need to manually clone rust-analyzer repository and " + + "run `cargo xtask install --server` to build the language server from sources. " + + "If you feel that your platform should be supported, please create an issue " + + "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " + + "will consider it." + ); + return undefined; + } + + const dest = path.join(config.globalStoragePath, binaryName); + const exists = await fs.stat(dest).then(() => true, () => false); + if (!exists) { + await state.updateServerVersion(undefined); + } + + if (state.serverVersion === config.packageJsonVersion) return dest; + + if (config.askBeforeDownload) { + const userResponse = await vscode.window.showInformationMessage( + `Language server version ${config.packageJsonVersion} for rust-analyzer is not installed.`, + "Download now" + ); + if (userResponse !== "Download now") return dest; + } + + const release = await fetchRelease(config.extensionReleaseTag); + const artifact = release.assets.find(artifact => artifact.name === binaryName); + assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); + + await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 }); + await state.updateServerVersion(config.packageJsonVersion); + return dest; +} diff --git a/rust-analyzer/editors/code/src/installation/downloads.ts b/rust-analyzer/editors/code/src/net.ts similarity index 50% rename from rust-analyzer/editors/code/src/installation/downloads.ts rename to rust-analyzer/editors/code/src/net.ts index 7ce2e296..49221393 100644 --- a/rust-analyzer/editors/code/src/installation/downloads.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -1,24 +1,101 @@ import fetch from "node-fetch"; import * as vscode from "vscode"; -import * as path from "path"; import * as fs from "fs"; import * as stream from "stream"; import * as util from "util"; -import { log, assert } from "../util"; -import { ArtifactReleaseInfo } from "./interfaces"; +import { log, assert } from "./util"; const pipeline = util.promisify(stream.pipeline); +const GITHUB_API_ENDPOINT_URL = "https://api.github.com"; +const OWNER = "rust-analyzer"; +const REPO = "rust-analyzer"; + +export async function fetchRelease( + releaseTag: string +): Promise { + + const apiEndpointPath = `/repos/${OWNER}/${REPO}/releases/tags/${releaseTag}`; + + const requestUrl = GITHUB_API_ENDPOINT_URL + apiEndpointPath; + + log.debug("Issuing request for released artifacts metadata to", requestUrl); + + const response = await fetch(requestUrl, { headers: { Accept: "application/vnd.github.v3+json" } }); + + if (!response.ok) { + log.error("Error fetching artifact release info", { + requestUrl, + releaseTag, + response: { + headers: response.headers, + status: response.status, + body: await response.text(), + } + }); + + throw new Error( + `Got response ${response.status} when trying to fetch ` + + `release info for ${releaseTag} release` + ); + } + + // We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`) + const release: GithubRelease = await response.json(); + return release; +} + +// We omit declaration of tremendous amount of fields that we are not using here +export interface GithubRelease { + name: string; + id: number; + // eslint-disable-next-line camelcase + published_at: string; + assets: Array<{ + name: string; + // eslint-disable-next-line camelcase + browser_download_url: string; + }>; +} + + +export async function download( + downloadUrl: string, + destinationPath: string, + progressTitle: string, + { mode }: { mode?: number } = {}, +) { + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, + title: progressTitle + }, + async (progress, _cancellationToken) => { + let lastPercentage = 0; + await downloadFile(downloadUrl, destinationPath, mode, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPercentage + }); + + lastPercentage = newPercentage; + }); + } + ); +} + /** * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`. * `onProgress` callback is called on recieveing each chunk of bytes * to track the progress of downloading, it gets the already read and total * amount of bytes to read as its parameters. */ -export async function downloadFile( +async function downloadFile( url: string, destFilePath: fs.PathLike, - destFilePermissions: number, + mode: number | undefined, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { const res = await fetch(url); @@ -41,7 +118,7 @@ export async function downloadFile( onProgress(readBytes, totalBytes); }); - const destFileStream = fs.createWriteStream(destFilePath, { mode: destFilePermissions }); + const destFileStream = fs.createWriteStream(destFilePath, { mode }); await pipeline(res.body, destFileStream); return new Promise(resolve => { @@ -52,46 +129,3 @@ export async function downloadFile( // Issue at nodejs repo: https://github.com/nodejs/node/issues/31776 }); } - -/** - * Downloads artifact from given `downloadUrl`. - * Creates `installationDir` if it is not yet created and puts the artifact under - * `artifactFileName`. - * Displays info about the download progress in an info message printing the name - * of the artifact as `displayName`. - */ -export async function downloadArtifactWithProgressUi( - { downloadUrl, releaseName }: ArtifactReleaseInfo, - artifactFileName: string, - installationDir: string, - displayName: string, -) { - await fs.promises.mkdir(installationDir).catch(err => assert( - err?.code === "EEXIST", - `Couldn't create directory "${installationDir}" to download ` + - `${artifactFileName} artifact: ${err?.message}` - )); - - const installationPath = path.join(installationDir, artifactFileName); - - await vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - cancellable: false, // FIXME: add support for canceling download? - title: `Downloading rust-analyzer ${displayName} (${releaseName})` - }, - async (progress, _cancellationToken) => { - let lastPrecentage = 0; - const filePermissions = 0o755; // (rwx, r_x, r_x) - await downloadFile(downloadUrl, installationPath, filePermissions, (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPrecentage - }); - - lastPrecentage = newPercentage; - }); - } - ); -} diff --git a/rust-analyzer/editors/code/src/persistent_state.ts b/rust-analyzer/editors/code/src/persistent_state.ts index 13095b80..138d11b8 100644 --- a/rust-analyzer/editors/code/src/persistent_state.ts +++ b/rust-analyzer/editors/code/src/persistent_state.ts @@ -1,49 +1,41 @@ import * as vscode from 'vscode'; -import { log } from "./util"; +import { log } from './util'; export class PersistentState { - constructor(private readonly ctx: vscode.ExtensionContext) { + constructor(private readonly globalState: vscode.Memento) { + const { lastCheck, releaseId, serverVersion } = this; + log.debug("PersistentState: ", { lastCheck, releaseId, serverVersion }); } - readonly installedNightlyExtensionReleaseDate = new DateStorage( - "installed-nightly-extension-release-date", - this.ctx.globalState - ); - readonly serverReleaseDate = new DateStorage("server-release-date", this.ctx.globalState); - readonly serverReleaseTag = new Storage("server-release-tag", this.ctx.globalState, null); -} - - -export class Storage { - constructor( - private readonly key: string, - private readonly storage: vscode.Memento, - private readonly defaultVal: T - ) { } - - get(): T { - const val = this.storage.get(this.key, this.defaultVal); - log.debug(this.key, "==", val); - return val; + /** + * Used to check for *nightly* updates once an hour. + */ + get lastCheck(): number | undefined { + return this.globalState.get("lastCheck"); } - async set(val: T) { - log.debug(this.key, "=", val); - await this.storage.update(this.key, val); + async updateLastCheck(value: number) { + await this.globalState.update("lastCheck", value); } -} -export class DateStorage { - inner: Storage; - constructor(key: string, storage: vscode.Memento) { - this.inner = new Storage(key, storage, null); + /** + * Release id of the *nightly* extension. + * Used to check if we should update. + */ + get releaseId(): number | undefined { + return this.globalState.get("releaseId"); } - - get(): null | Date { - const dateStr = this.inner.get(); - return dateStr ? new Date(dateStr) : null; + async updateReleaseId(value: number) { + await this.globalState.update("releaseId", value); } - async set(date: null | Date) { - await this.inner.set(date ? date.toString() : null); + /** + * Version of the extension that installed the server. + * Used to check if we need to update the server. + */ + get serverVersion(): string | undefined { + return this.globalState.get("serverVersion"); + } + async updateServerVersion(value: string | undefined) { + await this.globalState.update("serverVersion", value); } } diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 2bfc145e..978a3175 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,6 +1,5 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; -import { promises as dns } from "dns"; import { strict as nativeAssert } from "assert"; export function assert(condition: boolean, explanation: string): asserts condition { @@ -31,22 +30,6 @@ export const log = new class { // eslint-disable-next-line no-console console.error(message, ...optionalParams); } - - downloadError(err: Error, artifactName: string, repoName: string) { - vscode.window.showErrorMessage( - `Failed to download the rust-analyzer ${artifactName} from ${repoName} ` + - `GitHub repository: ${err.message}` - ); - log.error(err); - dns.resolve('example.com').then( - addrs => log.debug("DNS resolution for example.com was successful", addrs), - err => log.error( - "DNS resolution for example.com failed, " + - "there might be an issue with Internet availability", - err - ) - ); - } }; export async function sendRequestWithRetry( @@ -86,17 +69,6 @@ function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } -export function notReentrant( - fn: (this: TThis, ...params: TParams) => Promise -): typeof fn { - let entered = false; - return function(...params) { - assert(!entered, `Reentrancy invariant for ${fn.name} is violated`); - entered = true; - return fn.apply(this, params).finally(() => entered = false); - }; -} - export type RustDocument = vscode.TextDocument & { languageId: "rust" }; export type RustEditor = vscode.TextEditor & { document: RustDocument; id: string }; @@ -110,29 +82,3 @@ export function isRustDocument(document: vscode.TextDocument): document is RustD export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { return isRustDocument(editor.document); } - -/** - * @param extensionId The canonical extension identifier in the form of: `publisher.name` - */ -export async function vscodeReinstallExtension(extensionId: string) { - // Unfortunately there is no straightforward way as of now, these commands - // were found in vscode source code. - - log.debug("Uninstalling extension", extensionId); - await vscode.commands.executeCommand("workbench.extensions.uninstallExtension", extensionId); - log.debug("Installing extension", extensionId); - await vscode.commands.executeCommand("workbench.extensions.installExtension", extensionId); -} - -export async function vscodeReloadWindow(): Promise { - await vscode.commands.executeCommand("workbench.action.reloadWindow"); - - assert(false, "unreachable"); -} - -export async function vscodeInstallExtensionFromVsix(vsixPath: string) { - await vscode.commands.executeCommand( - "workbench.extensions.installExtension", - vscode.Uri.file(vsixPath) - ); -} From 9cecd88e9850efb8dcf0247cde0d4d2c17115f6a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 19 Mar 2020 09:32:57 +0100 Subject: [PATCH 562/819] Simplify extension tag sniffing --- rust-analyzer/editors/code/package.json | 4 ++-- rust-analyzer/editors/code/src/config.ts | 20 +++++++------------- rust-analyzer/editors/code/src/main.ts | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 150c3684..9f2fe06f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -5,8 +5,8 @@ "preview": true, "private": true, "icon": "icon.png", - "//": "The real version is in release.yaml, this one just needs to be bigger", - "version": "0.2.20200309-nightly", + "version": "0.4.0-dev", + "releaseTag": "nightly", "publisher": "matklad", "repository": { "url": "https://github.com/rust-analyzer/rust-analyzer.git", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 28698ab8..54b90530 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -38,23 +38,17 @@ export class Config { ] .map(opt => `${this.rootSection}.${opt}`); - readonly packageJsonVersion = vscode + readonly packageJsonVersion: string = vscode .extensions .getExtension(this.extensionId)! .packageJSON - .version as string; // n.n.YYYYMMDD[-nightly] + .version; - /** - * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) - */ - readonly extensionReleaseTag: string = (() => { - if (this.packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; - - const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/; - const [, yyyy, mm, dd] = this.packageJsonVersion.match(realVersionRegexp)!; - - return `${yyyy}-${mm}-${dd}`; - })(); + readonly releaseTag: string = vscode + .extensions + .getExtension(this.extensionId)! + .packageJSON + .releaseTag; private cfg!: vscode.WorkspaceConfiguration; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index d907f3e6..5297614a 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -111,7 +111,7 @@ async function bootstrap(config: Config, state: PersistentState): Promise { if (config.channel === "stable") { - if (config.extensionReleaseTag === NIGHTLY_TAG) { + if (config.releaseTag === NIGHTLY_TAG) { vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension. To switch to stable, uninstall the extension and re-install it from the marketplace`); } @@ -219,7 +219,7 @@ async function getServer(config: Config, state: PersistentState): Promise artifact.name === binaryName); assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); From e947bbc0d0e04d48367b355bcd1d5ae59e44d02c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 19 Mar 2020 10:30:41 +0100 Subject: [PATCH 563/819] :arrow_up: npm --- rust-analyzer/editors/code/package-lock.json | 8 ++++---- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 787f1b17..ff3e9fa6 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust-analyzer", - "version": "0.2.20200309-nightly", + "version": "0.4.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1762,9 +1762,9 @@ "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz", - "integrity": "sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.2.tgz", + "integrity": "sha512-jbasqsg+btvhB8AmGUyycmwZhM6ZESns5yKixffJfCVO5E5Mf++0Bl8xsGjLLpEi7fjN0NPaJY9EyiGX5ZF2zA==", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.3" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9f2fe06f..36d6de52 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -34,7 +34,7 @@ "dependencies": { "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", - "vscode-languageclient": "^6.1.1" + "vscode-languageclient": "^6.1.2" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", From 681a14004816716d72a52ff032a6d6e5d60b6c94 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 19 Mar 2020 15:03:57 +0100 Subject: [PATCH 564/819] Downgrade vscode-langaugeclient Looks like it broke completion :( --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index ff3e9fa6..d5eb3d01 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1762,9 +1762,9 @@ "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.2.tgz", - "integrity": "sha512-jbasqsg+btvhB8AmGUyycmwZhM6ZESns5yKixffJfCVO5E5Mf++0Bl8xsGjLLpEi7fjN0NPaJY9EyiGX5ZF2zA==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz", + "integrity": "sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA==", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.3" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 36d6de52..2cb48abb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -34,7 +34,7 @@ "dependencies": { "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", - "vscode-languageclient": "^6.1.2" + "vscode-languageclient": "=6.1.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", From 0783deaf039c6c866b04935cc4c68923cf5db25f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Mar 2020 12:50:50 +0100 Subject: [PATCH 565/819] Make from-source install use cargo installed binary by default --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/config.ts | 4 ++-- rust-analyzer/editors/code/src/main.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2cb48abb..7f1aa227 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -6,7 +6,7 @@ "private": true, "icon": "icon.png", "version": "0.4.0-dev", - "releaseTag": "nightly", + "releaseTag": null, "publisher": "matklad", "repository": { "url": "https://github.com/rust-analyzer/rust-analyzer.git", diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 54b90530..be5296fc 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -44,11 +44,11 @@ export class Config { .packageJSON .version; - readonly releaseTag: string = vscode + readonly releaseTag: string | undefined = vscode .extensions .getExtension(this.extensionId)! .packageJSON - .releaseTag; + .releaseTag ?? undefined; private cfg!: vscode.WorkspaceConfiguration; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5297614a..5d2da9a7 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -110,6 +110,7 @@ async function bootstrap(config: Config, state: PersistentState): Promise { + if (config.releaseTag === undefined) return; if (config.channel === "stable") { if (config.releaseTag === NIGHTLY_TAG) { vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension. @@ -184,6 +185,7 @@ async function getServer(config: Config, state: PersistentState): Promise Date: Fri, 20 Mar 2020 13:07:43 +0100 Subject: [PATCH 566/819] :arrow_up: npm --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d5eb3d01..b7220d8e 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1762,9 +1762,9 @@ "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" }, "vscode-languageclient": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz", - "integrity": "sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.3.tgz", + "integrity": "sha512-YciJxk08iU5LmWu7j5dUt9/1OLjokKET6rME3cI4BRpiF6HZlusm2ZwPt0MYJ0lV5y43sZsQHhyon2xBg4ZJVA==", "requires": { "semver": "^6.3.0", "vscode-languageserver-protocol": "^3.15.3" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7f1aa227..eb574851 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -34,7 +34,7 @@ "dependencies": { "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", - "vscode-languageclient": "=6.1.1" + "vscode-languageclient": "6.1.3" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", From 32f31b75d2771de29140d933a8a792acb6464412 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 20 Mar 2020 21:23:56 +0200 Subject: [PATCH 567/819] vscode: remove unnecessary code This cancel is unnecessary since we cancel the previous inlay hints requests in `fetchHints()` method itself. This is not a hard error, we just called cancel() 2 times. --- rust-analyzer/editors/code/src/inlay_hints.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index b19b09ad..17d0dfa3 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -134,8 +134,6 @@ class HintsUpdater implements Disposable { // No text documents changed, so we may try to use the cache if (!file.cachedDecorations) { - file.inlaysRequest?.cancel(); - const hints = await this.fetchHints(file); if (!hints) return; From ca413be267730a16078267883e430a95a418c6e2 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 24 Mar 2020 01:00:57 +0200 Subject: [PATCH 568/819] vscode: simplify and refactor config --- rust-analyzer/editors/code/src/config.ts | 106 ++++++++++------------- 1 file changed, 45 insertions(+), 61 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index be5296fc..16ac50a0 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -1,29 +1,10 @@ import * as vscode from 'vscode'; import { log } from "./util"; -export interface InlayHintOptions { - typeHints: boolean; - parameterHints: boolean; - maxLength: number | null; -} - -export interface CargoWatchOptions { - enable: boolean; - arguments: string[]; - command: string; - allTargets: boolean; -} - -export interface CargoFeatures { - noDefaultFeatures: boolean; - allFeatures: boolean; - features: string[]; - loadOutDirsFromCheck: boolean; -} - export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; + export class Config { readonly extensionId = "matklad.rust-analyzer"; @@ -50,25 +31,24 @@ export class Config { .packageJSON .releaseTag ?? undefined; - private cfg!: vscode.WorkspaceConfiguration; + readonly globalStoragePath: string; - constructor(private readonly ctx: vscode.ExtensionContext) { - vscode.workspace.onDidChangeConfiguration(this.onConfigChange, this, ctx.subscriptions); - this.refreshConfig(); + constructor(ctx: vscode.ExtensionContext) { + this.globalStoragePath = ctx.globalStoragePath; + vscode.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, ctx.subscriptions); + this.refreshLogging(); } - private refreshConfig() { - this.cfg = vscode.workspace.getConfiguration(this.rootSection); - const enableLogging = this.cfg.get("trace.extension") as boolean; - log.setEnabled(enableLogging); + private refreshLogging() { + log.setEnabled(this.traceExtension); log.debug( "Extension version:", this.packageJsonVersion, "using configuration:", this.cfg ); } - private async onConfigChange(event: vscode.ConfigurationChangeEvent) { - this.refreshConfig(); + private async onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) { + this.refreshLogging(); const requiresReloadOpt = this.requiresReloadOpts.find( opt => event.affectsConfiguration(opt) @@ -86,49 +66,53 @@ export class Config { } } - get globalStoragePath(): string { return this.ctx.globalStoragePath; } - // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - get serverPath() { return this.cfg.get("serverPath") as null | string; } - get channel() { return this.cfg.get<"stable" | "nightly">("updates.channel")!; } - get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } - get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } - get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } - get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } - get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } - get inlayHints(): InlayHintOptions { + private get cfg(): vscode.WorkspaceConfiguration { + return vscode.workspace.getConfiguration(this.rootSection); + } + + get serverPath() { return this.cfg.get("serverPath")!; } + get channel() { return this.cfg.get("updates.channel")!; } + get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload")!; } + get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens")!; } + get highlightingOn() { return this.cfg.get("highlightingOn")!; } + get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn")!; } + get lruCapacity() { return this.cfg.get("lruCapacity")!; } + get excludeGlobs() { return this.cfg.get("excludeGlobs")!; } + get useClientWatching() { return this.cfg.get("useClientWatching")!; } + get featureFlags() { return this.cfg.get>("featureFlags")!; } + get rustfmtArgs() { return this.cfg.get("rustfmtArgs")!; } + get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck")!; } + get traceExtension() { return this.cfg.get("trace.extension")!; } + + // for internal use + get withSysroot() { return this.cfg.get("withSysroot", true)!; } + + get inlayHints() { return { - typeHints: this.cfg.get("inlayHints.typeHints") as boolean, - parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean, - maxLength: this.cfg.get("inlayHints.maxLength") as null | number, + typeHints: this.cfg.get("inlayHints.typeHints")!, + parameterHints: this.cfg.get("inlayHints.parameterHints")!, + maxLength: this.cfg.get("inlayHints.maxLength")!, }; } - get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } - get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } - get featureFlags() { return this.cfg.get("featureFlags") as Record; } - get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } - get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck") as boolean; } - get cargoWatchOptions(): CargoWatchOptions { + get cargoWatchOptions() { return { - enable: this.cfg.get("cargo-watch.enable") as boolean, - arguments: this.cfg.get("cargo-watch.arguments") as string[], - allTargets: this.cfg.get("cargo-watch.allTargets") as boolean, - command: this.cfg.get("cargo-watch.command") as string, + enable: this.cfg.get("cargo-watch.enable")!, + arguments: this.cfg.get("cargo-watch.arguments")!, + allTargets: this.cfg.get("cargo-watch.allTargets")!, + command: this.cfg.get("cargo-watch.command")!, }; } - get cargoFeatures(): CargoFeatures { + get cargoFeatures() { return { - noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, - allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, - features: this.cfg.get("cargoFeatures.features") as string[], - loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck") as boolean, + noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures")!, + allFeatures: this.cfg.get("cargoFeatures.allFeatures")!, + features: this.cfg.get("cargoFeatures.features")!, + loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck")!, }; } - - // for internal use - get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } } From 58b02c62a6de792e2cbd8fee29dc6a201387e2db Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 24 Mar 2020 01:11:36 +0200 Subject: [PATCH 569/819] vscode: more type safety --- rust-analyzer/editors/code/package.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index eb574851..1d113ebb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -73,10 +73,18 @@ "type": "string" }, "args": { - "type": "array" + "type": "array", + "items": { + "type": "string" + } }, "env": { - "type": "object" + "type": "object", + "patternProperties": { + ".+": { + "type": "string" + } + } } } } From be181b5f2936bbb18d61ffec73de7b8b4dbe3627 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 24 Mar 2020 09:31:42 +0100 Subject: [PATCH 570/819] Don't try to enable proposed API's on stable --- rust-analyzer/editors/code/src/client.ts | 6 ++++-- rust-analyzer/editors/code/src/config.ts | 18 ++++++------------ rust-analyzer/editors/code/src/main.ts | 14 +++++++------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 08d821dd..82ca749f 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -99,8 +99,10 @@ export async function createClient(config: Config, serverPath: string): Promise< // Note that while the CallHierarchyFeature is stable the LSP protocol is not. res.registerFeature(new CallHierarchyFeature(res)); - if (config.highlightingSemanticTokens) { - res.registerFeature(new SemanticTokensFeature(res)); + if (config.package.enableProposedApi) { + if (config.highlightingSemanticTokens) { + res.registerFeature(new SemanticTokensFeature(res)); + } } return res; diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index be5296fc..602538ea 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -38,17 +38,11 @@ export class Config { ] .map(opt => `${this.rootSection}.${opt}`); - readonly packageJsonVersion: string = vscode - .extensions - .getExtension(this.extensionId)! - .packageJSON - .version; - - readonly releaseTag: string | undefined = vscode - .extensions - .getExtension(this.extensionId)! - .packageJSON - .releaseTag ?? undefined; + readonly package: { + version: string; + releaseTag: string | undefined; + enableProposedApi: boolean | undefined; + } = vscode.extensions.getExtension(this.extensionId)!.packageJSON; private cfg!: vscode.WorkspaceConfiguration; @@ -62,7 +56,7 @@ export class Config { const enableLogging = this.cfg.get("trace.extension") as boolean; log.setEnabled(enableLogging); log.debug( - "Extension version:", this.packageJsonVersion, + "Extension version:", this.package.version, "using configuration:", this.cfg ); } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5d2da9a7..7b7c19df 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -110,9 +110,9 @@ async function bootstrap(config: Config, state: PersistentState): Promise { - if (config.releaseTag === undefined) return; + if (config.package.releaseTag === undefined) return; if (config.channel === "stable") { - if (config.releaseTag === NIGHTLY_TAG) { + if (config.package.releaseTag === NIGHTLY_TAG) { vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension. To switch to stable, uninstall the extension and re-install it from the marketplace`); } @@ -185,7 +185,7 @@ async function getServer(config: Config, state: PersistentState): Promise artifact.name === binaryName); assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 }); - await state.updateServerVersion(config.packageJsonVersion); + await state.updateServerVersion(config.package.version); return dest; } From 7e5d305372c46202792e301a57a671dff01ed9c5 Mon Sep 17 00:00:00 2001 From: Matt Hooper Date: Mon, 23 Mar 2020 23:32:50 +0100 Subject: [PATCH 571/819] Extension types and rendering --- rust-analyzer/editors/code/package.json | 5 +++ rust-analyzer/editors/code/src/client.ts | 1 + rust-analyzer/editors/code/src/config.ts | 1 + rust-analyzer/editors/code/src/inlay_hints.ts | 32 +++++++++++++++++-- .../editors/code/src/rust-analyzer-api.ts | 4 ++- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1d113ebb..37e08322 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -333,6 +333,11 @@ "default": true, "description": "Whether to show inlay type hints" }, + "rust-analyzer.inlayHints.chainingHints": { + "type": "boolean", + "default": true, + "description": "Whether to show inlay type hints for method chains" + }, "rust-analyzer.inlayHints.parameterHints": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 82ca749f..98f2f232 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -32,6 +32,7 @@ export async function createClient(config: Config, serverPath: string): Promise< inlayHintsType: config.inlayHints.typeHints, inlayHintsParameter: config.inlayHints.parameterHints, + inlayHintsChaining: config.inlayHints.chainingHints, inlayHintsMaxLength: config.inlayHints.maxLength, cargoWatchEnable: cargoWatchOpts.enable, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 7668c20b..637aea27 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -88,6 +88,7 @@ export class Config { return { typeHints: this.cfg.get("inlayHints.typeHints")!, parameterHints: this.cfg.get("inlayHints.parameterHints")!, + chainingHints: this.cfg.get("inlayHints.chainingHints")!, maxLength: this.cfg.get("inlayHints.maxLength")!, }; } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 17d0dfa3..542d1f36 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -10,7 +10,11 @@ export function activateInlayHints(ctx: Ctx) { const maybeUpdater = { updater: null as null | HintsUpdater, onConfigChange() { - if (!ctx.config.inlayHints.typeHints && !ctx.config.inlayHints.parameterHints) { + if ( + !ctx.config.inlayHints.typeHints && + !ctx.config.inlayHints.parameterHints && + !ctx.config.inlayHints.chainingHints + ) { return this.dispose(); } if (!this.updater) this.updater = new HintsUpdater(ctx); @@ -63,6 +67,22 @@ const paramHints = { } }; +const chainingHints = { + decorationType: vscode.window.createTextEditorDecorationType({ + after: { + color: new vscode.ThemeColor('rust_analyzer.inlayHint'), + fontStyle: "normal", + } + }), + + toDecoration(hint: ra.InlayHint.ChainingHint, conv: lc.Protocol2CodeConverter): vscode.DecorationOptions { + return { + range: conv.asRange(hint.range), + renderOptions: { after: { contentText: ` ${hint.label}` } } + }; + } +}; + class HintsUpdater implements Disposable { private sourceFiles = new Map(); // map Uri -> RustSourceFile private readonly disposables: Disposable[] = []; @@ -95,7 +115,7 @@ class HintsUpdater implements Disposable { dispose() { this.sourceFiles.forEach(file => file.inlaysRequest?.cancel()); - this.ctx.visibleRustEditors.forEach(editor => this.renderDecorations(editor, { param: [], type: [] })); + this.ctx.visibleRustEditors.forEach(editor => this.renderDecorations(editor, { param: [], type: [], chaining: [] })); this.disposables.forEach(d => d.dispose()); } @@ -154,10 +174,11 @@ class HintsUpdater implements Disposable { private renderDecorations(editor: RustEditor, decorations: InlaysDecorations) { editor.setDecorations(typeHints.decorationType, decorations.type); editor.setDecorations(paramHints.decorationType, decorations.param); + editor.setDecorations(chainingHints.decorationType, decorations.chaining); } private hintsToDecorations(hints: ra.InlayHint[]): InlaysDecorations { - const decorations: InlaysDecorations = { type: [], param: [] }; + const decorations: InlaysDecorations = { type: [], param: [], chaining: [] }; const conv = this.ctx.client.protocol2CodeConverter; for (const hint of hints) { @@ -170,6 +191,10 @@ class HintsUpdater implements Disposable { decorations.param.push(paramHints.toDecoration(hint, conv)); continue; } + case ra.InlayHint.Kind.ChainingHint: { + decorations.chaining.push(chainingHints.toDecoration(hint, conv)); + continue; + } } } return decorations; @@ -196,6 +221,7 @@ class HintsUpdater implements Disposable { interface InlaysDecorations { type: vscode.DecorationOptions[]; param: vscode.DecorationOptions[]; + chaining: vscode.DecorationOptions[]; } interface RustSourceFile { diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 9846f734..400ac371 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -86,12 +86,13 @@ export interface Runnable { } export const runnables = request>("runnables"); -export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint; +export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; export namespace InlayHint { export const enum Kind { TypeHint = "TypeHint", ParamHint = "ParameterHint", + ChainingHint = "ChainingHint", } interface Common { range: lc.Range; @@ -99,6 +100,7 @@ export namespace InlayHint { } export type TypeHint = Common & { kind: Kind.TypeHint }; export type ParamHint = Common & { kind: Kind.ParamHint }; + export type ChainingHint = Common & { kind: Kind.ChainingHint }; } export interface InlayHintsParams { textDocument: lc.TextDocumentIdentifier; From 3293145a0c8975ea5d1ada5dd972d05f0e567f20 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Mar 2020 10:51:03 +0100 Subject: [PATCH 572/819] Use the right arch name for x86 (32 bit) --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 7b7c19df..de27d953 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -188,7 +188,7 @@ async function getServer(config: Config, state: PersistentState): Promise Date: Wed, 25 Mar 2020 21:00:04 +0200 Subject: [PATCH 573/819] vscode: refactor analyzer status --- .../code/src/commands/analyzer_status.ts | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts index 1c6ea399..09daa340 100644 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ b/rust-analyzer/editors/code/src/commands/analyzer_status.ts @@ -5,7 +5,7 @@ import { Ctx, Cmd } from '../ctx'; // Shows status of rust-analyzer (for debugging) export function analyzerStatus(ctx: Ctx): Cmd { - let poller: NodeJS.Timer | null = null; + let poller: NodeJS.Timer | undefined = undefined; const tdcp = new TextDocumentContentProvider(ctx); ctx.pushCleanup( @@ -17,41 +17,32 @@ export function analyzerStatus(ctx: Ctx): Cmd { ctx.pushCleanup({ dispose() { - if (poller != null) { + if (poller !== undefined) { clearInterval(poller); } }, }); - return async function handle() { - if (poller == null) { + return async () => { + if (poller === undefined) { poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000); } const document = await vscode.workspace.openTextDocument(tdcp.uri); - return vscode.window.showTextDocument( - document, - vscode.ViewColumn.Two, - true, - ); + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); }; } -class TextDocumentContentProvider - implements vscode.TextDocumentContentProvider { - uri = vscode.Uri.parse('rust-analyzer-status://status'); - eventEmitter = new vscode.EventEmitter(); +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { + readonly uri = vscode.Uri.parse('rust-analyzer-status://status'); + readonly eventEmitter = new vscode.EventEmitter(); constructor(private readonly ctx: Ctx) { } - provideTextDocumentContent( - _uri: vscode.Uri, - ): vscode.ProviderResult { - const editor = vscode.window.activeTextEditor; - const client = this.ctx.client; - if (!editor || !client) return ''; + provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult { + if (!vscode.window.activeTextEditor) return ''; - return client.sendRequest(ra.analyzerStatus, null); + return this.ctx.client.sendRequest(ra.analyzerStatus, null); } get onDidChange(): vscode.Event { From 777fde623ec276f01fcc42dd8c19c492cd40fbca Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 25 Mar 2020 20:56:48 +0200 Subject: [PATCH 574/819] vscode: fix local devel The value of releaseTag is not undefined, but null in actual package.json --- rust-analyzer/editors/code/src/config.ts | 2 +- rust-analyzer/editors/code/src/main.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 637aea27..e77462c1 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -21,7 +21,7 @@ export class Config { readonly package: { version: string; - releaseTag: string | undefined; + releaseTag: string | null; enableProposedApi: boolean | undefined; } = vscode.extensions.getExtension(this.extensionId)!.packageJSON; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index de27d953..814ae9dc 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -110,11 +110,13 @@ async function bootstrap(config: Config, state: PersistentState): Promise { - if (config.package.releaseTag === undefined) return; + if (config.package.releaseTag === null) return; if (config.channel === "stable") { if (config.package.releaseTag === NIGHTLY_TAG) { - vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension. -To switch to stable, uninstall the extension and re-install it from the marketplace`); + void vscode.window.showWarningMessage( + `You are running a nightly version of rust-analyzer extension. ` + + `To switch to stable, uninstall the extension and re-install it from the marketplace` + ); } return; }; @@ -185,7 +187,7 @@ async function getServer(config: Config, state: PersistentState): Promise Date: Thu, 26 Mar 2020 23:44:19 +0200 Subject: [PATCH 575/819] vscode: fix memory leak on server restart The memory leak was because on the server restrart the array of extensionContext.substiptions was not cleared --- rust-analyzer/editors/code/src/main.ts | 28 ++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 814ae9dc..6cde5c36 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -48,21 +48,19 @@ export async function activate(context: vscode.ExtensionContext) { ctx = await Ctx.create(config, context, serverPath); // Commands which invokes manually via command palette, shortcut, etc. - ctx.registerCommand('reload', (ctx) => { - return async () => { - vscode.window.showInformationMessage('Reloading rust-analyzer...'); - // @DanTup maneuver - // https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895 - await deactivate(); - for (const sub of ctx.subscriptions) { - try { - sub.dispose(); - } catch (e) { - log.error(e); - } + + // Reloading is inspired by @DanTup maneuver: https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895 + ctx.registerCommand('reload', _ => async () => { + void vscode.window.showInformationMessage('Reloading rust-analyzer...'); + await deactivate(); + while (context.subscriptions.length > 0) { + try { + context.subscriptions.pop()!.dispose(); + } catch (err) { + log.error("Dispose error:", err); } - await activate(context); - }; + } + await activate(context).catch(log.error); }); ctx.registerCommand('analyzerStatus', commands.analyzerStatus); @@ -96,7 +94,7 @@ export async function activate(context: vscode.ExtensionContext) { } export async function deactivate() { - await ctx?.client?.stop(); + await ctx?.client.stop(); ctx = undefined; } From 033811eb8bc52f9f3c350d6b8a01d46f500cf727 Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 26 Mar 2020 23:45:01 +0200 Subject: [PATCH 576/819] vscode: small post-refactor --- rust-analyzer/editors/code/src/main.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 6cde5c36..980ed925 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -169,9 +169,7 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< log.debug("Checked binary availability via --version", res); log.debug(res, "--version output:", res.output); if (res.status !== 0) { - throw new Error( - `Failed to execute ${path} --version` - ); + throw new Error(`Failed to execute ${path} --version`); } return path; From 998db5324b8268327d7316408d49e145b55598a0 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 24 Mar 2020 01:15:56 +0200 Subject: [PATCH 577/819] vscode: show release tag with along with the commit hash for RA version command --- .../editors/code/src/commands/server_version.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 03528b82..45fdefb1 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -4,7 +4,12 @@ import { Ctx, Cmd } from '../ctx'; export function serverVersion(ctx: Ctx): Cmd { return async () => { - const version = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }).stdout; - vscode.window.showInformationMessage('rust-analyzer version : ' + version); + const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); + const commitHash = stdout.slice(`rust-analyzer `.length).trim(); + const { releaseTag } = ctx.config; + + void vscode.window.showInformationMessage( + `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` + ); }; } From 0d88aa697463c3ad6dd7c2cfd8177f2bb9532374 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 27 Mar 2020 11:05:37 +0200 Subject: [PATCH 578/819] vscode: fix release tag retrieval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Laurențiu Nicola --- rust-analyzer/editors/code/src/commands/server_version.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts index 45fdefb1..d64ac726 100644 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ b/rust-analyzer/editors/code/src/commands/server_version.ts @@ -6,7 +6,7 @@ export function serverVersion(ctx: Ctx): Cmd { return async () => { const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); const commitHash = stdout.slice(`rust-analyzer `.length).trim(); - const { releaseTag } = ctx.config; + const { releaseTag } = ctx.config.package; void vscode.window.showInformationMessage( `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` From 82c83a8b9f5b4645a4d528777b786ea518471a98 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Mar 2020 01:39:12 +0200 Subject: [PATCH 579/819] Client side draft --- rust-analyzer/editors/code/src/main.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 980ed925..63d145db 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -91,6 +91,12 @@ export async function activate(context: vscode.ExtensionContext) { activateHighlighting(ctx); } activateInlayHints(ctx); + + vscode.workspace.onDidChangeConfiguration( + _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }), + null, + ctx?.subscriptions, + ); } export async function deactivate() { From 474c5612296eb2f3c60b9c97358abb5b6a903976 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Mar 2020 23:56:32 +0200 Subject: [PATCH 580/819] Process configuration response draft --- rust-analyzer/editors/code/src/config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e77462c1..501997fe 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -12,9 +12,9 @@ export class Config { private readonly requiresReloadOpts = [ "serverPath", "cargoFeatures", - "cargo-watch", - "highlighting.semanticTokens", - "inlayHints", + "excludeGlobs", + "useClientWatching", + "highlighting", "updates.channel", ] .map(opt => `${this.rootSection}.${opt}`); From d211efeadb28b784b9a71d5e8c383b82c5ac404b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 20 Mar 2020 00:42:18 +0200 Subject: [PATCH 581/819] Send the config from the client --- rust-analyzer/editors/code/src/client.ts | 49 +++++++++++++----------- rust-analyzer/editors/code/src/ctx.ts | 3 +- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 98f2f232..0d0832c4 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -5,6 +5,31 @@ import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +export function configToOptions(config: Config): object { + return { + publishDecorations: !config.highlightingSemanticTokens, + lruCapacity: config.lruCapacity, + + inlayHintsType: config.inlayHints.typeHints, + inlayHintsParameter: config.inlayHints.parameterHints, + inlayHintsChaining: config.inlayHints.chainingHints, + inlayHintsMaxLength: config.inlayHints.maxLength, + + cargoWatchEnable: config.cargoWatchOptions.enable, + cargoWatchArgs: config.cargoWatchOptions.arguments, + cargoWatchCommand: config.cargoWatchOptions.command, + cargoWatchAllTargets: config.cargoWatchOptions.allTargets, + + excludeGlobs: config.excludeGlobs, + useClientWatching: config.useClientWatching, + featureFlags: config.featureFlags, + withSysroot: config.withSysroot, + cargoFeatures: config.cargoFeatures, + rustfmtArgs: config.rustfmtArgs, + vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null, + }; +} + export async function createClient(config: Config, serverPath: string): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). @@ -22,32 +47,10 @@ export async function createClient(config: Config, serverPath: string): Promise< const traceOutputChannel = vscode.window.createOutputChannel( 'Rust Analyzer Language Server Trace', ); - const cargoWatchOpts = config.cargoWatchOptions; const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], - initializationOptions: { - publishDecorations: !config.highlightingSemanticTokens, - lruCapacity: config.lruCapacity, - - inlayHintsType: config.inlayHints.typeHints, - inlayHintsParameter: config.inlayHints.parameterHints, - inlayHintsChaining: config.inlayHints.chainingHints, - inlayHintsMaxLength: config.inlayHints.maxLength, - - cargoWatchEnable: cargoWatchOpts.enable, - cargoWatchArgs: cargoWatchOpts.arguments, - cargoWatchCommand: cargoWatchOpts.command, - cargoWatchAllTargets: cargoWatchOpts.allTargets, - - excludeGlobs: config.excludeGlobs, - useClientWatching: config.useClientWatching, - featureFlags: config.featureFlags, - withSysroot: config.withSysroot, - cargoFeatures: config.cargoFeatures, - rustfmtArgs: config.rustfmtArgs, - vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null, - }, + initializationOptions: configToOptions(config), traceOutputChannel, middleware: { // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 84c170ea..934638c6 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { createClient } from './client'; +import { createClient, configToOptions } from './client'; import { isRustEditor, RustEditor } from './util'; export class Ctx { @@ -20,6 +20,7 @@ export class Ctx { const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); + client.onRequest('workspace/configuration', _ => [configToOptions(config)]); return res; } From e9f8d0acd8ea4ed87cf63de693dffc06cc783f0f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 21 Mar 2020 00:01:47 +0200 Subject: [PATCH 582/819] Style fixes --- rust-analyzer/editors/code/src/client.ts | 4 ++-- rust-analyzer/editors/code/src/ctx.ts | 4 ++-- rust-analyzer/editors/code/src/inlay_hints.ts | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 0d0832c4..34965e2f 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -5,7 +5,7 @@ import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; -export function configToOptions(config: Config): object { +export function configToServerOptions(config: Config): object { return { publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, @@ -50,7 +50,7 @@ export async function createClient(config: Config, serverPath: string): Promise< const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], - initializationOptions: configToOptions(config), + initializationOptions: configToServerOptions(config), traceOutputChannel, middleware: { // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 934638c6..d2f49cd2 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { createClient, configToOptions } from './client'; +import { createClient, configToServerOptions } from './client'; import { isRustEditor, RustEditor } from './util'; export class Ctx { @@ -20,7 +20,7 @@ export class Ctx { const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); - client.onRequest('workspace/configuration', _ => [configToOptions(config)]); + client.onRequest('workspace/configuration', _ => [configToServerOptions(config)]); return res; } diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 542d1f36..98663e0e 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -18,6 +18,8 @@ export function activateInlayHints(ctx: Ctx) { return this.dispose(); } if (!this.updater) this.updater = new HintsUpdater(ctx); + + this.updater.syncCacheAndRenderHints(); }, dispose() { this.updater?.dispose(); @@ -124,7 +126,7 @@ class HintsUpdater implements Disposable { this.syncCacheAndRenderHints(); } - private syncCacheAndRenderHints() { + public syncCacheAndRenderHints() { // FIXME: make inlayHints request pass an array of files? this.sourceFiles.forEach((file, uri) => this.fetchHints(file).then(hints => { if (!hints) return; From 908ac0bf9fc37dfbbc63c488957abd725046a0e9 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 22 Mar 2020 00:40:07 +0200 Subject: [PATCH 583/819] Code review fixes Co-Authored-By: Veetaha --- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 10 ++++++---- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 34965e2f..d72ecc58 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -5,7 +5,7 @@ import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; -export function configToServerOptions(config: Config): object { +export function configToServerOptions(config: Config) { return { publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 98663e0e..6a8bd942 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -17,9 +17,11 @@ export function activateInlayHints(ctx: Ctx) { ) { return this.dispose(); } - if (!this.updater) this.updater = new HintsUpdater(ctx); - - this.updater.syncCacheAndRenderHints(); + if (this.updater) { + this.updater.syncCacheAndRenderHints(); + } else { + this.updater = new HintsUpdater(ctx); + } }, dispose() { this.updater?.dispose(); @@ -126,7 +128,7 @@ class HintsUpdater implements Disposable { this.syncCacheAndRenderHints(); } - public syncCacheAndRenderHints() { + syncCacheAndRenderHints() { // FIXME: make inlayHints request pass an array of files? this.sourceFiles.forEach((file, uri) => this.fetchHints(file).then(hints => { if (!hints) return; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 63d145db..a46dbde3 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -95,7 +95,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.onDidChangeConfiguration( _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }), null, - ctx?.subscriptions, + ctx.subscriptions, ); } From 88db662e0272af929c2f607bc5a9aa1ebc12ad40 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 30 Mar 2020 18:12:22 +0100 Subject: [PATCH 584/819] Add basic task support This adds basic support for running `cargo build`, `cargo run`, etc. --- rust-analyzer/editors/code/src/client.ts | 5 +- rust-analyzer/editors/code/src/ctx.ts | 9 +++- rust-analyzer/editors/code/src/main.ts | 9 +++- rust-analyzer/editors/code/src/tasks.ts | 60 ++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 rust-analyzer/editors/code/src/tasks.ts diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index d72ecc58..c9819e45 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -30,15 +30,14 @@ export function configToServerOptions(config: Config) { }; } -export async function createClient(config: Config, serverPath: string): Promise { +export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder | null): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. - const workspaceFolderPath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.'; const run: lc.Executable = { command: serverPath, - options: { cwd: workspaceFolderPath }, + options: { cwd: workspaceFolder?.uri.fsPath ?? '.' }, }; const serverOptions: lc.ServerOptions = { run, diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index d2f49cd2..0e705bc8 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -15,8 +15,13 @@ export class Ctx { } - static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { - const client = await createClient(config, serverPath); + static async create( + config: Config, + extCtx: vscode.ExtensionContext, + serverPath: string, + workspaceFolder: vscode.WorkspaceFolder | null, + ): Promise { + const client = await createClient(config, serverPath, workspaceFolder); const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a46dbde3..40701e4f 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -13,6 +13,7 @@ import { log, assert } from './util'; import { PersistentState } from './persistent_state'; import { fetchRelease, download } from './net'; import { spawnSync } from 'child_process'; +import { activateTaskProvider } from './tasks'; let ctx: Ctx | undefined; @@ -41,11 +42,13 @@ export async function activate(context: vscode.ExtensionContext) { const state = new PersistentState(context.globalState); const serverPath = await bootstrap(config, state); + const workspaceFolder = vscode.workspace.workspaceFolders?.[0] ?? null; + // Note: we try to start the server before we activate type hints so that it // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - ctx = await Ctx.create(config, context, serverPath); + ctx = await Ctx.create(config, context, serverPath, workspaceFolder); // Commands which invokes manually via command palette, shortcut, etc. @@ -85,6 +88,10 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); + if (workspaceFolder !== null) { + ctx.pushCleanup(activateTaskProvider(workspaceFolder)); + } + activateStatusDisplay(ctx); if (!ctx.config.highlightingSemanticTokens) { diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts new file mode 100644 index 00000000..be036b87 --- /dev/null +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -0,0 +1,60 @@ +import { + Disposable, + ShellExecution, + Task, + TaskGroup, + TaskProvider, + tasks, + WorkspaceFolder, +} from 'vscode'; + +// This ends up as the `type` key in tasks.json. RLS also uses `cargo` and +// our configuration should be compatible with it so use the same key. +const TASK_TYPE = 'cargo'; + +export function activateTaskProvider(target: WorkspaceFolder): Disposable { + const provider: TaskProvider = { + // Detect Rust tasks. Currently we do not do any actual detection + // of tasks (e.g. aliases in .cargo/config) and just return a fixed + // set of tasks that always exist. These tasks cannot be removed in + // tasks.json - only tweaked. + provideTasks: () => getStandardCargoTasks(target), + + // We don't need to implement this. + resolveTask: () => undefined, + }; + + return tasks.registerTaskProvider(TASK_TYPE, provider); +} + +function getStandardCargoTasks(target: WorkspaceFolder): Task[] { + return [ + { command: 'build', group: TaskGroup.Build }, + { command: 'check', group: TaskGroup.Build }, + { command: 'test', group: TaskGroup.Test }, + { command: 'clean', group: TaskGroup.Clean }, + { command: 'run', group: undefined }, + ] + .map(({ command, group }) => { + const vscodeTask = new Task( + // The contents of this object end up in the tasks.json entries. + { + type: TASK_TYPE, + command, + }, + // The scope of the task - workspace or specific folder (global + // is not supported). + target, + // The task name, and task source. These are shown in the UI as + // `${source}: ${name}`, e.g. `rust: cargo build`. + `cargo ${command}`, + 'rust', + // What to do when this command is executed. + new ShellExecution('cargo', [command]), + // Problem matchers. + ['$rustc'], + ); + vscodeTask.group = group; + return vscodeTask; + }); +} From 5e752ee66d54c35a6c7fdae85e89f0517d0e4d65 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Mar 2020 09:01:41 +0100 Subject: [PATCH 585/819] Use namespace import --- rust-analyzer/editors/code/src/tasks.ts | 30 +++++++++---------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index be036b87..fa1c4a95 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -1,19 +1,11 @@ -import { - Disposable, - ShellExecution, - Task, - TaskGroup, - TaskProvider, - tasks, - WorkspaceFolder, -} from 'vscode'; +import * as vscode from 'vscode'; // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and // our configuration should be compatible with it so use the same key. const TASK_TYPE = 'cargo'; -export function activateTaskProvider(target: WorkspaceFolder): Disposable { - const provider: TaskProvider = { +export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { + const provider: vscode.TaskProvider = { // Detect Rust tasks. Currently we do not do any actual detection // of tasks (e.g. aliases in .cargo/config) and just return a fixed // set of tasks that always exist. These tasks cannot be removed in @@ -24,19 +16,19 @@ export function activateTaskProvider(target: WorkspaceFolder): Disposable { resolveTask: () => undefined, }; - return tasks.registerTaskProvider(TASK_TYPE, provider); + return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); } -function getStandardCargoTasks(target: WorkspaceFolder): Task[] { +function getStandardCargoTasks(target: vscode.WorkspaceFolder): vscode.Task[] { return [ - { command: 'build', group: TaskGroup.Build }, - { command: 'check', group: TaskGroup.Build }, - { command: 'test', group: TaskGroup.Test }, - { command: 'clean', group: TaskGroup.Clean }, + { command: 'build', group: vscode.TaskGroup.Build }, + { command: 'check', group: vscode.TaskGroup.Build }, + { command: 'test', group: vscode.TaskGroup.Test }, + { command: 'clean', group: vscode.TaskGroup.Clean }, { command: 'run', group: undefined }, ] .map(({ command, group }) => { - const vscodeTask = new Task( + const vscodeTask = new vscode.Task( // The contents of this object end up in the tasks.json entries. { type: TASK_TYPE, @@ -50,7 +42,7 @@ function getStandardCargoTasks(target: WorkspaceFolder): Task[] { `cargo ${command}`, 'rust', // What to do when this command is executed. - new ShellExecution('cargo', [command]), + new vscode.ShellExecution('cargo', [command]), // Problem matchers. ['$rustc'], ); From 2f2153a8361223a6e1a99b7b0153c2f7cc8d2642 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Mar 2020 09:05:22 +0100 Subject: [PATCH 586/819] Throw error if no folder is opened --- rust-analyzer/editors/code/src/client.ts | 4 ++-- rust-analyzer/editors/code/src/ctx.ts | 2 +- rust-analyzer/editors/code/src/main.ts | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index c9819e45..0de45bb3 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -30,14 +30,14 @@ export function configToServerOptions(config: Config) { }; } -export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder | null): Promise { +export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. const run: lc.Executable = { command: serverPath, - options: { cwd: workspaceFolder?.uri.fsPath ?? '.' }, + options: { cwd: workspaceFolder.uri.fsPath }, }; const serverOptions: lc.ServerOptions = { run, diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 0e705bc8..255d57f5 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -19,7 +19,7 @@ export class Ctx { config: Config, extCtx: vscode.ExtensionContext, serverPath: string, - workspaceFolder: vscode.WorkspaceFolder | null, + workspaceFolder: vscode.WorkspaceFolder, ): Promise { const client = await createClient(config, serverPath, workspaceFolder); const res = new Ctx(config, extCtx, client, serverPath); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 40701e4f..ee6e712a 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -42,7 +42,12 @@ export async function activate(context: vscode.ExtensionContext) { const state = new PersistentState(context.globalState); const serverPath = await bootstrap(config, state); - const workspaceFolder = vscode.workspace.workspaceFolders?.[0] ?? null; + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + if (workspaceFolder === undefined) { + const err = "Cannot activate rust-analyzer when no folder is opened"; + void vscode.window.showErrorMessage(err); + throw new Error(err); + } // Note: we try to start the server before we activate type hints so that it // registers its `onDidChangeDocument` handler before us. From 21d9252312f1dd539d647f761aae91b4b31426f2 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Mar 2020 09:11:22 +0100 Subject: [PATCH 587/819] Remove unnecessary null check --- rust-analyzer/editors/code/src/main.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ee6e712a..c1e2b97c 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -93,9 +93,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); - if (workspaceFolder !== null) { - ctx.pushCleanup(activateTaskProvider(workspaceFolder)); - } + ctx.pushCleanup(activateTaskProvider(workspaceFolder)); activateStatusDisplay(ctx); From 6b7867432a37bf15d337f19e4547ff94e4d99f09 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Mar 2020 10:23:18 +0100 Subject: [PATCH 588/819] Pass string instread of WorkspaceFolder --- rust-analyzer/editors/code/src/client.ts | 4 ++-- rust-analyzer/editors/code/src/ctx.ts | 4 ++-- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 0de45bb3..f909f8db 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -30,14 +30,14 @@ export function configToServerOptions(config: Config) { }; } -export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder): Promise { +export async function createClient(config: Config, serverPath: string, cwd: string): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. const run: lc.Executable = { command: serverPath, - options: { cwd: workspaceFolder.uri.fsPath }, + options: { cwd }, }; const serverOptions: lc.ServerOptions = { run, diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 255d57f5..86b5f362 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -19,9 +19,9 @@ export class Ctx { config: Config, extCtx: vscode.ExtensionContext, serverPath: string, - workspaceFolder: vscode.WorkspaceFolder, + cwd: string, ): Promise { - const client = await createClient(config, serverPath, workspaceFolder); + const client = await createClient(config, serverPath, cwd); const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index c1e2b97c..7ba16120 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -53,7 +53,7 @@ export async function activate(context: vscode.ExtensionContext) { // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - ctx = await Ctx.create(config, context, serverPath, workspaceFolder); + ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath); // Commands which invokes manually via command palette, shortcut, etc. From a7e05c1a61d700896dabe2cae10d5f1c7a8576a3 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 31 Mar 2020 16:05:42 +0300 Subject: [PATCH 589/819] vscode: add syntax tree inspection hovers and highlights --- .../editors/code/src/commands/syntax_tree.ts | 169 ++++++++++++------ rust-analyzer/editors/code/src/util.ts | 4 +- 2 files changed, 118 insertions(+), 55 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 2e08e8f1..21ecf266 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -1,8 +1,10 @@ import * as vscode from 'vscode'; import * as ra from '../rust-analyzer-api'; -import { Ctx, Cmd } from '../ctx'; -import { isRustDocument } from '../util'; +import { Ctx, Cmd, Disposable } from '../ctx'; +import { isRustDocument, RustEditor, isRustEditor, sleep } from '../util'; + +const AST_FILE_SCHEME = "rust-analyzer"; // Opens the virtual file that will show the syntax tree // @@ -10,35 +12,13 @@ import { isRustDocument } from '../util'; export function syntaxTree(ctx: Ctx): Cmd { const tdcp = new TextDocumentContentProvider(ctx); - ctx.pushCleanup( - vscode.workspace.registerTextDocumentContentProvider( - 'rust-analyzer', - tdcp, - ), - ); - - vscode.workspace.onDidChangeTextDocument( - (event: vscode.TextDocumentChangeEvent) => { - const doc = event.document; - if (!isRustDocument(doc)) return; - afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); - }, - null, - ctx.subscriptions, - ); - - vscode.window.onDidChangeActiveTextEditor( - (editor: vscode.TextEditor | undefined) => { - if (!editor || !isRustDocument(editor.document)) return; - tdcp.eventEmitter.fire(tdcp.uri); - }, - null, - ctx.subscriptions, - ); + ctx.pushCleanup(new AstInspector); + ctx.pushCleanup(tdcp); + ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); return async () => { const editor = vscode.window.activeTextEditor; - const rangeEnabled = !!(editor && !editor.selection.isEmpty); + const rangeEnabled = !!editor && !editor.selection.isEmpty; const uri = rangeEnabled ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) @@ -48,45 +28,128 @@ export function syntaxTree(ctx: Ctx): Cmd { tdcp.eventEmitter.fire(uri); - return vscode.window.showTextDocument( - document, - vscode.ViewColumn.Two, - true, - ); + void await vscode.window.showTextDocument(document, { + viewColumn: vscode.ViewColumn.Two, + preserveFocus: true + }); }; } -// We need to order this after LS updates, but there's no API for that. -// Hence, good old setTimeout. -function afterLs(f: () => void) { - setTimeout(f, 10); -} - - -class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); - eventEmitter = new vscode.EventEmitter(); +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider, Disposable { + readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); + readonly eventEmitter = new vscode.EventEmitter(); + private readonly disposables: Disposable[] = []; constructor(private readonly ctx: Ctx) { + vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, this.disposables); + vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, this.disposables); + } + dispose() { + this.disposables.forEach(d => d.dispose()); } - provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { - const editor = vscode.window.activeTextEditor; - const client = this.ctx.client; - if (!editor || !client) return ''; + private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { + if (isRustDocument(event.document)) { + // We need to order this after language server updates, but there's no API for that. + // Hence, good old sleep(). + void sleep(10).then(() => this.eventEmitter.fire(this.uri)); + } + } + private onDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined) { + if (editor && isRustEditor(editor)) { + this.eventEmitter.fire(this.uri); + } + } + + provideTextDocumentContent(uri: vscode.Uri, ct: vscode.CancellationToken): vscode.ProviderResult { + const rustEditor = this.ctx.activeRustEditor; + if (!rustEditor) return ''; // When the range based query is enabled we take the range of the selection - const range = uri.query === 'range=true' && !editor.selection.isEmpty - ? client.code2ProtocolConverter.asRange(editor.selection) + const range = uri.query === 'range=true' && !rustEditor.selection.isEmpty + ? this.ctx.client.code2ProtocolConverter.asRange(rustEditor.selection) : null; - return client.sendRequest(ra.syntaxTree, { - textDocument: { uri: editor.document.uri.toString() }, - range, - }); + const params = { textDocument: { uri: rustEditor.document.uri.toString() }, range, }; + return this.ctx.client.sendRequest(ra.syntaxTree, params, ct); } get onDidChange(): vscode.Event { return this.eventEmitter.event; } } + + +// FIXME: consider implementing this via the Tree View API? +// https://code.visualstudio.com/api/extension-guides/tree-view +class AstInspector implements vscode.HoverProvider, Disposable { + private static readonly astDecorationType = vscode.window.createTextEditorDecorationType({ + fontStyle: "normal", + border: "#ffffff 1px solid", + }); + private rustEditor: undefined | RustEditor; + private readonly disposables: Disposable[] = []; + + constructor() { + this.disposables.push(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); + vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, this.disposables); + vscode.window.onDidChangeVisibleTextEditors(this.onDidChangeVisibleTextEditors, this, this.disposables); + } + dispose() { + this.setRustEditor(undefined); + this.disposables.forEach(d => d.dispose()); + } + + private onDidCloseTextDocument(doc: vscode.TextDocument) { + if (!!this.rustEditor && doc.uri.toString() === this.rustEditor.document.uri.toString()) { + this.setRustEditor(undefined); + } + } + + private onDidChangeVisibleTextEditors(editors: vscode.TextEditor[]) { + if (editors.every(suspect => suspect.document.uri.scheme !== AST_FILE_SCHEME)) { + this.setRustEditor(undefined); + return; + } + this.setRustEditor(editors.find(isRustEditor)); + } + + private setRustEditor(newRustEditor: undefined | RustEditor) { + if (newRustEditor !== this.rustEditor) { + this.rustEditor?.setDecorations(AstInspector.astDecorationType, []); + } + this.rustEditor = newRustEditor; + } + + provideHover(doc: vscode.TextDocument, hoverPosition: vscode.Position): vscode.ProviderResult { + if (!this.rustEditor) return; + + const astTextLine = doc.lineAt(hoverPosition.line); + + const rustTextRange = this.parseRustTextRange(this.rustEditor.document, astTextLine.text); + if (!rustTextRange) return; + + this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]); + + const rustSourceCode = this.rustEditor.document.getText(rustTextRange); + const astTextRange = this.findAstRange(astTextLine); + + return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astTextRange); + } + + private findAstRange(astLine: vscode.TextLine) { + const lineOffset = astLine.range.start; + const begin = lineOffset.translate(undefined, astLine.firstNonWhitespaceCharacterIndex); + const end = lineOffset.translate(undefined, astLine.text.trimEnd().length); + return new vscode.Range(begin, end); + } + + private parseRustTextRange(doc: vscode.TextDocument, astLine: string): undefined | vscode.Range { + const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); + if (!parsedRange) return; + + const [, begin, end] = parsedRange.map(off => doc.positionAt(+off)); + + return new vscode.Range(begin, end); + } +} diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 978a3175..6f91f81d 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -65,12 +65,12 @@ export async function sendRequestWithRetry( throw 'unreachable'; } -function sleep(ms: number) { +export function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } export type RustDocument = vscode.TextDocument & { languageId: "rust" }; -export type RustEditor = vscode.TextEditor & { document: RustDocument; id: string }; +export type RustEditor = vscode.TextEditor & { document: RustDocument }; export function isRustDocument(document: vscode.TextDocument): document is RustDocument { return document.languageId === 'rust' From 00f71c9d6cf8ec5938d289868910a06e660cf501 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 31 Mar 2020 09:47:53 -0400 Subject: [PATCH 590/819] Update node deps --- rust-analyzer/editors/code/package-lock.json | 59 ++++++++++++-------- rust-analyzer/editors/code/package.json | 8 +-- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index b7220d8e..955a0506 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -84,9 +84,9 @@ "dev": true }, "@types/node": { - "version": "12.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.30.tgz", - "integrity": "sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg==", + "version": "12.12.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.34.tgz", + "integrity": "sha512-BneGN0J9ke24lBRn44hVHNeDlrXRYF+VRp0HbSUNnEZahXGAysHZIqnf/hER6aabdBgzM4YOV4jrR8gj4Zfi0g==", "dev": true }, "@types/node-fetch": { @@ -115,45 +115,56 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.24.0.tgz", - "integrity": "sha512-wJRBeaMeT7RLQ27UQkDFOu25MqFOBus8PtOa9KaT5ZuxC1kAsd7JEHqWt4YXuY9eancX0GK9C68i5OROnlIzBA==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.26.0.tgz", + "integrity": "sha512-4yUnLv40bzfzsXcTAtZyTjbiGUXMrcIJcIMioI22tSOyAxpdXiZ4r7YQUU8Jj6XXrLz9d5aMHPQf5JFR7h27Nw==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.24.0", - "eslint-utils": "^1.4.3", + "@typescript-eslint/experimental-utils": "2.26.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.24.0.tgz", - "integrity": "sha512-DXrwuXTdVh3ycNCMYmWhUzn/gfqu9N0VzNnahjiDJvcyhfBy4gb59ncVZVxdp5XzBC77dCncu0daQgOkbvPwBw==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.26.0.tgz", + "integrity": "sha512-RELVoH5EYd+JlGprEyojUv9HeKcZqF7nZUGSblyAw1FwOGNnmQIU8kxJ69fttQvEwCsX5D6ECJT8GTozxrDKVQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.24.0", - "eslint-scope": "^5.0.0" + "@typescript-eslint/typescript-estree": "2.26.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + } } }, "@typescript-eslint/parser": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.24.0.tgz", - "integrity": "sha512-H2Y7uacwSSg8IbVxdYExSI3T7uM1DzmOn2COGtCahCC3g8YtM1xYAPi2MAHyfPs61VKxP/J/UiSctcRgw4G8aw==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.26.0.tgz", + "integrity": "sha512-+Xj5fucDtdKEVGSh9353wcnseMRkPpEAOY96EEenN7kJVrLqy/EVwtIh3mxcUz8lsFXW1mT5nN5vvEam/a5HiQ==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.24.0", - "@typescript-eslint/typescript-estree": "2.24.0", + "@typescript-eslint/experimental-utils": "2.26.0", + "@typescript-eslint/typescript-estree": "2.26.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.24.0.tgz", - "integrity": "sha512-RJ0yMe5owMSix55qX7Mi9V6z2FDuuDpN6eR5fzRJrp+8in9UF41IGNQHbg5aMK4/PjVaEQksLvz0IA8n+Mr/FA==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.26.0.tgz", + "integrity": "sha512-3x4SyZCLB4zsKsjuhxDLeVJN6W29VwBnYpCsZ7vIdPel9ZqLfIZJgJXO47MNUkurGpQuIBALdPQKtsSnWpE1Yg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -1388,9 +1399,9 @@ } }, "rollup": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.1.0.tgz", - "integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.1.tgz", + "integrity": "sha512-BRjzOauORe+R0U0I6SkMTSG22nYmtztR/TaBl0SvbXgc3VAxBDrZoB6HROiK0S5px1pUBnLnjBkbzmVuwC9Q1Q==", "dev": true, "requires": { "fsevents": "~2.1.2" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 37e08322..ba31c4e6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,13 +39,13 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", - "@types/node": "^12.12.30", + "@types/node": "^12.12.34", "@types/node-fetch": "^2.5.5", "@types/vscode": "^1.43.0", - "@typescript-eslint/eslint-plugin": "^2.24.0", - "@typescript-eslint/parser": "^2.24.0", + "@typescript-eslint/eslint-plugin": "^2.26.0", + "@typescript-eslint/parser": "^2.26.0", "eslint": "^6.8.0", - "rollup": "^2.1.0", + "rollup": "^2.3.1", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From 504db96cfeafb58993808decda4fab4e164487c2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Mar 2020 15:55:05 +0200 Subject: [PATCH 591/819] WIP: uniformalize external tools config --- rust-analyzer/editors/code/package.json | 50 ++++++++++++++++--------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 37e08322..ddc9de1c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -261,41 +261,57 @@ "default": [], "description": "Paths to exclude from analysis" }, - "rust-analyzer.rustfmtArgs": { + "rust-analyzer.useClientWatching": { + "type": "boolean", + "default": true, + "description": "client provided file watching instead of notify watching." + }, + "rust-analyzer.rustfmt.extraArgs": { "type": "array", "items": { "type": "string" }, "default": [], - "description": "Additional arguments to rustfmt" + "markdownDescription": "Additional `cargo fmt` arguments" }, - "rust-analyzer.useClientWatching": { + "rust-analyzer.rustfmt.overrideCommand": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "markdownDescription": "Advanced option, fully override `cargo fmt` command line" + }, + "rust-analyzer.checkOnSave.enable": { "type": "boolean", "default": true, - "description": "client provided file watching instead of notify watching." + "markdownDescription": "Run `cargo check` command for diagnostics on save" + }, + "rust-analyzer.checkOnSave.cargoCommand": { + "type": "string", + "default": "check", + "markdownDescription": "Cargo command to run on save" }, - "rust-analyzer.cargo-watch.enable": { + "rust-analyzer.checkOnSave.allTargets": { "type": "boolean", "default": true, - "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save" + "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, - "rust-analyzer.cargo-watch.arguments": { + "rust-analyzer.checkOnSave.extraArgs": { "type": "array", "items": { "type": "string" }, - "markdownDescription": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", + "markdownDescription": "Additional `cargo check` arguments", "default": [] }, - "rust-analyzer.cargo-watch.command": { - "type": "string", - "markdownDescription": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", - "default": "check" - }, - "rust-analyzer.cargo-watch.allTargets": { - "type": "boolean", - "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)", - "default": true + "rust-analyzer.checkOnSave.overrideCommand": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "markdownDescription": "Advanced option, fully override `cargo check` command line (this must include at least `--message-format=json`)" }, "rust-analyzer.trace.server": { "type": "string", From 61cb30dabc2390135e6322e0cc13f3d6e2e9109f Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 31 Mar 2020 16:57:03 +0300 Subject: [PATCH 592/819] vscode: use ctx.subscriptions instead of local .disposables --- .../editors/code/src/commands/syntax_tree.ts | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 21ecf266..eba51119 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -12,8 +12,8 @@ const AST_FILE_SCHEME = "rust-analyzer"; export function syntaxTree(ctx: Ctx): Cmd { const tdcp = new TextDocumentContentProvider(ctx); - ctx.pushCleanup(new AstInspector); - ctx.pushCleanup(tdcp); + void new AstInspector(ctx); + ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); return async () => { @@ -35,17 +35,14 @@ export function syntaxTree(ctx: Ctx): Cmd { }; } -class TextDocumentContentProvider implements vscode.TextDocumentContentProvider, Disposable { +class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); readonly eventEmitter = new vscode.EventEmitter(); - private readonly disposables: Disposable[] = []; + constructor(private readonly ctx: Ctx) { - vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, this.disposables); - vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, this.disposables); - } - dispose() { - this.disposables.forEach(d => d.dispose()); + vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); + vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, ctx.subscriptions); } private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { @@ -88,16 +85,16 @@ class AstInspector implements vscode.HoverProvider, Disposable { border: "#ffffff 1px solid", }); private rustEditor: undefined | RustEditor; - private readonly disposables: Disposable[] = []; - constructor() { - this.disposables.push(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); - vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, this.disposables); - vscode.window.onDidChangeVisibleTextEditors(this.onDidChangeVisibleTextEditors, this, this.disposables); + constructor(ctx: Ctx) { + ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); + vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, ctx.subscriptions); + vscode.window.onDidChangeVisibleTextEditors(this.onDidChangeVisibleTextEditors, this, ctx.subscriptions); + + ctx.pushCleanup(this); } dispose() { this.setRustEditor(undefined); - this.disposables.forEach(d => d.dispose()); } private onDidCloseTextDocument(doc: vscode.TextDocument) { From 8345be13ed395ad18fbbb85fb0ae6f9dcaf9a533 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Mar 2020 17:00:15 +0200 Subject: [PATCH 593/819] Revert accidental package.json changes --- rust-analyzer/editors/code/package.json | 50 +++++++++---------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f1278b29..ba31c4e6 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -261,57 +261,41 @@ "default": [], "description": "Paths to exclude from analysis" }, - "rust-analyzer.useClientWatching": { - "type": "boolean", - "default": true, - "description": "client provided file watching instead of notify watching." - }, - "rust-analyzer.rustfmt.extraArgs": { - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "markdownDescription": "Additional `cargo fmt` arguments" - }, - "rust-analyzer.rustfmt.overrideCommand": { + "rust-analyzer.rustfmtArgs": { "type": "array", "items": { "type": "string" }, "default": [], - "markdownDescription": "Advanced option, fully override `cargo fmt` command line" + "description": "Additional arguments to rustfmt" }, - "rust-analyzer.checkOnSave.enable": { + "rust-analyzer.useClientWatching": { "type": "boolean", "default": true, - "markdownDescription": "Run `cargo check` command for diagnostics on save" - }, - "rust-analyzer.checkOnSave.cargoCommand": { - "type": "string", - "default": "check", - "markdownDescription": "Cargo command to run on save" + "description": "client provided file watching instead of notify watching." }, - "rust-analyzer.checkOnSave.allTargets": { + "rust-analyzer.cargo-watch.enable": { "type": "boolean", "default": true, - "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" + "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save" }, - "rust-analyzer.checkOnSave.extraArgs": { + "rust-analyzer.cargo-watch.arguments": { "type": "array", "items": { "type": "string" }, - "markdownDescription": "Additional `cargo check` arguments", + "markdownDescription": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": [] }, - "rust-analyzer.checkOnSave.overrideCommand": { - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "markdownDescription": "Advanced option, fully override `cargo check` command line (this must include at least `--message-format=json`)" + "rust-analyzer.cargo-watch.command": { + "type": "string", + "markdownDescription": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", + "default": "check" + }, + "rust-analyzer.cargo-watch.allTargets": { + "type": "boolean", + "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)", + "default": true }, "rust-analyzer.trace.server": { "type": "string", From c63f4fd0919c25fc6fbe05da1f56b214a4105f02 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 31 Mar 2020 19:06:07 +0300 Subject: [PATCH 594/819] vscode: apply review nits --- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index eba51119..91d97f9c 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -98,7 +98,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { } private onDidCloseTextDocument(doc: vscode.TextDocument) { - if (!!this.rustEditor && doc.uri.toString() === this.rustEditor.document.uri.toString()) { + if (this.rustEditor && doc.uri.toString() === this.rustEditor.document.uri.toString()) { this.setRustEditor(undefined); } } From dfd2504fd76020261225a1a397f65a171d934893 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 31 Mar 2020 20:28:10 +0300 Subject: [PATCH 595/819] vscode: scroll to the syntax node in rust editor when highlighting --- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index eba51119..e443c5e5 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -127,6 +127,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { if (!rustTextRange) return; this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]); + this.rustEditor.revealRange(rustTextRange); const rustSourceCode = this.rustEditor.document.getText(rustTextRange); const astTextRange = this.findAstRange(astTextLine); @@ -145,7 +146,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); if (!parsedRange) return; - const [, begin, end] = parsedRange.map(off => doc.positionAt(+off)); + const [begin, end] = parsedRange.slice(1).map(off => doc.positionAt(+off)); return new vscode.Range(begin, end); } From b9f2b78b2fb04d71703b47257a0c706f4ad054ca Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 1 Apr 2020 14:44:30 -0400 Subject: [PATCH 596/819] rollup 2.3.2 --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 955a0506..2d8b432a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1399,9 +1399,9 @@ } }, "rollup": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.1.tgz", - "integrity": "sha512-BRjzOauORe+R0U0I6SkMTSG22nYmtztR/TaBl0SvbXgc3VAxBDrZoB6HROiK0S5px1pUBnLnjBkbzmVuwC9Q1Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.2.tgz", + "integrity": "sha512-p66+fbfaUUOGE84sHXAOgfeaYQMslgAazoQMp//nlR519R61213EPFgrMZa48j31jNacJwexSAR1Q8V/BwGKBA==", "dev": true, "requires": { "fsevents": "~2.1.2" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ba31c4e6..146b696e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -45,7 +45,7 @@ "@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/parser": "^2.26.0", "eslint": "^6.8.0", - "rollup": "^2.3.1", + "rollup": "^2.3.2", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From cf544bf0afd19bff37267341786d799170afedd9 Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 2 Apr 2020 01:20:08 +0300 Subject: [PATCH 597/819] vscode: add support for light themes and color customization for syntax tree highlights --- rust-analyzer/editors/code/package.json | 9 +++++++++ rust-analyzer/editors/code/src/commands/syntax_tree.ts | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 146b696e..cf74c677 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -450,6 +450,15 @@ "light": "#747474", "highContrast": "#BEBEBE" } + }, + { + "id": "rust_analyzer.syntaxTreeBorder", + "description": "Color of the border displayed in the Rust source code for the selected syntax node (see \"Show Syntax Tree\" command)", + "defaults": { + "dark": "#ffffff", + "light": "#b700ff", + "highContrast": "#b700ff" + } } ], "semanticTokenTypes": [ diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 996c7a71..ad987861 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -81,8 +81,10 @@ class TextDocumentContentProvider implements vscode.TextDocumentContentProvider // https://code.visualstudio.com/api/extension-guides/tree-view class AstInspector implements vscode.HoverProvider, Disposable { private static readonly astDecorationType = vscode.window.createTextEditorDecorationType({ - fontStyle: "normal", - border: "#ffffff 1px solid", + borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'), + borderStyle: "solid", + borderWidth: "2px", + }); private rustEditor: undefined | RustEditor; From 4b79ba89e9f355da0d858999c691770721378542 Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 2 Apr 2020 05:38:52 +0300 Subject: [PATCH 598/819] vscode: add highlighting of syntax tree --- rust-analyzer/editors/code/package.json | 15 +++++++++ .../code/ra_syntax_tree.tmGrammar.json | 31 +++++++++++++++++++ .../editors/code/src/commands/syntax_tree.ts | 5 ++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 146b696e..87999fe2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -411,6 +411,21 @@ ] } ], + "languages": [ + { + "id": "ra_syntax_tree", + "extensions": [ + ".rast" + ] + } + ], + "grammars": [ + { + "language": "ra_syntax_tree", + "scopeName": "source.ra_syntax_tree", + "path": "ra_syntax_tree.tmGrammar.json" + } + ], "problemMatchers": [ { "name": "rustc", diff --git a/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json b/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json new file mode 100644 index 00000000..0d72a3e3 --- /dev/null +++ b/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + + "scopeName": "source.ra_syntax_tree", + "patterns": [ + { "include": "#node_type" }, + { "include": "#node_range_index" }, + { "include": "#token_text" } + ], + "repository": { + "node_type": { + "match": "^\\s*([A-Z_]+?)@", + "captures": { + "1": { + "name": "entity.name.class" + } + } + }, + "node_range_index": { + "match": "\\d+", + "name": "constant.numeric" + }, + "token_text": { + "match": "\".+\"", + "name": "string" + } + }, + "fileTypes": [ + "rast" + ] +} diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 996c7a71..01ab4de7 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -15,6 +15,9 @@ export function syntaxTree(ctx: Ctx): Cmd { void new AstInspector(ctx); ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); + ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", { + brackets: [["[", ")"]], + })); return async () => { const editor = vscode.window.activeTextEditor; @@ -36,7 +39,7 @@ export function syntaxTree(ctx: Ctx): Cmd { } class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); + readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast'); readonly eventEmitter = new vscode.EventEmitter(); From 6f54208a2c499ddf0ac974186e119ba761313ed4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 09:52:27 +0200 Subject: [PATCH 599/819] Remove old syntax highlighting --- rust-analyzer/editors/code/package.json | 10 - rust-analyzer/editors/code/src/client.ts | 1 - rust-analyzer/editors/code/src/config.ts | 2 - .../editors/code/src/highlighting.ts | 255 ------------------ rust-analyzer/editors/code/src/main.ts | 4 - 5 files changed, 272 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/highlighting.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 146b696e..9f98ab73 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -182,16 +182,6 @@ "default": false, "description": "Use proposed semantic tokens API for syntax highlighting" }, - "rust-analyzer.highlightingOn": { - "type": "boolean", - "default": false, - "description": "Highlight Rust code (overrides built-in syntax highlighting)" - }, - "rust-analyzer.rainbowHighlightingOn": { - "type": "boolean", - "default": false, - "description": "When highlighting Rust code, use a unique color per identifier" - }, "rust-analyzer.featureFlags": { "type": "object", "default": {}, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index f909f8db..8ddc1cdc 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -7,7 +7,6 @@ import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode- export function configToServerOptions(config: Config) { return { - publishDecorations: !config.highlightingSemanticTokens, lruCapacity: config.lruCapacity, inlayHintsType: config.inlayHints.typeHints, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 501997fe..c37c6276 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -71,8 +71,6 @@ export class Config { get channel() { return this.cfg.get("updates.channel")!; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload")!; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens")!; } - get highlightingOn() { return this.cfg.get("highlightingOn")!; } - get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn")!; } get lruCapacity() { return this.cfg.get("lruCapacity")!; } get excludeGlobs() { return this.cfg.get("excludeGlobs")!; } get useClientWatching() { return this.cfg.get("useClientWatching")!; } diff --git a/rust-analyzer/editors/code/src/highlighting.ts b/rust-analyzer/editors/code/src/highlighting.ts deleted file mode 100644 index ea2dfc0e..00000000 --- a/rust-analyzer/editors/code/src/highlighting.ts +++ /dev/null @@ -1,255 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from './rust-analyzer-api'; - -import { ColorTheme, TextMateRuleSettings } from './color_theme'; - -import { Ctx } from './ctx'; -import { sendRequestWithRetry, isRustDocument } from './util'; - -export function activateHighlighting(ctx: Ctx) { - const highlighter = new Highlighter(ctx); - - ctx.client.onNotification(ra.publishDecorations, params => { - if (!ctx.config.highlightingOn) return; - - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape( - editor.document.uri.toString(), - ); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri; - }, - ); - if (!targetEditor) return; - - highlighter.setHighlights(targetEditor, params.decorations); - }); - - - vscode.workspace.onDidChangeConfiguration( - _ => highlighter.removeHighlights(), - null, - ctx.subscriptions, - ); - - vscode.window.onDidChangeActiveTextEditor( - async (editor: vscode.TextEditor | undefined) => { - if (!editor || !isRustDocument(editor.document)) return; - if (!ctx.config.highlightingOn) return; - const client = ctx.client; - if (!client) return; - - const decorations = await sendRequestWithRetry( - client, - ra.decorationsRequest, - { uri: editor.document.uri.toString() }, - ); - highlighter.setHighlights(editor, decorations); - }, - null, - ctx.subscriptions, - ); -} - -// Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 -function fancify(seed: string, shade: 'light' | 'dark') { - const random = randomU32Numbers(hashString(seed)); - const randomInt = (min: number, max: number) => { - return Math.abs(random()) % (max - min + 1) + min; - }; - - const h = randomInt(0, 360); - const s = randomInt(42, 98); - const l = shade === 'light' ? randomInt(15, 40) : randomInt(40, 90); - return `hsl(${h},${s}%,${l}%)`; -} - -class Highlighter { - private ctx: Ctx; - private decorations: Map< - string, - vscode.TextEditorDecorationType - > | null = null; - - constructor(ctx: Ctx) { - this.ctx = ctx; - } - - public removeHighlights() { - if (this.decorations == null) { - return; - } - - // Decorations are removed when the object is disposed - for (const decoration of this.decorations.values()) { - decoration.dispose(); - } - - this.decorations = null; - } - - public setHighlights(editor: vscode.TextEditor, highlights: ra.Decoration[]) { - const client = this.ctx.client; - if (!client) return; - // Initialize decorations if necessary - // - // Note: decoration objects need to be kept around so we can dispose them - // if the user disables syntax highlighting - if (this.decorations == null) { - this.decorations = initDecorations(); - } - - const byTag: Map = new Map(); - const colorfulIdents: Map< - string, - [vscode.Range[], boolean] - > = new Map(); - const rainbowTime = this.ctx.config.rainbowHighlightingOn; - - for (const tag of this.decorations.keys()) { - byTag.set(tag, []); - } - - for (const d of highlights) { - if (!byTag.get(d.tag)) { - continue; - } - - if (rainbowTime && d.bindingHash) { - if (!colorfulIdents.has(d.bindingHash)) { - const mut = d.tag.endsWith('.mut'); - colorfulIdents.set(d.bindingHash, [[], mut]); - } - colorfulIdents - .get(d.bindingHash)![0] - .push( - client.protocol2CodeConverter.asRange(d.range), - ); - } else { - byTag - .get(d.tag)! - .push( - client.protocol2CodeConverter.asRange(d.range), - ); - } - } - - for (const tag of byTag.keys()) { - const dec = this.decorations.get( - tag, - ) as vscode.TextEditorDecorationType; - const ranges = byTag.get(tag)!; - editor.setDecorations(dec, ranges); - } - - for (const [hash, [ranges, mut]] of colorfulIdents.entries()) { - const textDecoration = mut ? 'underline' : undefined; - const dec = vscode.window.createTextEditorDecorationType({ - light: { color: fancify(hash, 'light'), textDecoration }, - dark: { color: fancify(hash, 'dark'), textDecoration }, - }); - editor.setDecorations(dec, ranges); - } - } -} - -function initDecorations(): Map { - const theme = ColorTheme.load(); - const res = new Map(); - TAG_TO_SCOPES.forEach((scopes, tag) => { - // We are going to axe this soon, so don't try to detect unknown tags. - // Users should switch to the new semantic tokens implementation. - if (!scopes) return; - const rule = theme.lookup(scopes); - const decor = createDecorationFromTextmate(rule); - res.set(tag, decor); - }); - return res; -} - -function createDecorationFromTextmate( - themeStyle: TextMateRuleSettings, -): vscode.TextEditorDecorationType { - const decorationOptions: vscode.DecorationRenderOptions = {}; - decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; - - if (themeStyle.foreground) { - decorationOptions.color = themeStyle.foreground; - } - - if (themeStyle.background) { - decorationOptions.backgroundColor = themeStyle.background; - } - - if (themeStyle.fontStyle) { - const parts: string[] = themeStyle.fontStyle.split(' '); - parts.forEach(part => { - switch (part) { - case 'italic': - decorationOptions.fontStyle = 'italic'; - break; - case 'bold': - decorationOptions.fontWeight = 'bold'; - break; - case 'underline': - decorationOptions.textDecoration = 'underline'; - break; - default: - break; - } - }); - } - return vscode.window.createTextEditorDecorationType(decorationOptions); -} - -// sync with tags from `syntax_highlighting.rs`. -const TAG_TO_SCOPES = new Map([ - ["field", ["entity.name.field"]], - ["function", ["entity.name.function"]], - ["module", ["entity.name.module"]], - ["constant", ["entity.name.constant"]], - ["macro", ["entity.name.macro"]], - - ["variable", ["variable"]], - ["variable.mutable", ["variable", "meta.mutable"]], - - ["type", ["entity.name.type"]], - ["type.builtin", ["entity.name.type", "support.type.primitive"]], - ["type.self", ["entity.name.type.parameter.self"]], - ["type.param", ["entity.name.type.parameter", "entity.name.type.param.rust"]], - ["type.lifetime", ["entity.name.type.lifetime", "entity.name.lifetime.rust"]], - - ["literal.byte", ["constant.character.byte"]], - ["literal.char", ["constant.character.rust"]], - ["numeric_literal", ["constant.numeric"]], - - ["comment", ["comment"]], - ["string_literal", ["string.quoted"]], - ["attribute", ["meta.attribute.rust"]], - - ["keyword", ["keyword"]], - ["keyword.unsafe", ["keyword.other.unsafe"]], - ["keyword.control", ["keyword.control"]], -]); - -function randomU32Numbers(seed: number) { - let random = seed | 0; - return () => { - random ^= random << 13; - random ^= random >> 17; - random ^= random << 5; - random |= 0; - return random; - }; -} - -function hashString(str: string): number { - let res = 0; - for (let i = 0; i < str.length; ++i) { - const c = str.codePointAt(i)!; - res = (res * 31 + c) & ~0; - } - return res; -} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 7ba16120..4f3b89f4 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -7,7 +7,6 @@ import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; -import { activateHighlighting } from './highlighting'; import { Config, NIGHTLY_TAG } from './config'; import { log, assert } from './util'; import { PersistentState } from './persistent_state'; @@ -97,9 +96,6 @@ export async function activate(context: vscode.ExtensionContext) { activateStatusDisplay(ctx); - if (!ctx.config.highlightingSemanticTokens) { - activateHighlighting(ctx); - } activateInlayHints(ctx); vscode.workspace.onDidChangeConfiguration( From 5a04b309cdffe5e36874fff53418a50552271c3b Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 2 Apr 2020 03:24:30 +0300 Subject: [PATCH 600/819] vscode: add goto definition from rust file to syntax tree editor --- .../editors/code/src/commands/syntax_tree.ts | 88 +++++++++++++++++-- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 8d71cb39..c1af7122 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -83,7 +83,7 @@ class TextDocumentContentProvider implements vscode.TextDocumentContentProvider // FIXME: consider implementing this via the Tree View API? // https://code.visualstudio.com/api/extension-guides/tree-view class AstInspector implements vscode.HoverProvider, Disposable { - private static readonly astDecorationType = vscode.window.createTextEditorDecorationType({ + private readonly astDecorationType = vscode.window.createTextEditorDecorationType({ borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'), borderStyle: "solid", borderWidth: "2px", @@ -91,9 +91,35 @@ class AstInspector implements vscode.HoverProvider, Disposable { }); private rustEditor: undefined | RustEditor; + // Lazy rust token range -> syntax tree file range. + private readonly rust2Ast = new Lazy(() => { + const astEditor = this.findAstTextEditor(); + if (!this.rustEditor || !astEditor) return undefined; + + console.time("Build goto def index"); + let buf: [vscode.Range, vscode.Range][] = []; + for (let i = 0; i < astEditor.document.lineCount; ++i) { + const astLine = astEditor.document.lineAt(i); + + // Heuristically look for nodes with quoted text (which are token nodes) + const isTokenNode = astLine.text.lastIndexOf('"') >= 0; + if (!isTokenNode) continue; + + const rustRange = this.parseRustTextRange(this.rustEditor.document, astLine.text); + if (!rustRange) continue; + + buf.push([rustRange, this.findAstRange(astLine)]); + } + + console.timeEnd("Build goto def index"); + return buf; + }); + constructor(ctx: Ctx) { ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); + ctx.pushCleanup(vscode.languages.registerDefinitionProvider({ language: "rust" }, this)); vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, ctx.subscriptions); + vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); vscode.window.onDidChangeVisibleTextEditors(this.onDidChangeVisibleTextEditors, this, ctx.subscriptions); ctx.pushCleanup(this); @@ -102,6 +128,12 @@ class AstInspector implements vscode.HoverProvider, Disposable { this.setRustEditor(undefined); } + private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { + if (this.rustEditor && event.document.uri.toString() === this.rustEditor.document.uri.toString()) { + this.rust2Ast.reset(); + } + } + private onDidCloseTextDocument(doc: vscode.TextDocument) { if (this.rustEditor && doc.uri.toString() === this.rustEditor.document.uri.toString()) { this.setRustEditor(undefined); @@ -109,20 +141,51 @@ class AstInspector implements vscode.HoverProvider, Disposable { } private onDidChangeVisibleTextEditors(editors: vscode.TextEditor[]) { - if (editors.every(suspect => suspect.document.uri.scheme !== AST_FILE_SCHEME)) { + if (!this.findAstTextEditor()) { this.setRustEditor(undefined); return; } this.setRustEditor(editors.find(isRustEditor)); } + private findAstTextEditor(): undefined | vscode.TextEditor { + return vscode.window.visibleTextEditors.find(it => it.document.uri.scheme === AST_FILE_SCHEME); + } + private setRustEditor(newRustEditor: undefined | RustEditor) { - if (newRustEditor !== this.rustEditor) { - this.rustEditor?.setDecorations(AstInspector.astDecorationType, []); + if (this.rustEditor && this.rustEditor !== newRustEditor) { + this.rustEditor.setDecorations(this.astDecorationType, []); + this.rust2Ast.reset(); } this.rustEditor = newRustEditor; } + // additional positional params are omitted + provideDefinition(doc: vscode.TextDocument, pos: vscode.Position): vscode.ProviderResult { + if (!this.rustEditor || doc.uri.toString() !== this.rustEditor.document.uri.toString()) return; + + const astEditor = this.findAstTextEditor(); + if (!astEditor) return; + + console.time("Goto def"); + const rust2AstRanges = this.rust2Ast.get()?.find(([rustRange, _]) => rustRange.contains(pos)); + console.timeEnd("Goto def"); + if (!rust2AstRanges) return; + + const [rustFileRange, astFileRange] = rust2AstRanges; + + astEditor.revealRange(astFileRange); + astEditor.selection = new vscode.Selection(astFileRange.start, astFileRange.end); + + return [{ + targetRange: astFileRange, + targetUri: astEditor.document.uri, + originSelectionRange: rustFileRange, + targetSelectionRange: astFileRange, + }]; + } + + // additional positional params are omitted provideHover(doc: vscode.TextDocument, hoverPosition: vscode.Position): vscode.ProviderResult { if (!this.rustEditor) return; @@ -131,7 +194,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { const rustTextRange = this.parseRustTextRange(this.rustEditor.document, astTextLine.text); if (!rustTextRange) return; - this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]); + this.rustEditor.setDecorations(this.astDecorationType, [rustTextRange]); this.rustEditor.revealRange(rustTextRange); const rustSourceCode = this.rustEditor.document.getText(rustTextRange); @@ -156,3 +219,18 @@ class AstInspector implements vscode.HoverProvider, Disposable { return new vscode.Range(begin, end); } } + +class Lazy { + val: undefined | T; + + constructor(private readonly compute: () => undefined | T) {} + + get() { + return this.val ?? (this.val = this.compute()); + } + + reset() { + this.val = undefined; + } + +} From 50081325a794460b2043d2c97852b222eb2bfe56 Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 2 Apr 2020 03:24:45 +0300 Subject: [PATCH 601/819] vscode: postrefactor variable names --- .../editors/code/src/commands/syntax_tree.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index c1af7122..7b58cf78 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -189,18 +189,18 @@ class AstInspector implements vscode.HoverProvider, Disposable { provideHover(doc: vscode.TextDocument, hoverPosition: vscode.Position): vscode.ProviderResult { if (!this.rustEditor) return; - const astTextLine = doc.lineAt(hoverPosition.line); + const astFileLine = doc.lineAt(hoverPosition.line); - const rustTextRange = this.parseRustTextRange(this.rustEditor.document, astTextLine.text); - if (!rustTextRange) return; + const rustFileRange = this.parseRustTextRange(this.rustEditor.document, astFileLine.text); + if (!rustFileRange) return; - this.rustEditor.setDecorations(this.astDecorationType, [rustTextRange]); - this.rustEditor.revealRange(rustTextRange); + this.rustEditor.setDecorations(this.astDecorationType, [rustFileRange]); + this.rustEditor.revealRange(rustFileRange); - const rustSourceCode = this.rustEditor.document.getText(rustTextRange); - const astTextRange = this.findAstRange(astTextLine); + const rustSourceCode = this.rustEditor.document.getText(rustFileRange); + const astFileRange = this.findAstRange(astFileLine); - return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astTextRange); + return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astFileRange); } private findAstRange(astLine: vscode.TextLine) { From 21d1dcf516e7c0c447da0943f3fe3b9cc2ee8c2c Mon Sep 17 00:00:00 2001 From: veetaha Date: Thu, 2 Apr 2020 03:35:58 +0300 Subject: [PATCH 602/819] vscode: postrefactor --- .../editors/code/src/commands/syntax_tree.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index 7b58cf78..b7a39741 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -82,7 +82,7 @@ class TextDocumentContentProvider implements vscode.TextDocumentContentProvider // FIXME: consider implementing this via the Tree View API? // https://code.visualstudio.com/api/extension-guides/tree-view -class AstInspector implements vscode.HoverProvider, Disposable { +class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, Disposable { private readonly astDecorationType = vscode.window.createTextEditorDecorationType({ borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'), borderStyle: "solid", @@ -96,8 +96,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { const astEditor = this.findAstTextEditor(); if (!this.rustEditor || !astEditor) return undefined; - console.time("Build goto def index"); - let buf: [vscode.Range, vscode.Range][] = []; + const buf: [vscode.Range, vscode.Range][] = []; for (let i = 0; i < astEditor.document.lineCount; ++i) { const astLine = astEditor.document.lineAt(i); @@ -108,10 +107,8 @@ class AstInspector implements vscode.HoverProvider, Disposable { const rustRange = this.parseRustTextRange(this.rustEditor.document, astLine.text); if (!rustRange) continue; - buf.push([rustRange, this.findAstRange(astLine)]); + buf.push([rustRange, this.findAstNodeRange(astLine)]); } - - console.timeEnd("Build goto def index"); return buf; }); @@ -167,9 +164,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { const astEditor = this.findAstTextEditor(); if (!astEditor) return; - console.time("Goto def"); const rust2AstRanges = this.rust2Ast.get()?.find(([rustRange, _]) => rustRange.contains(pos)); - console.timeEnd("Goto def"); if (!rust2AstRanges) return; const [rustFileRange, astFileRange] = rust2AstRanges; @@ -198,12 +193,12 @@ class AstInspector implements vscode.HoverProvider, Disposable { this.rustEditor.revealRange(rustFileRange); const rustSourceCode = this.rustEditor.document.getText(rustFileRange); - const astFileRange = this.findAstRange(astFileLine); + const astFileRange = this.findAstNodeRange(astFileLine); return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astFileRange); } - private findAstRange(astLine: vscode.TextLine) { + private findAstNodeRange(astLine: vscode.TextLine) { const lineOffset = astLine.range.start; const begin = lineOffset.translate(undefined, astLine.firstNonWhitespaceCharacterIndex); const end = lineOffset.translate(undefined, astLine.text.trimEnd().length); @@ -223,7 +218,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { class Lazy { val: undefined | T; - constructor(private readonly compute: () => undefined | T) {} + constructor(private readonly compute: () => undefined | T) { } get() { return this.val ?? (this.val = this.compute()); @@ -232,5 +227,4 @@ class Lazy { reset() { this.val = undefined; } - } From 5aff719c3615dd6992c776128999c528cfb5165a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 11:55:04 +0200 Subject: [PATCH 603/819] New config in package.json --- rust-analyzer/editors/code/package.json | 245 ++++++++++++------------ 1 file changed, 125 insertions(+), 120 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 946145df..df8adfe0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -177,81 +177,71 @@ "type": "object", "title": "Rust Analyzer", "properties": { - "rust-analyzer.highlighting.semanticTokens": { + "rust-analyzer.diagnostics.enable": { "type": "boolean", - "default": false, - "description": "Use proposed semantic tokens API for syntax highlighting" + "default": true, + "markdownDescription": "Whether to show native rust-analyzer diagnostics." }, - "rust-analyzer.featureFlags": { - "type": "object", - "default": {}, - "description": "Fine grained feature flags to disable annoying features", - "properties": { - "lsp.diagnostics": { - "type": "boolean", - "markdownDescription": "Whether to show diagnostics from `cargo check`" - }, - "completion.insertion.add-call-parenthesis": { - "type": "boolean", - "description": "Whether to add parenthesis when completing functions" - }, - "completion.insertion.add-argument-snippets": { - "type": "boolean", - "description": "Whether to add argument snippets when completing functions" - }, - "completion.enable-postfix": { - "type": "boolean", - "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." - }, - "call-info.full": { - "type": "boolean", - "description": "Show function name and docs in parameter hints" - }, - "notifications.workspace-loaded": { - "type": "boolean", - "markdownDescription": "Whether to show `workspace loaded` message" - }, - "notifications.cargo-toml-not-found": { - "type": "boolean", - "markdownDescription": "Whether to show `can't find Cargo.toml` error message" - } - } + "rust-analyzer.lruCapacity": { + "type": [ + "null", + "integer" + ], + "default": null, + "minimum": 0, + "exclusiveMinimum": true, + "description": "Number of syntax trees rust-analyzer keeps in memory." }, - "rust-analyzer.updates.channel": { + "rust-analyzer.files.watcher": { "type": "string", "enum": [ - "stable", - "nightly" + "client", + "notify" ], - "default": "stable", - "markdownEnumDescriptions": [ - "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general", - "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" - ], - "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs" + "default": "client", + "description": "Controls file watching implementation." }, - "rust-analyzer.updates.askBeforeDownload": { + "rust-analyzer.files.exclude": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Paths to exclude from analysis." + }, + "rust-analyzer.notifications.workspaceLoaded": { "type": "boolean", - "default": true, - "description": "Whether to ask for permission before downloading any files from the Internet" + "markdownDescription": "Whether to show `workspace loaded` message." }, - "rust-analyzer.serverPath": { - "type": [ - "null", - "string" - ], - "default": null, - "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" + "rust-analyzer.notifications.cargoTomlNotFound": { + "type": "boolean", + "markdownDescription": "Whether to show `can't find Cargo.toml` error message" + }, + + "rust-analyzer.cargo.noDefaultFeatures": { + "type": "boolean", + "default": false, + "markdownDescription": "Do not activate the `default` feature" }, - "rust-analyzer.excludeGlobs": { + "rust-analyzer.cargo.allFeatures": { + "type": "boolean", + "default": true, + "description": "Activate all available features" + }, + "rust-analyzer.cargo.features": { "type": "array", "items": { "type": "string" }, "default": [], - "description": "Paths to exclude from analysis" + "description": "List of features to activate" }, - "rust-analyzer.rustfmtArgs": { + "rust-analyzer.cargo.loadOutDirsFromCheck": { + "type": "boolean", + "default": false, + "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" + }, + "rust-analyzer.rustfmt.extraArgs": { "type": "array", "items": { "type": "string" @@ -259,65 +249,30 @@ "default": [], "description": "Additional arguments to rustfmt" }, - "rust-analyzer.useClientWatching": { + "rust-analyzer.checkOnSave.enable": { "type": "boolean", "default": true, - "description": "client provided file watching instead of notify watching." + "markdownDescription": "Run specified `cargo check` command for diagnostics on save" }, - "rust-analyzer.cargo-watch.enable": { - "type": "boolean", - "default": true, - "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save" - }, - "rust-analyzer.cargo-watch.arguments": { + "rust-analyzer.checkOnSave.extraArgs": { "type": "array", "items": { "type": "string" }, - "markdownDescription": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", + "markdownDescription": "Extra arguments for `cargo check`", "default": [] }, - "rust-analyzer.cargo-watch.command": { - "type": "string", - "markdownDescription": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", - "default": "check" - }, - "rust-analyzer.cargo-watch.allTargets": { - "type": "boolean", - "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)", - "default": true - }, - "rust-analyzer.trace.server": { + "rust-analyzer.checkOnSave.command": { "type": "string", - "scope": "window", - "enum": [ - "off", - "messages", - "verbose" - ], - "enumDescriptions": [ - "No traces", - "Error only", - "Full log" - ], - "default": "off", - "description": "Trace requests to the rust-analyzer" + "default": "check", + "markdownDescription": "Cargo command to use for `cargo check`" }, - "rust-analyzer.trace.extension": { - "description": "Enable logging of VS Code extensions itself", + "rust-analyzer.checkOnSave.allTargets": { "type": "boolean", - "default": false - }, - "rust-analyzer.lruCapacity": { - "type": [ - "null", - "integer" - ], - "default": null, - "minimum": 0, - "exclusiveMinimum": true, - "description": "Number of syntax trees rust-analyzer keeps in memory" + "default": true, + "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, + "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, @@ -343,29 +298,79 @@ "exclusiveMinimum": true, "description": "Maximum length for inlay hints" }, - "rust-analyzer.cargoFeatures.noDefaultFeatures": { + + "rust-analyzer.completion.addCallParenthesis": { "type": "boolean", - "default": false, - "markdownDescription": "Do not activate the `default` feature" + "default": true, + "description": "Whether to add parenthesis when completing functions" }, - "rust-analyzer.cargoFeatures.allFeatures": { + "rust-analyzer.completion.addCallArgumentSnippets": { "type": "boolean", "default": true, - "description": "Activate all available features" + "description": "Whether to add argument snippets when completing functions" }, - "rust-analyzer.cargoFeatures.features": { - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "description": "List of features to activate" + "rust-analyzer.completion.postfix.enable": { + "type": "boolean", + "default": true, + "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." + }, + "rust-analyzer.callInfo.full": { + "type": "boolean", + "description": "Show function name and docs in parameter hints" }, - "rust-analyzer.cargoFeatures.loadOutDirsFromCheck": { + + "rust-analyzer.highlighting.semanticTokens": { "type": "boolean", "default": false, - "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" - } + "description": "Use proposed semantic tokens API for syntax highlighting" + }, + "rust-analyzer.updates.channel": { + "type": "string", + "enum": [ + "stable", + "nightly" + ], + "default": "stable", + "markdownEnumDescriptions": [ + "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general", + "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" + ], + "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs" + }, + "rust-analyzer.updates.askBeforeDownload": { + "type": "boolean", + "default": true, + "description": "Whether to ask for permission before downloading any files from the Internet" + }, + "rust-analyzer.serverPath": { + "type": [ + "null", + "string" + ], + "default": null, + "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" + }, + "rust-analyzer.trace.server": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "messages", + "verbose" + ], + "enumDescriptions": [ + "No traces", + "Error only", + "Full log" + ], + "default": "off", + "description": "Trace requests to the rust-analyzer" + }, + "rust-analyzer.trace.extension": { + "description": "Enable logging of VS Code extensions itself", + "type": "boolean", + "default": false + }, } }, "problemPatterns": [ From 85be7f1774a1ad036c366e22e46f43ea41230c28 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 12:47:58 +0200 Subject: [PATCH 604/819] Lean onto default implementation of configs --- rust-analyzer/editors/code/package.json | 6 +--- rust-analyzer/editors/code/src/client.ts | 26 +--------------- rust-analyzer/editors/code/src/config.ts | 30 +++---------------- rust-analyzer/editors/code/src/ctx.ts | 3 +- .../editors/code/src/status_display.ts | 2 +- 5 files changed, 8 insertions(+), 59 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index df8adfe0..1f95cd13 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -217,7 +217,6 @@ "type": "boolean", "markdownDescription": "Whether to show `can't find Cargo.toml` error message" }, - "rust-analyzer.cargo.noDefaultFeatures": { "type": "boolean", "default": false, @@ -272,7 +271,6 @@ "default": true, "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, - "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, @@ -298,7 +296,6 @@ "exclusiveMinimum": true, "description": "Maximum length for inlay hints" }, - "rust-analyzer.completion.addCallParenthesis": { "type": "boolean", "default": true, @@ -318,7 +315,6 @@ "type": "boolean", "description": "Show function name and docs in parameter hints" }, - "rust-analyzer.highlighting.semanticTokens": { "type": "boolean", "default": false, @@ -370,7 +366,7 @@ "description": "Enable logging of VS Code extensions itself", "type": "boolean", "default": false - }, + } } }, "problemPatterns": [ diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 8ddc1cdc..3b1d00bc 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -5,30 +5,6 @@ import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; -export function configToServerOptions(config: Config) { - return { - lruCapacity: config.lruCapacity, - - inlayHintsType: config.inlayHints.typeHints, - inlayHintsParameter: config.inlayHints.parameterHints, - inlayHintsChaining: config.inlayHints.chainingHints, - inlayHintsMaxLength: config.inlayHints.maxLength, - - cargoWatchEnable: config.cargoWatchOptions.enable, - cargoWatchArgs: config.cargoWatchOptions.arguments, - cargoWatchCommand: config.cargoWatchOptions.command, - cargoWatchAllTargets: config.cargoWatchOptions.allTargets, - - excludeGlobs: config.excludeGlobs, - useClientWatching: config.useClientWatching, - featureFlags: config.featureFlags, - withSysroot: config.withSysroot, - cargoFeatures: config.cargoFeatures, - rustfmtArgs: config.rustfmtArgs, - vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null, - }; -} - export async function createClient(config: Config, serverPath: string, cwd: string): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). @@ -48,7 +24,7 @@ export async function createClient(config: Config, serverPath: string, cwd: stri const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], - initializationOptions: configToServerOptions(config), + initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"), traceOutputChannel, middleware: { // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index c37c6276..1f45f1de 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -11,9 +11,8 @@ export class Config { private readonly rootSection = "rust-analyzer"; private readonly requiresReloadOpts = [ "serverPath", - "cargoFeatures", - "excludeGlobs", - "useClientWatching", + "cargo", + "files", "highlighting", "updates.channel", ] @@ -71,17 +70,8 @@ export class Config { get channel() { return this.cfg.get("updates.channel")!; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload")!; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens")!; } - get lruCapacity() { return this.cfg.get("lruCapacity")!; } - get excludeGlobs() { return this.cfg.get("excludeGlobs")!; } - get useClientWatching() { return this.cfg.get("useClientWatching")!; } - get featureFlags() { return this.cfg.get>("featureFlags")!; } - get rustfmtArgs() { return this.cfg.get("rustfmtArgs")!; } - get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck")!; } get traceExtension() { return this.cfg.get("trace.extension")!; } - // for internal use - get withSysroot() { return this.cfg.get("withSysroot", true)!; } - get inlayHints() { return { typeHints: this.cfg.get("inlayHints.typeHints")!, @@ -91,21 +81,9 @@ export class Config { }; } - get cargoWatchOptions() { - return { - enable: this.cfg.get("cargo-watch.enable")!, - arguments: this.cfg.get("cargo-watch.arguments")!, - allTargets: this.cfg.get("cargo-watch.allTargets")!, - command: this.cfg.get("cargo-watch.command")!, - }; - } - - get cargoFeatures() { + get checkOnSave() { return { - noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures")!, - allFeatures: this.cfg.get("cargoFeatures.allFeatures")!, - features: this.cfg.get("cargoFeatures.features")!, - loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck")!, + command: this.cfg.get("checkOnSave.command")!, }; } } diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 86b5f362..bd1c3de0 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { createClient, configToServerOptions } from './client'; +import { createClient } from './client'; import { isRustEditor, RustEditor } from './util'; export class Ctx { @@ -25,7 +25,6 @@ export class Ctx { const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); - client.onRequest('workspace/configuration', _ => [configToServerOptions(config)]); return res; } diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts index 0f5f6ef9..f9cadc8a 100644 --- a/rust-analyzer/editors/code/src/status_display.ts +++ b/rust-analyzer/editors/code/src/status_display.ts @@ -7,7 +7,7 @@ import { Ctx } from './ctx'; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export function activateStatusDisplay(ctx: Ctx) { - const statusDisplay = new StatusDisplay(ctx.config.cargoWatchOptions.command); + const statusDisplay = new StatusDisplay(ctx.config.checkOnSave.command); ctx.pushCleanup(statusDisplay); const client = ctx.client; if (client != null) { From 932fbc54f5c0c2826793646a009a0d96f7ba34e2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 12:56:14 +0200 Subject: [PATCH 605/819] Remove vscode_lldb setting --- rust-analyzer/editors/code/src/commands/runnables.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 35715516..2635a144 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -66,6 +66,10 @@ export function debugSingle(ctx: Ctx): Cmd { return async (config: ra.Runnable) => { const editor = ctx.activeRustEditor; if (!editor) return; + if (!vscode.extensions.getExtension("vadimcn.vscode-lldb")) { + vscode.window.showErrorMessage("Install `vadimcn.vscode-lldb` extension for debugging"); + return; + } const debugConfig = { type: "lldb", From ce86c28fd58362a7495fa95f7cededbdf5dda1fa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 14:30:28 +0200 Subject: [PATCH 606/819] Allow fully overriding check and fmt commands --- rust-analyzer/editors/code/package.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1f95cd13..e1c34c6a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -248,6 +248,13 @@ "default": [], "description": "Additional arguments to rustfmt" }, + "rust-analyzer.rustfmt.overrideCommand": { + "type": "array", + "items": { + "type": "string" + }, + "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." + }, "rust-analyzer.checkOnSave.enable": { "type": "boolean", "default": true, @@ -266,6 +273,13 @@ "default": "check", "markdownDescription": "Cargo command to use for `cargo check`" }, + "rust-analyzer.checkOnSave.overrideCommand": { + "type": "array", + "items": { + "type": "string" + }, + "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command must include `--message=format=json`." + }, "rust-analyzer.checkOnSave.allTargets": { "type": "boolean", "default": true, From fbe6b0848d9aa296b31e5c9e1648539e99a0d02a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 14:39:37 +0200 Subject: [PATCH 607/819] better wording --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e1c34c6a..9c8cca61 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -278,7 +278,7 @@ "items": { "type": "string" }, - "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command must include `--message=format=json`." + "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." }, "rust-analyzer.checkOnSave.allTargets": { "type": "boolean", From 864c6c94d7040b9708c8951951de6400569a30d7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 15:52:25 +0200 Subject: [PATCH 608/819] Fix semantic coloring --- rust-analyzer/editors/code/package.json | 85 ++++++++----------------- 1 file changed, 27 insertions(+), 58 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 9c8cca61..14bdec8c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -521,65 +521,34 @@ "description": "Style for unsafe operations" } ], - "semanticTokenStyleDefaults": [ + "semanticTokenScopes": [ { - "selector": "attribute", - "scope": [ - "meta.attribute" - ] - }, - { - "selector": "builtinType", - "scope": [ - "support.type.primitive" - ] - }, - { - "selector": "lifetime", - "scope": [ - "entity.name.lifetime.rust" - ] - }, - { - "selector": "typeAlias", - "scope": [ - "entity.name.typeAlias" - ] - }, - { - "selector": "union", - "scope": [ - "entity.name.union" - ] - }, - { - "selector": "keyword.unsafe", - "scope": [ - "keyword.other.unsafe" - ] - }, - { - "selector": "keyword.control", - "scope": [ - "keyword.control" - ] - }, - { - "selector": "variable.constant", - "scope": [ - "entity.name.constant" - ] - }, - { - "selector": "*.mutable", - "light": { - "fontStyle": "underline" - }, - "dark": { - "fontStyle": "underline" - }, - "highContrast": { - "fontStyle": "underline" + "language": "rust", + "scopes": { + "attribute": [ + "meta.attribute" + ], + "builtinType": [ + "support.type.primitive" + ], + "lifetime": [ + "entity.name.lifetime.rust" + ], + "typeAlias": [ + "entity.name.typeAlias" + ], + "union": [ + "entity.name.union" + ], + "keyword.unsafe": [ + "keyword.other.unsafe" + ], + "keyword.control": [ + "keyword.control" + ], + "variable.constant": [ + "entity.name.constant" + ] } } ] From 8da483bb8ccc3dfbcb5932e282270614f1650e0b Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 2 Apr 2020 12:03:30 -0400 Subject: [PATCH 609/819] Bumps vsce to 1.75 Fixes a security vulnerability --- rust-analyzer/editors/code/package-lock.json | 38 ++++++++++++-------- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 2d8b432a..d5dec8fc 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -459,12 +459,6 @@ "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", "dev": true }, - "didyoumean": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", - "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", - "dev": true - }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1043,6 +1037,12 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz", "integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==" }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -1088,16 +1088,24 @@ } }, "markdown-it": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", - "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", + "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", "dev": true, "requires": { "argparse": "^1.0.7", - "entities": "~1.1.1", + "entities": "~2.0.0", "linkify-it": "^2.0.0", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" + }, + "dependencies": { + "entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==", + "dev": true + } } }, "mdurl": { @@ -1723,9 +1731,9 @@ "dev": true }, "vsce": { - "version": "1.74.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.74.0.tgz", - "integrity": "sha512-8zWM9bZBNn9my40kkxAxdY4nhb9ADfazXsyDgx1thbRaLPbmPTlmqQ55vCAyWYFEi6XbJv8w599vzVUqsU1gHg==", + "version": "1.75.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.75.0.tgz", + "integrity": "sha512-qyAQTmolxKWc9bV1z0yBTSH4WEIWhDueBJMKB0GUFD6lM4MiaU1zJ9BtzekUORZu094YeNSKz0RmVVuxfqPq0g==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", @@ -1733,10 +1741,10 @@ "cheerio": "^1.0.0-rc.1", "commander": "^2.8.1", "denodeify": "^1.2.1", - "didyoumean": "^1.2.1", "glob": "^7.0.6", + "leven": "^3.1.0", "lodash": "^4.17.15", - "markdown-it": "^8.3.1", + "markdown-it": "^10.0.0", "mime": "^1.3.4", "minimatch": "^3.0.3", "osenv": "^0.1.3", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 14bdec8c..88b7ee86 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -49,7 +49,7 @@ "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", - "vsce": "^1.74.0" + "vsce": "^1.75.0" }, "activationEvents": [ "onLanguage:rust", From 8295baf1a07e301fff16f4cc0cbbdbb7a68955ac Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Apr 2020 12:24:11 +0200 Subject: [PATCH 610/819] Set semantic tokens supertypes --- rust-analyzer/editors/code/package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 88b7ee86..595d6e37 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -488,7 +488,8 @@ }, { "id": "builtinType", - "description": "Style for builtin types" + "description": "Style for builtin types", + "superType": "type" }, { "id": "lifetime", @@ -496,11 +497,13 @@ }, { "id": "typeAlias", - "description": "Style for type aliases" + "description": "Style for type aliases", + "superType": "type" }, { "id": "union", - "description": "Style for C-style untagged unions" + "description": "Style for C-style untagged unions", + "superType": "type" } ], "semanticTokenModifiers": [ From ba678ff3f4bf7033a96465988efeb0bad2294b12 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Apr 2020 20:00:06 +0200 Subject: [PATCH 611/819] Include grammar for syntax trees into vsix --- rust-analyzer/editors/code/.vscodeignore | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index 17c378a4..ac411f8e 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -2,5 +2,6 @@ !out/main.js !package.json !package-lock.json +!ra_syntax_tree.tmGrammar.json !icon.png !README.md From 217c7d9f7671a9da3570d46f063c2b8fc5e02e99 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 4 Apr 2020 15:57:03 +0300 Subject: [PATCH 612/819] vscode: restore removed default values After refactoring the config we forgot to set defaults for some properties like workspaceLoaded, callInfo.full, etc. This commit restored them to being turned on by defult, as well added defaults for other props to be more explicit on their defualt value. --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 595d6e37..f0d5127d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -211,10 +211,12 @@ }, "rust-analyzer.notifications.workspaceLoaded": { "type": "boolean", + "default": true, "markdownDescription": "Whether to show `workspace loaded` message." }, "rust-analyzer.notifications.cargoTomlNotFound": { "type": "boolean", + "default": true, "markdownDescription": "Whether to show `can't find Cargo.toml` error message" }, "rust-analyzer.cargo.noDefaultFeatures": { @@ -253,6 +255,7 @@ "items": { "type": "string" }, + "default": [], "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." }, "rust-analyzer.checkOnSave.enable": { @@ -278,6 +281,7 @@ "items": { "type": "string" }, + "default": [], "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." }, "rust-analyzer.checkOnSave.allTargets": { @@ -327,6 +331,7 @@ }, "rust-analyzer.callInfo.full": { "type": "boolean", + "default": true, "description": "Show function name and docs in parameter hints" }, "rust-analyzer.highlighting.semanticTokens": { From a82626d92da193283186664e8c55d1327a7be8a4 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 4 Apr 2020 16:10:06 +0300 Subject: [PATCH 613/819] vscode: log server binary path --- rust-analyzer/editors/code/src/main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 4f3b89f4..efd56a84 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -177,6 +177,8 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< ); } + log.debug("Using server binary at", path); + const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); log.debug("Checked binary availability via --version", res); log.debug(res, "--version output:", res.output); From ef0dcf770ff4b7ae4ea91277a0687c1a2a6bcb74 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 5 Apr 2020 14:46:07 +0200 Subject: [PATCH 614/819] Make control token modifier less ambiguous In textmate, keyword.control is used for all kinds of things; in fact, the default scope mapping for keyword is keyword.control! So let's add a less ambiguous controlFlow modifier See Microsoft/vscode#94367 --- rust-analyzer/editors/code/package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 595d6e37..8ca8c76c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -512,7 +512,7 @@ "description": "Style for compile-time constants" }, { - "id": "control", + "id": "controlFlow", "description": "Style for control flow keywords" }, { @@ -546,9 +546,6 @@ "keyword.unsafe": [ "keyword.other.unsafe" ], - "keyword.control": [ - "keyword.control" - ], "variable.constant": [ "entity.name.constant" ] From 82213a8669ff2cce694c3bd340b2434e0f0ebb8e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Apr 2020 08:51:52 +0200 Subject: [PATCH 615/819] Better config scheme & defaults --- rust-analyzer/editors/code/package.json | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 60ca0c69..8ae8ea41 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -251,11 +251,15 @@ "description": "Additional arguments to rustfmt" }, "rust-analyzer.rustfmt.overrideCommand": { - "type": "array", + "type": [ + "null", + "array" + ], "items": { - "type": "string" + "type": "string", + "minItems": 1 }, - "default": [], + "default": null, "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." }, "rust-analyzer.checkOnSave.enable": { @@ -277,11 +281,15 @@ "markdownDescription": "Cargo command to use for `cargo check`" }, "rust-analyzer.checkOnSave.overrideCommand": { - "type": "array", + "type": [ + "null", + "array" + ], "items": { - "type": "string" + "type": "string", + "minItems": 1 }, - "default": [], + "default": null, "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." }, "rust-analyzer.checkOnSave.allTargets": { From 7baebf5c9ff1bd73d9ef5932206db399af3a83bd Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 7 Apr 2020 11:17:54 -0400 Subject: [PATCH 616/819] Update some packages --- rust-analyzer/editors/code/package-lock.json | 44 ++++++++++---------- rust-analyzer/editors/code/package.json | 6 +-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index d5dec8fc..eb4f299a 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -115,25 +115,25 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.26.0.tgz", - "integrity": "sha512-4yUnLv40bzfzsXcTAtZyTjbiGUXMrcIJcIMioI22tSOyAxpdXiZ4r7YQUU8Jj6XXrLz9d5aMHPQf5JFR7h27Nw==", + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz", + "integrity": "sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.26.0", + "@typescript-eslint/experimental-utils": "2.27.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.26.0.tgz", - "integrity": "sha512-RELVoH5EYd+JlGprEyojUv9HeKcZqF7nZUGSblyAw1FwOGNnmQIU8kxJ69fttQvEwCsX5D6ECJT8GTozxrDKVQ==", + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz", + "integrity": "sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.26.0", + "@typescript-eslint/typescript-estree": "2.27.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, @@ -150,21 +150,21 @@ } }, "@typescript-eslint/parser": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.26.0.tgz", - "integrity": "sha512-+Xj5fucDtdKEVGSh9353wcnseMRkPpEAOY96EEenN7kJVrLqy/EVwtIh3mxcUz8lsFXW1mT5nN5vvEam/a5HiQ==", + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.27.0.tgz", + "integrity": "sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.26.0", - "@typescript-eslint/typescript-estree": "2.26.0", + "@typescript-eslint/experimental-utils": "2.27.0", + "@typescript-eslint/typescript-estree": "2.27.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.26.0.tgz", - "integrity": "sha512-3x4SyZCLB4zsKsjuhxDLeVJN6W29VwBnYpCsZ7vIdPel9ZqLfIZJgJXO47MNUkurGpQuIBALdPQKtsSnWpE1Yg==", + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz", + "integrity": "sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -1367,9 +1367,9 @@ } }, "regexpp": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", - "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", "dev": true }, "resolve": { @@ -1407,9 +1407,9 @@ } }, "rollup": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.2.tgz", - "integrity": "sha512-p66+fbfaUUOGE84sHXAOgfeaYQMslgAazoQMp//nlR519R61213EPFgrMZa48j31jNacJwexSAR1Q8V/BwGKBA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.3.tgz", + "integrity": "sha512-uJ9VNWk80mb4wDCSfd1AyHoSc9TrWbkZtnO6wbsMTp9muSWkT26Dvc99MX1yGCOTvUN1Skw/KpFzKdUDuZKTXA==", "dev": true, "requires": { "fsevents": "~2.1.2" diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8ae8ea41..94edc6ee 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -42,10 +42,10 @@ "@types/node": "^12.12.34", "@types/node-fetch": "^2.5.5", "@types/vscode": "^1.43.0", - "@typescript-eslint/eslint-plugin": "^2.26.0", - "@typescript-eslint/parser": "^2.26.0", + "@typescript-eslint/eslint-plugin": "^2.27.0", + "@typescript-eslint/parser": "^2.27.0", "eslint": "^6.8.0", - "rollup": "^2.3.2", + "rollup": "^2.3.3", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From 86ba275cfa2c9f70ade870e55cea25717577ce64 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 8 Apr 2020 15:45:39 -0400 Subject: [PATCH 617/819] Enable the SemanticTokensFeature by default This is covered under vscode's "editor.semanticHighlighting.enabled" setting plus the user has to have a theme that has opted into highlighting. Bumps required vscode stable to 1.44 --- rust-analyzer/editors/code/package.json | 7 +------ rust-analyzer/editors/code/src/client.ts | 16 ++++++---------- rust-analyzer/editors/code/src/config.ts | 1 - rust-analyzer/editors/code/src/ctx.ts | 2 +- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 94edc6ee..0bf7b6ae 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "Programming Languages" ], "engines": { - "vscode": "^1.43.0" + "vscode": "^1.44.0" }, "enableProposedApi": true, "scripts": { @@ -342,11 +342,6 @@ "default": true, "description": "Show function name and docs in parameter hints" }, - "rust-analyzer.highlighting.semanticTokens": { - "type": "boolean", - "default": false, - "description": "Use proposed semantic tokens API for syntax highlighting" - }, "rust-analyzer.updates.channel": { "type": "string", "enum": [ diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 3b1d00bc..0ad4b63a 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -1,11 +1,10 @@ import * as lc from 'vscode-languageclient'; import * as vscode from 'vscode'; -import { Config } from './config'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; -export async function createClient(config: Config, serverPath: string, cwd: string): Promise { +export async function createClient(serverPath: string, cwd: string): Promise { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. @@ -73,15 +72,12 @@ export async function createClient(config: Config, serverPath: string, cwd: stri }; // To turn on all proposed features use: res.registerProposedFeatures(); - // Here we want to just enable CallHierarchyFeature since it is available on stable. - // Note that while the CallHierarchyFeature is stable the LSP protocol is not. + // Here we want to enable CallHierarchyFeature and SemanticTokensFeature + // since they are available on stable. + // Note that while these features are stable in vscode their LSP protocol + // implementations are still in the "proposed" category for 3.16. res.registerFeature(new CallHierarchyFeature(res)); - - if (config.package.enableProposedApi) { - if (config.highlightingSemanticTokens) { - res.registerFeature(new SemanticTokensFeature(res)); - } - } + res.registerFeature(new SemanticTokensFeature(res)); return res; } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 1f45f1de..21c1c9f2 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -69,7 +69,6 @@ export class Config { get serverPath() { return this.cfg.get("serverPath")!; } get channel() { return this.cfg.get("updates.channel")!; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload")!; } - get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens")!; } get traceExtension() { return this.cfg.get("trace.extension")!; } get inlayHints() { diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index bd1c3de0..f7ed62d0 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -21,7 +21,7 @@ export class Ctx { serverPath: string, cwd: string, ): Promise { - const client = await createClient(config, serverPath, cwd); + const client = await createClient(serverPath, cwd); const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); From bb3f3f1a6d8472dc1863fbc308452487d019e50d Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 11 Apr 2020 15:36:16 +0300 Subject: [PATCH 618/819] vscode: fix indent --- rust-analyzer/editors/code/src/inlay_hints.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index 6a8bd942..da74f03d 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -229,13 +229,13 @@ interface InlaysDecorations { } interface RustSourceFile { - /* - * Source of the token to cancel in-flight inlay hints request if any. - */ + /** + * Source of the token to cancel in-flight inlay hints request if any. + */ inlaysRequest: null | vscode.CancellationTokenSource; /** - * Last applied decorations. - */ + * Last applied decorations. + */ cachedDecorations: null | InlaysDecorations; document: RustDocument; From d19ea71143c1dcdd013eac6be8866b24b4f60357 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 11 Apr 2020 15:23:07 +0300 Subject: [PATCH 619/819] vscode: fix typing bug in config --- rust-analyzer/editors/code/src/config.ts | 39 ++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 21c1c9f2..35a05131 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -66,23 +66,44 @@ export class Config { return vscode.workspace.getConfiguration(this.rootSection); } - get serverPath() { return this.cfg.get("serverPath")!; } - get channel() { return this.cfg.get("updates.channel")!; } - get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload")!; } - get traceExtension() { return this.cfg.get("trace.extension")!; } + /** + * Beware that postfix `!` operator erases both `null` and `undefined`. + * This is why the following doesn't work as expected: + * + * ```ts + * const nullableNum = vscode + * .workspace + * .getConfiguration + * .getConfiguration("rust-analyer") + * .get(path)!; + * + * // What happens is that type of `nullableNum` is `number` but not `null | number`: + * const fullFledgedNum: number = nullableNum; + * ``` + * So this getter handles this quirk by not requiring the caller to use postfix `!` + */ + private get(path: string): T { + return this.cfg.get(path)!; + } + + get serverPath() { return this.get("serverPath"); } + get channel() { return this.get("updates.channel"); } + get askBeforeDownload() { return this.get("updates.askBeforeDownload"); } + get traceExtension() { return this.get("trace.extension"); } + get inlayHints() { return { - typeHints: this.cfg.get("inlayHints.typeHints")!, - parameterHints: this.cfg.get("inlayHints.parameterHints")!, - chainingHints: this.cfg.get("inlayHints.chainingHints")!, - maxLength: this.cfg.get("inlayHints.maxLength")!, + typeHints: this.get("inlayHints.typeHints"), + parameterHints: this.get("inlayHints.parameterHints"), + chainingHints: this.get("inlayHints.chainingHints"), + maxLength: this.get("inlayHints.maxLength"), }; } get checkOnSave() { return { - command: this.cfg.get("checkOnSave.command")!, + command: this.get("checkOnSave.command"), }; } } From 6d9b08ad70a95893a47d6dcd3ae3ae5c5ec3cd2a Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 11 Apr 2020 18:22:13 +0300 Subject: [PATCH 620/819] fix: inlay hints config desyncronization between the frontend and the backend See the explanation in the issue comment: https://github.com/rust-analyzer/rust-analyzer/issues/3924#issuecomment-612444566 --- rust-analyzer/editors/code/src/inlay_hints.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index da74f03d..a0953179 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -3,13 +3,13 @@ import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; import { Ctx, Disposable } from './ctx'; -import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor } from './util'; +import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, sleep } from './util'; export function activateInlayHints(ctx: Ctx) { const maybeUpdater = { updater: null as null | HintsUpdater, - onConfigChange() { + async onConfigChange() { if ( !ctx.config.inlayHints.typeHints && !ctx.config.inlayHints.parameterHints && @@ -17,6 +17,7 @@ export function activateInlayHints(ctx: Ctx) { ) { return this.dispose(); } + await sleep(100); if (this.updater) { this.updater.syncCacheAndRenderHints(); } else { From a85796006f4632a35d0621cb624d947353004fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=BBuk?= Date: Mon, 13 Apr 2020 12:13:55 +0200 Subject: [PATCH 621/819] Fix parentModule shortcut conflict The default parentModule shortcut conflicts with VSCode's built-in undo selection --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 0bf7b6ae..5f68b2f9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -154,7 +154,7 @@ "keybindings": [ { "command": "rust-analyzer.parentModule", - "key": "ctrl+u", + "key": "ctrl+shift+u", "when": "editorTextFocus && editorLangId == rust" }, { From 60e26c9c045bc1aeffee19ce35e5493ccc7f26b5 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 14 Apr 2020 10:20:16 -0400 Subject: [PATCH 622/819] Bump @types/vscode and vscode-languageclient --- rust-analyzer/editors/code/package-lock.json | 36 ++++++++++---------- rust-analyzer/editors/code/package.json | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index eb4f299a..e11cffd6 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -109,9 +109,9 @@ } }, "@types/vscode": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.43.0.tgz", - "integrity": "sha512-kIaR9qzd80rJOxePKpCB/mdy00mz8Apt2QA5Y6rdrKFn13QNFNeP3Hzmsf37Bwh/3cS7QjtAeGSK7wSqAU0sYQ==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.44.0.tgz", + "integrity": "sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==", "dev": true }, "@typescript-eslint/eslint-plugin": { @@ -1776,32 +1776,32 @@ } }, "vscode-jsonrpc": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", - "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" + "version": "5.1.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.1.0-next.1.tgz", + "integrity": "sha512-mwLDojZkbmpizSJSmp690oa9FB9jig18SIDGZeBCvFc2/LYSRvMm/WwWtMBJuJ1MfFh7rZXfQige4Uje5Z9NzA==" }, "vscode-languageclient": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.3.tgz", - "integrity": "sha512-YciJxk08iU5LmWu7j5dUt9/1OLjokKET6rME3cI4BRpiF6HZlusm2ZwPt0MYJ0lV5y43sZsQHhyon2xBg4ZJVA==", + "version": "7.0.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.1.tgz", + "integrity": "sha512-JrjCUhLpQZxQ5VpWpilOHDMhVsn0fdN5jBh1uFNhSr5c2loJvRdr9Km2EuSQOFfOQsBKx0+xvY8PbsypNEcJ6w==", "requires": { "semver": "^6.3.0", - "vscode-languageserver-protocol": "^3.15.3" + "vscode-languageserver-protocol": "3.16.0-next.2" } }, "vscode-languageserver-protocol": { - "version": "3.15.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz", - "integrity": "sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw==", + "version": "3.16.0-next.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.2.tgz", + "integrity": "sha512-atmkGT/W6tF0cx4SaWFYtFs2UeSeC28RPiap9myv2YZTaTCFvTBEPNWrU5QRKfkyM0tbgtGo6T3UCQ8tkDpjzA==", "requires": { - "vscode-jsonrpc": "^5.0.1", - "vscode-languageserver-types": "3.15.1" + "vscode-jsonrpc": "5.1.0-next.1", + "vscode-languageserver-types": "3.16.0-next.1" } }, "vscode-languageserver-types": { - "version": "3.15.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", - "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" + "version": "3.16.0-next.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.1.tgz", + "integrity": "sha512-tZFUSbyjUcrh+qQf13ALX4QDdOfDX0cVaBFgy7ktJ0VwS7AW/yRKgGPSxVqqP9OCMNPdqP57O5q47w2pEwfaUg==" }, "which": { "version": "1.3.1", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 0bf7b6ae..33bd66b4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -34,14 +34,14 @@ "dependencies": { "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", - "vscode-languageclient": "6.1.3" + "vscode-languageclient": "7.0.0-next.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", "@types/node": "^12.12.34", "@types/node-fetch": "^2.5.5", - "@types/vscode": "^1.43.0", + "@types/vscode": "^1.44.0", "@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/parser": "^2.27.0", "eslint": "^6.8.0", From 655405cdc2a7909a638d1eb1ec33054f0840fc0d Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 13 Apr 2020 00:05:33 +0800 Subject: [PATCH 623/819] Add config for proc_macro --- rust-analyzer/editors/code/package.json | 10 ++++++++++ rust-analyzer/editors/code/src/config.ts | 1 + 2 files changed, 11 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5f73c8d8..d39a9b6d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -388,6 +388,16 @@ "description": "Enable logging of VS Code extensions itself", "type": "boolean", "default": false + }, + "rust-analyzer.procMacro.enabled": { + "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", + "type": "boolean", + "default": false + }, + "rust-analyzer.procMacro.serverPath": { + "description": "Proc macro server path", + "type": "string", + "default": "ra_proc_macro_srv" } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 35a05131..3b2eec8b 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -12,6 +12,7 @@ export class Config { private readonly requiresReloadOpts = [ "serverPath", "cargo", + "procMacro", "files", "highlighting", "updates.channel", From 596d83cd3ca43ed123ec5c065c6a5e4a04b0ed45 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 16 Apr 2020 21:13:57 +0800 Subject: [PATCH 624/819] Add proc-macro cli command for rust-analyzer --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d39a9b6d..5ce59e54 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -393,11 +393,6 @@ "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", "type": "boolean", "default": false - }, - "rust-analyzer.procMacro.serverPath": { - "description": "Proc macro server path", - "type": "string", - "default": "ra_proc_macro_srv" } } }, From e399eb2e225e0aaefed2079e6ccdd84aef3e1cae Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 18 Apr 2020 20:59:22 +0200 Subject: [PATCH 625/819] Add semantic tag for unresolved references This is a quick way to implement unresolved reference diagnostics. For example, adding to VS Code config "editor.tokenColorCustomizationsExperimental": { "unresolvedReference": "#FF0000" }, will highlight all unresolved refs in red. --- rust-analyzer/editors/code/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 5ce59e54..79410ad1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -517,6 +517,10 @@ "id": "union", "description": "Style for C-style untagged unions", "superType": "type" + }, + { + "id": "unresolvedReference", + "description": "Style for names which can not be resolved due to compilation errors" } ], "semanticTokenModifiers": [ From 53df4e15dd7b63612dc3ad31caa29e1288d172e8 Mon Sep 17 00:00:00 2001 From: Timo Freiberg Date: Mon, 20 Apr 2020 18:02:36 +0200 Subject: [PATCH 626/819] Jump to sourceChanges in other files --- rust-analyzer/editors/code/src/source_change.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts index 399a150c..af8f1df5 100644 --- a/rust-analyzer/editors/code/src/source_change.ts +++ b/rust-analyzer/editors/code/src/source_change.ts @@ -37,11 +37,13 @@ export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) { toReveal.position, ); const editor = vscode.window.activeTextEditor; - if (!editor || editor.document.uri.toString() !== uri.toString()) { + if (!editor || !editor.selection.isEmpty) { return; } - if (!editor.selection.isEmpty) { - return; + + if (editor.document.uri !== uri) { + const doc = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(doc); } editor.selection = new vscode.Selection(position, position); editor.revealRange( From 7cd5d79e9a03037bf20aba5192ead255dce23fbb Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 22 Apr 2020 02:00:58 +0300 Subject: [PATCH 627/819] Fix .rast tmGrammar to account for numbers in identifiers --- rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json b/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json index 0d72a3e3..431d414f 100644 --- a/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json +++ b/rust-analyzer/editors/code/ra_syntax_tree.tmGrammar.json @@ -9,7 +9,7 @@ ], "repository": { "node_type": { - "match": "^\\s*([A-Z_]+?)@", + "match": "^\\s*([A-Z_][A-Z_0-9]*?)@", "captures": { "1": { "name": "entity.name.class" From b1624abd6e30eae4647f1c93aa40edc74747f51a Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 22 Apr 2020 02:04:28 +0300 Subject: [PATCH 628/819] Work around crlf in syntax tree --- .../editors/code/src/commands/syntax_tree.ts | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index b7a39741..f00f46be 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -198,7 +198,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astFileRange); } - private findAstNodeRange(astLine: vscode.TextLine) { + private findAstNodeRange(astLine: vscode.TextLine): vscode.Range { const lineOffset = astLine.range.start; const begin = lineOffset.translate(undefined, astLine.firstNonWhitespaceCharacterIndex); const end = lineOffset.translate(undefined, astLine.text.trimEnd().length); @@ -209,10 +209,46 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); if (!parsedRange) return; - const [begin, end] = parsedRange.slice(1).map(off => doc.positionAt(+off)); + const [begin, end] = parsedRange + .slice(1) + .map(off => this.positionAt(doc, +off)); return new vscode.Range(begin, end); } + + // Shitty memoize the last value, otherwise the CPU is at 100% single core + // with quadratic lookups when we build rust2Ast cache + memo?: [vscode.TextDocument, number, number]; + + positionAt(doc: vscode.TextDocument, offset: number): vscode.Position { + if (doc.eol === vscode.EndOfLine.LF) { + return doc.positionAt(offset); + } + + // God damn shitty workaround for crlf line endings + // We are still in this prehistoric era of carriage returns here... + + let i = 0; + let curOffset = 0; + + if (this.memo) { + const [memDoc, memOffset, memI] = this.memo; + if (memDoc === doc && memOffset <= offset) { + curOffset = memOffset; + i = memI; + } + } + + while (true) { + const lineLenWithLf = doc.lineAt(i).text.length + 1; + curOffset += lineLenWithLf; + if (curOffset > offset) { + this.memo = [doc, curOffset - lineLenWithLf, i]; + return doc.positionAt(offset + i); + } + i += 1; + } + } } class Lazy { From 200c4b6896c9e6272933f6a5de8e633e6a723387 Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 22 Apr 2020 02:28:44 +0300 Subject: [PATCH 629/819] Refactor the workaround a bit --- .../editors/code/src/commands/syntax_tree.ts | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index f00f46be..cfcf47b2 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -216,37 +216,34 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D return new vscode.Range(begin, end); } - // Shitty memoize the last value, otherwise the CPU is at 100% single core + // Memoize the last value, otherwise the CPU is at 100% single core // with quadratic lookups when we build rust2Ast cache - memo?: [vscode.TextDocument, number, number]; + cache?: { doc: vscode.TextDocument; offset: number; line: number }; - positionAt(doc: vscode.TextDocument, offset: number): vscode.Position { + positionAt(doc: vscode.TextDocument, targetOffset: number): vscode.Position { if (doc.eol === vscode.EndOfLine.LF) { - return doc.positionAt(offset); + return doc.positionAt(targetOffset); } - // God damn shitty workaround for crlf line endings + // Shitty workaround for crlf line endings // We are still in this prehistoric era of carriage returns here... - let i = 0; - let curOffset = 0; + let line = 0; + let offset = 0; - if (this.memo) { - const [memDoc, memOffset, memI] = this.memo; - if (memDoc === doc && memOffset <= offset) { - curOffset = memOffset; - i = memI; - } + const cache = this.cache; + if (cache?.doc === doc && cache.offset <= targetOffset) { + ({ line, offset } = cache); } while (true) { - const lineLenWithLf = doc.lineAt(i).text.length + 1; - curOffset += lineLenWithLf; - if (curOffset > offset) { - this.memo = [doc, curOffset - lineLenWithLf, i]; - return doc.positionAt(offset + i); + const lineLenWithLf = doc.lineAt(line).text.length + 1; + if (offset + lineLenWithLf > targetOffset) { + this.cache = { doc, offset, line }; + return doc.positionAt(targetOffset + line); } - i += 1; + offset += lineLenWithLf; + line += 1; } } } From 92e4e9b3fb3e76d5e6b9b97dafcecfe737fa17f9 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 22 Apr 2020 10:58:50 -0400 Subject: [PATCH 630/819] npm update --- rust-analyzer/editors/code/package-lock.json | 145 +++++++++++++------ rust-analyzer/editors/code/package.json | 14 +- 2 files changed, 109 insertions(+), 50 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e11cffd6..55ba5351 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -25,25 +25,27 @@ } }, "@rollup/plugin-commonjs": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz", - "integrity": "sha512-MPYGZr0qdbV5zZj8/2AuomVpnRVXRU5XKXb3HVniwRoRCreGlf5kOE081isNWeiLIi6IYkwTX9zE0/c7V8g81g==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", + "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.0", + "@rollup/pluginutils": "^3.0.8", + "commondir": "^1.0.1", "estree-walker": "^1.0.1", + "glob": "^7.1.2", "is-reference": "^1.1.2", "magic-string": "^0.25.2", "resolve": "^1.11.0" } }, "@rollup/plugin-node-resolve": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.1.tgz", - "integrity": "sha512-14ddhD7TnemeHE97a4rLOhobfYvUVcaYuqTnL8Ti7Jxi9V9Jr5LY7Gko4HZ5k4h4vqQM0gBQt6tsp9xXW94WPA==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", + "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.6", + "@rollup/pluginutils": "^3.0.8", "@types/resolve": "0.0.8", "builtin-modules": "^3.1.0", "is-module": "^1.0.0", @@ -51,12 +53,14 @@ } }, "@rollup/pluginutils": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.8.tgz", - "integrity": "sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw==", + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.9.tgz", + "integrity": "sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==", "dev": true, "requires": { - "estree-walker": "^1.0.1" + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "micromatch": "^4.0.2" } }, "@types/color-name": { @@ -84,15 +88,15 @@ "dev": true }, "@types/node": { - "version": "12.12.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.34.tgz", - "integrity": "sha512-BneGN0J9ke24lBRn44hVHNeDlrXRYF+VRp0HbSUNnEZahXGAysHZIqnf/hER6aabdBgzM4YOV4jrR8gj4Zfi0g==", + "version": "12.12.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz", + "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==", "dev": true }, "@types/node-fetch": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.5.tgz", - "integrity": "sha512-IWwjsyYjGw+em3xTvWVQi5MgYKbRs0du57klfTaZkv/B24AEQ/p/IopNeqIYNy3EsfHOpg8ieQSDomPcsYMHpA==", + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.6.tgz", + "integrity": "sha512-2w0NTwMWF1d3NJMK0Uiq2UNN8htVCyOWOD0jIPjPgC5Ph/YP4dVhs9YxxcMcuLuwAslz0dVEcZQUaqkLs3IzOQ==", "dev": true, "requires": { "@types/node": "*", @@ -115,25 +119,25 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz", - "integrity": "sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.29.0.tgz", + "integrity": "sha512-X/YAY7azKirENm4QRpT7OVmzok02cSkqeIcLmdz6gXUQG4Hk0Fi9oBAynSAyNXeGdMRuZvjBa0c1Lu0dn/u6VA==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.27.0", + "@typescript-eslint/experimental-utils": "2.29.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz", - "integrity": "sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz", + "integrity": "sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.27.0", + "@typescript-eslint/typescript-estree": "2.29.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, @@ -150,21 +154,21 @@ } }, "@typescript-eslint/parser": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.27.0.tgz", - "integrity": "sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.29.0.tgz", + "integrity": "sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.27.0", - "@typescript-eslint/typescript-estree": "2.27.0", + "@typescript-eslint/experimental-utils": "2.29.0", + "@typescript-eslint/typescript-estree": "2.29.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz", - "integrity": "sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz", + "integrity": "sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA==", "dev": true, "requires": { "debug": "^4.1.1", @@ -287,6 +291,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -387,6 +400,12 @@ "integrity": "sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==", "dev": true }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -728,6 +747,15 @@ "flat-cache": "^2.0.1" } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -763,9 +791,9 @@ "dev": true }, "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", "dev": true, "optional": true }, @@ -983,6 +1011,12 @@ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -1114,6 +1148,16 @@ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -1322,6 +1366,12 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -1373,9 +1423,9 @@ "dev": true }, "resolve": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", - "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", + "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -1407,9 +1457,9 @@ } }, "rollup": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.3.tgz", - "integrity": "sha512-uJ9VNWk80mb4wDCSfd1AyHoSc9TrWbkZtnO6wbsMTp9muSWkT26Dvc99MX1yGCOTvUN1Skw/KpFzKdUDuZKTXA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.7.1.tgz", + "integrity": "sha512-c1FCjY8HK1nAq0bTZHaR72ZknpP7p0EjxbcVc6BcmtOosurK//P5jtwxX+f/4fgtbrjczqf0uvR+EdtxpriE8g==", "dev": true, "requires": { "fsevents": "~2.1.2" @@ -1629,6 +1679,15 @@ "os-tmpdir": "~1.0.2" } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "tslib": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 79410ad1..cc74c92d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -37,15 +37,15 @@ "vscode-languageclient": "7.0.0-next.1" }, "devDependencies": { - "@rollup/plugin-commonjs": "^11.0.2", - "@rollup/plugin-node-resolve": "^7.1.1", - "@types/node": "^12.12.34", - "@types/node-fetch": "^2.5.5", + "@rollup/plugin-commonjs": "^11.1.0", + "@rollup/plugin-node-resolve": "^7.1.3", + "@types/node": "^12.12.37", + "@types/node-fetch": "^2.5.6", "@types/vscode": "^1.44.0", - "@typescript-eslint/eslint-plugin": "^2.27.0", - "@typescript-eslint/parser": "^2.27.0", + "@typescript-eslint/eslint-plugin": "^2.29.0", + "@typescript-eslint/parser": "^2.29.0", "eslint": "^6.8.0", - "rollup": "^2.3.3", + "rollup": "^2.7.1", "tslib": "^1.11.1", "typescript": "^3.8.3", "typescript-formatter": "^7.2.2", From b3075a63287b16c94e6a743015f0ba7522790598 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 22 Apr 2020 17:22:59 +0200 Subject: [PATCH 631/819] Align the name of proc-macro enabling flag We use `enable`, not `enabled` elsewhere --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 79410ad1..0726167b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -389,7 +389,7 @@ "type": "boolean", "default": false }, - "rust-analyzer.procMacro.enabled": { + "rust-analyzer.procMacro.enable": { "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", "type": "boolean", "default": false From 9ce349ec2b05476c87f162a50c65b31203bdc95c Mon Sep 17 00:00:00 2001 From: Jonathan Dickinson Date: Wed, 22 Apr 2020 17:05:04 -0700 Subject: [PATCH 632/819] tasks.json Support Move the task provider anonymous class into a real class, as this seems to be how Microsoft do this in their documentation. resolveTask is now implemented, which is used by VSCode to determine how to execute tasks that the user has defined in tasks.json. --- rust-analyzer/editors/code/src/tasks.ts | 103 +++++++++++++++--------- 1 file changed, 67 insertions(+), 36 deletions(-) diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index fa1c4a95..1366c76d 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -4,49 +4,80 @@ import * as vscode from 'vscode'; // our configuration should be compatible with it so use the same key. const TASK_TYPE = 'cargo'; -export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { - const provider: vscode.TaskProvider = { +interface CargoTaskDefinition extends vscode.TaskDefinition { + command?: string; + args?: string[]; + cwd?: string; + env?: { [key: string]: string }; +} + +class CargoTaskProvider implements vscode.TaskProvider { + private readonly target: vscode.WorkspaceFolder; + + constructor(target: vscode.WorkspaceFolder) { + this.target = target; + } + + provideTasks(): vscode.Task[] { // Detect Rust tasks. Currently we do not do any actual detection // of tasks (e.g. aliases in .cargo/config) and just return a fixed // set of tasks that always exist. These tasks cannot be removed in // tasks.json - only tweaked. - provideTasks: () => getStandardCargoTasks(target), - // We don't need to implement this. - resolveTask: () => undefined, - }; + return [ + { command: 'build', group: vscode.TaskGroup.Build }, + { command: 'check', group: vscode.TaskGroup.Build }, + { command: 'test', group: vscode.TaskGroup.Test }, + { command: 'clean', group: vscode.TaskGroup.Clean }, + { command: 'run', group: undefined }, + ] + .map(({ command, group }) => { + const vscodeTask = new vscode.Task( + // The contents of this object end up in the tasks.json entries. + { + type: TASK_TYPE, + command, + }, + // The scope of the task - workspace or specific folder (global + // is not supported). + this.target, + // The task name, and task source. These are shown in the UI as + // `${source}: ${name}`, e.g. `rust: cargo build`. + `cargo ${command}`, + 'rust', + // What to do when this command is executed. + new vscode.ShellExecution('cargo', [command]), + // Problem matchers. + ['$rustc'], + ); + vscodeTask.group = group; + return vscodeTask; + }); + } - return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); -} + resolveTask(task: vscode.Task): vscode.Task | undefined { + // VSCode calls this for every cargo task in the user's tasks.json, + // we need to inform VSCode how to execute that command by creating + // a ShellExecution for it. -function getStandardCargoTasks(target: vscode.WorkspaceFolder): vscode.Task[] { - return [ - { command: 'build', group: vscode.TaskGroup.Build }, - { command: 'check', group: vscode.TaskGroup.Build }, - { command: 'test', group: vscode.TaskGroup.Test }, - { command: 'clean', group: vscode.TaskGroup.Clean }, - { command: 'run', group: undefined }, - ] - .map(({ command, group }) => { - const vscodeTask = new vscode.Task( - // The contents of this object end up in the tasks.json entries. - { - type: TASK_TYPE, - command, - }, - // The scope of the task - workspace or specific folder (global - // is not supported). - target, - // The task name, and task source. These are shown in the UI as - // `${source}: ${name}`, e.g. `rust: cargo build`. - `cargo ${command}`, + const definition = task.definition as CargoTaskDefinition; + + if (definition.type === 'cargo' && definition.command) { + const args = [definition.command].concat(definition.args ?? []); + + return new vscode.Task( + definition, + task.name, 'rust', - // What to do when this command is executed. - new vscode.ShellExecution('cargo', [command]), - // Problem matchers. - ['$rustc'], + new vscode.ShellExecution('cargo', args, definition), ); - vscodeTask.group = group; - return vscodeTask; - }); + } + + return undefined; + } } + +export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { + const provider = new CargoTaskProvider(target); + return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); +} \ No newline at end of file From 5ddab196ac9c8d54d25286f9522dacab0fb93fe8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 23 Apr 2020 20:46:44 +0200 Subject: [PATCH 633/819] Disable onEnter command by default We are transitioning from experimental to production-ready stance, so it makes sense to disable potentially disruptive features by default. --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ab0f25b2..b8aaa07d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -166,11 +166,6 @@ "command": "rust-analyzer.joinLines", "key": "ctrl+shift+j", "when": "editorTextFocus && editorLangId == rust" - }, - { - "command": "rust-analyzer.onEnter", - "key": "enter", - "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust" } ], "configuration": { From 32163381c215b599a3e868121996d02782a329ed Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 25 Apr 2020 20:52:50 +0300 Subject: [PATCH 634/819] Remove unnecessary async from vscode language client creation --- rust-analyzer/editors/code/src/client.ts | 2 +- rust-analyzer/editors/code/src/ctx.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 0ad4b63a..97e79409 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -4,7 +4,7 @@ import * as vscode from 'vscode'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; -export async function createClient(serverPath: string, cwd: string): Promise { +export function createClient(serverPath: string, cwd: string): lc.LanguageClient { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). // It might be a good idea to test if the uri points to a file. diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index f7ed62d0..41df1199 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -21,7 +21,7 @@ export class Ctx { serverPath: string, cwd: string, ): Promise { - const client = await createClient(serverPath, cwd); + const client = createClient(serverPath, cwd); const res = new Ctx(config, extCtx, client, serverPath); res.pushCleanup(client.start()); await client.onReady(); From c59febd848cfb44679ee473df1b1108a63987d48 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Apr 2020 21:11:18 +0200 Subject: [PATCH 635/819] Remove dead code --- rust-analyzer/editors/code/src/client.ts | 29 ------------------------ 1 file changed, 29 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 0ad4b63a..f702829c 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -42,35 +42,6 @@ export async function createClient(serverPath: string, cwd: string): Promise { - if (typeof messageOrDataObject === 'string') { - if ( - messageOrDataObject.includes( - 'rust-analyzer/publishDecorations', - ) || - messageOrDataObject.includes( - 'rust-analyzer/decorationsRequest', - ) - ) { - // Don't log publish decorations requests - } else { - // @ts-ignore This is just a utility function - res.logTrace(messageOrDataObject, data); - } - } else { - // @ts-ignore - res.logObjectTrace(messageOrDataObject); - } - }, - }; - // To turn on all proposed features use: res.registerProposedFeatures(); // Here we want to enable CallHierarchyFeature and SemanticTokensFeature // since they are available on stable. From e2a58e2b04583327767fae825691a7c3cc80b3b7 Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Mon, 27 Apr 2020 00:11:04 +0200 Subject: [PATCH 636/819] Started rust-analyzer.cargo.defaultTarget implementation --- rust-analyzer/editors/code/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b8aaa07d..fe330fb4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,6 +237,14 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, + "rust-analyzer.cargo.rustc.defaultTarget": { + "type": [ + "null", + "string" + ], + "default": null, + "description": "Specify the default target" + }, "rust-analyzer.rustfmt.extraArgs": { "type": "array", "items": { From c71e2303ec863b803cd73571d4bfbd21142a0cab Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 28 Apr 2020 00:15:54 +0200 Subject: [PATCH 637/819] [config] rename cargo.defaultTarget --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fe330fb4..775bdaf1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,7 +237,7 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, - "rust-analyzer.cargo.rustc.defaultTarget": { + "rust-analyzer.cargo.defaultTarget": { "type": [ "null", "string" From 661100a76ba34113d9a44f65294334472183772e Mon Sep 17 00:00:00 2001 From: vsrs Date: Tue, 28 Apr 2020 17:30:49 +0300 Subject: [PATCH 638/819] ms-vscode.cpptools debugger support, initial version. --- rust-analyzer/editors/code/src/cargo.ts | 103 ++++++++++++++++++ .../editors/code/src/commands/runnables.ts | 47 ++++++-- 2 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 rust-analyzer/editors/code/src/cargo.ts diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts new file mode 100644 index 00000000..d119b622 --- /dev/null +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -0,0 +1,103 @@ +import { window } from 'vscode'; +import * as cp from 'child_process'; +import * as readline from 'readline'; + +interface CompilationArtifact { + fileName: string; + name: string; + kind: string; + isTest: boolean; +} + +export class Cargo { + rootFolder: string; + env?: { [key: string]: string }; + + public constructor(cargoTomlFolder: string) { + this.rootFolder = cargoTomlFolder; + } + + public async artifactsFromArgs(cargoArgs: string[]): Promise { + let artifacts: CompilationArtifact[] = []; + + try { + await this.runCargo(cargoArgs, + message => { + if (message.reason == 'compiler-artifact' && message.executable) { + let isBinary = message.target.crate_types.includes('bin'); + let isBuildScript = message.target.kind.includes('custom-build'); + if ((isBinary && !isBuildScript) || message.profile.test) { + artifacts.push({ + fileName: message.executable, + name: message.target.name, + kind: message.target.kind[0], + isTest: message.profile.test + }) + } + } + }, + _stderr => { + // TODO: to output + } + ); + } + catch (err) { + // TODO: to output + throw new Error(`Cargo invocation has failed: ${err}`); + } + + return artifacts; + } + + public async executableFromArgs(cargoArgs: string[], extraArgs?: string[]): Promise { + cargoArgs.push("--message-format=json"); + if (extraArgs) { + cargoArgs.push('--'); + cargoArgs.push(...extraArgs); + } + + let artifacts = await this.artifactsFromArgs(cargoArgs); + + if (artifacts.length == 0 ) { + throw new Error('No compilation artifacts'); + } else if (artifacts.length > 1) { + throw new Error('Multiple compilation artifacts are not supported.'); + } + + return artifacts[0].fileName; + } + + runCargo( + cargoArgs: string[], + onStdoutJson: (obj: any) => void, + onStderrString: (data: string) => void + ): Promise { + return new Promise((resolve, reject) => { + let cargo = cp.spawn('cargo', cargoArgs, { + stdio: ['ignore', 'pipe', 'pipe'], + cwd: this.rootFolder, + env: this.env, + }); + + cargo.on('error', err => { + reject(new Error(`could not launch cargo: ${err}`)); + }); + cargo.stderr.on('data', chunk => { + onStderrString(chunk.toString()); + }); + + let rl = readline.createInterface({ input: cargo.stdout }); + rl.on('line', line => { + let message = JSON.parse(line); + onStdoutJson(message); + }); + + cargo.on('exit', (exitCode, _) => { + if (exitCode == 0) + resolve(exitCode); + else + reject(new Error(`exit code: ${exitCode}.`)); + }); + }); + } +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 2635a144..26db1815 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; +import { Cargo } from '../cargo'; export function run(ctx: Ctx): Cmd { let prevRunnable: RunnableQuickPick | undefined; @@ -62,25 +63,47 @@ export function runSingle(ctx: Ctx): Cmd { }; } +function getLldbDebugConfig(config: ra.Runnable) : vscode.DebugConfiguration { + return { + type: "lldb", + request: "launch", + name: config.label, + cargo: { + args: config.args, + }, + args: config.extraArgs, + cwd: config.cwd + }; +} + +async function getCppvsDebugConfig(config: ra.Runnable) : Promise { + let cargo = new Cargo(config.cwd || '.'); + let executable = await cargo.executableFromArgs(config.args, config.extraArgs); + + return { + type: "cppvsdbg", + request: "launch", + name: config.label, + program: executable, + args: config.extraArgs, + cwd: config.cwd, + }; +} + export function debugSingle(ctx: Ctx): Cmd { return async (config: ra.Runnable) => { const editor = ctx.activeRustEditor; if (!editor) return; - if (!vscode.extensions.getExtension("vadimcn.vscode-lldb")) { - vscode.window.showErrorMessage("Install `vadimcn.vscode-lldb` extension for debugging"); + + const mscpp = vscode.extensions.getExtension("ms-vscode.cpptools"); + const lldb = vscode.extensions.getExtension("vadimcn.vscode-lldb"); + + if (!(lldb || mscpp)) { + vscode.window.showErrorMessage("Install `vadimcn.vscode-lldb` or `ms-vscode.cpptools` extension for debugging"); return; } - const debugConfig = { - type: "lldb", - request: "launch", - name: config.label, - cargo: { - args: config.args, - }, - args: config.extraArgs, - cwd: config.cwd - }; + const debugConfig = lldb ? getLldbDebugConfig(config) : await getCppvsDebugConfig(config); return vscode.debug.startDebugging(undefined, debugConfig); }; From 6bbbbe98e7b04b4e15f577017da9686035fe77b7 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 28 Apr 2020 22:32:23 +0200 Subject: [PATCH 639/819] Build extension too --- rust-analyzer/editors/code/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b8aaa07d..c4dfa7e1 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -27,6 +27,7 @@ "scripts": { "vscode:prepublish": "tsc && rollup -c", "package": "vsce package -o rust-analyzer.vsix", + "build": "tsc", "watch": "tsc --watch", "lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src", "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" From d5d6223fa440315a2309ba9d411300d6991069ed Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 29 Apr 2020 13:10:42 +0300 Subject: [PATCH 640/819] Configuration settings and source maps support --- rust-analyzer/editors/code/package.json | 19 +++++++++++ rust-analyzer/editors/code/src/cargo.ts | 1 - .../editors/code/src/commands/runnables.ts | 33 ++++++++++++++----- rust-analyzer/editors/code/src/config.ts | 9 ++++- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b8aaa07d..aa806517 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -388,6 +388,25 @@ "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", "type": "boolean", "default": false + }, + "rust-analyzer.debug.engine": { + "type": [ + "null", + "string" + ], + "enum": [ + "ms-vscode.cpptools", + "vadimcn.vscode-lldb" + ], + "default": null, + "description": "Preffered debug engine." + }, + "rust-analyzer.debug.sourceFileMap" : { + "type":"object", + "description": "Optional source file mappings passed to the debug engine.", + "default": { + "": "" + } } } }, diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index d119b622..5999187f 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -1,4 +1,3 @@ -import { window } from 'vscode'; import * as cp from 'child_process'; import * as readline from 'readline'; diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 26db1815..befb8b36 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -63,7 +63,7 @@ export function runSingle(ctx: Ctx): Cmd { }; } -function getLldbDebugConfig(config: ra.Runnable) : vscode.DebugConfiguration { +function getLldbDebugConfig(config: ra.Runnable, sourceFileMap: Record): vscode.DebugConfiguration { return { type: "lldb", request: "launch", @@ -72,11 +72,12 @@ function getLldbDebugConfig(config: ra.Runnable) : vscode.DebugConfiguration { args: config.args, }, args: config.extraArgs, - cwd: config.cwd + cwd: config.cwd, + sourceMap: sourceFileMap }; } -async function getCppvsDebugConfig(config: ra.Runnable) : Promise { +async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record): Promise { let cargo = new Cargo(config.cwd || '.'); let executable = await cargo.executableFromArgs(config.args, config.extraArgs); @@ -87,6 +88,7 @@ async function getCppvsDebugConfig(config: ra.Runnable) : Promise("updates.askBeforeDownload"); } get traceExtension() { return this.get("trace.extension"); } - get inlayHints() { return { typeHints: this.get("inlayHints.typeHints"), @@ -107,4 +106,12 @@ export class Config { command: this.get("checkOnSave.command"), }; } + + get debug() { + return { + engine: this.get("debug.engine"), + sourceFileMap: this.get>("debug.sourceFileMap"), + }; + } + } From ec2a95872557012afba58e725d96bf47f5fb39ee Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 29 Apr 2020 14:13:57 +0300 Subject: [PATCH 641/819] better configuration enum items --- rust-analyzer/editors/code/package.json | 25 +++++++++++-------- .../editors/code/src/commands/runnables.ts | 2 +- rust-analyzer/editors/code/src/config.ts | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index aa806517..4f2df89e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -390,22 +390,25 @@ "default": false }, "rust-analyzer.debug.engine": { - "type": [ - "null", - "string" - ], + "type": "string", "enum": [ - "ms-vscode.cpptools", - "vadimcn.vscode-lldb" + "auto", + "vadimcn.vscode-lldb", + "ms-vscode.cpptools" ], - "default": null, - "description": "Preffered debug engine." + "default": "auto", + "description": "Preffered debug engine.", + "markdownEnumDescriptions": [ + "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", + "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", + "Use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)" + ] }, - "rust-analyzer.debug.sourceFileMap" : { - "type":"object", + "rust-analyzer.debug.sourceFileMap": { + "type": "object", "description": "Optional source file mappings passed to the debug engine.", "default": { - "": "" + "/rustc/": "${env:USERPROFILE}/.rustup/toolchains//lib/rustlib/src/rust" } } } diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index befb8b36..2238a5a7 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -102,7 +102,7 @@ export function debugSingle(ctx: Ctx): Cmd { let debugEngineId = ctx.config.debug.engine; let debugEngine = null; - if (!debugEngineId) { + if ( debugEngineId === "auto" ) { debugEngine = vscode.extensions.getExtension(lldbId); if (!debugEngine) { debugEngine = vscode.extensions.getExtension(cpptoolsId); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 7764a217..110e5418 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -109,7 +109,7 @@ export class Config { get debug() { return { - engine: this.get("debug.engine"), + engine: this.get("debug.engine"), sourceFileMap: this.get>("debug.sourceFileMap"), }; } From 30e34cb1728c727df0ca5d6920ebfd60196df410 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 29 Apr 2020 16:52:53 +0300 Subject: [PATCH 642/819] MS C++ tools on linux --- rust-analyzer/editors/code/src/commands/runnables.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 2238a5a7..9b078065 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; +import * as os from "os"; import { Ctx, Cmd } from '../ctx'; import { Cargo } from '../cargo'; @@ -82,7 +83,7 @@ async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record Date: Thu, 30 Apr 2020 15:25:04 +0300 Subject: [PATCH 643/819] pass Cargo errors to the Debug output channel --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/cargo.ts | 17 ++++++++++++----- .../editors/code/src/commands/runnables.ts | 7 ++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4f2df89e..70a5c661 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -399,7 +399,7 @@ "default": "auto", "description": "Preffered debug engine.", "markdownEnumDescriptions": [ - "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", + "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed try to use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", "Use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)" ] diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 5999187f..857b84d5 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -1,5 +1,6 @@ import * as cp from 'child_process'; import * as readline from 'readline'; +import { OutputChannel } from 'vscode'; interface CompilationArtifact { fileName: string; @@ -10,10 +11,13 @@ interface CompilationArtifact { export class Cargo { rootFolder: string; - env?: { [key: string]: string }; + env?: Record; + output: OutputChannel; - public constructor(cargoTomlFolder: string) { + public constructor(cargoTomlFolder: string, output: OutputChannel, env: Record | undefined = undefined) { this.rootFolder = cargoTomlFolder; + this.output = output; + this.env = env; } public async artifactsFromArgs(cargoArgs: string[]): Promise { @@ -34,14 +38,17 @@ export class Cargo { }) } } + else if( message.reason == 'compiler-message') { + this.output.append(message.message.rendered); + } }, - _stderr => { - // TODO: to output + stderr => { + this.output.append(stderr); } ); } catch (err) { - // TODO: to output + this.output.show(true); throw new Error(`Cargo invocation has failed: ${err}`); } diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 9b078065..e8035c7d 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -78,10 +78,15 @@ function getLldbDebugConfig(config: ra.Runnable, sourceFileMap: Record): Promise { - let cargo = new Cargo(config.cwd || '.'); + debugOutput.clear(); + + let cargo = new Cargo(config.cwd || '.', debugOutput); let executable = await cargo.executableFromArgs(config.args, config.extraArgs); + // if we are here, there were no compilation errors. return { type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg', request: "launch", From 4db8a874b33303ef1f529489b460ba45032bf9fa Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 30 Apr 2020 18:41:48 +0300 Subject: [PATCH 644/819] Fixed tsfmt and eslint errors. --- rust-analyzer/editors/code/src/cargo.ts | 24 +++++++++---------- .../editors/code/src/commands/runnables.ts | 14 +++++------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 857b84d5..50f93856 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -21,24 +21,24 @@ export class Cargo { } public async artifactsFromArgs(cargoArgs: string[]): Promise { - let artifacts: CompilationArtifact[] = []; + const artifacts: CompilationArtifact[] = []; try { await this.runCargo(cargoArgs, message => { - if (message.reason == 'compiler-artifact' && message.executable) { - let isBinary = message.target.crate_types.includes('bin'); - let isBuildScript = message.target.kind.includes('custom-build'); + if (message.reason === 'compiler-artifact' && message.executable) { + const isBinary = message.target.crate_types.includes('bin'); + const isBuildScript = message.target.kind.includes('custom-build'); if ((isBinary && !isBuildScript) || message.profile.test) { artifacts.push({ fileName: message.executable, name: message.target.name, kind: message.target.kind[0], isTest: message.profile.test - }) + }); } } - else if( message.reason == 'compiler-message') { + else if (message.reason === 'compiler-message') { this.output.append(message.message.rendered); } }, @@ -62,9 +62,9 @@ export class Cargo { cargoArgs.push(...extraArgs); } - let artifacts = await this.artifactsFromArgs(cargoArgs); + const artifacts = await this.artifactsFromArgs(cargoArgs); - if (artifacts.length == 0 ) { + if (artifacts.length === 0) { throw new Error('No compilation artifacts'); } else if (artifacts.length > 1) { throw new Error('Multiple compilation artifacts are not supported.'); @@ -79,7 +79,7 @@ export class Cargo { onStderrString: (data: string) => void ): Promise { return new Promise((resolve, reject) => { - let cargo = cp.spawn('cargo', cargoArgs, { + const cargo = cp.spawn('cargo', cargoArgs, { stdio: ['ignore', 'pipe', 'pipe'], cwd: this.rootFolder, env: this.env, @@ -92,14 +92,14 @@ export class Cargo { onStderrString(chunk.toString()); }); - let rl = readline.createInterface({ input: cargo.stdout }); + const rl = readline.createInterface({ input: cargo.stdout }); rl.on('line', line => { - let message = JSON.parse(line); + const message = JSON.parse(line); onStdoutJson(message); }); cargo.on('exit', (exitCode, _) => { - if (exitCode == 0) + if (exitCode === 0) resolve(exitCode); else reject(new Error(`exit code: ${exitCode}.`)); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index e8035c7d..36d30933 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -82,9 +82,9 @@ const debugOutput = vscode.window.createOutputChannel("Debug"); async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record): Promise { debugOutput.clear(); - - let cargo = new Cargo(config.cwd || '.', debugOutput); - let executable = await cargo.executableFromArgs(config.args, config.extraArgs); + + const cargo = new Cargo(config.cwd || '.', debugOutput); + const executable = await cargo.executableFromArgs(config.args, config.extraArgs); // if we are here, there were no compilation errors. return { @@ -106,9 +106,9 @@ export function debugSingle(ctx: Ctx): Cmd { const lldbId = "vadimcn.vscode-lldb"; const cpptoolsId = "ms-vscode.cpptools"; - let debugEngineId = ctx.config.debug.engine; + const debugEngineId = ctx.config.debug.engine; let debugEngine = null; - if ( debugEngineId === "auto" ) { + if (debugEngineId === "auto") { debugEngine = vscode.extensions.getExtension(lldbId); if (!debugEngine) { debugEngine = vscode.extensions.getExtension(cpptoolsId); @@ -120,11 +120,11 @@ export function debugSingle(ctx: Ctx): Cmd { if (!debugEngine) { vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})` - + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); + + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); return; } - const debugConfig = lldbId == debugEngine.id + const debugConfig = lldbId === debugEngine.id ? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap) : await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap); From 5a225f559ea71d41f14553c8564037c699f57501 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 30 Apr 2020 18:53:34 +0300 Subject: [PATCH 645/819] Removed unnecessary extraArgs for cargo invocation --- rust-analyzer/editors/code/src/cargo.ts | 7 ++----- rust-analyzer/editors/code/src/commands/runnables.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 50f93856..3a7e7030 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -55,12 +55,9 @@ export class Cargo { return artifacts; } - public async executableFromArgs(cargoArgs: string[], extraArgs?: string[]): Promise { + public async executableFromArgs(args: string[]): Promise { + let cargoArgs = [...args]; // to remain args unchanged cargoArgs.push("--message-format=json"); - if (extraArgs) { - cargoArgs.push('--'); - cargoArgs.push(...extraArgs); - } const artifacts = await this.artifactsFromArgs(cargoArgs); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 36d30933..d77e8188 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -84,7 +84,7 @@ async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record Date: Thu, 30 Apr 2020 18:57:40 +0300 Subject: [PATCH 646/819] fixed lint warning --- rust-analyzer/editors/code/src/cargo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 3a7e7030..a328ba9b 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -56,7 +56,7 @@ export class Cargo { } public async executableFromArgs(args: string[]): Promise { - let cargoArgs = [...args]; // to remain args unchanged + const cargoArgs = [...args]; // to remain args unchanged cargoArgs.push("--message-format=json"); const artifacts = await this.artifactsFromArgs(cargoArgs); From a1ea3f0725de6de4c9c859a77e14ddbd55abb59f Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Fri, 1 May 2020 18:59:19 -0400 Subject: [PATCH 647/819] Remove `workspaceLoaded` setting The `workspaceLoaded` notification setting was originally designed to control the display of a popup message that said: "workspace loaded, {} rust packages" This popup was removed and replaced by a much sleeker message in the VSCode status bar that provides a real-time status while loading: rust-analyzer: {}/{} packages This was done as part of #3587 The new status-bar indicator is unobtrusive and shouldn't need to be disabled. So this setting is removed. --- rust-analyzer/editors/code/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d3067379..7ef727b9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -205,11 +205,6 @@ "default": [], "description": "Paths to exclude from analysis." }, - "rust-analyzer.notifications.workspaceLoaded": { - "type": "boolean", - "default": true, - "markdownDescription": "Whether to show `workspace loaded` message." - }, "rust-analyzer.notifications.cargoTomlNotFound": { "type": "boolean", "default": true, From 51f792b0d3db3a56a11418aebd32ecbc513fb60b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 4 May 2020 13:10:59 +0200 Subject: [PATCH 648/819] Specify cotributed semanticTokenTypes in package.json --- rust-analyzer/editors/code/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 7ef727b9..1cbd8d66 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -534,6 +534,10 @@ { "id": "unresolvedReference", "description": "Style for names which can not be resolved due to compilation errors" + }, + { + "id": "formatSpecifier", + "description": "Style for {} placeholders in format strings" } ], "semanticTokenModifiers": [ From f1fd2d6a85cba634b04b022ddf74ef8e5a55a0b2 Mon Sep 17 00:00:00 2001 From: szunami Date: Mon, 4 May 2020 10:27:59 -0400 Subject: [PATCH 649/819] Fix typo in markdownDescription --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1cbd8d66..442b9de9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -281,7 +281,7 @@ "minItems": 1 }, "default": null, - "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message=format=json` or similar option." + "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message-format=json` or similar option." }, "rust-analyzer.checkOnSave.allTargets": { "type": "boolean", From 352bbdacc77978aa637d1c2500f2657a6a2091b1 Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 5 May 2020 18:01:54 +0200 Subject: [PATCH 650/819] Rename `defaultTarget` to target --- rust-analyzer/editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 775bdaf1..d363e9fb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,13 +237,13 @@ "default": false, "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs" }, - "rust-analyzer.cargo.defaultTarget": { + "rust-analyzer.cargo.target": { "type": [ "null", "string" ], "default": null, - "description": "Specify the default target" + "description": "Specify the compilation target" }, "rust-analyzer.rustfmt.extraArgs": { "type": "array", From 6ae6b4a7d59ae1e063bedb00cfd2d9dc03901b5f Mon Sep 17 00:00:00 2001 From: guigui64 Date: Tue, 5 May 2020 22:44:39 +0200 Subject: [PATCH 651/819] add the allFeatures flag (true by default) --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a05a6975..97276339 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -296,6 +296,11 @@ "default": true, "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, + "rust-analyzer.checkOnSave.allFeatures": { + "type": "boolean", + "default": true, + "markdownDescription": "Check with all features (will be passed as `--all-features`)" + }, "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, From 0cc7a6e9b088209670f1de26ea1bc096340ddad5 Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 6 May 2020 00:39:29 +0300 Subject: [PATCH 652/819] Drop dead code and a dependency! --- rust-analyzer/editors/code/package-lock.json | 5 - rust-analyzer/editors/code/package.json | 1 - rust-analyzer/editors/code/src/color_theme.ts | 129 ------------------ 3 files changed, 135 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/color_theme.ts diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 55ba5351..71c627a2 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -1066,11 +1066,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "jsonc-parser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz", - "integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==" - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 97276339..eeb3d351 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -33,7 +33,6 @@ "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" }, "dependencies": { - "jsonc-parser": "^2.2.1", "node-fetch": "^2.6.0", "vscode-languageclient": "7.0.0-next.1" }, diff --git a/rust-analyzer/editors/code/src/color_theme.ts b/rust-analyzer/editors/code/src/color_theme.ts deleted file mode 100644 index 5b9327b2..00000000 --- a/rust-analyzer/editors/code/src/color_theme.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as fs from 'fs'; -import * as jsonc from 'jsonc-parser'; -import * as path from 'path'; -import * as vscode from 'vscode'; - -export interface TextMateRuleSettings { - foreground?: string; - background?: string; - fontStyle?: string; -} - -export class ColorTheme { - private rules: Map = new Map(); - - static load(): ColorTheme { - // Find out current color theme - const themeName = vscode.workspace - .getConfiguration('workbench') - .get('colorTheme'); - - if (typeof themeName !== 'string') { - // console.warn('workbench.colorTheme is', themeName) - return new ColorTheme(); - } - return loadThemeNamed(themeName); - } - - static fromRules(rules: TextMateRule[]): ColorTheme { - const res = new ColorTheme(); - for (const rule of rules) { - const scopes = typeof rule.scope === 'undefined' - ? [] - : typeof rule.scope === 'string' - ? [rule.scope] - : rule.scope; - - for (const scope of scopes) { - res.rules.set(scope, rule.settings); - } - } - return res; - } - - lookup(scopes: string[]): TextMateRuleSettings { - let res: TextMateRuleSettings = {}; - for (const scope of scopes) { - this.rules.forEach((value, key) => { - if (scope.startsWith(key)) { - res = mergeRuleSettings(res, value); - } - }); - } - return res; - } - - mergeFrom(other: ColorTheme) { - other.rules.forEach((value, key) => { - const merged = mergeRuleSettings(this.rules.get(key), value); - this.rules.set(key, merged); - }); - } -} - -function loadThemeNamed(themeName: string): ColorTheme { - function isTheme(extension: vscode.Extension): boolean { - return ( - extension.extensionKind === vscode.ExtensionKind.UI && - extension.packageJSON.contributes && - extension.packageJSON.contributes.themes - ); - } - - const themePaths: string[] = vscode.extensions.all - .filter(isTheme) - .flatMap( - ext => ext.packageJSON.contributes.themes - .filter((it: any) => (it.id || it.label) === themeName) - .map((it: any) => path.join(ext.extensionPath, it.path)) - ); - - const res = new ColorTheme(); - for (const themePath of themePaths) { - res.mergeFrom(loadThemeFile(themePath)); - } - - const globalCustomizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(globalCustomizations?.textMateRules ?? [])); - - const themeCustomizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); - res.mergeFrom(ColorTheme.fromRules(themeCustomizations?.textMateRules ?? [])); - - - return res; -} - -function loadThemeFile(themePath: string): ColorTheme { - let text; - try { - text = fs.readFileSync(themePath, 'utf8'); - } catch { - return new ColorTheme(); - } - const obj = jsonc.parse(text); - const tokenColors: TextMateRule[] = obj?.tokenColors ?? []; - const res = ColorTheme.fromRules(tokenColors); - - for (const include of obj?.include ?? []) { - const includePath = path.join(path.dirname(themePath), include); - res.mergeFrom(loadThemeFile(includePath)); - } - - return res; -} - -interface TextMateRule { - scope: string | string[]; - settings: TextMateRuleSettings; -} - -function mergeRuleSettings( - defaultSetting: TextMateRuleSettings | undefined, - override: TextMateRuleSettings, -): TextMateRuleSettings { - return { - foreground: override.foreground ?? defaultSetting?.foreground, - background: override.background ?? defaultSetting?.background, - fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, - }; -} From a17b9b8038cd276d5598c0ee7495ea5d1344bdd7 Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 6 May 2020 01:22:02 +0300 Subject: [PATCH 653/819] Preliminary refactoring of cargo.ts --- rust-analyzer/editors/code/src/cargo.ts | 45 ++++++------------- .../editors/code/src/commands/runnables.ts | 7 ++- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index a328ba9b..613aa82d 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -10,17 +10,9 @@ interface CompilationArtifact { } export class Cargo { - rootFolder: string; - env?: Record; - output: OutputChannel; + constructor(readonly rootFolder: string, readonly output: OutputChannel) { } - public constructor(cargoTomlFolder: string, output: OutputChannel, env: Record | undefined = undefined) { - this.rootFolder = cargoTomlFolder; - this.output = output; - this.env = env; - } - - public async artifactsFromArgs(cargoArgs: string[]): Promise { + private async artifactsFromArgs(cargoArgs: string[]): Promise { const artifacts: CompilationArtifact[] = []; try { @@ -37,17 +29,13 @@ export class Cargo { isTest: message.profile.test }); } - } - else if (message.reason === 'compiler-message') { + } else if (message.reason === 'compiler-message') { this.output.append(message.message.rendered); } }, - stderr => { - this.output.append(stderr); - } + stderr => this.output.append(stderr), ); - } - catch (err) { + } catch (err) { this.output.show(true); throw new Error(`Cargo invocation has failed: ${err}`); } @@ -55,9 +43,8 @@ export class Cargo { return artifacts; } - public async executableFromArgs(args: string[]): Promise { - const cargoArgs = [...args]; // to remain args unchanged - cargoArgs.push("--message-format=json"); + async executableFromArgs(args: readonly string[]): Promise { + const cargoArgs = [...args, "--message-format=json"]; const artifacts = await this.artifactsFromArgs(cargoArgs); @@ -70,24 +57,20 @@ export class Cargo { return artifacts[0].fileName; } - runCargo( + private runCargo( cargoArgs: string[], onStdoutJson: (obj: any) => void, onStderrString: (data: string) => void ): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const cargo = cp.spawn('cargo', cargoArgs, { stdio: ['ignore', 'pipe', 'pipe'], - cwd: this.rootFolder, - env: this.env, + cwd: this.rootFolder }); - cargo.on('error', err => { - reject(new Error(`could not launch cargo: ${err}`)); - }); - cargo.stderr.on('data', chunk => { - onStderrString(chunk.toString()); - }); + cargo.on('error', err => reject(new Error(`could not launch cargo: ${err}`))); + + cargo.stderr.on('data', chunk => onStderrString(chunk.toString())); const rl = readline.createInterface({ input: cargo.stdout }); rl.on('line', line => { @@ -103,4 +86,4 @@ export class Cargo { }); }); } -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index d77e8188..2ed150e2 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -119,8 +119,11 @@ export function debugSingle(ctx: Ctx): Cmd { } if (!debugEngine) { - vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})` - + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); + vscode.window.showErrorMessage( + `Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId}) ` + + `or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) ` + + `extension for debugging.` + ); return; } From 1113b4fef2312a8dc3042f4312103d4f44b1c42a Mon Sep 17 00:00:00 2001 From: veetaha Date: Wed, 6 May 2020 01:42:04 +0300 Subject: [PATCH 654/819] Fix cargo not found on macos bug at vscode extension side --- rust-analyzer/editors/code/src/cargo.ts | 36 ++++++++++++++++++++++++- rust-analyzer/editors/code/src/main.ts | 8 ++---- rust-analyzer/editors/code/src/util.ts | 11 ++++++++ 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 613aa82d..2a2c2e0e 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -1,6 +1,9 @@ import * as cp from 'child_process'; +import * as os from 'os'; +import * as path from 'path'; import * as readline from 'readline'; import { OutputChannel } from 'vscode'; +import { isValidExecutable } from './util'; interface CompilationArtifact { fileName: string; @@ -63,7 +66,14 @@ export class Cargo { onStderrString: (data: string) => void ): Promise { return new Promise((resolve, reject) => { - const cargo = cp.spawn('cargo', cargoArgs, { + let cargoPath; + try { + cargoPath = getCargoPathOrFail(); + } catch (err) { + return reject(err); + } + + const cargo = cp.spawn(cargoPath, cargoArgs, { stdio: ['ignore', 'pipe', 'pipe'], cwd: this.rootFolder }); @@ -87,3 +97,27 @@ export class Cargo { }); } } + +// Mirrors `ra_env::get_path_for_executable` implementation +function getCargoPathOrFail(): string { + const envVar = process.env.CARGO; + const executableName = "cargo"; + + if (envVar) { + if (isValidExecutable(envVar)) return envVar; + + throw new Error(`\`${envVar}\` environment variable points to something that's not a valid executable`); + } + + if (isValidExecutable(executableName)) return executableName; + + const standardLocation = path.join(os.homedir(), '.cargo', 'bin', executableName); + + if (isValidExecutable(standardLocation)) return standardLocation; + + throw new Error( + `Failed to find \`${executableName}\` executable. ` + + `Make sure \`${executableName}\` is in \`$PATH\`, ` + + `or set \`${envVar}\` to point to a valid executable.` + ); +} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index efd56a84..9b020d00 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -8,10 +8,9 @@ import { activateInlayHints } from './inlay_hints'; import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { Config, NIGHTLY_TAG } from './config'; -import { log, assert } from './util'; +import { log, assert, isValidExecutable } from './util'; import { PersistentState } from './persistent_state'; import { fetchRelease, download } from './net'; -import { spawnSync } from 'child_process'; import { activateTaskProvider } from './tasks'; let ctx: Ctx | undefined; @@ -179,10 +178,7 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< log.debug("Using server binary at", path); - const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); - log.debug("Checked binary availability via --version", res); - log.debug(res, "--version output:", res.output); - if (res.status !== 0) { + if (!isValidExecutable(path)) { throw new Error(`Failed to execute ${path} --version`); } diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 6f91f81d..127a9e91 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,6 +1,7 @@ import * as lc from "vscode-languageclient"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; +import { spawnSync } from "child_process"; export function assert(condition: boolean, explanation: string): asserts condition { try { @@ -82,3 +83,13 @@ export function isRustDocument(document: vscode.TextDocument): document is RustD export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { return isRustDocument(editor.document); } + +export function isValidExecutable(path: string): boolean { + log.debug("Checking availability of a binary at", path); + + const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); + + log.debug(res, "--version output:", res.output); + + return res.status === 0; +} From 28bc0435ec37ae67cafb4453be27ea7fd1b6dd63 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 6 May 2020 16:01:35 +0300 Subject: [PATCH 655/819] Uniformed way to get Debug Lens target executable. --- .../editors/code/src/commands/runnables.ts | 59 +++++++++++-------- rust-analyzer/editors/code/src/config.ts | 6 +- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index d77e8188..7bb8727e 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -64,29 +64,19 @@ export function runSingle(ctx: Ctx): Cmd { }; } -function getLldbDebugConfig(config: ra.Runnable, sourceFileMap: Record): vscode.DebugConfiguration { +function getLldbDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: "lldb", request: "launch", name: config.label, - cargo: { - args: config.args, - }, + program: executable, args: config.extraArgs, cwd: config.cwd, sourceMap: sourceFileMap }; } -const debugOutput = vscode.window.createOutputChannel("Debug"); - -async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record): Promise { - debugOutput.clear(); - - const cargo = new Cargo(config.cwd || '.', debugOutput); - const executable = await cargo.executableFromArgs(config.args); - - // if we are here, there were no compilation errors. +function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg', request: "launch", @@ -98,36 +88,53 @@ async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record { + debugOutput.clear(); + + const cargo = new Cargo(config.cwd || '.', debugOutput); + const executable = await cargo.executableFromArgs(config.args); + + // if we are here, there were no compilation errors. + return executable; +} + +type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; + export function debugSingle(ctx: Ctx): Cmd { return async (config: ra.Runnable) => { const editor = ctx.activeRustEditor; if (!editor) return; - const lldbId = "vadimcn.vscode-lldb"; - const cpptoolsId = "ms-vscode.cpptools"; + const knownEngines: Record = { + "vadimcn.vscode-lldb": getLldbDebugConfig, + "ms-vscode.cpptools": getCppvsDebugConfig + }; + const debugOptions = ctx.config.debug; - const debugEngineId = ctx.config.debug.engine; let debugEngine = null; - if (debugEngineId === "auto") { - debugEngine = vscode.extensions.getExtension(lldbId); - if (!debugEngine) { - debugEngine = vscode.extensions.getExtension(cpptoolsId); + if (debugOptions.engine === "auto") { + for (var engineId in knownEngines) { + debugEngine = vscode.extensions.getExtension(engineId); + if (debugEngine) break; } } else { - debugEngine = vscode.extensions.getExtension(debugEngineId); + debugEngine = vscode.extensions.getExtension(debugOptions.engine); } if (!debugEngine) { - vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})` - + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); + vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)` + + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`); return; } - const debugConfig = lldbId === debugEngine.id - ? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap) - : await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap); + const executable = await getDebugExecutable(config); + const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + debugOutput.appendLine("Launching debug configuration:"); + debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); return vscode.debug.startDebugging(undefined, debugConfig); }; } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 110e5418..8bceaaf7 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -108,10 +108,12 @@ export class Config { } get debug() { + // "/rustc/" used by suggestions only. + const { ["/rustc/"]: _, ...sourceFileMap } = this.get>("debug.sourceFileMap"); + return { engine: this.get("debug.engine"), - sourceFileMap: this.get>("debug.sourceFileMap"), + sourceFileMap: sourceFileMap, }; } - } From 24bb254ad8fe6e0ab51dcd2d696ccf89a7fe8501 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Wed, 6 May 2020 11:22:24 -0400 Subject: [PATCH 656/819] package.json: Minor configuration spelling fix --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index eeb3d351..8849615c 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -405,7 +405,7 @@ "ms-vscode.cpptools" ], "default": "auto", - "description": "Preffered debug engine.", + "description": "Preferred debug engine.", "markdownEnumDescriptions": [ "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed try to use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", From 8ecea80f43a7d8989f0787927b5676b1b024556a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 6 May 2020 19:03:17 +0200 Subject: [PATCH 657/819] Better mapping to TextMate scopes for keywords https://github.com/microsoft/vscode/issues/94367#issuecomment-608629883 --- rust-analyzer/editors/code/package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 8849615c..12a08ba4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -592,6 +592,12 @@ "keyword.unsafe": [ "keyword.other.unsafe" ], + "keyword": [ + "keyword" + ], + "keyword.controlFlow": [ + "keyword.control" + ], "variable.constant": [ "entity.name.constant" ] From 59670a4c3c3293d43063f4771832c5a10bd1f502 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 7 May 2020 17:07:58 +0300 Subject: [PATCH 658/819] Add additional debug options --- rust-analyzer/editors/code/package.json | 10 ++++++++++ rust-analyzer/editors/code/src/commands/runnables.ts | 12 +++++++++--- rust-analyzer/editors/code/src/config.ts | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index eeb3d351..84aea824 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -418,6 +418,16 @@ "default": { "/rustc/": "${env:USERPROFILE}/.rustup/toolchains//lib/rustlib/src/rust" } + }, + "rust-analyzer.debug.openUpDebugPane": { + "description": "Whether to open up the Debug Pane on debugging start.", + "type": "boolean", + "default": false + }, + "rust-analyzer.debug.engineSettings": { + "type": "object", + "default": {}, + "description": "Optional settings passed to the debug engine." } } }, diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 7bb8727e..782a7ba8 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -91,8 +91,6 @@ function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFile const debugOutput = vscode.window.createOutputChannel("Debug"); async function getDebugExecutable(config: ra.Runnable): Promise { - debugOutput.clear(); - const cargo = new Cargo(config.cwd || '.', debugOutput); const executable = await cargo.executableFromArgs(config.args); @@ -130,8 +128,16 @@ export function debugSingle(ctx: Ctx): Cmd { return; } + debugOutput.clear(); + if (ctx.config.debug.openUpDebugPane) { + debugOutput.show(true); + } + const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + let debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + for (var key in debugOptions.engineSettings) { + debugConfig[key] = (debugOptions.engineSettings as any)[key]; + } debugOutput.appendLine("Launching debug configuration:"); debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 8bceaaf7..533be191 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -113,6 +113,8 @@ export class Config { return { engine: this.get("debug.engine"), + engineSettings: this.get("debug.engineSettings"), + openUpDebugPane: this.get("debug.openUpDebugPane"), sourceFileMap: sourceFileMap, }; } From 60699f47f7124c72509ccd4dcfba1ab02aee4138 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 7 May 2020 18:35:48 +0300 Subject: [PATCH 659/819] Add separate settings for each debug engine. --- rust-analyzer/editors/code/package.json | 4 ++-- rust-analyzer/editors/code/src/commands/runnables.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 84aea824..e4dd6692 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -427,7 +427,7 @@ "rust-analyzer.debug.engineSettings": { "type": "object", "default": {}, - "description": "Optional settings passed to the debug engine." + "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" } } }, @@ -609,4 +609,4 @@ } ] } -} +} \ No newline at end of file diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 782a7ba8..e62de7d6 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -134,9 +134,12 @@ export function debugSingle(ctx: Ctx): Cmd { } const executable = await getDebugExecutable(config); - let debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); - for (var key in debugOptions.engineSettings) { - debugConfig[key] = (debugOptions.engineSettings as any)[key]; + const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + if (debugConfig.type in debugOptions.engineSettings) { + const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; + for (var key in settingsMap) { + debugConfig[key] = settingsMap[key]; + } } debugOutput.appendLine("Launching debug configuration:"); From f11e293bf0a1565e9860392d98d5123895ac9b20 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 7 May 2020 18:53:14 +0300 Subject: [PATCH 660/819] Add CodeLLDB Rust visualization --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/src/commands/runnables.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e4dd6692..e8e9598f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -609,4 +609,4 @@ } ] } -} \ No newline at end of file +} diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index e62de7d6..ae328d2a 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -72,7 +72,8 @@ function getLldbDebugConfig(config: ra.Runnable, executable: string, sourceFileM program: executable, args: config.extraArgs, cwd: config.cwd, - sourceMap: sourceFileMap + sourceMap: sourceFileMap, + sourceLanguages: ["rust"] }; } From d7f124f54cc450ddef955ce2cfa4a8d6f4b33fbe Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 7 May 2020 18:46:58 +0200 Subject: [PATCH 661/819] Use the correct color for structs This works around https://github.com/microsoft/vscode/issues/97162 --- rust-analyzer/editors/code/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 12a08ba4..6935fa7a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -589,6 +589,9 @@ "union": [ "entity.name.union" ], + "struct": [ + "entity.name.type.struct" + ], "keyword.unsafe": [ "keyword.other.unsafe" ], From e09e6058ae060d3376d09d7bb3f9860988a2479e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 May 2020 09:28:15 +0200 Subject: [PATCH 662/819] Add master config for inlayHints to make disabling easy --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 1 + rust-analyzer/editors/code/src/inlay_hints.ts | 14 +++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6935fa7a..853fc513 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -300,6 +300,11 @@ "default": true, "markdownDescription": "Check with all features (will be passed as `--all-features`)" }, + "rust-analyzer.inlayHints.enable": { + "type": "boolean", + "default": true, + "description": "Disable all inlay hints" + }, "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 110e5418..46de922f 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -94,6 +94,7 @@ export class Config { get inlayHints() { return { + enable: this.get("inlayHints.enable"), typeHints: this.get("inlayHints.typeHints"), parameterHints: this.get("inlayHints.parameterHints"), chainingHints: this.get("inlayHints.chainingHints"), diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index a0953179..a2b07d00 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -10,13 +10,13 @@ export function activateInlayHints(ctx: Ctx) { const maybeUpdater = { updater: null as null | HintsUpdater, async onConfigChange() { - if ( - !ctx.config.inlayHints.typeHints && - !ctx.config.inlayHints.parameterHints && - !ctx.config.inlayHints.chainingHints - ) { - return this.dispose(); - } + const anyEnabled = ctx.config.inlayHints.typeHints + || ctx.config.inlayHints.parameterHints + || ctx.config.inlayHints.chainingHints; + const enabled = ctx.config.inlayHints.enable && anyEnabled; + + if (!enabled) return this.dispose(); + await sleep(100); if (this.updater) { this.updater.syncCacheAndRenderHints(); From 334537df48de40f6390a68be6dc85de0e74201f7 Mon Sep 17 00:00:00 2001 From: vsrs <62505555+vsrs@users.noreply.github.com> Date: Fri, 8 May 2020 19:22:26 +0300 Subject: [PATCH 663/819] "rust-analyzer.debug.openDebugPane" Co-authored-by: bjorn3 --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e8e9598f..e750412a 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -419,7 +419,7 @@ "/rustc/": "${env:USERPROFILE}/.rustup/toolchains//lib/rustlib/src/rust" } }, - "rust-analyzer.debug.openUpDebugPane": { + "rust-analyzer.debug.openDebugPane": { "description": "Whether to open up the Debug Pane on debugging start.", "type": "boolean", "default": false From 9ff04e6d21a07826a47dc0f141a664daf091085b Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 10 May 2020 21:05:09 +0800 Subject: [PATCH 664/819] Word fix --- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index cfcf47b2..b80a18a4 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -225,7 +225,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D return doc.positionAt(targetOffset); } - // Shitty workaround for crlf line endings + // Dirty workaround for crlf line endings // We are still in this prehistoric era of carriage returns here... let line = 0; From 91de2def507110be556337b2ee73630e0cdfd291 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sun, 10 May 2020 20:43:48 +0300 Subject: [PATCH 665/819] Fix "show syntax tree" command @matlkad please don't forget to keep it up-to-date! --- rust-analyzer/editors/code/src/commands/syntax_tree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/commands/syntax_tree.ts index cfcf47b2..b7616c21 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/commands/syntax_tree.ts @@ -206,7 +206,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D } private parseRustTextRange(doc: vscode.TextDocument, astLine: string): undefined | vscode.Range { - const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); + const parsedRange = /(\d+)\.\.(\d+)/.exec(astLine); if (!parsedRange) return; const [begin, end] = parsedRange From d84d42f4050ae77c513108fbf1e83347340b08ec Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 10:23:32 -0700 Subject: [PATCH 666/819] Tweak the textmate fallback scopes to be consistent with builtin TextMate grammar and other languages --- rust-analyzer/editors/code/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c6fc1351..a86d0ad0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -596,28 +596,28 @@ "support.type.primitive" ], "lifetime": [ - "entity.name.lifetime.rust" + "entity.name.type.lifetime" ], "typeAlias": [ - "entity.name.typeAlias" + "entity.name.type.typeAlias" ], "union": [ - "entity.name.union" + "entity.name.type.union" ], "struct": [ "entity.name.type.struct" ], - "keyword.unsafe": [ - "keyword.other.unsafe" - ], "keyword": [ - "keyword" + "keyword.other" ], "keyword.controlFlow": [ "keyword.control" ], "variable.constant": [ - "entity.name.constant" + "variable.other.constant" + ], + "formatSpecifier": [ + "punctuation.section.embedded" ] } } From 31baedc9ba853ee7a3d2474a4c0e4aadc0649cf4 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:24:59 -0700 Subject: [PATCH 667/819] Import built-in textmate grammar, with no changes --- rust-analyzer/editors/code/.vscodeignore | 1 + rust-analyzer/editors/code/package.json | 5 + .../editors/code/rust.tmGrammar.json | 692 ++++++++++++++++++ 3 files changed, 698 insertions(+) create mode 100644 rust-analyzer/editors/code/rust.tmGrammar.json diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index ac411f8e..257b744b 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -3,5 +3,6 @@ !package.json !package-lock.json !ra_syntax_tree.tmGrammar.json +!rust.tmGrammar.json !icon.png !README.md diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a86d0ad0..40ae3ab9 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -478,6 +478,11 @@ } ], "grammars": [ + { + "language": "rust", + "scopeName": "source.rust", + "path": "rust.tmGrammar.json" + }, { "language": "ra_syntax_tree", "scopeName": "source.ra_syntax_tree", diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json new file mode 100644 index 00000000..784bd8c9 --- /dev/null +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -0,0 +1,692 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson", + "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/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f", + "name": "Rust", + "scopeName": "source.rust", + "patterns": [ + { + "comment": "Implementation", + "begin": "\\b(impl)\\b", + "end": "\\{", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#where" + }, + { + "name": "storage.type.rust", + "match": "\\bfor\\b" + }, + { + "include": "#type" + } + ] + }, + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + }, + { + "include": "#line_doc_comment" + }, + { + "include": "#line_comment" + }, + { + "comment": "Attribute", + "name": "meta.attribute.rust", + "begin": "#\\!?\\[", + "end": "\\]", + "patterns": [ + { + "include": "#string_literal" + }, + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + }, + { + "include": "#line_doc_comment" + }, + { + "include": "#line_comment" + } + ] + }, + { + "comment": "Single-quote string literal (character)", + "name": "string.quoted.single.rust", + "match": "b?'([^'\\\\]|\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'" + }, + { + "include": "#string_literal" + }, + { + "include": "#raw_string_literal" + }, + { + "comment": "Floating point literal (fraction)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b" + }, + { + "comment": "Floating point literal (exponent)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b" + }, + { + "comment": "Floating point literal (typed)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b" + }, + { + "comment": "Integer literal (decimal)", + "name": "constant.numeric.integer.decimal.rust", + "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (hexadecimal)", + "name": "constant.numeric.integer.hexadecimal.rust", + "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (octal)", + "name": "constant.numeric.integer.octal.rust", + "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (binary)", + "name": "constant.numeric.integer.binary.rust", + "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Static storage modifier", + "name": "storage.modifier.static.rust", + "match": "\\bstatic\\b" + }, + { + "comment": "Boolean constant", + "name": "constant.language.boolean.rust", + "match": "\\b(true|false)\\b" + }, + { + "comment": "Control keyword", + "name": "keyword.control.rust", + "match": "\\b(async|await|break|continue|else|if|in|for|loop|match|return|try|while)\\b" + }, + { + "comment": "Keyword", + "name": "keyword.other.rust", + "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b" + }, + { + "comment": "Reserved keyword", + "name": "invalid.deprecated.rust", + "match": "\\b(abstract|alignof|become|do|final|macro|offsetof|override|priv|proc|pure|sizeof|typeof|virtual|yield)\\b" + }, + { + "include": "#unsafe" + }, + { + "include": "#sigils" + }, + { + "include": "#self" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#box" + }, + { + "include": "#lifetime" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#const" + }, + { + "include": "#pub" + }, + { + "comment": "Miscellaneous operator", + "name": "keyword.operator.misc.rust", + "match": "(=>|::|\\bas\\b)" + }, + { + "comment": "Comparison operator", + "name": "keyword.operator.comparison.rust", + "match": "(&&|\\|\\||==|!=)" + }, + { + "comment": "Assignment operator", + "name": "keyword.operator.assignment.rust", + "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)" + }, + { + "comment": "Arithmetic operator", + "name": "keyword.operator.arithmetic.rust", + "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)" + }, + { + "comment": "Comparison operator (second group because of regex precedence)", + "name": "keyword.operator.comparison.rust", + "match": "(<=|>=|<|>)" + }, + { + "include": "#core_types" + }, + { + "include": "#core_vars" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "comment": "Built-in macro", + "name": "support.function.builtin.rust", + "match": "\\b(macro_rules|compile_error|format_args|env|option_env|concat_idents|concat|line|column|file|stringify|include|include_str|include_bytes|module_path|cfg)!" + }, + { + "comment": "Core macro", + "name": "support.function.core.rust", + "match": "\\b(panic|assert|assert_eq|assert_ne|debug_assert|debug_assert_eq|debug_assert_ne|try|write|writeln|unreachable|unimplemented)!" + }, + { + "comment": "Standard library macro", + "name": "support.function.std.rust", + "match": "\\b(format|print|println|eprint|eprintln|select|vec)!" + }, + { + "comment": "Logging macro", + "name": "support.function.log.rust", + "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" + }, + { + "comment": "Invokation of a macro", + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", + "captures": { + "1": { + "name": "entity.name.function.macro.rust" + } + } + }, + { + "comment": "Function call", + "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", + "captures": { + "1": { + "name": "entity.name.function.rust" + } + } + }, + { + "comment": "Function call with type parameters", + "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()", + "end": "\\(", + "captures": { + "1": { + "name": "entity.name.function.rust" + }, + "2": { + "name": "keyword.operator.misc.rust" + } + }, + "patterns": [ + { + "include": "#type_params" + } + ] + }, + { + "comment": "Function definition", + "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)", + "end": "[\\{;]", + "beginCaptures": { + "1": { + "name": "keyword.other.fn.rust" + }, + "2": { + "name": "entity.name.function.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#self" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#const" + }, + { + "include": "#where" + }, + { + "include": "#unsafe" + }, + { + "comment": "Function arguments", + "match": "\bfn\b", + "name": "keyword.other.fn.rust" + } + ] + }, + { + "comment": "Type declaration", + "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": "[\\{\\(;]", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + }, + "2": { + "name": "entity.name.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#core_types" + }, + { + "include": "#pub" + }, + { + "include": "#where" + } + ] + }, + { + "comment": "Type alias", + "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": ";", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + }, + "2": { + "name": "entity.name.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#lifetime" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + } + ] + } + ], + "repository": { + "block_doc_comment": { + "comment": "Block documentation comment", + "name": "comment.block.documentation.rust", + "begin": "/\\*[\\*!](?![\\*/])", + "end": "\\*/", + "patterns": [ + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + } + ] + }, + "block_comment": { + "comment": "Block comment", + "name": "comment.block.rust", + "begin": "/\\*", + "end": "\\*/", + "patterns": [ + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + } + ] + }, + "line_doc_comment": { + "comment": "Single-line documentation comment", + "name": "comment.line.documentation.rust", + "begin": "//[!/](?=[^/])", + "end": "$" + }, + "line_comment": { + "comment": "Single-line comment", + "name": "comment.line.double-slash.rust", + "begin": "//", + "end": "$" + }, + "escaped_character": { + "name": "constant.character.escape.rust", + "match": "\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)" + }, + "string_literal": { + "comment": "Double-quote string literal", + "name": "string.quoted.double.rust", + "begin": "b?\"", + "end": "\"", + "patterns": [ + { + "include": "#escaped_character" + } + ] + }, + "raw_string_literal": { + "comment": "Raw double-quote string literal", + "name": "string.quoted.double.raw.rust", + "begin": "b?r(#*)\"", + "end": "\"\\1" + }, + "sigils": { + "comment": "Sigil", + "name": "keyword.operator.sigil.rust", + "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" + }, + "self": { + "comment": "Self variable", + "name": "variable.language.rust", + "match": "\\bself\\b" + }, + "mut": { + "comment": "Mutable storage modifier", + "name": "storage.modifier.mut.rust", + "match": "\\bmut\\b" + }, + "dyn": { + "comment": "Dynamic modifier", + "name": "storage.modifier.dyn.rust", + "match": "\\bdyn\\b" + }, + "impl": { + "comment": "Existential type modifier", + "name": "storage.modifier.impl.rust", + "match": "\\bimpl\\b" + }, + "box": { + "comment": "Box storage modifier", + "name": "storage.modifier.box.rust", + "match": "\\bbox\\b" + }, + "const": { + "comment": "Const storage modifier", + "name": "storage.modifier.const.rust", + "match": "\\bconst\\b" + }, + "pub": { + "comment": "Visibility modifier", + "name": "storage.modifier.visibility.rust", + "match": "\\bpub\\b" + }, + "unsafe": { + "comment": "Unsafe code keyword", + "name": "keyword.other.unsafe.rust", + "match": "\\bunsafe\\b" + }, + "where": { + "comment": "Generic where clause", + "name": "keyword.other.where.rust", + "match": "\\bwhere\\b" + }, + "lifetime": { + "comment": "Named lifetime", + "name": "storage.modifier.lifetime.rust", + "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b", + "captures": { + "1": { + "name": "entity.name.lifetime.rust" + } + } + }, + "ref_lifetime": { + "comment": "Reference with named lifetime", + "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b", + "captures": { + "1": { + "name": "storage.modifier.lifetime.rust" + }, + "2": { + "name": "entity.name.lifetime.rust" + } + } + }, + "core_types": { + "comment": "Built-in/core type", + "name": "storage.type.core.rust", + "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" + }, + "core_vars": { + "comment": "Core type variant", + "name": "support.constant.core.rust", + "match": "\\b(Some|None|Ok|Err)\\b" + }, + "core_marker": { + "comment": "Core trait (marker)", + "name": "support.type.marker.rust", + "match": "\\b(Copy|Send|Sized|Sync)\\b" + }, + "core_traits": { + "comment": "Core trait", + "name": "support.type.core.rust", + "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b" + }, + "std_types": { + "comment": "Standard library type", + "name": "storage.class.std.rust", + "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" + }, + "std_traits": { + "comment": "Standard library trait", + "name": "support.type.std.rust", + "match": "\\b(ToOwned|ToString)\\b" + }, + "type": { + "comment": "A type", + "name": "entity.name.type.rust", + "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b" + }, + "type_params": { + "comment": "Type parameters", + "name": "meta.type_params.rust", + "begin": "<(?![=<])", + "end": "(?", + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + } + ] + } + } +} \ No newline at end of file From d8d6b4250065998b9ac7816be92af1d79c7c3c35 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:32:08 -0700 Subject: [PATCH 668/819] Color lifetimes like types --- rust-analyzer/editors/code/rust.tmGrammar.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index 784bd8c9..16497abb 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -586,23 +586,15 @@ }, "lifetime": { "comment": "Named lifetime", - "name": "storage.modifier.lifetime.rust", - "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b", - "captures": { - "1": { - "name": "entity.name.lifetime.rust" - } - } + "name": "entity.name.type.lifetime.rust", + "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, "ref_lifetime": { "comment": "Reference with named lifetime", - "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b", + "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "storage.modifier.lifetime.rust" - }, - "2": { - "name": "entity.name.lifetime.rust" + "name": "entity.name.type.lifetime.rust" } } }, From 5c8a86905c59b6f1c062e810610cefccf3f88a1d Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:34:28 -0700 Subject: [PATCH 669/819] Color sigil like keyword --- rust-analyzer/editors/code/rust.tmGrammar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index 16497abb..03403883 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -536,7 +536,7 @@ }, "sigils": { "comment": "Sigil", - "name": "keyword.operator.sigil.rust", + "name": "keyword.other.sigil.rust", "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" }, "self": { From fb34d38883ff1302a73858d4ef3369e429a28525 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:57:32 -0700 Subject: [PATCH 670/819] Color core types as types, not keywords --- rust-analyzer/editors/code/rust.tmGrammar.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index 03403883..c14dc09a 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -600,7 +600,7 @@ }, "core_types": { "comment": "Built-in/core type", - "name": "storage.type.core.rust", + "name": "entity.name.type.core.rust", "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" }, "core_vars": { @@ -610,22 +610,22 @@ }, "core_marker": { "comment": "Core trait (marker)", - "name": "support.type.marker.rust", + "name": "entity.name.type.marker.rust", "match": "\\b(Copy|Send|Sized|Sync)\\b" }, "core_traits": { "comment": "Core trait", - "name": "support.type.core.rust", + "name": "entity.name.type.core.rust", "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b" }, "std_types": { "comment": "Standard library type", - "name": "storage.class.std.rust", + "name": "entity.name.type.class.std.rust", "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" }, "std_traits": { "comment": "Standard library trait", - "name": "support.type.std.rust", + "name": "entity.name.type.std.rust", "match": "\\b(ToOwned|ToString)\\b" }, "type": { From 5f655c80d3b79ebef7aaf05bbbeaeb2e00a20b88 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 13:00:06 -0700 Subject: [PATCH 671/819] No longer true --- rust-analyzer/editors/code/rust.tmGrammar.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index c14dc09a..d2752844 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -1,10 +1,4 @@ { - "information_for_contributors": [ - "This file has been converted from https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson", - "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/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f", "name": "Rust", "scopeName": "source.rust", "patterns": [ From 0c41671577b8c04efcf0d0a020fdc9186765ed3a Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 11:01:56 -0700 Subject: [PATCH 672/819] Color `as` as a keyword --- rust-analyzer/editors/code/rust.tmGrammar.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index d2752844..6fe16d79 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -159,7 +159,7 @@ { "comment": "Keyword", "name": "keyword.other.rust", - "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b" + "match": "\\b(crate|extern|mod|let|ref|use|super|move|as)\\b" }, { "comment": "Reserved keyword", @@ -202,7 +202,7 @@ { "comment": "Miscellaneous operator", "name": "keyword.operator.misc.rust", - "match": "(=>|::|\\bas\\b)" + "match": "(=>|::)" }, { "comment": "Comparison operator", From 35dca04f9ae5a9b84c0d6b35fd3d0ee997548574 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 13:32:42 -0700 Subject: [PATCH 673/819] Change lifetimes back to keyword-ish, tweak builtins for consistency between TextMate and semantic --- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/rust.tmGrammar.json | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 40ae3ab9..f46684c7 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -601,7 +601,7 @@ "support.type.primitive" ], "lifetime": [ - "entity.name.type.lifetime" + "storage.modifier.lifetime.rust" ], "typeAlias": [ "entity.name.type.typeAlias" diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index 6fe16d79..c5ac9a99 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -580,22 +580,25 @@ }, "lifetime": { "comment": "Named lifetime", - "name": "entity.name.type.lifetime.rust", + "name": "storage.modifier.lifetime.rust", "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, "ref_lifetime": { "comment": "Reference with named lifetime", - "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b", + "match": "(&)('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "entity.name.type.lifetime.rust" + "name": "keyword.other.sigil.rust" + }, + "2": { + "name": "storage.modifier.lifetime.rust" } } }, "core_types": { "comment": "Built-in/core type", - "name": "entity.name.type.core.rust", - "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" + "name": "support.type.primitive", + "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self)\\b" }, "core_vars": { "comment": "Core type variant", @@ -615,7 +618,7 @@ "std_types": { "comment": "Standard library type", "name": "entity.name.type.class.std.rust", - "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" + "match": "\\b(Box|String|Vec|Path|PathBuf|Option|Result)\\b" }, "std_traits": { "comment": "Standard library trait", From 6d8e6b19f94c80d74a1fe36a8863562964fdaaf1 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 15:36:47 -0700 Subject: [PATCH 674/819] Put sigil back to keyword.operator --- rust-analyzer/editors/code/rust.tmGrammar.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index c5ac9a99..27982c13 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -530,7 +530,7 @@ }, "sigils": { "comment": "Sigil", - "name": "keyword.other.sigil.rust", + "name": "keyword.operator.sigil.rust", "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" }, "self": { @@ -588,7 +588,7 @@ "match": "(&)('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "keyword.other.sigil.rust" + "name": "keyword.operator.sigil.rust" }, "2": { "name": "storage.modifier.lifetime.rust" From 4755e099540d61ecef87d24c86218ee9cca4d456 Mon Sep 17 00:00:00 2001 From: vsrs Date: Mon, 11 May 2020 16:06:57 +0300 Subject: [PATCH 675/819] "rust-analyzer.debug" command --- rust-analyzer/editors/code/package.json | 5 + .../editors/code/src/commands/runnables.ts | 149 +++++------------- rust-analyzer/editors/code/src/debug.ts | 95 +++++++++++ rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 144 insertions(+), 106 deletions(-) create mode 100644 rust-analyzer/editors/code/src/debug.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c6fc1351..2f90d3ba 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -120,6 +120,11 @@ "title": "Run", "category": "Rust Analyzer" }, + { + "command": "rust-analyzer.debug", + "title": "Debug", + "category": "Rust Analyzer" + }, { "command": "rust-analyzer.analyzerStatus", "title": "Status", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index ae328d2a..c1b872bc 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -1,43 +1,46 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; -import * as os from "os"; import { Ctx, Cmd } from '../ctx'; -import { Cargo } from '../cargo'; +import { startDebugSession } from '../debug'; + +async function selectRunnable(ctx: Ctx, prevRunnable: RunnableQuickPick | undefined): Promise { + const editor = ctx.activeRustEditor; + const client = ctx.client; + if (!editor || !client) return; + + const textDocument: lc.TextDocumentIdentifier = { + uri: editor.document.uri.toString(), + }; + + const runnables = await client.sendRequest(ra.runnables, { + textDocument, + position: client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }); + const items: RunnableQuickPick[] = []; + if (prevRunnable) { + items.push(prevRunnable); + } + for (const r of runnables) { + if ( + prevRunnable && + JSON.stringify(prevRunnable.runnable) === JSON.stringify(r) + ) { + continue; + } + items.push(new RunnableQuickPick(r)); + } + return await vscode.window.showQuickPick(items); +} export function run(ctx: Ctx): Cmd { let prevRunnable: RunnableQuickPick | undefined; return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const textDocument: lc.TextDocumentIdentifier = { - uri: editor.document.uri.toString(), - }; - - const runnables = await client.sendRequest(ra.runnables, { - textDocument, - position: client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }); - const items: RunnableQuickPick[] = []; - if (prevRunnable) { - items.push(prevRunnable); - } - for (const r of runnables) { - if ( - prevRunnable && - JSON.stringify(prevRunnable.runnable) === JSON.stringify(r) - ) { - continue; - } - items.push(new RunnableQuickPick(r)); - } - const item = await vscode.window.showQuickPick(items); + const item = await selectRunnable(ctx, prevRunnable); if (!item) return; item.detail = 'rerun'; @@ -64,88 +67,22 @@ export function runSingle(ctx: Ctx): Cmd { }; } -function getLldbDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { - return { - type: "lldb", - request: "launch", - name: config.label, - program: executable, - args: config.extraArgs, - cwd: config.cwd, - sourceMap: sourceFileMap, - sourceLanguages: ["rust"] - }; -} - -function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { - return { - type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg', - request: "launch", - name: config.label, - program: executable, - args: config.extraArgs, - cwd: config.cwd, - sourceFileMap: sourceFileMap, - }; -} +export function debug(ctx: Ctx): Cmd { + let prevDebuggee: RunnableQuickPick | undefined; -const debugOutput = vscode.window.createOutputChannel("Debug"); - -async function getDebugExecutable(config: ra.Runnable): Promise { - const cargo = new Cargo(config.cwd || '.', debugOutput); - const executable = await cargo.executableFromArgs(config.args); + return async () => { + const item = await selectRunnable(ctx, prevDebuggee); + if (!item) return; - // if we are here, there were no compilation errors. - return executable; + item.detail = 'restart'; + prevDebuggee = item; + return await startDebugSession(ctx, item.runnable); + }; } -type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; - export function debugSingle(ctx: Ctx): Cmd { return async (config: ra.Runnable) => { - const editor = ctx.activeRustEditor; - if (!editor) return; - - const knownEngines: Record = { - "vadimcn.vscode-lldb": getLldbDebugConfig, - "ms-vscode.cpptools": getCppvsDebugConfig - }; - const debugOptions = ctx.config.debug; - - let debugEngine = null; - if (debugOptions.engine === "auto") { - for (var engineId in knownEngines) { - debugEngine = vscode.extensions.getExtension(engineId); - if (debugEngine) break; - } - } - else { - debugEngine = vscode.extensions.getExtension(debugOptions.engine); - } - - if (!debugEngine) { - vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)` - + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`); - return; - } - - debugOutput.clear(); - if (ctx.config.debug.openUpDebugPane) { - debugOutput.show(true); - } - - const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); - if (debugConfig.type in debugOptions.engineSettings) { - const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; - for (var key in settingsMap) { - debugConfig[key] = settingsMap[key]; - } - } - - debugOutput.appendLine("Launching debug configuration:"); - debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); - return vscode.debug.startDebugging(undefined, debugConfig); + await startDebugSession(ctx, config); }; } diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts new file mode 100644 index 00000000..4f4b88ad --- /dev/null +++ b/rust-analyzer/editors/code/src/debug.ts @@ -0,0 +1,95 @@ +import * as os from "os"; +import * as vscode from 'vscode'; +import * as ra from './rust-analyzer-api'; + +import { Cargo } from './cargo'; +import { Ctx } from "./ctx"; + +const debugOutput = vscode.window.createOutputChannel("Debug"); +type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; + +function getLldbDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { + return { + type: "lldb", + request: "launch", + name: config.label, + program: executable, + args: config.extraArgs, + cwd: config.cwd, + sourceMap: sourceFileMap, + sourceLanguages: ["rust"] + }; +} + +function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { + return { + type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg", + request: "launch", + name: config.label, + program: executable, + args: config.extraArgs, + cwd: config.cwd, + sourceFileMap: sourceFileMap, + }; +} + +async function getDebugExecutable(config: ra.Runnable): Promise { + const cargo = new Cargo(config.cwd || '.', debugOutput); + const executable = await cargo.executableFromArgs(config.args); + + // if we are here, there were no compilation errors. + return executable; +} + +export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Promise { + const editor = ctx.activeRustEditor; + if (!editor) return; + + const knownEngines: Record = { + "vadimcn.vscode-lldb": getLldbDebugConfig, + "ms-vscode.cpptools": getCppvsDebugConfig + }; + const debugOptions = ctx.config.debug; + + let debugEngine = null; + if (debugOptions.engine === "auto") { + for (var engineId in knownEngines) { + debugEngine = vscode.extensions.getExtension(engineId); + if (debugEngine) break; + } + } + else { + debugEngine = vscode.extensions.getExtension(debugOptions.engine); + } + + if (!debugEngine) { + vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)` + + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`); + return; + } + + debugOutput.clear(); + if (ctx.config.debug.openUpDebugPane) { + debugOutput.show(true); + } + + const executable = await getDebugExecutable(config); + const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + if (debugConfig.type in debugOptions.engineSettings) { + const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; + for (var key in settingsMap) { + debugConfig[key] = settingsMap[key]; + } + } + + return debugConfig; +} + +export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise { + const debugConfig = await getDebugConfiguration(ctx, config); + if (!debugConfig) return false; + + debugOutput.appendLine("Launching debug configuration:"); + debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); + return vscode.debug.startDebugging(undefined, debugConfig); +} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 9b020d00..5fdeebd6 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -77,6 +77,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('syntaxTree', commands.syntaxTree); ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); + ctx.registerCommand('debug', commands.debug); defaultOnEnter.dispose(); ctx.registerCommand('onEnter', commands.onEnter); From 78bc5a8195b7b7c0dc16726851a9aacf720f34cf Mon Sep 17 00:00:00 2001 From: vsrs Date: Mon, 11 May 2020 18:00:15 +0300 Subject: [PATCH 676/819] "rust-analyzer.newDebugConfig" command --- rust-analyzer/editors/code/package.json | 5 ++++ .../editors/code/src/commands/runnables.ts | 30 ++++++++++++++++++- rust-analyzer/editors/code/src/debug.ts | 3 +- rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2f90d3ba..ec325ad3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -125,6 +125,11 @@ "title": "Debug", "category": "Rust Analyzer" }, + { + "command": "rust-analyzer.newDebugConfig", + "title": "Generate launch configuration", + "category": "Rust Analyzer" + }, { "command": "rust-analyzer.analyzerStatus", "title": "Status", diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index c1b872bc..5e88eeae 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; -import { startDebugSession } from '../debug'; +import { startDebugSession, getDebugConfiguration } from '../debug'; async function selectRunnable(ctx: Ctx, prevRunnable: RunnableQuickPick | undefined): Promise { const editor = ctx.activeRustEditor; @@ -86,6 +86,34 @@ export function debugSingle(ctx: Ctx): Cmd { }; } +export function newDebugConfig(ctx: Ctx): Cmd { + return async () => { + const scope = ctx.activeRustEditor?.document.uri; + if (!scope) return; + + const item = await selectRunnable(ctx, undefined); + if (!item) return; + + const debugConfig = await getDebugConfiguration(ctx, item.runnable); + if (!debugConfig) return; + + const wsLaunchSection = vscode.workspace.getConfiguration("launch", scope); + const configurations = wsLaunchSection.get("configurations") || []; + + const index = configurations.findIndex(c => c.name === debugConfig.name); + if (index !== -1) { + const answer = await vscode.window.showErrorMessage(`Launch configuration '${debugConfig.name}' already exists!`, 'Cancel', 'Update'); + if (answer === "Cancel") return; + + configurations[index] = debugConfig; + } else { + configurations.push(debugConfig); + } + + await wsLaunchSection.update("configurations", configurations); + }; +} + class RunnableQuickPick implements vscode.QuickPickItem { public label: string; public description?: string | undefined; diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 4f4b88ad..228a7ab7 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -57,8 +57,7 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom debugEngine = vscode.extensions.getExtension(engineId); if (debugEngine) break; } - } - else { + } else { debugEngine = vscode.extensions.getExtension(debugOptions.engine); } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5fdeebd6..c015460b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -78,6 +78,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('expandMacro', commands.expandMacro); ctx.registerCommand('run', commands.run); ctx.registerCommand('debug', commands.debug); + ctx.registerCommand('newDebugConfig', commands.newDebugConfig); defaultOnEnter.dispose(); ctx.registerCommand('onEnter', commands.onEnter); From e912cd244a77155f317bff57e341693c1959f4f1 Mon Sep 17 00:00:00 2001 From: vsrs Date: Mon, 11 May 2020 18:49:45 +0300 Subject: [PATCH 677/819] DebugConfiguration simplification. ${workspaceRoot} substitution in generated DebugConfiguration. --- rust-analyzer/editors/code/src/debug.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 228a7ab7..cc575561 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -1,5 +1,6 @@ import * as os from "os"; import * as vscode from 'vscode'; +import * as path from 'path'; import * as ra from './rust-analyzer-api'; import { Cargo } from './cargo'; @@ -72,8 +73,13 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom debugOutput.show(true); } + const wsFolder = path.normalize(vscode.workspace.workspaceFolders![0].uri.fsPath); // folder exists or RA is not active. + function simplifyPath(p: string): string { + return path.normalize(p).replace(wsFolder, '${workspaceRoot}'); + } + const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + const debugConfig = knownEngines[debugEngine.id](config, simplifyPath(executable), debugOptions.sourceFileMap); if (debugConfig.type in debugOptions.engineSettings) { const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; for (var key in settingsMap) { @@ -81,6 +87,10 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom } } + if (debugConfig.cwd) { + debugConfig.cwd = simplifyPath(debugConfig.cwd); + } + return debugConfig; } From d86c8997febe5c63e675ea8a865ca241e7a186ce Mon Sep 17 00:00:00 2001 From: George Fraser Date: Tue, 12 May 2020 08:31:43 -0700 Subject: [PATCH 678/819] Use .rust suffix on scopes --- rust-analyzer/editors/code/package.json | 18 +++++++++--------- rust-analyzer/editors/code/rust.tmGrammar.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f46684c7..e51f1105 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -595,34 +595,34 @@ "language": "rust", "scopes": { "attribute": [ - "meta.attribute" + "meta.attribute.rust" ], "builtinType": [ - "support.type.primitive" + "support.type.primitive.rust" ], "lifetime": [ "storage.modifier.lifetime.rust" ], "typeAlias": [ - "entity.name.type.typeAlias" + "entity.name.type.typeAlias.rust" ], "union": [ - "entity.name.type.union" + "entity.name.type.union.rust" ], "struct": [ - "entity.name.type.struct" + "entity.name.type.struct.rust" ], "keyword": [ - "keyword.other" + "keyword.other.rust" ], "keyword.controlFlow": [ - "keyword.control" + "keyword.control.rust" ], "variable.constant": [ - "variable.other.constant" + "variable.other.constant.rust" ], "formatSpecifier": [ - "punctuation.section.embedded" + "punctuation.section.embedded.rust" ] } } diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index 27982c13..aa081132 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -597,7 +597,7 @@ }, "core_types": { "comment": "Built-in/core type", - "name": "support.type.primitive", + "name": "support.type.primitive.rust", "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self)\\b" }, "core_vars": { From d64bd7d44045302addb8d93acd3ab288044f1a46 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 13:19:29 -0700 Subject: [PATCH 679/819] Mark up statics and mutables --- rust-analyzer/editors/code/package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e51f1105..a7ca6f01 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -623,6 +623,12 @@ ], "formatSpecifier": [ "punctuation.section.embedded.rust" + ], + "*.mutable": [ + "markup.underline" + ], + "*.static": [ + "markup.italic" ] } } From b69962d0b75b3aa1b0723bb5cf1f44ea52a5a919 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Tue, 12 May 2020 08:36:37 -0700 Subject: [PATCH 680/819] Leave statics alone --- rust-analyzer/editors/code/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index a7ca6f01..321353f2 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -626,9 +626,6 @@ ], "*.mutable": [ "markup.underline" - ], - "*.static": [ - "markup.italic" ] } } From 945bccb831ece13f0cfff2e3281a7c0732ab8ed0 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 12 May 2020 17:36:03 -0400 Subject: [PATCH 681/819] vscode engine 1.45 latest stable --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e51f1105..3c9caa26 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "Programming Languages" ], "engines": { - "vscode": "^1.44.0" + "vscode": "^1.45.0" }, "enableProposedApi": true, "scripts": { From b7dc912b9143946ee6203c4114cfc660e9539c50 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 12 May 2020 17:43:47 -0400 Subject: [PATCH 682/819] Bump packages --- rust-analyzer/editors/code/package-lock.json | 92 +++++++++++--------- rust-analyzer/editors/code/package.json | 16 ++-- 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 71c627a2..06178990 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -88,15 +88,15 @@ "dev": true }, "@types/node": { - "version": "12.12.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz", - "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==", + "version": "12.12.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", + "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==", "dev": true }, "@types/node-fetch": { - "version": "2.5.6", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.6.tgz", - "integrity": "sha512-2w0NTwMWF1d3NJMK0Uiq2UNN8htVCyOWOD0jIPjPgC5Ph/YP4dVhs9YxxcMcuLuwAslz0dVEcZQUaqkLs3IzOQ==", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", + "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", "dev": true, "requires": { "@types/node": "*", @@ -113,31 +113,31 @@ } }, "@types/vscode": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.44.0.tgz", - "integrity": "sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==", + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.0.tgz", + "integrity": "sha512-b0Gyir7sPBCqiKLygAhn/AYVfzWD+SMPkWltBrIuPEyTOxSU1wVApWY/FcxYO2EWTRacoubTl4+gvZf86RkecA==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.29.0.tgz", - "integrity": "sha512-X/YAY7azKirENm4QRpT7OVmzok02cSkqeIcLmdz6gXUQG4Hk0Fi9oBAynSAyNXeGdMRuZvjBa0c1Lu0dn/u6VA==", + "version": "2.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.33.0.tgz", + "integrity": "sha512-QV6P32Btu1sCI/kTqjTNI/8OpCYyvlGjW5vD8MpTIg+HGE5S88HtT1G+880M4bXlvXj/NjsJJG0aGcVh0DdbeQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.29.0", + "@typescript-eslint/experimental-utils": "2.33.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz", - "integrity": "sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw==", + "version": "2.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.33.0.tgz", + "integrity": "sha512-qzPM2AuxtMrRq78LwyZa8Qn6gcY8obkIrBs1ehqmQADwkYzTE1Pb4y2W+U3rE/iFkSWcWHG2LS6MJfj6SmHApg==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.29.0", + "@typescript-eslint/typescript-estree": "2.33.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, @@ -154,21 +154,21 @@ } }, "@typescript-eslint/parser": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.29.0.tgz", - "integrity": "sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA==", + "version": "2.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.33.0.tgz", + "integrity": "sha512-AUtmwUUhJoH6yrtxZMHbRUEMsC2G6z5NSxg9KsROOGqNXasM71I8P2NihtumlWTUCRld70vqIZ6Pm4E5PAziEA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.29.0", - "@typescript-eslint/typescript-estree": "2.29.0", + "@typescript-eslint/experimental-utils": "2.33.0", + "@typescript-eslint/typescript-estree": "2.33.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz", - "integrity": "sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA==", + "version": "2.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.33.0.tgz", + "integrity": "sha512-d8rY6/yUxb0+mEwTShCQF2zYQdLlqihukNfG9IUlLYz5y1CH6G/9XYbrxQLq3Z14RNvkCC6oe+OcFlyUpwUbkg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -176,8 +176,16 @@ "glob": "^7.1.6", "is-glob": "^4.0.1", "lodash": "^4.17.15", - "semver": "^6.3.0", + "semver": "^7.3.2", "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } } }, "acorn": { @@ -1160,18 +1168,18 @@ "dev": true }, "mime-db": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", - "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", "dev": true }, "mime-types": { - "version": "2.1.26", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", - "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "dev": true, "requires": { - "mime-db": "1.43.0" + "mime-db": "1.44.0" } }, "mimic-fn": { @@ -1452,9 +1460,9 @@ } }, "rollup": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.7.1.tgz", - "integrity": "sha512-c1FCjY8HK1nAq0bTZHaR72ZknpP7p0EjxbcVc6BcmtOosurK//P5jtwxX+f/4fgtbrjczqf0uvR+EdtxpriE8g==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.0.tgz", + "integrity": "sha512-7BmpEfUN9P6esJzWIn3DmR//90mW6YwYB1t3y48LpF8ITpYtL8s1kEirMKqUu44dVH/6a/rs0EuwYVL3FuRDoA==", "dev": true, "requires": { "fsevents": "~2.1.2" @@ -1684,9 +1692,9 @@ } }, "tslib": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", - "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.12.0.tgz", + "integrity": "sha512-5rxCQkP0kytf4H1T4xz1imjxaUUPMvc5aWp0rJ/VMIN7ClRiH1FwFvBt8wOeMasp/epeUnmSW6CixSIePtiLqA==", "dev": true }, "tsutils": { @@ -1730,9 +1738,9 @@ } }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", + "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", "dev": true }, "typescript-formatter": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3c9caa26..44cb0971 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,15 +39,15 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.1.0", "@rollup/plugin-node-resolve": "^7.1.3", - "@types/node": "^12.12.37", - "@types/node-fetch": "^2.5.6", - "@types/vscode": "^1.44.0", - "@typescript-eslint/eslint-plugin": "^2.29.0", - "@typescript-eslint/parser": "^2.29.0", + "@types/node": "^12.12.39", + "@types/node-fetch": "^2.5.7", + "@types/vscode": "^1.45.0", + "@typescript-eslint/eslint-plugin": "^2.33.0", + "@typescript-eslint/parser": "^2.33.0", "eslint": "^6.8.0", - "rollup": "^2.7.1", - "tslib": "^1.11.1", - "typescript": "^3.8.3", + "rollup": "^2.10.0", + "tslib": "^1.12.0", + "typescript": "^3.9.2", "typescript-formatter": "^7.2.2", "vsce": "^1.75.0" }, From a72de96ee5be98972e55097da475658cfd38ce22 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 13 May 2020 15:51:15 +0300 Subject: [PATCH 683/819] Use launch.json in Debug Lens sessions. Add the possibility to use existing configurations via Debug Lens --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/config.ts | 1 + rust-analyzer/editors/code/src/debug.ts | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ec325ad3..34dbea0b 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -443,6 +443,11 @@ "type": "object", "default": {}, "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" + }, + "rust-analyzer.debug.useLaunchJson": { + "description": "Whether to use existing configurations from launch.json.", + "type": "boolean", + "default": false } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index be2e27ae..24002483 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -117,6 +117,7 @@ export class Config { engineSettings: this.get("debug.engineSettings"), openUpDebugPane: this.get("debug.openUpDebugPane"), sourceFileMap: sourceFileMap, + useLaunchJson: this.get("debug.useLaunchJson"), }; } } diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index cc575561..bbf3ff31 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -95,10 +95,27 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom } export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise { - const debugConfig = await getDebugConfiguration(ctx, config); + let debugConfig: vscode.DebugConfiguration | undefined = undefined; + let message = ""; + + if (ctx.config.debug.useLaunchJson) { + const wsLaunchSection = vscode.workspace.getConfiguration("launch"); + const configurations = wsLaunchSection.get("configurations") || []; + + const index = configurations.findIndex(c => c.name === config.label); + if (-1 !== index) { + debugConfig = configurations[index]; + message = " (from launch.json)"; + debugOutput.clear(); + } + } + if (!debugConfig) { + debugConfig = await getDebugConfiguration(ctx, config); + } + if (!debugConfig) return false; - debugOutput.appendLine("Launching debug configuration:"); + debugOutput.appendLine(`Launching debug configuration${message}:`); debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); return vscode.debug.startDebugging(undefined, debugConfig); } From f7f00102e7965fd561f183902cb30949d9073f6c Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 11:12:10 +0300 Subject: [PATCH 684/819] Remove "rust-analyzer.debug.useLaunchJson" option --- rust-analyzer/editors/code/package.json | 5 ----- rust-analyzer/editors/code/src/config.ts | 3 +-- rust-analyzer/editors/code/src/debug.ts | 21 +++++++++------------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 34dbea0b..ec325ad3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -443,11 +443,6 @@ "type": "object", "default": {}, "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" - }, - "rust-analyzer.debug.useLaunchJson": { - "description": "Whether to use existing configurations from launch.json.", - "type": "boolean", - "default": false } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 24002483..1652827c 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -116,8 +116,7 @@ export class Config { engine: this.get("debug.engine"), engineSettings: this.get("debug.engineSettings"), openUpDebugPane: this.get("debug.openUpDebugPane"), - sourceFileMap: sourceFileMap, - useLaunchJson: this.get("debug.useLaunchJson"), + sourceFileMap: sourceFileMap }; } } diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index bbf3ff31..b500fe02 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -98,18 +98,15 @@ export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise< let debugConfig: vscode.DebugConfiguration | undefined = undefined; let message = ""; - if (ctx.config.debug.useLaunchJson) { - const wsLaunchSection = vscode.workspace.getConfiguration("launch"); - const configurations = wsLaunchSection.get("configurations") || []; - - const index = configurations.findIndex(c => c.name === config.label); - if (-1 !== index) { - debugConfig = configurations[index]; - message = " (from launch.json)"; - debugOutput.clear(); - } - } - if (!debugConfig) { + const wsLaunchSection = vscode.workspace.getConfiguration("launch"); + const configurations = wsLaunchSection.get("configurations") || []; + + const index = configurations.findIndex(c => c.name === config.label); + if (-1 !== index) { + debugConfig = configurations[index]; + message = " (from launch.json)"; + debugOutput.clear(); + } else { debugConfig = await getDebugConfiguration(ctx, config); } From 61a4f4ffcfaf4ca9724090d27d87c9221c9d617c Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Fri, 24 Apr 2020 21:57:10 +0200 Subject: [PATCH 685/819] Make some stuff public so that they can be reused by other tools --- rust-analyzer/editors/code/src/commands/ssr.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index 6fee051f..4ef8cdf0 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -11,7 +11,7 @@ export function ssr(ctx: Ctx): Cmd { const options: vscode.InputBoxOptions = { value: "() ==>> ()", - prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", + prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", validateInput: async (x: string) => { try { await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); From 20ebece5a78ef86acde9502ccdd03085d4fe16a4 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 13:22:52 +0300 Subject: [PATCH 686/819] Runnable quick pick with buttons --- .../editors/code/src/commands/runnables.ts | 82 ++++++++++++++----- 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index 5e88eeae..b1d93fc3 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -5,7 +5,9 @@ import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; import { startDebugSession, getDebugConfiguration } from '../debug'; -async function selectRunnable(ctx: Ctx, prevRunnable: RunnableQuickPick | undefined): Promise { +const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; + +async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, showButtons: boolean = true): Promise { const editor = ctx.activeRustEditor; const client = ctx.client; if (!editor || !client) return; @@ -33,7 +35,41 @@ async function selectRunnable(ctx: Ctx, prevRunnable: RunnableQuickPick | undefi } items.push(new RunnableQuickPick(r)); } - return await vscode.window.showQuickPick(items); + + return await new Promise((resolve) => { + const disposables: vscode.Disposable[] = []; + const close = (result?: RunnableQuickPick) => { + resolve(result); + disposables.forEach(d => d.dispose()); + }; + + const quickPick = vscode.window.createQuickPick(); + quickPick.items = items; + quickPick.title = "Select Runnable"; + if (showButtons) { + quickPick.buttons = quickPickButtons; + } + disposables.push( + quickPick.onDidHide(() => close()), + quickPick.onDidAccept(() => close(quickPick.selectedItems[0])), + quickPick.onDidTriggerButton((_button) => { + (async () => await makeDebugConfig(ctx, quickPick.activeItems[0]))(); + close(); + }), + quickPick.onDidChangeActive((active) => { + if (showButtons && active.length > 0) { + if (active[0].label.startsWith('cargo')) { + // save button makes no sense for `cargo test` or `cargo check` + quickPick.buttons = []; + } else if (quickPick.buttons.length === 0) { + quickPick.buttons = quickPickButtons; + } + } + }), + quickPick + ); + quickPick.show(); + }); } export function run(ctx: Ctx): Cmd { @@ -86,31 +122,35 @@ export function debugSingle(ctx: Ctx): Cmd { }; } -export function newDebugConfig(ctx: Ctx): Cmd { - return async () => { - const scope = ctx.activeRustEditor?.document.uri; - if (!scope) return; +async function makeDebugConfig(ctx: Ctx, item: RunnableQuickPick): Promise { + const scope = ctx.activeRustEditor?.document.uri; + if (!scope) return; - const item = await selectRunnable(ctx, undefined); - if (!item) return; + const debugConfig = await getDebugConfiguration(ctx, item.runnable); + if (!debugConfig) return; - const debugConfig = await getDebugConfiguration(ctx, item.runnable); - if (!debugConfig) return; + const wsLaunchSection = vscode.workspace.getConfiguration("launch", scope); + const configurations = wsLaunchSection.get("configurations") || []; - const wsLaunchSection = vscode.workspace.getConfiguration("launch", scope); - const configurations = wsLaunchSection.get("configurations") || []; + const index = configurations.findIndex(c => c.name === debugConfig.name); + if (index !== -1) { + const answer = await vscode.window.showErrorMessage(`Launch configuration '${debugConfig.name}' already exists!`, 'Cancel', 'Update'); + if (answer === "Cancel") return; - const index = configurations.findIndex(c => c.name === debugConfig.name); - if (index !== -1) { - const answer = await vscode.window.showErrorMessage(`Launch configuration '${debugConfig.name}' already exists!`, 'Cancel', 'Update'); - if (answer === "Cancel") return; + configurations[index] = debugConfig; + } else { + configurations.push(debugConfig); + } - configurations[index] = debugConfig; - } else { - configurations.push(debugConfig); - } + await wsLaunchSection.update("configurations", configurations); +} + +export function newDebugConfig(ctx: Ctx): Cmd { + return async () => { + const item = await selectRunnable(ctx, undefined, false); + if (!item) return; - await wsLaunchSection.update("configurations", configurations); + await makeDebugConfig(ctx, item); }; } From 701236148c59ddabcce2ebae603398b6eca45e78 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 13:30:05 +0300 Subject: [PATCH 687/819] Fix "rust-analyzer.debug" for QuickPick binaries. --- rust-analyzer/editors/code/src/cargo.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 2a2c2e0e..ba286c0a 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -48,6 +48,10 @@ export class Cargo { async executableFromArgs(args: readonly string[]): Promise { const cargoArgs = [...args, "--message-format=json"]; + if( cargoArgs[0] == "run" ) { + // a runnable from the quick pick. + cargoArgs[0] = "build"; + } const artifacts = await this.artifactsFromArgs(cargoArgs); From 41fa5595a97effb08ee3907369f2616f1f4f289e Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 13:48:02 +0300 Subject: [PATCH 688/819] Multiple binaries support for launch.json. --- rust-analyzer/editors/code/src/debug.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index b500fe02..96601988 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -87,6 +87,11 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom } } + if (debugConfig.name === "run binary") { + // A workaround for multiple binaries. It would be better to get proper names on the LSP side. + debugConfig.name = `run binary [${path.basename(executable)}]`; + } + if (debugConfig.cwd) { debugConfig.cwd = simplifyPath(debugConfig.cwd); } From ac9105314d39fd1cdb937409e848899e2580d67a Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 14:42:40 +0300 Subject: [PATCH 689/819] Mixed "bin" and "test" artifacts workaround. --- rust-analyzer/editors/code/src/cargo.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index ba286c0a..4ff24ea7 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -48,12 +48,17 @@ export class Cargo { async executableFromArgs(args: readonly string[]): Promise { const cargoArgs = [...args, "--message-format=json"]; - if( cargoArgs[0] == "run" ) { + if (cargoArgs[0] === "run") { // a runnable from the quick pick. cargoArgs[0] = "build"; } - const artifacts = await this.artifactsFromArgs(cargoArgs); + let artifacts = await this.artifactsFromArgs(cargoArgs); + if (cargoArgs[0] === "test") { + // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests + // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} + artifacts = artifacts.filter(a => a.isTest); + } if (artifacts.length === 0) { throw new Error('No compilation artifacts'); From 5e05be130c11abcf38ddccd3faeac0fa01c5abb2 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 16:02:01 +0300 Subject: [PATCH 690/819] Multiple binaries support for launch.json. Generate unique names on the LSP side. --- rust-analyzer/editors/code/src/debug.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 96601988..1f93a2b7 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -88,8 +88,9 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom } if (debugConfig.name === "run binary") { - // A workaround for multiple binaries. It would be better to get proper names on the LSP side. - debugConfig.name = `run binary [${path.basename(executable)}]`; + // The LSP side: crates\rust-analyzer\src\main_loop\handlers.rs, + // fn to_lsp_runnable(...) with RunnableKind::Bin + debugConfig.name = `run binary '${path.basename(executable)}'`; } if (debugConfig.cwd) { From 3f1bebaabd7f116c0adf4e969ec62f1c85f5b495 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 14 May 2020 17:32:24 +0300 Subject: [PATCH 691/819] Fix runnable naming in the client side fallback. --- rust-analyzer/editors/code/src/debug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 1f93a2b7..d3fe588e 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -90,7 +90,7 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom if (debugConfig.name === "run binary") { // The LSP side: crates\rust-analyzer\src\main_loop\handlers.rs, // fn to_lsp_runnable(...) with RunnableKind::Bin - debugConfig.name = `run binary '${path.basename(executable)}'`; + debugConfig.name = `run ${path.basename(executable)}`; } if (debugConfig.cwd) { From d1284f9390e6ba002f5b491ff64124df73c7135e Mon Sep 17 00:00:00 2001 From: vsrs Date: Fri, 15 May 2020 15:31:09 +0300 Subject: [PATCH 692/819] Fix occasional test run during debug configuration --- rust-analyzer/editors/code/src/cargo.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 4ff24ea7..28c7de99 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -48,9 +48,13 @@ export class Cargo { async executableFromArgs(args: readonly string[]): Promise { const cargoArgs = [...args, "--message-format=json"]; + + // arguments for a runnable from the quick pick should be updated. + // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens if (cargoArgs[0] === "run") { - // a runnable from the quick pick. cargoArgs[0] = "build"; + } else if (cargoArgs.indexOf("--no-run") === -1) { + cargoArgs.push("--no-run"); } let artifacts = await this.artifactsFromArgs(cargoArgs); From 1ceeb15cf304743a0d4c8404e6274d590f20cce6 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Fri, 15 May 2020 19:27:18 -0700 Subject: [PATCH 693/819] Color macros (fixes #4462) --- rust-analyzer/editors/code/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4e7e3faf..2dbbde85 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -604,6 +604,9 @@ { "language": "rust", "scopes": { + "macro": [ + "entity.name.function.macro.rust" + ], "attribute": [ "meta.attribute.rust" ], From 0d5c81f0d748a78dda5e8f782c87494e4bd23168 Mon Sep 17 00:00:00 2001 From: vsrs Date: Sun, 17 May 2020 19:51:44 +0300 Subject: [PATCH 694/819] CodeLens configuration options. --- rust-analyzer/editors/code/package.json | 15 +++++++++++++++ rust-analyzer/editors/code/src/config.ts | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2dbbde85..efed4c7f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -443,6 +443,21 @@ "type": "object", "default": {}, "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" + }, + "rust-analyzer.lens.run": { + "description": "Whether to show Run lens.", + "type": "boolean", + "default": true + }, + "rust-analyzer.lens.debug": { + "description": "Whether to show Debug lens.", + "type": "boolean", + "default": true + }, + "rust-analyzer.lens.implementations": { + "description": "Whether to show Implementations lens.", + "type": "boolean", + "default": true } } }, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 1652827c..93d9aa16 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -16,6 +16,9 @@ export class Config { "files", "highlighting", "updates.channel", + "lens.run", + "lens.debug", + "lens.implementations", ] .map(opt => `${this.rootSection}.${opt}`); @@ -119,4 +122,12 @@ export class Config { sourceFileMap: sourceFileMap }; } + + get lens() { + return { + run: this.get("lens.run"), + debug: this.get("lens.debug"), + implementations: this.get("lens.implementations"), + }; + } } From c8c37d4df5a09a59891996e3674933f4d04a863b Mon Sep 17 00:00:00 2001 From: vsrs Date: Sun, 17 May 2020 20:29:59 +0300 Subject: [PATCH 695/819] Runnable QuickPick with debuggees only --- .../editors/code/src/commands/runnables.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index b1d93fc3..a408021e 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -7,7 +7,7 @@ import { startDebugSession, getDebugConfiguration } from '../debug'; const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; -async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, showButtons: boolean = true): Promise { +async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debuggeeOnly = false, showButtons: boolean = true): Promise { const editor = ctx.activeRustEditor; const client = ctx.client; if (!editor || !client) return; @@ -33,9 +33,20 @@ async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, showBu ) { continue; } + + if (debuggeeOnly && (r.label.startsWith('doctest') || r.label.startsWith('cargo'))) { + continue; + } items.push(new RunnableQuickPick(r)); } + if( items.length === 0 ) { + // it is the debug case, run always has at least 'cargo check ...' + // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables + vscode.window.showErrorMessage("There's no debug target!"); + return; + } + return await new Promise((resolve) => { const disposables: vscode.Disposable[] = []; const close = (result?: RunnableQuickPick) => { @@ -107,7 +118,7 @@ export function debug(ctx: Ctx): Cmd { let prevDebuggee: RunnableQuickPick | undefined; return async () => { - const item = await selectRunnable(ctx, prevDebuggee); + const item = await selectRunnable(ctx, prevDebuggee, true); if (!item) return; item.detail = 'restart'; @@ -147,7 +158,7 @@ async function makeDebugConfig(ctx: Ctx, item: RunnableQuickPick): Promise export function newDebugConfig(ctx: Ctx): Cmd { return async () => { - const item = await selectRunnable(ctx, undefined, false); + const item = await selectRunnable(ctx, undefined, true, false); if (!item) return; await makeDebugConfig(ctx, item); From 06a3633eb3eb84af523b2567e42288d5f3b9e365 Mon Sep 17 00:00:00 2001 From: vsrs Date: Sun, 17 May 2020 20:38:50 +0300 Subject: [PATCH 696/819] code formatting --- rust-analyzer/editors/code/src/commands/runnables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/commands/runnables.ts index a408021e..0bd30fb0 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/commands/runnables.ts @@ -40,7 +40,7 @@ async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debugg items.push(new RunnableQuickPick(r)); } - if( items.length === 0 ) { + if (items.length === 0) { // it is the debug case, run always has at least 'cargo check ...' // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables vscode.window.showErrorMessage("There's no debug target!"); From 0215aea545a67526a2acc79fc0587b2c978bfc08 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 17 May 2020 15:57:30 +0200 Subject: [PATCH 697/819] Relax VS Code version requirement --- rust-analyzer/editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2dbbde85..4045ab3d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "Programming Languages" ], "engines": { - "vscode": "^1.45.0" + "vscode": "^1.44.0" }, "enableProposedApi": true, "scripts": { @@ -41,7 +41,7 @@ "@rollup/plugin-node-resolve": "^7.1.3", "@types/node": "^12.12.39", "@types/node-fetch": "^2.5.7", - "@types/vscode": "^1.45.0", + "@types/vscode": "^1.44.0", "@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/parser": "^2.33.0", "eslint": "^6.8.0", From c4c8afdd96f278352f3bb6a57c24b8ab086e06e4 Mon Sep 17 00:00:00 2001 From: vsrs Date: Mon, 18 May 2020 10:27:00 +0300 Subject: [PATCH 698/819] Add "rust-analyzer.lens.enable" --- rust-analyzer/editors/code/package.json | 11 ++++++++--- rust-analyzer/editors/code/src/config.ts | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index efed4c7f..38c77533 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -444,18 +444,23 @@ "default": {}, "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" }, + "rust-analyzer.lens.enable": { + "description": "Whether to show CodeLens in Rust files.", + "type": "boolean", + "default": true + }, "rust-analyzer.lens.run": { - "description": "Whether to show Run lens.", + "markdownDescription": "Whether to show Run lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true }, "rust-analyzer.lens.debug": { - "description": "Whether to show Debug lens.", + "markdownDescription": "Whether to show Debug lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true }, "rust-analyzer.lens.implementations": { - "description": "Whether to show Implementations lens.", + "markdownDescription": "Whether to show Implementations lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true } diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 93d9aa16..ee294fbe 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -16,6 +16,7 @@ export class Config { "files", "highlighting", "updates.channel", + "lens.enable", "lens.run", "lens.debug", "lens.implementations", @@ -125,6 +126,7 @@ export class Config { get lens() { return { + enable: this.get("lens.enable"), run: this.get("lens.run"), debug: this.get("lens.debug"), implementations: this.get("lens.implementations"), From c90e2d91544f531f1213caab1ee267793a8dc976 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Tue, 12 May 2020 21:58:51 -0700 Subject: [PATCH 699/819] Color attribute functions --- rust-analyzer/editors/code/package.json | 7 +++++++ rust-analyzer/editors/code/rust.tmGrammar.json | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d899f60e..d078f747 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -603,6 +603,10 @@ } ], "semanticTokenModifiers": [ + { + "id": "attribute", + "description": "Style for elements within attributes" + }, { "id": "constant", "description": "Style for compile-time constants" @@ -630,6 +634,9 @@ "attribute": [ "meta.attribute.rust" ], + "function.attribute": [ + "entity.name.function.attribute.rust" + ], "builtinType": [ "support.type.primitive.rust" ], diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index aa081132..cdcd557d 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -75,8 +75,13 @@ { "comment": "Attribute", "name": "meta.attribute.rust", - "begin": "#\\!?\\[", + "begin": "#\\!?\\[(\\w*)", "end": "\\]", + "captures": { + "1": { + "name": "entity.name.function.attribute.rust" + } + }, "patterns": [ { "include": "#string_literal" From f1f1e26080c67c7c16ad1ab5062d5b68f0d3b8e0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 17 May 2020 21:24:33 +0200 Subject: [PATCH 700/819] Add snippetTextEdit protocol extension --- rust-analyzer/editors/code/src/client.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index cffdcf11..2067738e 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -35,7 +35,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient } as any }; - const res = new lc.LanguageClient( + const client = new lc.LanguageClient( 'rust-analyzer', 'Rust Analyzer Language Server', serverOptions, @@ -47,8 +47,19 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient // since they are available on stable. // Note that while these features are stable in vscode their LSP protocol // implementations are still in the "proposed" category for 3.16. - res.registerFeature(new CallHierarchyFeature(res)); - res.registerFeature(new SemanticTokensFeature(res)); + client.registerFeature(new CallHierarchyFeature(client)); + client.registerFeature(new SemanticTokensFeature(client)); + client.registerFeature(new SnippetTextEditFeature()); - return res; + return client; +} + +class SnippetTextEditFeature implements lc.StaticFeature { + fillClientCapabilities(capabilities: lc.ClientCapabilities): void { + const caps: any = capabilities.experimental ?? {}; + caps.snippetTextEdit = true; + capabilities.experimental = caps + } + initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { + } } From e218fdaba291327fdacf31647ec6dc2d6107c538 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 18 May 2020 01:53:55 +0200 Subject: [PATCH 701/819] Implement client-side of SnippetTextEdit --- rust-analyzer/editors/code/src/client.ts | 48 ++++++++++++++++++- .../editors/code/src/commands/index.ts | 34 +++++++++++++ rust-analyzer/editors/code/src/main.ts | 1 + 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 2067738e..fac1a0be 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -31,7 +31,39 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient const res = await next(document, token); if (res === undefined) throw new Error('busy'); return res; + }, + async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) { + const params: lc.CodeActionParams = { + textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), + range: client.code2ProtocolConverter.asRange(range), + context: client.code2ProtocolConverter.asCodeActionContext(context) + }; + return client.sendRequest(lc.CodeActionRequest.type, params, token).then((values) => { + if (values === null) return undefined; + const result: (vscode.CodeAction | vscode.Command)[] = []; + for (const item of values) { + if (lc.CodeAction.is(item)) { + const action = client.protocol2CodeConverter.asCodeAction(item); + if (isSnippetEdit(item)) { + action.command = { + command: "rust-analyzer.applySnippetWorkspaceEdit", + title: "", + arguments: [action.edit], + }; + action.edit = undefined; + } + result.push(action); + } else { + const command = client.protocol2CodeConverter.asCommand(item); + result.push(command); + } + } + return result; + }, + (_error) => undefined + ); } + } as any }; @@ -42,7 +74,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient clientOptions, ); - // To turn on all proposed features use: res.registerProposedFeatures(); + // To turn on all proposed features use: client.registerProposedFeatures(); // Here we want to enable CallHierarchyFeature and SemanticTokensFeature // since they are available on stable. // Note that while these features are stable in vscode their LSP protocol @@ -58,8 +90,20 @@ class SnippetTextEditFeature implements lc.StaticFeature { fillClientCapabilities(capabilities: lc.ClientCapabilities): void { const caps: any = capabilities.experimental ?? {}; caps.snippetTextEdit = true; - capabilities.experimental = caps + capabilities.experimental = caps; } initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { } } + +function isSnippetEdit(action: lc.CodeAction): boolean { + const documentChanges = action.edit?.documentChanges ?? []; + for (const edit of documentChanges) { + if (lc.TextDocumentEdit.is(edit)) { + if (edit.edits.some((indel) => (indel as any).insertTextFormat === lc.InsertTextFormat.Snippet)) { + return true; + } + } + } + return false; +} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index bdb7fc3b..770d11bd 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,6 +4,7 @@ import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; import * as sourceChange from '../source_change'; +import { assert } from '../util'; export * from './analyzer_status'; export * from './matching_brace'; @@ -51,3 +52,36 @@ export function selectAndApplySourceChange(ctx: Ctx): Cmd { } }; } + +export function applySnippetWorkspaceEdit(_ctx: Ctx): Cmd { + return async (edit: vscode.WorkspaceEdit) => { + assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); + const [uri, edits] = edit.entries()[0]; + + const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); + if (!editor) return; + + let editWithSnippet: vscode.TextEdit | undefined = undefined; + let lineDelta = 0; + await editor.edit((builder) => { + for (const indel of edits) { + if (indel.newText.indexOf('$0') !== -1) { + editWithSnippet = indel; + } else { + if (!editWithSnippet) { + lineDelta = (indel.newText.match(/\n/g) || []).length - (indel.range.end.line - indel.range.start.line); + } + builder.replace(indel.range, indel.newText); + } + } + }); + if (editWithSnippet) { + const snip = editWithSnippet as vscode.TextEdit; + const range = snip.range.with( + snip.range.start.with(snip.range.start.line + lineDelta), + snip.range.end.with(snip.range.end.line + lineDelta), + ); + await editor.insertSnippet(new vscode.SnippetString(snip.newText), range); + } + }; +} diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index c015460b..ac3bb365 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -91,6 +91,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('debugSingle', commands.debugSingle); ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySourceChange', commands.applySourceChange); + ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEdit); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); ctx.pushCleanup(activateTaskProvider(workspaceFolder)); From 38d6a5f35c6704f4fdab300bce15b7e053ffe97c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 May 2020 00:49:08 +0200 Subject: [PATCH 702/819] Fix client-side snippets --- rust-analyzer/editors/code/src/commands/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 770d11bd..0937b495 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -65,7 +65,8 @@ export function applySnippetWorkspaceEdit(_ctx: Ctx): Cmd { let lineDelta = 0; await editor.edit((builder) => { for (const indel of edits) { - if (indel.newText.indexOf('$0') !== -1) { + const isSnippet = indel.newText.indexOf('$0') !== -1 || indel.newText.indexOf('${') !== -1; + if (isSnippet) { editWithSnippet = indel; } else { if (!editWithSnippet) { From 3bdd08bb71afe2300009edbded282a06a551e72e Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 20 May 2020 09:42:00 +0300 Subject: [PATCH 703/819] Debug lens fix for a binary. --- rust-analyzer/editors/code/src/cargo.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 28c7de99..6a41873d 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -51,10 +51,14 @@ export class Cargo { // arguments for a runnable from the quick pick should be updated. // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens - if (cargoArgs[0] === "run") { - cargoArgs[0] = "build"; - } else if (cargoArgs.indexOf("--no-run") === -1) { - cargoArgs.push("--no-run"); + switch (cargoArgs[0]) { + case "run": cargoArgs[0] = "build"; break; + case "test": { + if (cargoArgs.indexOf("--no-run") === -1) { + cargoArgs.push("--no-run"); + } + break; + } } let artifacts = await this.artifactsFromArgs(cargoArgs); From 77263282a010e5006e0600309a5aa10768e68d73 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 20 May 2020 21:03:49 +0300 Subject: [PATCH 704/819] vscode client side tests --- rust-analyzer/editors/code/.vscodeignore | 2 +- rust-analyzer/editors/code/package-lock.json | 768 ++++++++++++++++++ rust-analyzer/editors/code/package.json | 15 +- rust-analyzer/editors/code/rollup.config.js | 4 +- rust-analyzer/editors/code/src/cargo.ts | 63 +- rust-analyzer/editors/code/tests/runTests.ts | 46 ++ .../editors/code/tests/unit/index.ts | 38 + .../code/tests/unit/launch_config.test.ts | 52 ++ rust-analyzer/editors/code/tsconfig.json | 9 +- 9 files changed, 965 insertions(+), 32 deletions(-) create mode 100644 rust-analyzer/editors/code/tests/runTests.ts create mode 100644 rust-analyzer/editors/code/tests/unit/index.ts create mode 100644 rust-analyzer/editors/code/tests/unit/launch_config.test.ts diff --git a/rust-analyzer/editors/code/.vscodeignore b/rust-analyzer/editors/code/.vscodeignore index 257b744b..7149ab79 100644 --- a/rust-analyzer/editors/code/.vscodeignore +++ b/rust-analyzer/editors/code/.vscodeignore @@ -1,5 +1,5 @@ ** -!out/main.js +!out/src/main.js !package.json !package-lock.json !ra_syntax_tree.tmGrammar.json diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 06178990..c322b02c 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -81,12 +81,41 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/json-schema": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", "dev": true }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/mocha": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-7.0.2.tgz", + "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==", + "dev": true + }, "@types/node": { "version": "12.12.39", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", @@ -200,6 +229,15 @@ "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", "dev": true }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, "ajv": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", @@ -212,6 +250,12 @@ "uri-js": "^4.2.2" } }, + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "dev": true + }, "ansi-escapes": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", @@ -244,6 +288,16 @@ "color-convert": "^1.9.0" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -283,6 +337,12 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "dev": true + }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -308,6 +368,12 @@ "fill-range": "^7.0.1" } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -326,6 +392,12 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -357,6 +429,22 @@ "parse5": "^3.0.1" } }, + "chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" + } + }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -372,6 +460,42 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -468,12 +592,27 @@ "ms": "^2.1.1" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -486,6 +625,12 @@ "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=", "dev": true }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -562,6 +707,51 @@ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true }, + "es-abstract": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -764,6 +954,24 @@ "to-regex-range": "^5.0.1" } }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -805,12 +1013,24 @@ "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -843,12 +1063,39 @@ "type-fest": "^0.8.1" } }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -863,6 +1110,54 @@ "readable-stream": "^3.1.1" } }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dev": true, + "requires": { + "agent-base": "4", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -992,6 +1287,33 @@ } } }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + }, + "is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "dev": true + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1040,6 +1362,24 @@ "@types/estree": "0.0.39" } }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1099,12 +1439,31 @@ "uc.micro": "^1.0.1" } }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } + }, "lru-cache": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", @@ -1212,6 +1571,93 @@ "minimist": "^1.2.5" } }, + "mocha": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", + "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", + "dev": true, + "requires": { + "ansi-colors": "3.2.3", + "browser-stdout": "1.3.1", + "chokidar": "3.3.0", + "debug": "3.2.6", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "find-up": "3.0.0", + "glob": "7.1.3", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", + "minimatch": "3.0.4", + "mkdirp": "0.5.5", + "ms": "2.1.1", + "node-environment-flags": "1.0.6", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1236,11 +1682,35 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "node-fetch": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -1250,6 +1720,40 @@ "boolbase": "~1.0.0" } }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1310,6 +1814,30 @@ "os-tmpdir": "^1.0.0" } }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -1345,6 +1873,12 @@ "@types/node": "*" } }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1419,12 +1953,33 @@ "util-deprecate": "^1.0.1" } }, + "readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "dev": true, + "requires": { + "picomatch": "^2.0.4" + } + }, "regexpp": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", "dev": true }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "resolve": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", @@ -1503,6 +2058,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -1583,6 +2144,48 @@ } } }, + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" + } + }, + "string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1865,6 +2468,17 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.1.tgz", "integrity": "sha512-tZFUSbyjUcrh+qQf13ALX4QDdOfDX0cVaBFgy7ktJ0VwS7AW/yRKgGPSxVqqP9OCMNPdqP57O5q47w2pEwfaUg==" }, + "vscode-test": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.3.0.tgz", + "integrity": "sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw==", + "dev": true, + "requires": { + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^2.2.4", + "rimraf": "^2.6.3" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -1874,12 +2488,96 @@ "isexe": "^2.0.0" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1895,12 +2593,82 @@ "mkdirp": "^0.5.1" } }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + } + }, "yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d899f60e..cf66deaf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -29,8 +29,10 @@ "package": "vsce package -o rust-analyzer.vsix", "build": "tsc", "watch": "tsc --watch", - "lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src", - "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix" + "lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src ./tests", + "fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src ./tests --fix", + "pretest": "npm run build", + "test": "node ./out/tests/runTests.js" }, "dependencies": { "node-fetch": "^2.6.0", @@ -39,17 +41,22 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.1.0", "@rollup/plugin-node-resolve": "^7.1.3", + "@types/glob": "^7.1.1", + "@types/mocha": "^7.0.2", "@types/node": "^12.12.39", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.0", "@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/parser": "^2.33.0", "eslint": "^6.8.0", + "glob": "^7.1.6", + "mocha": "^7.1.2", "rollup": "^2.10.0", "tslib": "^1.12.0", "typescript": "^3.9.2", "typescript-formatter": "^7.2.2", - "vsce": "^1.75.0" + "vsce": "^1.75.0", + "vscode-test": "^1.3.0" }, "activationEvents": [ "onLanguage:rust", @@ -57,7 +64,7 @@ "onCommand:rust-analyzer.collectGarbage", "workspaceContains:**/Cargo.toml" ], - "main": "./out/main", + "main": "./out/src/main", "contributes": { "taskDefinitions": [ { diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 2ca27694..58360eab 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -6,7 +6,7 @@ import nodeBuiltins from 'builtin-modules'; /** @type { import('rollup').RollupOptions } */ export default { - input: 'out/main.js', + input: 'out/src/main.js', plugins: [ resolve({ preferBuiltins: true @@ -20,7 +20,7 @@ export default { ], external: [...nodeBuiltins, 'vscode'], output: { - file: './out/main.js', + file: './out/src/main.js', format: 'cjs', exports: 'named' } diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index 6a41873d..c3e2e5c0 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -12,14 +12,46 @@ interface CompilationArtifact { isTest: boolean; } +export interface ArtifactSpec { + cargoArgs: string[]; + filter?: (artifacts: CompilationArtifact[]) => CompilationArtifact[]; +} + +export function artifactSpec(args: readonly string[]): ArtifactSpec { + const cargoArgs = [...args, "--message-format=json"]; + + // arguments for a runnable from the quick pick should be updated. + // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens + switch (cargoArgs[0]) { + case "run": cargoArgs[0] = "build"; break; + case "test": { + if (cargoArgs.indexOf("--no-run") === -1) { + cargoArgs.push("--no-run"); + } + break; + } + } + + const result: ArtifactSpec = { cargoArgs: cargoArgs }; + if (cargoArgs[0] === "test") { + // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests + // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} + result.filter = (artifacts) => { + return artifacts.filter(a => a.isTest); + }; + } + + return result; +} + export class Cargo { constructor(readonly rootFolder: string, readonly output: OutputChannel) { } - private async artifactsFromArgs(cargoArgs: string[]): Promise { - const artifacts: CompilationArtifact[] = []; + private async getArtifacts(spec: ArtifactSpec): Promise { + let artifacts: CompilationArtifact[] = []; try { - await this.runCargo(cargoArgs, + await this.runCargo(spec.cargoArgs, message => { if (message.reason === 'compiler-artifact' && message.executable) { const isBinary = message.target.crate_types.includes('bin'); @@ -43,30 +75,15 @@ export class Cargo { throw new Error(`Cargo invocation has failed: ${err}`); } + if (spec.filter) { + artifacts = spec.filter(artifacts); + } + return artifacts; } async executableFromArgs(args: readonly string[]): Promise { - const cargoArgs = [...args, "--message-format=json"]; - - // arguments for a runnable from the quick pick should be updated. - // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens - switch (cargoArgs[0]) { - case "run": cargoArgs[0] = "build"; break; - case "test": { - if (cargoArgs.indexOf("--no-run") === -1) { - cargoArgs.push("--no-run"); - } - break; - } - } - - let artifacts = await this.artifactsFromArgs(cargoArgs); - if (cargoArgs[0] === "test") { - // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests - // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} - artifacts = artifacts.filter(a => a.isTest); - } + const artifacts = await this.getArtifacts(artifactSpec(args)); if (artifacts.length === 0) { throw new Error('No compilation artifacts'); diff --git a/rust-analyzer/editors/code/tests/runTests.ts b/rust-analyzer/editors/code/tests/runTests.ts new file mode 100644 index 00000000..81600f6a --- /dev/null +++ b/rust-analyzer/editors/code/tests/runTests.ts @@ -0,0 +1,46 @@ +import * as path from 'path'; +import * as fs from 'fs'; + +import { runTests } from 'vscode-test'; + +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // Minimum supported version. + const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); + const json = JSON.parse(jsonData.toString()); + let minimalVersion: string = json.engines.vscode; + if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); + + const launchArgs = ["--disable-extensions"]; + + // All test suites (either unit tests or integration tests) should be in subfolders. + const extensionTestsPath = path.resolve(__dirname, './unit/index'); + + // Run tests using the minimal supported version. + await runTests({ + version: minimalVersion, + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + // and the latest one + await runTests({ + version: 'stable', + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + } catch (err) { + // eslint-disable-next-line no-console + console.error('Failed to run tests', err); + process.exit(1); + } +} + +main(); diff --git a/rust-analyzer/editors/code/tests/unit/index.ts b/rust-analyzer/editors/code/tests/unit/index.ts new file mode 100644 index 00000000..1deb1c40 --- /dev/null +++ b/rust-analyzer/editors/code/tests/unit/index.ts @@ -0,0 +1,38 @@ +import * as path from 'path'; +import Mocha from 'mocha'; +import glob from 'glob'; + +export function run(): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: 'tdd', + color: true + }); + + const testsRoot = __dirname; + + return new Promise((c, e) => { + glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { + if (err) { + return e(err); + } + + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.timeout(100000); + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + e(err); + } + }); + }); +} diff --git a/rust-analyzer/editors/code/tests/unit/launch_config.test.ts b/rust-analyzer/editors/code/tests/unit/launch_config.test.ts new file mode 100644 index 00000000..d5cf1b74 --- /dev/null +++ b/rust-analyzer/editors/code/tests/unit/launch_config.test.ts @@ -0,0 +1,52 @@ +import * as assert from 'assert'; +import * as cargo from '../../src/cargo'; + +suite('Launch configuration', () => { + + suite('Lens', () => { + test('A binary', async () => { + const args = cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "pkg_name"]); + + assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]); + assert.deepEqual(args.filter, undefined); + }); + + test('One of Multiple Binaries', async () => { + const args = cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "bin1"]); + + assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin1", "--message-format=json"]); + assert.deepEqual(args.filter, undefined); + }); + + test('A test', async () => { + const args = cargo.artifactSpec(["test", "--package", "pkg_name", "--lib", "--no-run"]); + + assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--no-run", "--message-format=json"]); + assert.notDeepEqual(args.filter, undefined); + }); + }); + + suite('QuickPick', () => { + test('A binary', async () => { + const args = cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "pkg_name"]); + + assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]); + assert.deepEqual(args.filter, undefined); + }); + + + test('One of Multiple Binaries', async () => { + const args = cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "bin2"]); + + assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin2", "--message-format=json"]); + assert.deepEqual(args.filter, undefined); + }); + + test('A test', async () => { + const args = cargo.artifactSpec(["test", "--package", "pkg_name", "--lib"]); + + assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--message-format=json", "--no-run"]); + assert.notDeepEqual(args.filter, undefined); + }); + }); +}); diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index ad134865..32d1a865 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "sourceMap": true, - "rootDir": "src", + "rootDir": ".", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, @@ -18,6 +18,11 @@ "newLine": "LF" }, "exclude": [ - "node_modules" + "node_modules", + ".vscode-test" + ], + "include": [ + "src", + "tests" ] } From 58b0606adb455b0855e4a74f9e6125c2c5350d5b Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 21 May 2020 11:34:34 +0300 Subject: [PATCH 705/819] Apply suggestions from @Veetaha code review --- rust-analyzer/editors/code/src/cargo.ts | 14 +--- rust-analyzer/editors/code/tests/runTests.ts | 73 +++++++++---------- .../editors/code/tests/unit/index.ts | 10 +-- 3 files changed, 44 insertions(+), 53 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index c3e2e5c0..a55b2f86 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -25,7 +25,7 @@ export function artifactSpec(args: readonly string[]): ArtifactSpec { switch (cargoArgs[0]) { case "run": cargoArgs[0] = "build"; break; case "test": { - if (cargoArgs.indexOf("--no-run") === -1) { + if (!cargoArgs.includes("--no-run")) { cargoArgs.push("--no-run"); } break; @@ -36,9 +36,7 @@ export function artifactSpec(args: readonly string[]): ArtifactSpec { if (cargoArgs[0] === "test") { // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} - result.filter = (artifacts) => { - return artifacts.filter(a => a.isTest); - }; + result.filter = (artifacts) => artifacts.filter(it => it.isTest); } return result; @@ -48,7 +46,7 @@ export class Cargo { constructor(readonly rootFolder: string, readonly output: OutputChannel) { } private async getArtifacts(spec: ArtifactSpec): Promise { - let artifacts: CompilationArtifact[] = []; + const artifacts: CompilationArtifact[] = []; try { await this.runCargo(spec.cargoArgs, @@ -75,11 +73,7 @@ export class Cargo { throw new Error(`Cargo invocation has failed: ${err}`); } - if (spec.filter) { - artifacts = spec.filter(artifacts); - } - - return artifacts; + return spec.filter?.(artifacts) ?? artifacts; } async executableFromArgs(args: readonly string[]): Promise { diff --git a/rust-analyzer/editors/code/tests/runTests.ts b/rust-analyzer/editors/code/tests/runTests.ts index 81600f6a..22df80ad 100644 --- a/rust-analyzer/editors/code/tests/runTests.ts +++ b/rust-analyzer/editors/code/tests/runTests.ts @@ -4,43 +4,40 @@ import * as fs from 'fs'; import { runTests } from 'vscode-test'; async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); - - // Minimum supported version. - const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); - const json = JSON.parse(jsonData.toString()); - let minimalVersion: string = json.engines.vscode; - if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); - - const launchArgs = ["--disable-extensions"]; - - // All test suites (either unit tests or integration tests) should be in subfolders. - const extensionTestsPath = path.resolve(__dirname, './unit/index'); - - // Run tests using the minimal supported version. - await runTests({ - version: minimalVersion, - launchArgs, - extensionDevelopmentPath, - extensionTestsPath - }); - - // and the latest one - await runTests({ - version: 'stable', - launchArgs, - extensionDevelopmentPath, - extensionTestsPath - }); - - } catch (err) { - // eslint-disable-next-line no-console - console.error('Failed to run tests', err); - process.exit(1); - } + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // Minimum supported version. + const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); + const json = JSON.parse(jsonData.toString()); + let minimalVersion: string = json.engines.vscode; + if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); + + const launchArgs = ["--disable-extensions"]; + + // All test suites (either unit tests or integration tests) should be in subfolders. + const extensionTestsPath = path.resolve(__dirname, './unit/index'); + + // Run tests using the minimal supported version. + await runTests({ + version: minimalVersion, + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + // and the latest one + await runTests({ + version: 'stable', + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); } -main(); +main().catch(err => { + // eslint-disable-next-line no-console + console.error('Failed to run tests', err); + process.exit(1); +}); diff --git a/rust-analyzer/editors/code/tests/unit/index.ts b/rust-analyzer/editors/code/tests/unit/index.ts index 1deb1c40..5165720b 100644 --- a/rust-analyzer/editors/code/tests/unit/index.ts +++ b/rust-analyzer/editors/code/tests/unit/index.ts @@ -11,10 +11,10 @@ export function run(): Promise { const testsRoot = __dirname; - return new Promise((c, e) => { + return new Promise((resolve, reject) => { glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { - return e(err); + return reject(err); } // Add files to the test suite @@ -25,13 +25,13 @@ export function run(): Promise { mocha.timeout(100000); mocha.run(failures => { if (failures > 0) { - e(new Error(`${failures} tests failed.`)); + reject(new Error(`${failures} tests failed.`)); } else { - c(); + resolve(); } }); } catch (err) { - e(err); + reject(err); } }); }); From d011e7ffd05cd62c55f4d897c36fafe0a8510f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 21 May 2020 12:24:18 +0300 Subject: [PATCH 706/819] Fix phrasing in inlay hints settings --- rust-analyzer/editors/code/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d899f60e..78f647ba 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -313,22 +313,22 @@ "rust-analyzer.inlayHints.enable": { "type": "boolean", "default": true, - "description": "Disable all inlay hints" + "description": "Whether to show inlay hints" }, "rust-analyzer.inlayHints.typeHints": { "type": "boolean", "default": true, - "description": "Whether to show inlay type hints" + "description": "Whether to show inlay type hints for variables." }, "rust-analyzer.inlayHints.chainingHints": { "type": "boolean", "default": true, - "description": "Whether to show inlay type hints for method chains" + "description": "Whether to show inlay type hints for method chains." }, "rust-analyzer.inlayHints.parameterHints": { "type": "boolean", "default": true, - "description": "Whether to show function parameter name inlay hints at the call site" + "description": "Whether to show function parameter name inlay hints at the call site." }, "rust-analyzer.inlayHints.maxLength": { "type": [ From d0d558edf4015ba21eb200a6f180507fdfcdfa87 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 May 2020 14:26:44 +0200 Subject: [PATCH 707/819] Transition OnEnter to WorkspaceSnippetEdit This also changes our handiling of snippet edits on the client side. `editor.insertSnippet` unfortunately forces indentation, which we really don't want to have to deal with. So, let's just implement our manual hacky way of dealing with a simple subset of snippets we actually use in rust-analyzer --- .../editors/code/src/commands/index.ts | 75 ++++++++++++------- .../editors/code/src/commands/on_enter.ts | 5 +- rust-analyzer/editors/code/src/main.ts | 2 +- .../editors/code/src/rust-analyzer-api.ts | 2 +- 4 files changed, 53 insertions(+), 31 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 0937b495..e5ed77e3 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -53,36 +53,57 @@ export function selectAndApplySourceChange(ctx: Ctx): Cmd { }; } -export function applySnippetWorkspaceEdit(_ctx: Ctx): Cmd { +export function applySnippetWorkspaceEditCommand(_ctx: Ctx): Cmd { return async (edit: vscode.WorkspaceEdit) => { - assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); - const [uri, edits] = edit.entries()[0]; + await applySnippetWorkspaceEdit(edit); + }; +} + +export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { + assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); + const [uri, edits] = edit.entries()[0]; - const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); - if (!editor) return; + const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); + if (!editor) return; - let editWithSnippet: vscode.TextEdit | undefined = undefined; - let lineDelta = 0; - await editor.edit((builder) => { - for (const indel of edits) { - const isSnippet = indel.newText.indexOf('$0') !== -1 || indel.newText.indexOf('${') !== -1; - if (isSnippet) { - editWithSnippet = indel; - } else { - if (!editWithSnippet) { - lineDelta = (indel.newText.match(/\n/g) || []).length - (indel.range.end.line - indel.range.start.line); - } - builder.replace(indel.range, indel.newText); - } + let selection: vscode.Selection | undefined = undefined; + let lineDelta = 0; + await editor.edit((builder) => { + for (const indel of edits) { + const parsed = parseSnippet(indel.newText); + if (parsed) { + const [newText, [placeholderStart, placeholderLength]] = parsed; + const prefix = newText.substr(0, placeholderStart); + const lastNewline = prefix.lastIndexOf('\n'); + + const startLine = indel.range.start.line + lineDelta + countLines(prefix); + const startColumn = lastNewline === -1 ? + indel.range.start.character + placeholderStart + : prefix.length - lastNewline - 1; + const endColumn = startColumn + placeholderLength; + selection = new vscode.Selection( + new vscode.Position(startLine, startColumn), + new vscode.Position(startLine, endColumn), + ); + builder.replace(indel.range, newText); + } else { + lineDelta = countLines(indel.newText) - (indel.range.end.line - indel.range.start.line); + builder.replace(indel.range, indel.newText); } - }); - if (editWithSnippet) { - const snip = editWithSnippet as vscode.TextEdit; - const range = snip.range.with( - snip.range.start.with(snip.range.start.line + lineDelta), - snip.range.end.with(snip.range.end.line + lineDelta), - ); - await editor.insertSnippet(new vscode.SnippetString(snip.newText), range); } - }; + }); + if (selection) editor.selection = selection; +} + +function parseSnippet(snip: string): [string, [number, number]] | undefined { + const m = snip.match(/\$(0|\{0:([^}]*)\})/); + if (!m) return undefined; + const placeholder = m[2] ?? ""; + const range: [number, number] = [m.index!!, placeholder.length]; + const insert = snip.replace(m[0], placeholder); + return [insert, range]; +} + +function countLines(text: string): number { + return (text.match(/\n/g) || []).length; } diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index 285849db..a7871c31 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; import * as ra from '../rust-analyzer-api'; -import { applySourceChange } from '../source_change'; import { Cmd, Ctx } from '../ctx'; +import { applySnippetWorkspaceEdit } from '.'; async function handleKeypress(ctx: Ctx) { const editor = ctx.activeRustEditor; @@ -21,7 +21,8 @@ async function handleKeypress(ctx: Ctx) { }); if (!change) return false; - await applySourceChange(ctx, change); + const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change); + await applySnippetWorkspaceEdit(workspaceEdit); return true; } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ac3bb365..8b0a9d87 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -91,7 +91,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('debugSingle', commands.debugSingle); ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySourceChange', commands.applySourceChange); - ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEdit); + ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); ctx.pushCleanup(activateTaskProvider(workspaceFolder)); diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 400ac371..3b83b10e 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -69,7 +69,7 @@ export interface JoinLinesParams { export const joinLines = request("joinLines"); -export const onEnter = request>("onEnter"); +export const onEnter = request>("onEnter"); export interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; From 11db21154d679354631a6de650c00f8467475096 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Thu, 21 May 2020 18:26:50 +0300 Subject: [PATCH 708/819] editors/vscode: added patchelf after download --- rust-analyzer/editors/code/src/main.ts | 49 +++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index ac3bb365..0a234cb8 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as path from "path"; import * as os from "os"; -import { promises as fs } from "fs"; +import { promises as fs, PathLike } from "fs"; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; @@ -12,6 +12,7 @@ import { log, assert, isValidExecutable } from './util'; import { PersistentState } from './persistent_state'; import { fetchRelease, download } from './net'; import { activateTaskProvider } from './tasks'; +import { exec } from 'child_process'; let ctx: Ctx | undefined; @@ -188,6 +189,46 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< return path; } +async function patchelf(dest: PathLike): Promise { + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + title: "Patching rust-analysis for NixOS" + }, + async (progress, _) => { + let patch_path = path.join(os.tmpdir(), "patch-ra.nix") + progress.report({message: "Writing nix file", increment: 5}) + await fs.writeFile(patch_path, ` + {src, pkgs ? import {}}: + pkgs.stdenv.mkDerivation { + name = "rust-analyzer"; + inherit src; + phases = [ "installPhase" "fixupPhase" ]; + installPhase = "cp $src $out"; + fixupPhase = '' + chmod 755 $out + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out + ''; + } + `) + let orig_file = dest + "-orig" + await fs.rename(dest, orig_file) + progress.report({message: "Patching executable", increment: 20}) + await new Promise((resolve, reject) => { + exec(`nix-build ${patch_path} --arg src '${orig_file}' -o ${dest}`, + (err, stdout, stderr) => { + if (err != null) { + reject(Error(stderr)) + } else { + resolve(stdout) + } + }) + }) + // await fs.unlink(orig_file) + } + ) +} + async function getServer(config: Config, state: PersistentState): Promise { const explicitPath = process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; if (explicitPath) { @@ -237,6 +278,12 @@ async function getServer(config: Config, state: PersistentState): Promise true).catch(_ => false)) { + await patchelf(dest) + } + await state.updateServerVersion(config.package.version); return dest; } From 2616f4efa7290c58a3f3745ee865201df2c88588 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Thu, 21 May 2020 18:45:37 +0300 Subject: [PATCH 709/819] editors/vscode: removing original file after patching --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0a234cb8..0a2c3059 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -224,7 +224,7 @@ async function patchelf(dest: PathLike): Promise { } }) }) - // await fs.unlink(orig_file) + await fs.unlink(orig_file) } ) } From dfa699682639ff2ebf97497552547105d911d17b Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Thu, 21 May 2020 18:49:30 +0300 Subject: [PATCH 710/819] editor/vscode: lint --- rust-analyzer/editors/code/src/main.ts | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0a2c3059..1c6e3093 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -192,13 +192,13 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< async function patchelf(dest: PathLike): Promise { await vscode.window.withProgress( { - location: vscode.ProgressLocation.Notification, + location: vscode.ProgressLocation.Notification, title: "Patching rust-analysis for NixOS" - }, + }, async (progress, _) => { - let patch_path = path.join(os.tmpdir(), "patch-ra.nix") - progress.report({message: "Writing nix file", increment: 5}) - await fs.writeFile(patch_path, ` + const patchPath = path.join(os.tmpdir(), "patch-ra.nix"); + progress.report({ message: "Writing nix file", increment: 5 }); + await fs.writeFile(patchPath, ` {src, pkgs ? import {}}: pkgs.stdenv.mkDerivation { name = "rust-analyzer"; @@ -210,23 +210,23 @@ async function patchelf(dest: PathLike): Promise { patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out ''; } - `) - let orig_file = dest + "-orig" - await fs.rename(dest, orig_file) - progress.report({message: "Patching executable", increment: 20}) + `); + const origFile = dest + "-orig"; + await fs.rename(dest, origFile); + progress.report({ message: "Patching executable", increment: 20 }); await new Promise((resolve, reject) => { - exec(`nix-build ${patch_path} --arg src '${orig_file}' -o ${dest}`, - (err, stdout, stderr) => { - if (err != null) { - reject(Error(stderr)) - } else { - resolve(stdout) - } - }) - }) - await fs.unlink(orig_file) + exec(`nix-build ${patchPath} --arg src '${origFile}' -o ${dest}`, + (err, stdout, stderr) => { + if (err != null) { + reject(Error(stderr)); + } else { + resolve(stdout); + } + }); + }); + await fs.unlink(origFile); } - ) + ); } async function getServer(config: Config, state: PersistentState): Promise { @@ -281,7 +281,7 @@ async function getServer(config: Config, state: PersistentState): Promise true).catch(_ => false)) { - await patchelf(dest) + await patchelf(dest); } await state.updateServerVersion(config.package.version); From cb3bea7b7df5d2081f60072ee4c7c981b9aeb7f5 Mon Sep 17 00:00:00 2001 From: Cabia Rangris Date: Thu, 21 May 2020 17:50:28 +0200 Subject: [PATCH 711/819] Update editors/code/src/main.ts Co-authored-by: Jeremy Kolb --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 1c6e3093..bfa9980b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -193,7 +193,7 @@ async function patchelf(dest: PathLike): Promise { await vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Patching rust-analysis for NixOS" + title: "Patching rust-analyzer for NixOS" }, async (progress, _) => { const patchPath = path.join(os.tmpdir(), "patch-ra.nix"); From 706da08b12ea736b59d38dea8ea70f76e7a2c154 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 May 2020 19:50:23 +0200 Subject: [PATCH 712/819] Formalize JoinLines protocol extension --- .../editors/code/src/commands/join_lines.ts | 12 ++++++++---- rust-analyzer/editors/code/src/rust-analyzer-api.ts | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts index de061465..0bf1ee6e 100644 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ b/rust-analyzer/editors/code/src/commands/join_lines.ts @@ -1,7 +1,7 @@ import * as ra from '../rust-analyzer-api'; +import * as lc from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; -import { applySourceChange } from '../source_change'; export function joinLines(ctx: Ctx): Cmd { return async () => { @@ -9,10 +9,14 @@ export function joinLines(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const change = await client.sendRequest(ra.joinLines, { - range: client.code2ProtocolConverter.asRange(editor.selection), + const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, { + ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)), textDocument: { uri: editor.document.uri.toString() }, }); - await applySourceChange(ctx, change); + editor.edit((builder) => { + client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { + builder.replace(edit.range, edit.newText); + }); + }); }; } diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 3b83b10e..8ed56c17 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -64,9 +64,9 @@ export const parentModule = request("joinLines"); +export const joinLines = new lc.RequestType('experimental/joinLines'); export const onEnter = request>("onEnter"); From a09886215fa6cab6f8ad736630ce57212b690355 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Thu, 21 May 2020 21:30:56 +0300 Subject: [PATCH 713/819] editors/vscode: patchelf-ing without intermediate files --- rust-analyzer/editors/code/src/main.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 1c6e3093..dbb24119 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -196,9 +196,7 @@ async function patchelf(dest: PathLike): Promise { title: "Patching rust-analysis for NixOS" }, async (progress, _) => { - const patchPath = path.join(os.tmpdir(), "patch-ra.nix"); - progress.report({ message: "Writing nix file", increment: 5 }); - await fs.writeFile(patchPath, ` + const expression = ` {src, pkgs ? import {}}: pkgs.stdenv.mkDerivation { name = "rust-analyzer"; @@ -210,12 +208,12 @@ async function patchelf(dest: PathLike): Promise { patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out ''; } - `); + `; const origFile = dest + "-orig"; await fs.rename(dest, origFile); progress.report({ message: "Patching executable", increment: 20 }); await new Promise((resolve, reject) => { - exec(`nix-build ${patchPath} --arg src '${origFile}' -o ${dest}`, + const handle = exec(`nix-build -E - --arg src '${origFile}' -o ${dest}`, (err, stdout, stderr) => { if (err != null) { reject(Error(stderr)); @@ -223,6 +221,8 @@ async function patchelf(dest: PathLike): Promise { resolve(stdout); } }); + handle.stdin?.write(expression); + handle.stdin?.end(); }); await fs.unlink(origFile); } From e61f4c8b6fdf412c1f70702fc62b940dee4e9774 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Thu, 21 May 2020 21:32:27 +0300 Subject: [PATCH 714/819] editors/vscode: forgotten await in os check --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index dbb24119..42685e0c 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -280,7 +280,7 @@ async function getServer(config: Config, state: PersistentState): Promise true).catch(_ => false)) { + if (await fs.stat("/etc/nixos").then(_ => true).catch(_ => false)) { await patchelf(dest); } From e0be537f00ebccd8a02d90657b050a41715a0ea9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 May 2020 00:28:49 +0200 Subject: [PATCH 715/819] Use WorkspaceEdit for ssr --- rust-analyzer/editors/code/src/commands/ssr.ts | 6 ++---- rust-analyzer/editors/code/src/rust-analyzer-api.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts index 4ef8cdf0..5d40a64d 100644 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ b/rust-analyzer/editors/code/src/commands/ssr.ts @@ -2,7 +2,6 @@ import * as vscode from 'vscode'; import * as ra from "../rust-analyzer-api"; import { Ctx, Cmd } from '../ctx'; -import { applySourceChange } from '../source_change'; export function ssr(ctx: Ctx): Cmd { return async () => { @@ -22,11 +21,10 @@ export function ssr(ctx: Ctx): Cmd { } }; const request = await vscode.window.showInputBox(options); - if (!request) return; - const change = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); + const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); - await applySourceChange(ctx, change); + await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); }; } diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 8ed56c17..73f36432 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -112,7 +112,7 @@ export interface SsrParams { query: string; parseOnly: boolean; } -export const ssr = request("ssr"); +export const ssr = new lc.RequestType('experimental/ssr'); export const publishDecorations = notification("publishDecorations"); From 9c0a78e76bdc4c9bf49e03ae236e03f85d5eb290 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 May 2020 17:29:55 +0200 Subject: [PATCH 716/819] CodeAction groups --- rust-analyzer/editors/code/src/client.ts | 41 +++++++++++++++++-- .../editors/code/src/commands/index.ts | 14 +++---- rust-analyzer/editors/code/src/main.ts | 2 +- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index fac1a0be..d64f9a3f 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -41,10 +41,12 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient return client.sendRequest(lc.CodeActionRequest.type, params, token).then((values) => { if (values === null) return undefined; const result: (vscode.CodeAction | vscode.Command)[] = []; + const groups = new Map(); for (const item of values) { if (lc.CodeAction.is(item)) { const action = client.protocol2CodeConverter.asCodeAction(item); - if (isSnippetEdit(item)) { + const group = actionGroup(item); + if (isSnippetEdit(item) || group) { action.command = { command: "rust-analyzer.applySnippetWorkspaceEdit", title: "", @@ -52,12 +54,38 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient }; action.edit = undefined; } - result.push(action); + + if (group) { + let entry = groups.get(group); + if (!entry) { + entry = { index: result.length, items: [] }; + groups.set(group, entry); + result.push(action); + } + entry.items.push(action); + } else { + result.push(action); + } } else { const command = client.protocol2CodeConverter.asCommand(item); result.push(command); } } + for (const [group, { index, items }] of groups) { + if (items.length === 1) { + result[index] = items[0]; + } else { + const action = new vscode.CodeAction(group); + action.command = { + command: "rust-analyzer.applyActionGroup", + title: "", + arguments: [items.map((item) => { + return { label: item.title, edit: item.command!!.arguments!![0] }; + })], + }; + result[index] = action; + } + } return result; }, (_error) => undefined @@ -81,15 +109,16 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient // implementations are still in the "proposed" category for 3.16. client.registerFeature(new CallHierarchyFeature(client)); client.registerFeature(new SemanticTokensFeature(client)); - client.registerFeature(new SnippetTextEditFeature()); + client.registerFeature(new ExperimentalFeatures()); return client; } -class SnippetTextEditFeature implements lc.StaticFeature { +class ExperimentalFeatures implements lc.StaticFeature { fillClientCapabilities(capabilities: lc.ClientCapabilities): void { const caps: any = capabilities.experimental ?? {}; caps.snippetTextEdit = true; + caps.codeActionGroup = true; capabilities.experimental = caps; } initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { @@ -107,3 +136,7 @@ function isSnippetEdit(action: lc.CodeAction): boolean { } return false; } + +function actionGroup(action: lc.CodeAction): string | undefined { + return (action as any).group; +} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index e5ed77e3..abb53a24 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -41,15 +41,11 @@ export function applySourceChange(ctx: Ctx): Cmd { }; } -export function selectAndApplySourceChange(ctx: Ctx): Cmd { - return async (changes: ra.SourceChange[]) => { - if (changes.length === 1) { - await sourceChange.applySourceChange(ctx, changes[0]); - } else if (changes.length > 0) { - const selectedChange = await vscode.window.showQuickPick(changes); - if (!selectedChange) return; - await sourceChange.applySourceChange(ctx, selectedChange); - } +export function applyActionGroup(_ctx: Ctx): Cmd { + return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => { + const selectedAction = await vscode.window.showQuickPick(actions); + if (!selectedAction) return; + await applySnippetWorkspaceEdit(selectedAction.edit); }; } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 8b0a9d87..4d451386 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -92,7 +92,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); - ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); + ctx.registerCommand('applyActionGroup', commands.applyActionGroup); ctx.pushCleanup(activateTaskProvider(workspaceFolder)); From bc323c61c318f1224be4b5f0d734209bd5d50646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 22 May 2020 21:20:59 +0300 Subject: [PATCH 717/819] Bump some npm deps --- rust-analyzer/editors/code/package-lock.json | 62 ++++++++++---------- rust-analyzer/editors/code/package.json | 16 ++--- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index c322b02c..ee6b40a3 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -117,9 +117,9 @@ "dev": true }, "@types/node": { - "version": "12.12.39", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", - "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==", + "version": "12.12.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.42.tgz", + "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==", "dev": true }, "@types/node-fetch": { @@ -142,31 +142,31 @@ } }, "@types/vscode": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.0.tgz", - "integrity": "sha512-b0Gyir7sPBCqiKLygAhn/AYVfzWD+SMPkWltBrIuPEyTOxSU1wVApWY/FcxYO2EWTRacoubTl4+gvZf86RkecA==", + "version": "1.45.1", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.1.tgz", + "integrity": "sha512-0NO9qrrEJBO8FsqHCrFMgR2suKnwCsKBWvRSb2OzH5gs4i3QO5AhEMQYrSzDbU/wLPt7N617/rN9lPY213gmwg==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.33.0.tgz", - "integrity": "sha512-QV6P32Btu1sCI/kTqjTNI/8OpCYyvlGjW5vD8MpTIg+HGE5S88HtT1G+880M4bXlvXj/NjsJJG0aGcVh0DdbeQ==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", + "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.33.0", + "@typescript-eslint/experimental-utils": "2.34.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.33.0.tgz", - "integrity": "sha512-qzPM2AuxtMrRq78LwyZa8Qn6gcY8obkIrBs1ehqmQADwkYzTE1Pb4y2W+U3rE/iFkSWcWHG2LS6MJfj6SmHApg==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.33.0", + "@typescript-eslint/typescript-estree": "2.34.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, @@ -183,21 +183,21 @@ } }, "@typescript-eslint/parser": { - "version": "2.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.33.0.tgz", - "integrity": "sha512-AUtmwUUhJoH6yrtxZMHbRUEMsC2G6z5NSxg9KsROOGqNXasM71I8P2NihtumlWTUCRld70vqIZ6Pm4E5PAziEA==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", + "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.33.0", - "@typescript-eslint/typescript-estree": "2.33.0", + "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/typescript-estree": "2.34.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.33.0.tgz", - "integrity": "sha512-d8rY6/yUxb0+mEwTShCQF2zYQdLlqihukNfG9IUlLYz5y1CH6G/9XYbrxQLq3Z14RNvkCC6oe+OcFlyUpwUbkg==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -2015,9 +2015,9 @@ } }, "rollup": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.0.tgz", - "integrity": "sha512-7BmpEfUN9P6esJzWIn3DmR//90mW6YwYB1t3y48LpF8ITpYtL8s1kEirMKqUu44dVH/6a/rs0EuwYVL3FuRDoA==", + "version": "2.10.7", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.7.tgz", + "integrity": "sha512-rofUSH2i4GymWhQq6bfRaSiVbz4LEB4h/7+AhuXCaeOSwQqClD0hINjs59j8SyfQwcqe83NcVJAY2kjp0h33bQ==", "dev": true, "requires": { "fsevents": "~2.1.2" @@ -2295,9 +2295,9 @@ } }, "tslib": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.12.0.tgz", - "integrity": "sha512-5rxCQkP0kytf4H1T4xz1imjxaUUPMvc5aWp0rJ/VMIN7ClRiH1FwFvBt8wOeMasp/epeUnmSW6CixSIePtiLqA==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", "dev": true }, "tsutils": { @@ -2341,9 +2341,9 @@ } }, "typescript": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", - "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "typescript-formatter": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1eebe060..ce79f549 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -21,7 +21,7 @@ "Programming Languages" ], "engines": { - "vscode": "^1.44.0" + "vscode": "^1.44.1" }, "enableProposedApi": true, "scripts": { @@ -43,17 +43,17 @@ "@rollup/plugin-node-resolve": "^7.1.3", "@types/glob": "^7.1.1", "@types/mocha": "^7.0.2", - "@types/node": "^12.12.39", + "@types/node": "^12.12.42", "@types/node-fetch": "^2.5.7", - "@types/vscode": "^1.44.0", - "@typescript-eslint/eslint-plugin": "^2.33.0", - "@typescript-eslint/parser": "^2.33.0", + "@types/vscode": "^1.44.1", + "@typescript-eslint/eslint-plugin": "^2.34.0", + "@typescript-eslint/parser": "^2.34.0", "eslint": "^6.8.0", "glob": "^7.1.6", "mocha": "^7.1.2", - "rollup": "^2.10.0", - "tslib": "^1.12.0", - "typescript": "^3.9.2", + "rollup": "^2.10.7", + "tslib": "^1.13.0", + "typescript": "^3.9.3", "typescript-formatter": "^7.2.2", "vsce": "^1.75.0", "vscode-test": "^1.3.0" From 579ddbfa27188e4863f60f800f8a0ec4e40e4b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 22 May 2020 21:34:53 +0300 Subject: [PATCH 718/819] Bump more npm deps --- rust-analyzer/editors/code/package-lock.json | 564 +++++++++++-------- rust-analyzer/editors/code/package.json | 14 +- 2 files changed, 338 insertions(+), 240 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index ee6b40a3..3b4a3168 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -13,21 +13,27 @@ "@babel/highlight": "^7.8.3" } }, + "@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "dev": true + }, "@babel/highlight": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", - "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", "dev": true, "requires": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" } }, "@rollup/plugin-commonjs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", - "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-12.0.0.tgz", + "integrity": "sha512-8+mDQt1QUmN+4Y9D3yCG8AJNewuTSLYPJVzKKUZ+lGeQrI+bV12Tc5HCyt2WdlnG6ihIL/DPbKRJlB40DX40mw==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8", @@ -40,27 +46,29 @@ } }, "@rollup/plugin-node-resolve": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", - "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.0.0.tgz", + "integrity": "sha512-5poJCChrkVggXXND/sQ7yNqwjUNT4fP31gpRWCnSNnlXuUXTCMHT33xZrTGxgjm5Rl18MHj7iEzlCT8rYWwQSA==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8", "@types/resolve": "0.0.8", "builtin-modules": "^3.1.0", + "deep-freeze": "^0.0.1", + "deepmerge": "^4.2.2", "is-module": "^1.0.0", "resolve": "^1.14.2" } }, "@rollup/pluginutils": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.9.tgz", - "integrity": "sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==", + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.10.tgz", + "integrity": "sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==", "dev": true, "requires": { "@types/estree": "0.0.39", "estree-walker": "^1.0.1", - "micromatch": "^4.0.2" + "picomatch": "^2.2.2" } }, "@types/color-name": { @@ -117,9 +125,9 @@ "dev": true }, "@types/node": { - "version": "12.12.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.42.tgz", - "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==", + "version": "14.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", + "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==", "dev": true }, "@types/node-fetch": { @@ -142,62 +150,60 @@ } }, "@types/vscode": { - "version": "1.45.1", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.1.tgz", - "integrity": "sha512-0NO9qrrEJBO8FsqHCrFMgR2suKnwCsKBWvRSb2OzH5gs4i3QO5AhEMQYrSzDbU/wLPt7N617/rN9lPY213gmwg==", + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.0.tgz", + "integrity": "sha512-b0Gyir7sPBCqiKLygAhn/AYVfzWD+SMPkWltBrIuPEyTOxSU1wVApWY/FcxYO2EWTRacoubTl4+gvZf86RkecA==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", - "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz", + "integrity": "sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/experimental-utils": "3.0.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", + "semver": "^7.3.2", "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } } }, "@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz", + "integrity": "sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/typescript-estree": "3.0.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" - }, - "dependencies": { - "eslint-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", - "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - } } }, "@typescript-eslint/parser": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", - "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.0.tgz", + "integrity": "sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.34.0", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/experimental-utils": "3.0.0", + "@typescript-eslint/typescript-estree": "3.0.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz", + "integrity": "sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -218,9 +224,9 @@ } }, "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", + "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", "dev": true }, "acorn-jsx": { @@ -239,9 +245,9 @@ } }, "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -455,9 +461,9 @@ } }, "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", "dev": true }, "cliui": { @@ -471,6 +477,12 @@ "wrap-ansi": "^5.1.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -493,6 +505,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -545,24 +566,14 @@ "dev": true }, "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", "dev": true, "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, "css-select": { @@ -598,12 +609,24 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "deep-freeze": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz", + "integrity": "sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ=", + "dev": true + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -759,22 +782,22 @@ "dev": true }, "eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz", + "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", + "eslint-utils": "^2.0.0", "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", + "espree": "^7.0.0", + "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", @@ -787,27 +810,76 @@ "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", + "levn": "^0.4.1", "lodash": "^4.17.14", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "optionator": "^0.8.3", + "optionator": "^0.9.1", "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", "table": "^5.2.3", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, "dependencies": { - "regexpp": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, @@ -822,9 +894,9 @@ } }, "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" @@ -837,9 +909,9 @@ "dev": true }, "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", + "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", "dev": true, "requires": { "acorn": "^7.1.1", @@ -854,12 +926,20 @@ "dev": true }, "esquery": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz", - "integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", "dev": true, "requires": { - "estraverse": "^4.0.0" + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", + "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "dev": true + } } }, "esrecurse": { @@ -984,9 +1064,9 @@ } }, "flatted": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", - "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, "form-data": { @@ -1046,9 +1126,9 @@ } }, "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -1267,15 +1347,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -1347,12 +1418,6 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, "is-reference": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", @@ -1393,9 +1458,9 @@ "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -1421,13 +1486,13 @@ "dev": true }, "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" } }, "linkify-it": { @@ -1510,16 +1575,6 @@ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", "dev": true }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -1563,18 +1618,18 @@ "dev": true }, "mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { "minimist": "^1.2.5" } }, "mocha": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", - "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", + "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -1626,13 +1681,14 @@ "path-is-absolute": "^1.0.0" } }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { - "minimist": "^1.2.5" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "ms": { @@ -1655,6 +1711,15 @@ "requires": { "has-flag": "^3.0.0" } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -1676,12 +1741,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, "node-environment-flags": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", @@ -1773,17 +1832,17 @@ } }, "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" } }, "os": { @@ -1886,9 +1945,9 @@ "dev": true }, "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, "path-parse": { @@ -1910,9 +1969,9 @@ "dev": true }, "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, "progress": { @@ -1981,9 +2040,9 @@ "dev": true }, "resolve": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", - "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -2015,30 +2074,35 @@ } }, "rollup": { - "version": "2.10.7", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.7.tgz", - "integrity": "sha512-rofUSH2i4GymWhQq6bfRaSiVbz4LEB4h/7+AhuXCaeOSwQqClD0hINjs59j8SyfQwcqe83NcVJAY2kjp0h33bQ==", + "version": "2.10.9", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.9.tgz", + "integrity": "sha512-dY/EbjiWC17ZCUSyk14hkxATAMAShkMsD43XmZGWjLrgFj15M3Dw2kEkA9ns64BiLFm9PKN6vTQw8neHwK74eg==", "dev": true, "requires": { "fsevents": "~2.1.2" } }, "run-async": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", - "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true }, "rxjs": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", - "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", "dev": true, "requires": { "tslib": "^1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "dev": true + } } }, "safe-buffer": { @@ -2065,18 +2129,18 @@ "dev": true }, "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "shebang-regex": "^3.0.0" } }, "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, "sigmund": { @@ -2086,9 +2150,9 @@ "dev": true }, "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "slice-ansi": { @@ -2131,17 +2195,6 @@ "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } } }, "string.prototype.trimend": { @@ -2196,26 +2249,18 @@ } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - } + "ansi-regex": "^5.0.0" } }, "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", + "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", "dev": true }, "supports-color": { @@ -2239,6 +2284,12 @@ "string-width": "^3.0.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -2261,6 +2312,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -2295,9 +2355,9 @@ } }, "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", + "integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==", "dev": true }, "tsutils": { @@ -2307,6 +2367,14 @@ "dev": true, "requires": { "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "dev": true + } } }, "tunnel": { @@ -2316,12 +2384,12 @@ "dev": true }, "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "requires": { - "prelude-ls": "~1.1.2" + "prelude-ls": "^1.2.1" } }, "type-fest": { @@ -2480,9 +2548,9 @@ } }, "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -2553,6 +2621,12 @@ "strip-ansi": "^5.0.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -2575,6 +2649,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -2623,6 +2706,12 @@ "yargs-parser": "^13.1.2" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -2645,6 +2734,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index ce79f549..8f5a0681 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,20 +39,20 @@ "vscode-languageclient": "7.0.0-next.1" }, "devDependencies": { - "@rollup/plugin-commonjs": "^11.1.0", - "@rollup/plugin-node-resolve": "^7.1.3", + "@rollup/plugin-commonjs": "^12.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", "@types/glob": "^7.1.1", "@types/mocha": "^7.0.2", - "@types/node": "^12.12.42", + "@types/node": "^14.0.5", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.1", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^2.34.0", - "eslint": "^6.8.0", + "@typescript-eslint/eslint-plugin": "^3.0.0", + "@typescript-eslint/parser": "^3.0.0", + "eslint": "^7.0.0", "glob": "^7.1.6", "mocha": "^7.1.2", "rollup": "^2.10.7", - "tslib": "^1.13.0", + "tslib": "^2.0.0", "typescript": "^3.9.3", "typescript-formatter": "^7.2.2", "vsce": "^1.75.0", From 71fdedd20c19b6982ab31ade659ab58104ee4067 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 21 May 2020 17:40:52 +0100 Subject: [PATCH 719/819] Highlight `true` and `false` as literals --- rust-analyzer/editors/code/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 578ee8b0..21039ced 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -644,6 +644,9 @@ "function.attribute": [ "entity.name.function.attribute.rust" ], + "boolean": [ + "constant.language.boolean.rust" + ], "builtinType": [ "support.type.primitive.rust" ], From f328dad7d4fc0768e2ebd9494c6dfd49653ec2ab Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 May 2020 16:18:46 +0200 Subject: [PATCH 720/819] Document matchingBrace LSP request --- rust-analyzer/editors/code/src/commands/matching_brace.ts | 4 ++-- rust-analyzer/editors/code/src/rust-analyzer-api.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts index a60776e2..9c418b88 100644 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ b/rust-analyzer/editors/code/src/commands/matching_brace.ts @@ -9,9 +9,9 @@ export function matchingBrace(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const response = await client.sendRequest(ra.findMatchingBrace, { + const response = await client.sendRequest(ra.matchingBrace, { textDocument: { uri: editor.document.uri.toString() }, - offsets: editor.selections.map(s => + positions: editor.selections.map(s => client.code2ProtocolConverter.asPosition(s.active), ), }); diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 73f36432..900c5cd5 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -40,12 +40,11 @@ export interface ExpandedMacro { export const expandMacro = request>("expandMacro"); -export interface FindMatchingBraceParams { +export interface MatchingBraceParams { textDocument: lc.TextDocumentIdentifier; - offsets: Vec; + positions: lc.Position[]; } -export const findMatchingBrace = request>("findMatchingBrace"); - +export const matchingBrace = new lc.RequestType('experimental/matchingBrace'); export interface PublishDecorationsParams { uri: string; From 8c42b62cee414f14fcf68dfcb4e4e146e8d331fe Mon Sep 17 00:00:00 2001 From: veetaha Date: Mon, 25 May 2020 03:47:33 +0300 Subject: [PATCH 721/819] Introduce `toggle inlay hints` vscode command Users now can assign a shortcut for this command via the general vscode keybindings ui or `keybinding.json file` Closes: #4599 --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/commands/index.ts | 1 + .../editors/code/src/commands/toggle_inlay_hints.ts | 11 +++++++++++ rust-analyzer/editors/code/src/config.ts | 2 +- rust-analyzer/editors/code/src/main.ts | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 21039ced..2f14eaeb 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -166,6 +166,11 @@ "command": "rust-analyzer.serverVersion", "title": "Show RA Version", "category": "Rust Analyzer" + }, + { + "command": "rust-analyzer.toggleInlayHints", + "title": "Toggle inlay hints", + "category": "Rust Analyzer" } ], "keybindings": [ diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index abb53a24..c2a232d5 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -16,6 +16,7 @@ export * from './expand_macro'; export * from './runnables'; export * from './ssr'; export * from './server_version'; +export * from './toggle_inlay_hints'; export function collectGarbage(ctx: Ctx): Cmd { return async () => ctx.client.sendRequest(ra.collectGarbage, null); diff --git a/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts b/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts new file mode 100644 index 00000000..7606af8d --- /dev/null +++ b/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts @@ -0,0 +1,11 @@ +import * as vscode from 'vscode'; +import { Ctx, Cmd } from '../ctx'; + +export function toggleInlayHints(ctx: Ctx): Cmd { + return async () => { + await vscode + .workspace + .getConfiguration(`${ctx.config.rootSection}.inlayHints`) + .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Workspace); + }; +} diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index ee294fbe..e8abf828 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -8,7 +8,7 @@ export const NIGHTLY_TAG = "nightly"; export class Config { readonly extensionId = "matklad.rust-analyzer"; - private readonly rootSection = "rust-analyzer"; + readonly rootSection = "rust-analyzer"; private readonly requiresReloadOpts = [ "serverPath", "cargo", diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 3405634f..0e5a2064 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -86,6 +86,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('ssr', commands.ssr); ctx.registerCommand('serverVersion', commands.serverVersion); + ctx.registerCommand('toggleInlayHints', commands.toggleInlayHints); // Internal commands which are invoked by the server. ctx.registerCommand('runSingle', commands.runSingle); From dc78853a65133fe14ace832f149c251bee7742cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 25 May 2020 11:39:56 +0300 Subject: [PATCH 722/819] Add boolean literals to package.json --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2f14eaeb..0e6755a3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -586,6 +586,11 @@ "id": "attribute", "description": "Style for attributes" }, + { + "id": "boolean", + "description": "Style for boolean literals", + "superType": "keyword" + }, { "id": "builtinType", "description": "Style for builtin types", From a162debed485be15d9ed7122c82ff8c0106ca9f4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 10:59:54 +0200 Subject: [PATCH 723/819] Remove dead code --- .../editors/code/src/commands/index.ts | 52 +----------------- .../editors/code/src/commands/on_enter.ts | 2 +- rust-analyzer/editors/code/src/snippets.ts | 52 ++++++++++++++++++ .../editors/code/src/source_change.ts | 54 ------------------- 4 files changed, 54 insertions(+), 106 deletions(-) create mode 100644 rust-analyzer/editors/code/src/snippets.ts delete mode 100644 rust-analyzer/editors/code/src/source_change.ts diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index c2a232d5..1ed8258d 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -3,8 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; -import * as sourceChange from '../source_change'; -import { assert } from '../util'; +import { applySnippetWorkspaceEdit } from '../snippets'; export * from './analyzer_status'; export * from './matching_brace'; @@ -55,52 +54,3 @@ export function applySnippetWorkspaceEditCommand(_ctx: Ctx): Cmd { await applySnippetWorkspaceEdit(edit); }; } - -export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { - assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); - const [uri, edits] = edit.entries()[0]; - - const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); - if (!editor) return; - - let selection: vscode.Selection | undefined = undefined; - let lineDelta = 0; - await editor.edit((builder) => { - for (const indel of edits) { - const parsed = parseSnippet(indel.newText); - if (parsed) { - const [newText, [placeholderStart, placeholderLength]] = parsed; - const prefix = newText.substr(0, placeholderStart); - const lastNewline = prefix.lastIndexOf('\n'); - - const startLine = indel.range.start.line + lineDelta + countLines(prefix); - const startColumn = lastNewline === -1 ? - indel.range.start.character + placeholderStart - : prefix.length - lastNewline - 1; - const endColumn = startColumn + placeholderLength; - selection = new vscode.Selection( - new vscode.Position(startLine, startColumn), - new vscode.Position(startLine, endColumn), - ); - builder.replace(indel.range, newText); - } else { - lineDelta = countLines(indel.newText) - (indel.range.end.line - indel.range.start.line); - builder.replace(indel.range, indel.newText); - } - } - }); - if (selection) editor.selection = selection; -} - -function parseSnippet(snip: string): [string, [number, number]] | undefined { - const m = snip.match(/\$(0|\{0:([^}]*)\})/); - if (!m) return undefined; - const placeholder = m[2] ?? ""; - const range: [number, number] = [m.index!!, placeholder.length]; - const insert = snip.replace(m[0], placeholder); - return [insert, range]; -} - -function countLines(text: string): number { - return (text.match(/\n/g) || []).length; -} diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts index a7871c31..0e476963 100644 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ b/rust-analyzer/editors/code/src/commands/on_enter.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as ra from '../rust-analyzer-api'; import { Cmd, Ctx } from '../ctx'; -import { applySnippetWorkspaceEdit } from '.'; +import { applySnippetWorkspaceEdit } from '../snippets'; async function handleKeypress(ctx: Ctx) { const editor = ctx.activeRustEditor; diff --git a/rust-analyzer/editors/code/src/snippets.ts b/rust-analyzer/editors/code/src/snippets.ts new file mode 100644 index 00000000..79453016 --- /dev/null +++ b/rust-analyzer/editors/code/src/snippets.ts @@ -0,0 +1,52 @@ +import * as vscode from 'vscode'; + +import { assert } from './util'; + +export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { + assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); + const [uri, edits] = edit.entries()[0]; + + const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); + if (!editor) return; + + let selection: vscode.Selection | undefined = undefined; + let lineDelta = 0; + await editor.edit((builder) => { + for (const indel of edits) { + const parsed = parseSnippet(indel.newText); + if (parsed) { + const [newText, [placeholderStart, placeholderLength]] = parsed; + const prefix = newText.substr(0, placeholderStart); + const lastNewline = prefix.lastIndexOf('\n'); + + const startLine = indel.range.start.line + lineDelta + countLines(prefix); + const startColumn = lastNewline === -1 ? + indel.range.start.character + placeholderStart + : prefix.length - lastNewline - 1; + const endColumn = startColumn + placeholderLength; + selection = new vscode.Selection( + new vscode.Position(startLine, startColumn), + new vscode.Position(startLine, endColumn), + ); + builder.replace(indel.range, newText); + } else { + lineDelta = countLines(indel.newText) - (indel.range.end.line - indel.range.start.line); + builder.replace(indel.range, indel.newText); + } + } + }); + if (selection) editor.selection = selection; +} + +function parseSnippet(snip: string): [string, [number, number]] | undefined { + const m = snip.match(/\$(0|\{0:([^}]*)\})/); + if (!m) return undefined; + const placeholder = m[2] ?? ""; + const range: [number, number] = [m.index!!, placeholder.length]; + const insert = snip.replace(m[0], placeholder); + return [insert, range]; +} + +function countLines(text: string): number { + return (text.match(/\n/g) || []).length; +} diff --git a/rust-analyzer/editors/code/src/source_change.ts b/rust-analyzer/editors/code/src/source_change.ts deleted file mode 100644 index af8f1df5..00000000 --- a/rust-analyzer/editors/code/src/source_change.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; -import * as ra from './rust-analyzer-api'; - -import { Ctx } from './ctx'; - -export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) { - const client = ctx.client; - if (!client) return; - - const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( - change.workspaceEdit, - ); - let created; - let moved; - if (change.workspaceEdit.documentChanges) { - for (const docChange of change.workspaceEdit.documentChanges) { - if (lc.CreateFile.is(docChange)) { - created = docChange.uri; - } else if (lc.RenameFile.is(docChange)) { - moved = docChange.newUri; - } - } - } - const toOpen = created || moved; - const toReveal = change.cursorPosition; - await vscode.workspace.applyEdit(wsEdit); - if (toOpen) { - const toOpenUri = vscode.Uri.parse(toOpen); - const doc = await vscode.workspace.openTextDocument(toOpenUri); - await vscode.window.showTextDocument(doc); - } else if (toReveal) { - const uri = client.protocol2CodeConverter.asUri( - toReveal.textDocument.uri, - ); - const position = client.protocol2CodeConverter.asPosition( - toReveal.position, - ); - const editor = vscode.window.activeTextEditor; - if (!editor || !editor.selection.isEmpty) { - return; - } - - if (editor.document.uri !== uri) { - const doc = await vscode.workspace.openTextDocument(uri); - await vscode.window.showTextDocument(doc); - } - editor.selection = new vscode.Selection(position, position); - editor.revealRange( - new vscode.Range(position, position), - vscode.TextEditorRevealType.Default, - ); - } -} From be680d18030114af500a0e20146ae2f58aca1fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 25 May 2020 11:51:56 +0300 Subject: [PATCH 724/819] Add self keyword semantic token type --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 2f14eaeb..3127e6a3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -595,6 +595,11 @@ "id": "lifetime", "description": "Style for lifetimes" }, + { + "id": "selfKeyword", + "description": "Style for the self keyword", + "superType": "keyword" + }, { "id": "typeAlias", "description": "Style for type aliases", From 0dea356aefb53e74a5ea2e6651cb3cfbd9542f39 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 11:10:31 +0200 Subject: [PATCH 725/819] Flatten simple commands --- .../code/src/commands/analyzer_status.ts | 51 ---- .../editors/code/src/commands/expand_macro.ts | 66 ----- .../editors/code/src/commands/index.ts | 257 +++++++++++++++++- .../editors/code/src/commands/join_lines.ts | 22 -- .../code/src/commands/matching_brace.ts | 27 -- .../editors/code/src/commands/on_enter.ts | 35 --- .../code/src/commands/parent_module.ts | 29 -- .../code/src/commands/server_version.ts | 15 - .../editors/code/src/commands/ssr.ts | 30 -- .../code/src/commands/toggle_inlay_hints.ts | 11 - 10 files changed, 242 insertions(+), 301 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/commands/analyzer_status.ts delete mode 100644 rust-analyzer/editors/code/src/commands/expand_macro.ts delete mode 100644 rust-analyzer/editors/code/src/commands/join_lines.ts delete mode 100644 rust-analyzer/editors/code/src/commands/matching_brace.ts delete mode 100644 rust-analyzer/editors/code/src/commands/on_enter.ts delete mode 100644 rust-analyzer/editors/code/src/commands/parent_module.ts delete mode 100644 rust-analyzer/editors/code/src/commands/server_version.ts delete mode 100644 rust-analyzer/editors/code/src/commands/ssr.ts delete mode 100644 rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts diff --git a/rust-analyzer/editors/code/src/commands/analyzer_status.ts b/rust-analyzer/editors/code/src/commands/analyzer_status.ts deleted file mode 100644 index 09daa340..00000000 --- a/rust-analyzer/editors/code/src/commands/analyzer_status.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as vscode from 'vscode'; - -import * as ra from '../rust-analyzer-api'; -import { Ctx, Cmd } from '../ctx'; - -// Shows status of rust-analyzer (for debugging) -export function analyzerStatus(ctx: Ctx): Cmd { - let poller: NodeJS.Timer | undefined = undefined; - const tdcp = new TextDocumentContentProvider(ctx); - - ctx.pushCleanup( - vscode.workspace.registerTextDocumentContentProvider( - 'rust-analyzer-status', - tdcp, - ), - ); - - ctx.pushCleanup({ - dispose() { - if (poller !== undefined) { - clearInterval(poller); - } - }, - }); - - return async () => { - if (poller === undefined) { - poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000); - } - const document = await vscode.workspace.openTextDocument(tdcp.uri); - return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); - }; -} - -class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - readonly uri = vscode.Uri.parse('rust-analyzer-status://status'); - readonly eventEmitter = new vscode.EventEmitter(); - - constructor(private readonly ctx: Ctx) { - } - - provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult { - if (!vscode.window.activeTextEditor) return ''; - - return this.ctx.client.sendRequest(ra.analyzerStatus, null); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} diff --git a/rust-analyzer/editors/code/src/commands/expand_macro.ts b/rust-analyzer/editors/code/src/commands/expand_macro.ts deleted file mode 100644 index 23f2ef1d..00000000 --- a/rust-analyzer/editors/code/src/commands/expand_macro.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Ctx, Cmd } from '../ctx'; - -// Opens the virtual file that will show the syntax tree -// -// The contents of the file come from the `TextDocumentContentProvider` -export function expandMacro(ctx: Ctx): Cmd { - const tdcp = new TextDocumentContentProvider(ctx); - ctx.pushCleanup( - vscode.workspace.registerTextDocumentContentProvider( - 'rust-analyzer', - tdcp, - ), - ); - - return async () => { - const document = await vscode.workspace.openTextDocument(tdcp.uri); - tdcp.eventEmitter.fire(tdcp.uri); - return vscode.window.showTextDocument( - document, - vscode.ViewColumn.Two, - true, - ); - }; -} - -function codeFormat(expanded: ra.ExpandedMacro): string { - let result = `// Recursive expansion of ${expanded.name}! macro\n`; - result += '// ' + '='.repeat(result.length - 3); - result += '\n\n'; - result += expanded.expansion; - - return result; -} - -class TextDocumentContentProvider - implements vscode.TextDocumentContentProvider { - uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs'); - eventEmitter = new vscode.EventEmitter(); - - constructor(private readonly ctx: Ctx) { - } - - async provideTextDocumentContent(_uri: vscode.Uri): Promise { - const editor = vscode.window.activeTextEditor; - const client = this.ctx.client; - if (!editor || !client) return ''; - - const position = editor.selection.active; - - const expanded = await client.sendRequest(ra.expandMacro, { - textDocument: { uri: editor.document.uri.toString() }, - position, - }); - - if (expanded == null) return 'Not available'; - - return codeFormat(expanded); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands/index.ts index 1ed8258d..1585912a 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands/index.ts @@ -4,18 +4,251 @@ import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; import { applySnippetWorkspaceEdit } from '../snippets'; +import { spawnSync } from 'child_process'; -export * from './analyzer_status'; -export * from './matching_brace'; -export * from './join_lines'; -export * from './on_enter'; -export * from './parent_module'; export * from './syntax_tree'; -export * from './expand_macro'; export * from './runnables'; -export * from './ssr'; -export * from './server_version'; -export * from './toggle_inlay_hints'; + +export function analyzerStatus(ctx: Ctx): Cmd { + const tdcp = new class implements vscode.TextDocumentContentProvider { + readonly uri = vscode.Uri.parse('rust-analyzer-status://status'); + readonly eventEmitter = new vscode.EventEmitter(); + + provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult { + if (!vscode.window.activeTextEditor) return ''; + + return ctx.client.sendRequest(ra.analyzerStatus, null); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } + }(); + + let poller: NodeJS.Timer | undefined = undefined; + + ctx.pushCleanup( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer-status', + tdcp, + ), + ); + + ctx.pushCleanup({ + dispose() { + if (poller !== undefined) { + clearInterval(poller); + } + }, + }); + + return async () => { + if (poller === undefined) { + poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000); + } + const document = await vscode.workspace.openTextDocument(tdcp.uri); + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); + }; +} + +export function matchingBrace(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + const client = ctx.client; + if (!editor || !client) return; + + const response = await client.sendRequest(ra.matchingBrace, { + textDocument: { uri: editor.document.uri.toString() }, + positions: editor.selections.map(s => + client.code2ProtocolConverter.asPosition(s.active), + ), + }); + editor.selections = editor.selections.map((sel, idx) => { + const active = client.protocol2CodeConverter.asPosition( + response[idx], + ); + const anchor = sel.isEmpty ? active : sel.anchor; + return new vscode.Selection(anchor, active); + }); + editor.revealRange(editor.selection); + }; +} + +export function joinLines(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + const client = ctx.client; + if (!editor || !client) return; + + const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, { + ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)), + textDocument: { uri: editor.document.uri.toString() }, + }); + editor.edit((builder) => { + client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { + builder.replace(edit.range, edit.newText); + }); + }); + }; +} + +export function onEnter(ctx: Ctx): Cmd { + async function handleKeypress() { + const editor = ctx.activeRustEditor; + const client = ctx.client; + + if (!editor || !client) return false; + + const change = await client.sendRequest(ra.onEnter, { + textDocument: { uri: editor.document.uri.toString() }, + position: client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }).catch(_error => { + // client.logFailedRequest(OnEnterRequest.type, error); + return null; + }); + if (!change) return false; + + const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change); + await applySnippetWorkspaceEdit(workspaceEdit); + return true; + } + + return async () => { + if (await handleKeypress()) return; + + await vscode.commands.executeCommand('default:type', { text: '\n' }); + }; +} + +export function parentModule(ctx: Ctx): Cmd { + return async () => { + const editor = ctx.activeRustEditor; + const client = ctx.client; + if (!editor || !client) return; + + const response = await client.sendRequest(ra.parentModule, { + textDocument: { uri: editor.document.uri.toString() }, + position: client.code2ProtocolConverter.asPosition( + editor.selection.active, + ), + }); + const loc = response[0]; + if (loc == null) return; + + const uri = client.protocol2CodeConverter.asUri(loc.uri); + const range = client.protocol2CodeConverter.asRange(loc.range); + + const doc = await vscode.workspace.openTextDocument(uri); + const e = await vscode.window.showTextDocument(doc); + e.selection = new vscode.Selection(range.start, range.start); + e.revealRange(range, vscode.TextEditorRevealType.InCenter); + }; +} + +export function ssr(ctx: Ctx): Cmd { + return async () => { + const client = ctx.client; + if (!client) return; + + const options: vscode.InputBoxOptions = { + value: "() ==>> ()", + prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", + validateInput: async (x: string) => { + try { + await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); + } catch (e) { + return e.toString(); + } + return null; + } + }; + const request = await vscode.window.showInputBox(options); + if (!request) return; + + const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); + + await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); + }; +} + +export function serverVersion(ctx: Ctx): Cmd { + return async () => { + const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); + const commitHash = stdout.slice(`rust-analyzer `.length).trim(); + const { releaseTag } = ctx.config.package; + + void vscode.window.showInformationMessage( + `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` + ); + }; +} + +export function toggleInlayHints(ctx: Ctx): Cmd { + return async () => { + await vscode + .workspace + .getConfiguration(`${ctx.config.rootSection}.inlayHints`) + .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Workspace); + }; +} + +// Opens the virtual file that will show the syntax tree +// +// The contents of the file come from the `TextDocumentContentProvider` +export function expandMacro(ctx: Ctx): Cmd { + function codeFormat(expanded: ra.ExpandedMacro): string { + let result = `// Recursive expansion of ${expanded.name}! macro\n`; + result += '// ' + '='.repeat(result.length - 3); + result += '\n\n'; + result += expanded.expansion; + + return result; + } + + const tdcp = new class implements vscode.TextDocumentContentProvider { + uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs'); + eventEmitter = new vscode.EventEmitter(); + async provideTextDocumentContent(_uri: vscode.Uri): Promise { + const editor = vscode.window.activeTextEditor; + const client = ctx.client; + if (!editor || !client) return ''; + + const position = editor.selection.active; + + const expanded = await client.sendRequest(ra.expandMacro, { + textDocument: { uri: editor.document.uri.toString() }, + position, + }); + + if (expanded == null) return 'Not available'; + + return codeFormat(expanded); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } + }(); + + ctx.pushCleanup( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer', + tdcp, + ), + ); + + return async () => { + const document = await vscode.workspace.openTextDocument(tdcp.uri); + tdcp.eventEmitter.fire(tdcp.uri); + return vscode.window.showTextDocument( + document, + vscode.ViewColumn.Two, + true, + ); + }; +} export function collectGarbage(ctx: Ctx): Cmd { return async () => ctx.client.sendRequest(ra.collectGarbage, null); @@ -35,12 +268,6 @@ export function showReferences(ctx: Ctx): Cmd { }; } -export function applySourceChange(ctx: Ctx): Cmd { - return async (change: ra.SourceChange) => { - await sourceChange.applySourceChange(ctx, change); - }; -} - export function applyActionGroup(_ctx: Ctx): Cmd { return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => { const selectedAction = await vscode.window.showQuickPick(actions); diff --git a/rust-analyzer/editors/code/src/commands/join_lines.ts b/rust-analyzer/editors/code/src/commands/join_lines.ts deleted file mode 100644 index 0bf1ee6e..00000000 --- a/rust-analyzer/editors/code/src/commands/join_lines.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as ra from '../rust-analyzer-api'; -import * as lc from 'vscode-languageclient'; - -import { Ctx, Cmd } from '../ctx'; - -export function joinLines(ctx: Ctx): Cmd { - return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, { - ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)), - textDocument: { uri: editor.document.uri.toString() }, - }); - editor.edit((builder) => { - client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { - builder.replace(edit.range, edit.newText); - }); - }); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/matching_brace.ts b/rust-analyzer/editors/code/src/commands/matching_brace.ts deleted file mode 100644 index 9c418b88..00000000 --- a/rust-analyzer/editors/code/src/commands/matching_brace.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Ctx, Cmd } from '../ctx'; - -export function matchingBrace(ctx: Ctx): Cmd { - return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const response = await client.sendRequest(ra.matchingBrace, { - textDocument: { uri: editor.document.uri.toString() }, - positions: editor.selections.map(s => - client.code2ProtocolConverter.asPosition(s.active), - ), - }); - editor.selections = editor.selections.map((sel, idx) => { - const active = client.protocol2CodeConverter.asPosition( - response[idx], - ); - const anchor = sel.isEmpty ? active : sel.anchor; - return new vscode.Selection(anchor, active); - }); - editor.revealRange(editor.selection); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/on_enter.ts b/rust-analyzer/editors/code/src/commands/on_enter.ts deleted file mode 100644 index 0e476963..00000000 --- a/rust-analyzer/editors/code/src/commands/on_enter.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Cmd, Ctx } from '../ctx'; -import { applySnippetWorkspaceEdit } from '../snippets'; - -async function handleKeypress(ctx: Ctx) { - const editor = ctx.activeRustEditor; - const client = ctx.client; - - if (!editor || !client) return false; - - const change = await client.sendRequest(ra.onEnter, { - textDocument: { uri: editor.document.uri.toString() }, - position: client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }).catch(_error => { - // client.logFailedRequest(OnEnterRequest.type, error); - return null; - }); - if (!change) return false; - - const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change); - await applySnippetWorkspaceEdit(workspaceEdit); - return true; -} - -export function onEnter(ctx: Ctx): Cmd { - return async () => { - if (await handleKeypress(ctx)) return; - - await vscode.commands.executeCommand('default:type', { text: '\n' }); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/parent_module.ts b/rust-analyzer/editors/code/src/commands/parent_module.ts deleted file mode 100644 index 8f78ddd7..00000000 --- a/rust-analyzer/editors/code/src/commands/parent_module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Ctx, Cmd } from '../ctx'; - -export function parentModule(ctx: Ctx): Cmd { - return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const response = await client.sendRequest(ra.parentModule, { - textDocument: { uri: editor.document.uri.toString() }, - position: client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }); - const loc = response[0]; - if (loc == null) return; - - const uri = client.protocol2CodeConverter.asUri(loc.uri); - const range = client.protocol2CodeConverter.asRange(loc.range); - - const doc = await vscode.workspace.openTextDocument(uri); - const e = await vscode.window.showTextDocument(doc); - e.selection = new vscode.Selection(range.start, range.start); - e.revealRange(range, vscode.TextEditorRevealType.InCenter); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/server_version.ts b/rust-analyzer/editors/code/src/commands/server_version.ts deleted file mode 100644 index d64ac726..00000000 --- a/rust-analyzer/editors/code/src/commands/server_version.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as vscode from "vscode"; -import { spawnSync } from "child_process"; -import { Ctx, Cmd } from '../ctx'; - -export function serverVersion(ctx: Ctx): Cmd { - return async () => { - const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); - const commitHash = stdout.slice(`rust-analyzer `.length).trim(); - const { releaseTag } = ctx.config.package; - - void vscode.window.showInformationMessage( - `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` - ); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/ssr.ts b/rust-analyzer/editors/code/src/commands/ssr.ts deleted file mode 100644 index 5d40a64d..00000000 --- a/rust-analyzer/editors/code/src/commands/ssr.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from "../rust-analyzer-api"; - -import { Ctx, Cmd } from '../ctx'; - -export function ssr(ctx: Ctx): Cmd { - return async () => { - const client = ctx.client; - if (!client) return; - - const options: vscode.InputBoxOptions = { - value: "() ==>> ()", - prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", - validateInput: async (x: string) => { - try { - await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); - } catch (e) { - return e.toString(); - } - return null; - } - }; - const request = await vscode.window.showInputBox(options); - if (!request) return; - - const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); - - await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); - }; -} diff --git a/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts b/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts deleted file mode 100644 index 7606af8d..00000000 --- a/rust-analyzer/editors/code/src/commands/toggle_inlay_hints.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as vscode from 'vscode'; -import { Ctx, Cmd } from '../ctx'; - -export function toggleInlayHints(ctx: Ctx): Cmd { - return async () => { - await vscode - .workspace - .getConfiguration(`${ctx.config.rootSection}.inlayHints`) - .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Workspace); - }; -} From 761f8ff3694366166e3dd90d198be8a80119f672 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 12:02:30 +0200 Subject: [PATCH 726/819] Flatten commands.ts --- .../syntax_tree.ts => ast_inspector.ts} | 88 +---------------- .../src/{commands/index.ts => commands.ts} | 97 ++++++++++++++++++- rust-analyzer/editors/code/src/main.ts | 1 - .../src/{commands/runnables.ts => run.ts} | 26 ++--- 4 files changed, 103 insertions(+), 109 deletions(-) rename rust-analyzer/editors/code/src/{commands/syntax_tree.ts => ast_inspector.ts} (67%) rename rust-analyzer/editors/code/src/{commands/index.ts => commands.ts} (72%) rename rust-analyzer/editors/code/src/{commands/runnables.ts => run.ts} (88%) diff --git a/rust-analyzer/editors/code/src/commands/syntax_tree.ts b/rust-analyzer/editors/code/src/ast_inspector.ts similarity index 67% rename from rust-analyzer/editors/code/src/commands/syntax_tree.ts rename to rust-analyzer/editors/code/src/ast_inspector.ts index a5446c32..4fdd167b 100644 --- a/rust-analyzer/editors/code/src/commands/syntax_tree.ts +++ b/rust-analyzer/editors/code/src/ast_inspector.ts @@ -1,93 +1,15 @@ import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Ctx, Cmd, Disposable } from '../ctx'; -import { isRustDocument, RustEditor, isRustEditor, sleep } from '../util'; - -const AST_FILE_SCHEME = "rust-analyzer"; - -// Opens the virtual file that will show the syntax tree -// -// The contents of the file come from the `TextDocumentContentProvider` -export function syntaxTree(ctx: Ctx): Cmd { - const tdcp = new TextDocumentContentProvider(ctx); - - void new AstInspector(ctx); - - ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); - ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", { - brackets: [["[", ")"]], - })); - - return async () => { - const editor = vscode.window.activeTextEditor; - const rangeEnabled = !!editor && !editor.selection.isEmpty; - - const uri = rangeEnabled - ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) - : tdcp.uri; - - const document = await vscode.workspace.openTextDocument(uri); - - tdcp.eventEmitter.fire(uri); - - void await vscode.window.showTextDocument(document, { - viewColumn: vscode.ViewColumn.Two, - preserveFocus: true - }); - }; -} - -class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast'); - readonly eventEmitter = new vscode.EventEmitter(); - - - constructor(private readonly ctx: Ctx) { - vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); - vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, ctx.subscriptions); - } - - private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { - if (isRustDocument(event.document)) { - // We need to order this after language server updates, but there's no API for that. - // Hence, good old sleep(). - void sleep(10).then(() => this.eventEmitter.fire(this.uri)); - } - } - private onDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined) { - if (editor && isRustEditor(editor)) { - this.eventEmitter.fire(this.uri); - } - } - - provideTextDocumentContent(uri: vscode.Uri, ct: vscode.CancellationToken): vscode.ProviderResult { - const rustEditor = this.ctx.activeRustEditor; - if (!rustEditor) return ''; - - // When the range based query is enabled we take the range of the selection - const range = uri.query === 'range=true' && !rustEditor.selection.isEmpty - ? this.ctx.client.code2ProtocolConverter.asRange(rustEditor.selection) - : null; - - const params = { textDocument: { uri: rustEditor.document.uri.toString() }, range, }; - return this.ctx.client.sendRequest(ra.syntaxTree, params, ct); - } - - get onDidChange(): vscode.Event { - return this.eventEmitter.event; - } -} +import { Ctx, Disposable } from './ctx'; +import { RustEditor, isRustEditor } from './util'; // FIXME: consider implementing this via the Tree View API? // https://code.visualstudio.com/api/extension-guides/tree-view -class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, Disposable { +export class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, Disposable { private readonly astDecorationType = vscode.window.createTextEditorDecorationType({ borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'), borderStyle: "solid", borderWidth: "2px", - }); private rustEditor: undefined | RustEditor; @@ -113,7 +35,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D }); constructor(ctx: Ctx) { - ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); + ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: 'rust-analyzer' }, this)); ctx.pushCleanup(vscode.languages.registerDefinitionProvider({ language: "rust" }, this)); vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, ctx.subscriptions); vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); @@ -146,7 +68,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D } private findAstTextEditor(): undefined | vscode.TextEditor { - return vscode.window.visibleTextEditors.find(it => it.document.uri.scheme === AST_FILE_SCHEME); + return vscode.window.visibleTextEditors.find(it => it.document.uri.scheme === 'rust-analyzer'); } private setRustEditor(newRustEditor: undefined | RustEditor) { diff --git a/rust-analyzer/editors/code/src/commands/index.ts b/rust-analyzer/editors/code/src/commands.ts similarity index 72% rename from rust-analyzer/editors/code/src/commands/index.ts rename to rust-analyzer/editors/code/src/commands.ts index 1585912a..573af5aa 100644 --- a/rust-analyzer/editors/code/src/commands/index.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -1,13 +1,16 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as ra from '../rust-analyzer-api'; +import * as ra from './rust-analyzer-api'; -import { Ctx, Cmd } from '../ctx'; -import { applySnippetWorkspaceEdit } from '../snippets'; +import { Ctx, Cmd } from './ctx'; +import { applySnippetWorkspaceEdit } from './snippets'; import { spawnSync } from 'child_process'; +import { RunnableQuickPick, selectRunnable, createTask } from './run'; +import { AstInspector } from './ast_inspector'; +import { isRustDocument, sleep, isRustEditor } from './util'; -export * from './syntax_tree'; -export * from './runnables'; +export * from './ast_inspector'; +export * from './run'; export function analyzerStatus(ctx: Ctx): Cmd { const tdcp = new class implements vscode.TextDocumentContentProvider { @@ -194,6 +197,90 @@ export function toggleInlayHints(ctx: Ctx): Cmd { }; } +export function run(ctx: Ctx): Cmd { + let prevRunnable: RunnableQuickPick | undefined; + + return async () => { + const item = await selectRunnable(ctx, prevRunnable); + if (!item) return; + + item.detail = 'rerun'; + prevRunnable = item; + const task = createTask(item.runnable); + return await vscode.tasks.executeTask(task); + }; +} + +// Opens the virtual file that will show the syntax tree +// +// The contents of the file come from the `TextDocumentContentProvider` +export function syntaxTree(ctx: Ctx): Cmd { + const tdcp = new class implements vscode.TextDocumentContentProvider { + readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast'); + readonly eventEmitter = new vscode.EventEmitter(); + constructor() { + vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); + vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, ctx.subscriptions); + } + + private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { + if (isRustDocument(event.document)) { + // We need to order this after language server updates, but there's no API for that. + // Hence, good old sleep(). + void sleep(10).then(() => this.eventEmitter.fire(this.uri)); + } + } + private onDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined) { + if (editor && isRustEditor(editor)) { + this.eventEmitter.fire(this.uri); + } + } + + provideTextDocumentContent(uri: vscode.Uri, ct: vscode.CancellationToken): vscode.ProviderResult { + const rustEditor = ctx.activeRustEditor; + if (!rustEditor) return ''; + + // When the range based query is enabled we take the range of the selection + const range = uri.query === 'range=true' && !rustEditor.selection.isEmpty + ? ctx.client.code2ProtocolConverter.asRange(rustEditor.selection) + : null; + + const params = { textDocument: { uri: rustEditor.document.uri.toString() }, range, }; + return ctx.client.sendRequest(ra.syntaxTree, params, ct); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } + }; + + void new AstInspector(ctx); + + ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp)); + ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", { + brackets: [["[", ")"]], + })); + + return async () => { + const editor = vscode.window.activeTextEditor; + const rangeEnabled = !!editor && !editor.selection.isEmpty; + + const uri = rangeEnabled + ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) + : tdcp.uri; + + const document = await vscode.workspace.openTextDocument(uri); + + tdcp.eventEmitter.fire(uri); + + void await vscode.window.showTextDocument(document, { + viewColumn: vscode.ViewColumn.Two, + preserveFocus: true + }); + }; +} + + // Opens the virtual file that will show the syntax tree // // The contents of the file come from the `TextDocumentContentProvider` diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 0e5a2064..31ac81ee 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -92,7 +92,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('debugSingle', commands.debugSingle); ctx.registerCommand('showReferences', commands.showReferences); - ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); ctx.registerCommand('applyActionGroup', commands.applyActionGroup); diff --git a/rust-analyzer/editors/code/src/commands/runnables.ts b/rust-analyzer/editors/code/src/run.ts similarity index 88% rename from rust-analyzer/editors/code/src/commands/runnables.ts rename to rust-analyzer/editors/code/src/run.ts index 0bd30fb0..8f0487d7 100644 --- a/rust-analyzer/editors/code/src/commands/runnables.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -1,13 +1,13 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as ra from '../rust-analyzer-api'; +import * as ra from './rust-analyzer-api'; -import { Ctx, Cmd } from '../ctx'; -import { startDebugSession, getDebugConfiguration } from '../debug'; +import { Ctx, Cmd } from './ctx'; +import { startDebugSession, getDebugConfiguration } from './debug'; const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; -async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debuggeeOnly = false, showButtons: boolean = true): Promise { +export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debuggeeOnly = false, showButtons: boolean = true): Promise { const editor = ctx.activeRustEditor; const client = ctx.client; if (!editor || !client) return; @@ -83,20 +83,6 @@ async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debugg }); } -export function run(ctx: Ctx): Cmd { - let prevRunnable: RunnableQuickPick | undefined; - - return async () => { - const item = await selectRunnable(ctx, prevRunnable); - if (!item) return; - - item.detail = 'rerun'; - prevRunnable = item; - const task = createTask(item.runnable); - return await vscode.tasks.executeTask(task); - }; -} - export function runSingle(ctx: Ctx): Cmd { return async (runnable: ra.Runnable) => { const editor = ctx.activeRustEditor; @@ -165,7 +151,7 @@ export function newDebugConfig(ctx: Ctx): Cmd { }; } -class RunnableQuickPick implements vscode.QuickPickItem { +export class RunnableQuickPick implements vscode.QuickPickItem { public label: string; public description?: string | undefined; public detail?: string | undefined; @@ -184,7 +170,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { env?: { [key: string]: string }; } -function createTask(spec: ra.Runnable): vscode.Task { +export function createTask(spec: ra.Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; const definition: CargoTaskDefinition = { type: 'cargo', From 2f801764ca9155a0d0b482afdd8e98bc9b6970a5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 14:12:53 +0200 Subject: [PATCH 727/819] Less rust-analyzer specific onEnter --- rust-analyzer/editors/code/src/commands.ts | 10 +++++----- rust-analyzer/editors/code/src/rust-analyzer-api.ts | 3 +-- rust-analyzer/editors/code/src/snippets.ts | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 573af5aa..e0803014 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as ra from './rust-analyzer-api'; import { Ctx, Cmd } from './ctx'; -import { applySnippetWorkspaceEdit } from './snippets'; +import { applySnippetWorkspaceEdit, applySnippetTextEdits } from './snippets'; import { spawnSync } from 'child_process'; import { RunnableQuickPick, selectRunnable, createTask } from './run'; import { AstInspector } from './ast_inspector'; @@ -102,7 +102,7 @@ export function onEnter(ctx: Ctx): Cmd { if (!editor || !client) return false; - const change = await client.sendRequest(ra.onEnter, { + const lcEdits = await client.sendRequest(ra.onEnter, { textDocument: { uri: editor.document.uri.toString() }, position: client.code2ProtocolConverter.asPosition( editor.selection.active, @@ -111,10 +111,10 @@ export function onEnter(ctx: Ctx): Cmd { // client.logFailedRequest(OnEnterRequest.type, error); return null; }); - if (!change) return false; + if (!lcEdits) return false; - const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change); - await applySnippetWorkspaceEdit(workspaceEdit); + const edits = client.protocol2CodeConverter.asTextEdits(lcEdits); + await applySnippetTextEdits(editor, edits); return true; } diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts index 900c5cd5..c10c0fa7 100644 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ b/rust-analyzer/editors/code/src/rust-analyzer-api.ts @@ -67,8 +67,7 @@ export interface JoinLinesParams { } export const joinLines = new lc.RequestType('experimental/joinLines'); - -export const onEnter = request>("onEnter"); +export const onEnter = new lc.RequestType('experimental/onEnter'); export interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; diff --git a/rust-analyzer/editors/code/src/snippets.ts b/rust-analyzer/editors/code/src/snippets.ts index 79453016..bcb3f2cc 100644 --- a/rust-analyzer/editors/code/src/snippets.ts +++ b/rust-analyzer/editors/code/src/snippets.ts @@ -8,7 +8,10 @@ export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); if (!editor) return; + await applySnippetTextEdits(editor, edits); +} +export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vscode.TextEdit[]) { let selection: vscode.Selection | undefined = undefined; let lineDelta = 0; await editor.edit((builder) => { From cc3e5a94947302c034b48dfa30bcadae1b211ff3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 14:56:26 +0200 Subject: [PATCH 728/819] Cleanup lsp extensions on the client side --- rust-analyzer/editors/code/src/commands.ts | 2 +- rust-analyzer/editors/code/src/debug.ts | 2 +- rust-analyzer/editors/code/src/inlay_hints.ts | 2 +- rust-analyzer/editors/code/src/lsp_ext.ts | 84 ++++++++++++ rust-analyzer/editors/code/src/run.ts | 2 +- .../editors/code/src/rust-analyzer-api.ts | 123 ------------------ 6 files changed, 88 insertions(+), 127 deletions(-) create mode 100644 rust-analyzer/editors/code/src/lsp_ext.ts delete mode 100644 rust-analyzer/editors/code/src/rust-analyzer-api.ts diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index e0803014..49e3845d 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as ra from './rust-analyzer-api'; +import * as ra from './lsp_ext'; import { Ctx, Cmd } from './ctx'; import { applySnippetWorkspaceEdit, applySnippetTextEdits } from './snippets'; diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index d3fe588e..027504ec 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -1,7 +1,7 @@ import * as os from "os"; import * as vscode from 'vscode'; import * as path from 'path'; -import * as ra from './rust-analyzer-api'; +import * as ra from './lsp_ext'; import { Cargo } from './cargo'; import { Ctx } from "./ctx"; diff --git a/rust-analyzer/editors/code/src/inlay_hints.ts b/rust-analyzer/editors/code/src/inlay_hints.ts index a2b07d00..9e6d6045 100644 --- a/rust-analyzer/editors/code/src/inlay_hints.ts +++ b/rust-analyzer/editors/code/src/inlay_hints.ts @@ -1,6 +1,6 @@ import * as lc from "vscode-languageclient"; import * as vscode from 'vscode'; -import * as ra from './rust-analyzer-api'; +import * as ra from './lsp_ext'; import { Ctx, Disposable } from './ctx'; import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, sleep } from './util'; diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts new file mode 100644 index 00000000..2a066326 --- /dev/null +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -0,0 +1,84 @@ +/** + * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. + */ + +import * as lc from "vscode-languageclient"; + +export const analyzerStatus = new lc.RequestType("rust-analyzer/analyzerStatus"); + +export const collectGarbage = new lc.RequestType("rust-analyzer/collectGarbage"); + +export interface SyntaxTreeParams { + textDocument: lc.TextDocumentIdentifier; + range: lc.Range | null; +} +export const syntaxTree = new lc.RequestType("rust-analyzer/syntaxTree"); + + +export interface ExpandMacroParams { + textDocument: lc.TextDocumentIdentifier; + position: lc.Position; +} +export interface ExpandedMacro { + name: string; + expansion: string; +} +export const expandMacro = new lc.RequestType("rust-analyzer/expandMacro"); + +export interface MatchingBraceParams { + textDocument: lc.TextDocumentIdentifier; + positions: lc.Position[]; +} +export const matchingBrace = new lc.RequestType("experimental/matchingBrace"); + +export const parentModule = new lc.RequestType("rust-analyzer/parentModule"); + +export interface JoinLinesParams { + textDocument: lc.TextDocumentIdentifier; + ranges: lc.Range[]; +} +export const joinLines = new lc.RequestType("experimental/joinLines"); + +export const onEnter = new lc.RequestType("experimental/onEnter"); + +export interface RunnablesParams { + textDocument: lc.TextDocumentIdentifier; + position: lc.Position | null; +} +export interface Runnable { + range: lc.Range; + label: string; + bin: string; + args: string[]; + extraArgs: string[]; + env: { [key: string]: string }; + cwd: string | null; +} +export const runnables = new lc.RequestType("rust-analyzer/runnables"); + +export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; + +export namespace InlayHint { + export const enum Kind { + TypeHint = "TypeHint", + ParamHint = "ParameterHint", + ChainingHint = "ChainingHint", + } + interface Common { + range: lc.Range; + label: string; + } + export type TypeHint = Common & { kind: Kind.TypeHint }; + export type ParamHint = Common & { kind: Kind.ParamHint }; + export type ChainingHint = Common & { kind: Kind.ChainingHint }; +} +export interface InlayHintsParams { + textDocument: lc.TextDocumentIdentifier; +} +export const inlayHints = new lc.RequestType("rust-analyzer/inlayHints"); + +export interface SsrParams { + query: string; + parseOnly: boolean; +} +export const ssr = new lc.RequestType('experimental/ssr'); diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 8f0487d7..2a7a429c 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; -import * as ra from './rust-analyzer-api'; +import * as ra from './lsp_ext'; import { Ctx, Cmd } from './ctx'; import { startDebugSession, getDebugConfiguration } from './debug'; diff --git a/rust-analyzer/editors/code/src/rust-analyzer-api.ts b/rust-analyzer/editors/code/src/rust-analyzer-api.ts deleted file mode 100644 index c10c0fa7..00000000 --- a/rust-analyzer/editors/code/src/rust-analyzer-api.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. - */ - -import * as lc from "vscode-languageclient"; - -type Option = null | T; -type Vec = T[]; -type FxHashMap = Record; - -function request(method: string) { - return new lc.RequestType(`rust-analyzer/${method}`); -} -function notification(method: string) { - return new lc.NotificationType(method); -} - - -export const analyzerStatus = request("analyzerStatus"); - - -export const collectGarbage = request("collectGarbage"); - - -export interface SyntaxTreeParams { - textDocument: lc.TextDocumentIdentifier; - range: Option; -} -export const syntaxTree = request("syntaxTree"); - - -export interface ExpandMacroParams { - textDocument: lc.TextDocumentIdentifier; - position: Option; -} -export interface ExpandedMacro { - name: string; - expansion: string; -} -export const expandMacro = request>("expandMacro"); - - -export interface MatchingBraceParams { - textDocument: lc.TextDocumentIdentifier; - positions: lc.Position[]; -} -export const matchingBrace = new lc.RequestType('experimental/matchingBrace'); - -export interface PublishDecorationsParams { - uri: string; - decorations: Vec; -} -export interface Decoration { - range: lc.Range; - tag: string; - bindingHash: Option; -} -export const decorationsRequest = request>("decorationsRequest"); - - -export const parentModule = request>("parentModule"); - - -export interface JoinLinesParams { - textDocument: lc.TextDocumentIdentifier; - ranges: lc.Range[]; -} -export const joinLines = new lc.RequestType('experimental/joinLines'); - -export const onEnter = new lc.RequestType('experimental/onEnter'); - -export interface RunnablesParams { - textDocument: lc.TextDocumentIdentifier; - position: Option; -} -export interface Runnable { - range: lc.Range; - label: string; - bin: string; - args: Vec; - extraArgs: Vec; - env: FxHashMap; - cwd: Option; -} -export const runnables = request>("runnables"); - -export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; - -export namespace InlayHint { - export const enum Kind { - TypeHint = "TypeHint", - ParamHint = "ParameterHint", - ChainingHint = "ChainingHint", - } - interface Common { - range: lc.Range; - label: string; - } - export type TypeHint = Common & { kind: Kind.TypeHint }; - export type ParamHint = Common & { kind: Kind.ParamHint }; - export type ChainingHint = Common & { kind: Kind.ChainingHint }; -} -export interface InlayHintsParams { - textDocument: lc.TextDocumentIdentifier; -} -export const inlayHints = request>("inlayHints"); - - -export interface SsrParams { - query: string; - parseOnly: boolean; -} -export const ssr = new lc.RequestType('experimental/ssr'); - - -export const publishDecorations = notification("publishDecorations"); - - -export interface SourceChange { - label: string; - workspaceEdit: lc.WorkspaceEdit; - cursorPosition: Option; -} From 99e22656005cb02df2399faba8e109b3793ca2d3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 15:55:25 +0200 Subject: [PATCH 729/819] Document `parentModule` experimental LSP request --- rust-analyzer/editors/code/src/commands.ts | 6 +++--- rust-analyzer/editors/code/src/lsp_ext.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 49e3845d..86302db3 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -138,10 +138,10 @@ export function parentModule(ctx: Ctx): Cmd { ), }); const loc = response[0]; - if (loc == null) return; + if (!loc) return; - const uri = client.protocol2CodeConverter.asUri(loc.uri); - const range = client.protocol2CodeConverter.asRange(loc.range); + const uri = client.protocol2CodeConverter.asUri(loc.targetUri); + const range = client.protocol2CodeConverter.asRange(loc.targetRange); const doc = await vscode.workspace.openTextDocument(uri); const e = await vscode.window.showTextDocument(doc); diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 2a066326..4da12eb3 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -31,7 +31,7 @@ export interface MatchingBraceParams { } export const matchingBrace = new lc.RequestType("experimental/matchingBrace"); -export const parentModule = new lc.RequestType("rust-analyzer/parentModule"); +export const parentModule = new lc.RequestType("experimental/parentModule"); export interface JoinLinesParams { textDocument: lc.TextDocumentIdentifier; From 28f6809dcb1e5454d203f5d178cd8862299dcc7d Mon Sep 17 00:00:00 2001 From: Yuki Kodama Date: Tue, 26 May 2020 02:36:34 +0900 Subject: [PATCH 730/819] Add question mark operator --- rust-analyzer/editors/code/rust.tmGrammar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index cdcd557d..ab87cd39 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -207,7 +207,7 @@ { "comment": "Miscellaneous operator", "name": "keyword.operator.misc.rust", - "match": "(=>|::)" + "match": "(=>|::|\\?)" }, { "comment": "Comparison operator", From c82b7a1252407387b931c987c47a67d88197eab1 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 26 May 2020 22:51:04 +0300 Subject: [PATCH 731/819] Partially fix displaying inlay hints in Github PR diff views --- rust-analyzer/editors/code/src/util.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 127a9e91..793c481f 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -74,10 +74,11 @@ export type RustDocument = vscode.TextDocument & { languageId: "rust" }; export type RustEditor = vscode.TextEditor & { document: RustDocument }; export function isRustDocument(document: vscode.TextDocument): document is RustDocument { - return document.languageId === 'rust' - // SCM diff views have the same URI as the on-disk document but not the same content - && document.uri.scheme !== 'git' - && document.uri.scheme !== 'svn'; + // Prevent corrupted text (particularly via inlay hints) in diff views + // by allowing only `file` schemes + // unfortunately extensions that use diff views not always set this + // to something different than 'file' (see ongoing bug: #4608) + return document.languageId === 'rust' && document.uri.scheme === 'file'; } export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { From 8d48e0c44786a0ce9d91e5eef91f838da02255ef Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 27 May 2020 19:40:13 +0300 Subject: [PATCH 732/819] Add `inRustProject` when-clause for commands. --- rust-analyzer/editors/code/package.json | 66 ++++++++++++++++++++++++- rust-analyzer/editors/code/src/main.ts | 6 +++ rust-analyzer/editors/code/src/util.ts | 5 ++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index acf3ca4b..75dbafc0 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -694,6 +694,70 @@ ] } } - ] + ], + "menus": { + "commandPalette": [ + { + "command": "rust-analyzer.syntaxTree", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.expandMacro", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.matchingBrace", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.parentModule", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.joinLines", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.run", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.debug", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.newDebugConfig", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.analyzerStatus", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.collectGarbage", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.reload", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.onEnter", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.ssr", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.serverVersion", + "when": "inRustProject" + }, + { + "command": "rust-analyzer.toggleInlayHints", + "when": "inRustProject" + } + ] + } } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 31ac81ee..b7337621 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -12,10 +12,13 @@ import { log, assert, isValidExecutable } from './util'; import { PersistentState } from './persistent_state'; import { fetchRelease, download } from './net'; import { activateTaskProvider } from './tasks'; +import { setContextValue } from './util'; import { exec } from 'child_process'; let ctx: Ctx | undefined; +const RUST_PROJECT_CONTEXT_NAME = "inRustProject"; + export async function activate(context: vscode.ExtensionContext) { // Register a "dumb" onEnter command for the case where server fails to // start. @@ -54,6 +57,8 @@ export async function activate(context: vscode.ExtensionContext) { // This a horribly, horribly wrong way to deal with this problem. ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath); + setContextValue(RUST_PROJECT_CONTEXT_NAME, true); + // Commands which invokes manually via command palette, shortcut, etc. // Reloading is inspired by @DanTup maneuver: https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895 @@ -109,6 +114,7 @@ export async function activate(context: vscode.ExtensionContext) { } export async function deactivate() { + setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined); await ctx?.client.stop(); ctx = undefined; } diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 793c481f..352ef916 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -94,3 +94,8 @@ export function isValidExecutable(path: string): boolean { return res.status === 0; } + +/** Sets ['when'](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) clause contexts */ +export function setContextValue(key: string, value: any): Thenable { + return vscode.commands.executeCommand('setContext', key, value); +} From b8b283b155490f182ccab65c288dd0bdf67be602 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 23 May 2020 04:58:22 +0300 Subject: [PATCH 733/819] Fix invoking cargo without consulting CARGO or standard installation paths --- rust-analyzer/editors/code/src/cargo.ts | 4 ++-- rust-analyzer/editors/code/src/tasks.ts | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/cargo.ts index a55b2f86..46cd3d77 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/cargo.ts @@ -126,8 +126,8 @@ export class Cargo { } } -// Mirrors `ra_env::get_path_for_executable` implementation -function getCargoPathOrFail(): string { +// Mirrors `ra_toolchain::cargo()` implementation +export function getCargoPathOrFail(): string { const envVar = process.env.CARGO; const executableName = "cargo"; diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index 1366c76d..c22d6936 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -1,4 +1,5 @@ import * as vscode from 'vscode'; +import { getCargoPathOrFail } from "./cargo"; // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and // our configuration should be compatible with it so use the same key. @@ -24,6 +25,8 @@ class CargoTaskProvider implements vscode.TaskProvider { // set of tasks that always exist. These tasks cannot be removed in // tasks.json - only tweaked. + const cargoPath = getCargoPathOrFail(); + return [ { command: 'build', group: vscode.TaskGroup.Build }, { command: 'check', group: vscode.TaskGroup.Build }, @@ -46,7 +49,7 @@ class CargoTaskProvider implements vscode.TaskProvider { `cargo ${command}`, 'rust', // What to do when this command is executed. - new vscode.ShellExecution('cargo', [command]), + new vscode.ShellExecution(cargoPath, [command]), // Problem matchers. ['$rustc'], ); @@ -80,4 +83,4 @@ class CargoTaskProvider implements vscode.TaskProvider { export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { const provider = new CargoTaskProvider(target); return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); -} \ No newline at end of file +} From 03d1257ddeb766bb7dbd08c8d6240cd118a5dc38 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sun, 31 May 2020 05:13:08 +0300 Subject: [PATCH 734/819] Change Runnable.bin -> Runnable.kind As per matklad, we now pass the responsibility for finding the binary to the frontend. Also, added caching for finding the binary path to reduce the amount of filesystem interactions. --- rust-analyzer/editors/code/src/debug.ts | 2 +- rust-analyzer/editors/code/src/lsp_ext.ts | 5 +- rust-analyzer/editors/code/src/run.ts | 3 +- rust-analyzer/editors/code/src/tasks.ts | 4 +- .../code/src/{cargo.ts => toolchain.ts} | 117 +++++++++++------- rust-analyzer/editors/code/src/util.ts | 18 +++ .../code/tests/unit/launch_config.test.ts | 14 +-- 7 files changed, 104 insertions(+), 59 deletions(-) rename rust-analyzer/editors/code/src/{cargo.ts => toolchain.ts} (53%) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 027504ec..bdec5b73 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; import * as ra from './lsp_ext'; -import { Cargo } from './cargo'; +import { Cargo } from './toolchain'; import { Ctx } from "./ctx"; const debugOutput = vscode.window.createOutputChannel("Debug"); diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 4da12eb3..3e0b6069 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -45,10 +45,13 @@ export interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; position: lc.Position | null; } + +export type RunnableKind = "cargo" | "rustc" | "rustup"; + export interface Runnable { range: lc.Range; label: string; - bin: string; + kind: RunnableKind; args: string[]; extraArgs: string[]; env: { [key: string]: string }; diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 2a7a429c..401cb76a 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as ra from './lsp_ext'; +import * as toolchain from "./toolchain"; import { Ctx, Cmd } from './ctx'; import { startDebugSession, getDebugConfiguration } from './debug'; @@ -175,7 +176,7 @@ export function createTask(spec: ra.Runnable): vscode.Task { const definition: CargoTaskDefinition = { type: 'cargo', label: spec.label, - command: spec.bin, + command: toolchain.getPathForExecutable(spec.kind), args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, env: spec.env, }; diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index c22d6936..9748824d 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { getCargoPathOrFail } from "./cargo"; +import * as toolchain from "./toolchain"; // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and // our configuration should be compatible with it so use the same key. @@ -25,7 +25,7 @@ class CargoTaskProvider implements vscode.TaskProvider { // set of tasks that always exist. These tasks cannot be removed in // tasks.json - only tweaked. - const cargoPath = getCargoPathOrFail(); + const cargoPath = toolchain.cargoPath(); return [ { command: 'build', group: vscode.TaskGroup.Build }, diff --git a/rust-analyzer/editors/code/src/cargo.ts b/rust-analyzer/editors/code/src/toolchain.ts similarity index 53% rename from rust-analyzer/editors/code/src/cargo.ts rename to rust-analyzer/editors/code/src/toolchain.ts index 46cd3d77..80a7915e 100644 --- a/rust-analyzer/editors/code/src/cargo.ts +++ b/rust-analyzer/editors/code/src/toolchain.ts @@ -1,9 +1,10 @@ import * as cp from 'child_process'; import * as os from 'os'; import * as path from 'path'; +import * as fs from 'fs'; import * as readline from 'readline'; import { OutputChannel } from 'vscode'; -import { isValidExecutable } from './util'; +import { log, memoize } from './util'; interface CompilationArtifact { fileName: string; @@ -17,33 +18,34 @@ export interface ArtifactSpec { filter?: (artifacts: CompilationArtifact[]) => CompilationArtifact[]; } -export function artifactSpec(args: readonly string[]): ArtifactSpec { - const cargoArgs = [...args, "--message-format=json"]; +export class Cargo { + constructor(readonly rootFolder: string, readonly output: OutputChannel) { } - // arguments for a runnable from the quick pick should be updated. - // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens - switch (cargoArgs[0]) { - case "run": cargoArgs[0] = "build"; break; - case "test": { - if (!cargoArgs.includes("--no-run")) { - cargoArgs.push("--no-run"); + // Made public for testing purposes + static artifactSpec(args: readonly string[]): ArtifactSpec { + const cargoArgs = [...args, "--message-format=json"]; + + // arguments for a runnable from the quick pick should be updated. + // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_code_lens + switch (cargoArgs[0]) { + case "run": cargoArgs[0] = "build"; break; + case "test": { + if (!cargoArgs.includes("--no-run")) { + cargoArgs.push("--no-run"); + } + break; } - break; } - } - const result: ArtifactSpec = { cargoArgs: cargoArgs }; - if (cargoArgs[0] === "test") { - // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests - // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} - result.filter = (artifacts) => artifacts.filter(it => it.isTest); - } - - return result; -} + const result: ArtifactSpec = { cargoArgs: cargoArgs }; + if (cargoArgs[0] === "test") { + // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests + // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} + result.filter = (artifacts) => artifacts.filter(it => it.isTest); + } -export class Cargo { - constructor(readonly rootFolder: string, readonly output: OutputChannel) { } + return result; + } private async getArtifacts(spec: ArtifactSpec): Promise { const artifacts: CompilationArtifact[] = []; @@ -77,7 +79,7 @@ export class Cargo { } async executableFromArgs(args: readonly string[]): Promise { - const artifacts = await this.getArtifacts(artifactSpec(args)); + const artifacts = await this.getArtifacts(Cargo.artifactSpec(args)); if (artifacts.length === 0) { throw new Error('No compilation artifacts'); @@ -94,14 +96,7 @@ export class Cargo { onStderrString: (data: string) => void ): Promise { return new Promise((resolve, reject) => { - let cargoPath; - try { - cargoPath = getCargoPathOrFail(); - } catch (err) { - return reject(err); - } - - const cargo = cp.spawn(cargoPath, cargoArgs, { + const cargo = cp.spawn(cargoPath(), cargoArgs, { stdio: ['ignore', 'pipe', 'pipe'], cwd: this.rootFolder }); @@ -126,26 +121,54 @@ export class Cargo { } } -// Mirrors `ra_toolchain::cargo()` implementation -export function getCargoPathOrFail(): string { - const envVar = process.env.CARGO; - const executableName = "cargo"; +/** Mirrors `ra_toolchain::cargo()` implementation */ +export function cargoPath(): string { + return getPathForExecutable("cargo"); +} + +/** Mirrors `ra_toolchain::get_path_for_executable()` implementation */ +export const getPathForExecutable = memoize( + // We apply caching to decrease file-system interactions + (executableName: "cargo" | "rustc" | "rustup"): string => { + { + const envVar = process.env[executableName.toUpperCase()]; + if (envVar) return envVar; + } + + if (lookupInPath(executableName)) return executableName; - if (envVar) { - if (isValidExecutable(envVar)) return envVar; + try { + // hmm, `os.homedir()` seems to be infallible + // it is not mentioned in docs and cannot be infered by the type signature... + const standardPath = path.join(os.homedir(), ".cargo", "bin", executableName); - throw new Error(`\`${envVar}\` environment variable points to something that's not a valid executable`); + if (isFile(standardPath)) return standardPath; + } catch (err) { + log.error("Failed to read the fs info", err); + } + return executableName; } +); - if (isValidExecutable(executableName)) return executableName; +function lookupInPath(exec: string): boolean { + const paths = process.env.PATH ?? "";; - const standardLocation = path.join(os.homedir(), '.cargo', 'bin', executableName); + const candidates = paths.split(path.delimiter).flatMap(dirInPath => { + const candidate = path.join(dirInPath, exec); + return os.type() === "Windows_NT" + ? [candidate, `${candidate}.exe`] + : [candidate]; + }); - if (isValidExecutable(standardLocation)) return standardLocation; + return candidates.some(isFile); +} - throw new Error( - `Failed to find \`${executableName}\` executable. ` + - `Make sure \`${executableName}\` is in \`$PATH\`, ` + - `or set \`${envVar}\` to point to a valid executable.` - ); +function isFile(suspectPath: string): boolean { + // It is not mentionned in docs, but `statSync()` throws an error when + // the path doesn't exist + try { + return fs.statSync(suspectPath).isFile(); + } catch { + return false; + } } diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 352ef916..fe3fb71c 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -99,3 +99,21 @@ export function isValidExecutable(path: string): boolean { export function setContextValue(key: string, value: any): Thenable { return vscode.commands.executeCommand('setContext', key, value); } + +/** + * Returns a higher-order function that caches the results of invoking the + * underlying function. + */ +export function memoize(func: (this: TThis, arg: Param) => Ret) { + const cache = new Map(); + + return function(this: TThis, arg: Param) { + const cached = cache.get(arg); + if (cached) return cached; + + const result = func.call(this, arg); + cache.set(arg, result); + + return result; + }; +} diff --git a/rust-analyzer/editors/code/tests/unit/launch_config.test.ts b/rust-analyzer/editors/code/tests/unit/launch_config.test.ts index d5cf1b74..68794d53 100644 --- a/rust-analyzer/editors/code/tests/unit/launch_config.test.ts +++ b/rust-analyzer/editors/code/tests/unit/launch_config.test.ts @@ -1,25 +1,25 @@ import * as assert from 'assert'; -import * as cargo from '../../src/cargo'; +import { Cargo } from '../../src/toolchain'; suite('Launch configuration', () => { suite('Lens', () => { test('A binary', async () => { - const args = cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "pkg_name"]); + const args = Cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "pkg_name"]); assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]); assert.deepEqual(args.filter, undefined); }); test('One of Multiple Binaries', async () => { - const args = cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "bin1"]); + const args = Cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "bin1"]); assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin1", "--message-format=json"]); assert.deepEqual(args.filter, undefined); }); test('A test', async () => { - const args = cargo.artifactSpec(["test", "--package", "pkg_name", "--lib", "--no-run"]); + const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib", "--no-run"]); assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--no-run", "--message-format=json"]); assert.notDeepEqual(args.filter, undefined); @@ -28,7 +28,7 @@ suite('Launch configuration', () => { suite('QuickPick', () => { test('A binary', async () => { - const args = cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "pkg_name"]); + const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "pkg_name"]); assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]); assert.deepEqual(args.filter, undefined); @@ -36,14 +36,14 @@ suite('Launch configuration', () => { test('One of Multiple Binaries', async () => { - const args = cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "bin2"]); + const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "bin2"]); assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin2", "--message-format=json"]); assert.deepEqual(args.filter, undefined); }); test('A test', async () => { - const args = cargo.artifactSpec(["test", "--package", "pkg_name", "--lib"]); + const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib"]); assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--message-format=json", "--no-run"]); assert.notDeepEqual(args.filter, undefined); From 3a52d649393b435dba685600ba33c3bd66045cc1 Mon Sep 17 00:00:00 2001 From: Alin Sinpalean Date: Sun, 31 May 2020 13:41:52 +0200 Subject: [PATCH 735/819] Always derive from `process.env` when spawning a child process/shell execution This is useful when an extension (e.g. Nix Environment Selector) or launch configuration sets one or more environment variables. When `env` is not explicitly specified in the options passed to `child_process.spawn()` or `vscode.ShellExecution()`, then `process.env` gets applied automatically. But when an explicit `env` is set, it should inherit from `process.env` rather than replace it completely. --- rust-analyzer/editors/code/src/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 2a7a429c..8e1ba83e 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -177,7 +177,7 @@ export function createTask(spec: ra.Runnable): vscode.Task { label: spec.label, command: spec.bin, args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, - env: spec.env, + env: Object.assign({}, process.env, spec.env), }; const execOption: vscode.ShellExecutionOptions = { From c559303a4fffb5106b95500d02078f9f577c1145 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Jun 2020 14:33:47 +0200 Subject: [PATCH 736/819] Move run commands to commands.ts --- rust-analyzer/editors/code/src/commands.ts | 74 ++++++++++--- rust-analyzer/editors/code/src/debug.ts | 119 ++++++++++++--------- rust-analyzer/editors/code/src/run.ts | 74 +------------ 3 files changed, 134 insertions(+), 133 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 86302db3..534d2a98 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -8,6 +8,7 @@ import { spawnSync } from 'child_process'; import { RunnableQuickPick, selectRunnable, createTask } from './run'; import { AstInspector } from './ast_inspector'; import { isRustDocument, sleep, isRustEditor } from './util'; +import { startDebugSession, makeDebugConfig } from './debug'; export * from './ast_inspector'; export * from './run'; @@ -197,20 +198,6 @@ export function toggleInlayHints(ctx: Ctx): Cmd { }; } -export function run(ctx: Ctx): Cmd { - let prevRunnable: RunnableQuickPick | undefined; - - return async () => { - const item = await selectRunnable(ctx, prevRunnable); - if (!item) return; - - item.detail = 'rerun'; - prevRunnable = item; - const task = createTask(item.runnable); - return await vscode.tasks.executeTask(task); - }; -} - // Opens the virtual file that will show the syntax tree // // The contents of the file come from the `TextDocumentContentProvider` @@ -368,3 +355,62 @@ export function applySnippetWorkspaceEditCommand(_ctx: Ctx): Cmd { await applySnippetWorkspaceEdit(edit); }; } + +export function run(ctx: Ctx): Cmd { + let prevRunnable: RunnableQuickPick | undefined; + + return async () => { + const item = await selectRunnable(ctx, prevRunnable); + if (!item) return; + + item.detail = 'rerun'; + prevRunnable = item; + const task = createTask(item.runnable); + return await vscode.tasks.executeTask(task); + }; +} + +export function runSingle(ctx: Ctx): Cmd { + return async (runnable: ra.Runnable) => { + const editor = ctx.activeRustEditor; + if (!editor) return; + + const task = createTask(runnable); + task.group = vscode.TaskGroup.Build; + task.presentationOptions = { + reveal: vscode.TaskRevealKind.Always, + panel: vscode.TaskPanelKind.Dedicated, + clear: true, + }; + + return vscode.tasks.executeTask(task); + }; +} + +export function debug(ctx: Ctx): Cmd { + let prevDebuggee: RunnableQuickPick | undefined; + + return async () => { + const item = await selectRunnable(ctx, prevDebuggee, true); + if (!item) return; + + item.detail = 'restart'; + prevDebuggee = item; + return await startDebugSession(ctx, item.runnable); + }; +} + +export function debugSingle(ctx: Ctx): Cmd { + return async (config: ra.Runnable) => { + await startDebugSession(ctx, config); + }; +} + +export function newDebugConfig(ctx: Ctx): Cmd { + return async () => { + const item = await selectRunnable(ctx, undefined, true, false); + if (!item) return; + + await makeDebugConfig(ctx, item.runnable); + }; +} diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index bdec5b73..1e421d40 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -9,40 +9,53 @@ import { Ctx } from "./ctx"; const debugOutput = vscode.window.createOutputChannel("Debug"); type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; -function getLldbDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { - return { - type: "lldb", - request: "launch", - name: config.label, - program: executable, - args: config.extraArgs, - cwd: config.cwd, - sourceMap: sourceFileMap, - sourceLanguages: ["rust"] - }; -} +export async function makeDebugConfig(ctx: Ctx, runnable: ra.Runnable): Promise { + const scope = ctx.activeRustEditor?.document.uri; + if (!scope) return; -function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { - return { - type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg", - request: "launch", - name: config.label, - program: executable, - args: config.extraArgs, - cwd: config.cwd, - sourceFileMap: sourceFileMap, - }; + const debugConfig = await getDebugConfiguration(ctx, runnable); + if (!debugConfig) return; + + const wsLaunchSection = vscode.workspace.getConfiguration("launch", scope); + const configurations = wsLaunchSection.get("configurations") || []; + + const index = configurations.findIndex(c => c.name === debugConfig.name); + if (index !== -1) { + const answer = await vscode.window.showErrorMessage(`Launch configuration '${debugConfig.name}' already exists!`, 'Cancel', 'Update'); + if (answer === "Cancel") return; + + configurations[index] = debugConfig; + } else { + configurations.push(debugConfig); + } + + await wsLaunchSection.update("configurations", configurations); } -async function getDebugExecutable(config: ra.Runnable): Promise { - const cargo = new Cargo(config.cwd || '.', debugOutput); - const executable = await cargo.executableFromArgs(config.args); +export async function startDebugSession(ctx: Ctx, runnable: ra.Runnable): Promise { + let debugConfig: vscode.DebugConfiguration | undefined = undefined; + let message = ""; - // if we are here, there were no compilation errors. - return executable; + const wsLaunchSection = vscode.workspace.getConfiguration("launch"); + const configurations = wsLaunchSection.get("configurations") || []; + + const index = configurations.findIndex(c => c.name === runnable.label); + if (-1 !== index) { + debugConfig = configurations[index]; + message = " (from launch.json)"; + debugOutput.clear(); + } else { + debugConfig = await getDebugConfiguration(ctx, runnable); + } + + if (!debugConfig) return false; + + debugOutput.appendLine(`Launching debug configuration${message}:`); + debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); + return vscode.debug.startDebugging(undefined, debugConfig); } -export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Promise { +async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { const editor = ctx.activeRustEditor; if (!editor) return; @@ -78,8 +91,8 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom return path.normalize(p).replace(wsFolder, '${workspaceRoot}'); } - const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, simplifyPath(executable), debugOptions.sourceFileMap); + const executable = await getDebugExecutable(runnable); + const debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), debugOptions.sourceFileMap); if (debugConfig.type in debugOptions.engineSettings) { const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; for (var key in settingsMap) { @@ -100,25 +113,35 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom return debugConfig; } -export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise { - let debugConfig: vscode.DebugConfiguration | undefined = undefined; - let message = ""; - - const wsLaunchSection = vscode.workspace.getConfiguration("launch"); - const configurations = wsLaunchSection.get("configurations") || []; +async function getDebugExecutable(runnable: ra.Runnable): Promise { + const cargo = new Cargo(runnable.cwd || '.', debugOutput); + const executable = await cargo.executableFromArgs(runnable.args); - const index = configurations.findIndex(c => c.name === config.label); - if (-1 !== index) { - debugConfig = configurations[index]; - message = " (from launch.json)"; - debugOutput.clear(); - } else { - debugConfig = await getDebugConfiguration(ctx, config); - } + // if we are here, there were no compilation errors. + return executable; +} - if (!debugConfig) return false; +function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { + return { + type: "lldb", + request: "launch", + name: runnable.label, + program: executable, + args: runnable.extraArgs, + cwd: runnable.cwd, + sourceMap: sourceFileMap, + sourceLanguages: ["rust"] + }; +} - debugOutput.appendLine(`Launching debug configuration${message}:`); - debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); - return vscode.debug.startDebugging(undefined, debugConfig); +function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { + return { + type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg", + request: "launch", + name: runnable.label, + program: executable, + args: runnable.extraArgs, + cwd: runnable.cwd, + sourceFileMap: sourceFileMap, + }; } diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 113354ba..5fc4f8e4 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -3,8 +3,8 @@ import * as lc from 'vscode-languageclient'; import * as ra from './lsp_ext'; import * as toolchain from "./toolchain"; -import { Ctx, Cmd } from './ctx'; -import { startDebugSession, getDebugConfiguration } from './debug'; +import { Ctx } from './ctx'; +import { makeDebugConfig } from './debug'; const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; @@ -65,7 +65,7 @@ export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, quickPick.onDidHide(() => close()), quickPick.onDidAccept(() => close(quickPick.selectedItems[0])), quickPick.onDidTriggerButton((_button) => { - (async () => await makeDebugConfig(ctx, quickPick.activeItems[0]))(); + (async () => await makeDebugConfig(ctx, quickPick.activeItems[0].runnable))(); close(); }), quickPick.onDidChangeActive((active) => { @@ -84,74 +84,6 @@ export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, }); } -export function runSingle(ctx: Ctx): Cmd { - return async (runnable: ra.Runnable) => { - const editor = ctx.activeRustEditor; - if (!editor) return; - - const task = createTask(runnable); - task.group = vscode.TaskGroup.Build; - task.presentationOptions = { - reveal: vscode.TaskRevealKind.Always, - panel: vscode.TaskPanelKind.Dedicated, - clear: true, - }; - - return vscode.tasks.executeTask(task); - }; -} - -export function debug(ctx: Ctx): Cmd { - let prevDebuggee: RunnableQuickPick | undefined; - - return async () => { - const item = await selectRunnable(ctx, prevDebuggee, true); - if (!item) return; - - item.detail = 'restart'; - prevDebuggee = item; - return await startDebugSession(ctx, item.runnable); - }; -} - -export function debugSingle(ctx: Ctx): Cmd { - return async (config: ra.Runnable) => { - await startDebugSession(ctx, config); - }; -} - -async function makeDebugConfig(ctx: Ctx, item: RunnableQuickPick): Promise { - const scope = ctx.activeRustEditor?.document.uri; - if (!scope) return; - - const debugConfig = await getDebugConfiguration(ctx, item.runnable); - if (!debugConfig) return; - - const wsLaunchSection = vscode.workspace.getConfiguration("launch", scope); - const configurations = wsLaunchSection.get("configurations") || []; - - const index = configurations.findIndex(c => c.name === debugConfig.name); - if (index !== -1) { - const answer = await vscode.window.showErrorMessage(`Launch configuration '${debugConfig.name}' already exists!`, 'Cancel', 'Update'); - if (answer === "Cancel") return; - - configurations[index] = debugConfig; - } else { - configurations.push(debugConfig); - } - - await wsLaunchSection.update("configurations", configurations); -} - -export function newDebugConfig(ctx: Ctx): Cmd { - return async () => { - const item = await selectRunnable(ctx, undefined, true, false); - if (!item) return; - - await makeDebugConfig(ctx, item); - }; -} - export class RunnableQuickPick implements vscode.QuickPickItem { public label: string; public description?: string | undefined; From 34f4ed4988b231e0d0a9f6aef069d4cdb9008595 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Jun 2020 17:22:23 +0200 Subject: [PATCH 737/819] New runnables API --- rust-analyzer/editors/code/src/debug.ts | 12 ++++++------ rust-analyzer/editors/code/src/lsp_ext.ts | 15 +++++++-------- rust-analyzer/editors/code/src/run.ts | 21 +++++++++++++++------ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 1e421d40..a0c9b3ab 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -114,8 +114,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { - const cargo = new Cargo(runnable.cwd || '.', debugOutput); - const executable = await cargo.executableFromArgs(runnable.args); + const cargo = new Cargo(runnable.args.workspaceRoot || '.', debugOutput); + const executable = await cargo.executableFromArgs(runnable.args.cargoArgs); // if we are here, there were no compilation errors. return executable; @@ -127,8 +127,8 @@ function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFil request: "launch", name: runnable.label, program: executable, - args: runnable.extraArgs, - cwd: runnable.cwd, + args: runnable.args.executableArgs, + cwd: runnable.args.workspaceRoot, sourceMap: sourceFileMap, sourceLanguages: ["rust"] }; @@ -140,8 +140,8 @@ function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFi request: "launch", name: runnable.label, program: executable, - args: runnable.extraArgs, - cwd: runnable.cwd, + args: runnable.args.executableArgs, + cwd: runnable.args.workspaceRoot, sourceFileMap: sourceFileMap, }; } diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 3e0b6069..73d57367 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -46,16 +46,15 @@ export interface RunnablesParams { position: lc.Position | null; } -export type RunnableKind = "cargo" | "rustc" | "rustup"; - export interface Runnable { - range: lc.Range; label: string; - kind: RunnableKind; - args: string[]; - extraArgs: string[]; - env: { [key: string]: string }; - cwd: string | null; + location?: lc.LocationLink; + kind: "cargo"; + args: { + workspaceRoot?: string; + cargoArgs: string[]; + executableArgs: string[]; + }; } export const runnables = new lc.RequestType("rust-analyzer/runnables"); diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 5fc4f8e4..5c790741 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -103,18 +103,27 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { env?: { [key: string]: string }; } -export function createTask(spec: ra.Runnable): vscode.Task { +export function createTask(runnable: ra.Runnable): vscode.Task { const TASK_SOURCE = 'Rust'; + + let command; + switch (runnable.kind) { + case "cargo": command = toolchain.getPathForExecutable("cargo"); + } + const args = runnable.args.cargoArgs; + if (runnable.args.executableArgs.length > 0) { + args.push('--', ...runnable.args.executableArgs); + } const definition: CargoTaskDefinition = { type: 'cargo', - label: spec.label, - command: toolchain.getPathForExecutable(spec.kind), - args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, - env: Object.assign({}, process.env, spec.env), + label: runnable.label, + command, + args, + env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), }; const execOption: vscode.ShellExecutionOptions = { - cwd: spec.cwd || '.', + cwd: runnable.args.workspaceRoot || '.', env: definition.env, }; const exec = new vscode.ShellExecution( From e2ae1cd21c0dab584d49ad6a51620ef7032a8d94 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Jun 2020 17:34:18 +0200 Subject: [PATCH 738/819] Spec better runnables --- rust-analyzer/editors/code/src/lsp_ext.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 73d57367..c51acfcc 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -56,7 +56,7 @@ export interface Runnable { executableArgs: string[]; }; } -export const runnables = new lc.RequestType("rust-analyzer/runnables"); +export const runnables = new lc.RequestType("experimental/runnables"); export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; From d80b609f21acd2aaab3f5ecd6ca565fe5580b5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Tue, 2 Jun 2020 12:24:33 +0300 Subject: [PATCH 739/819] Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default --- rust-analyzer/editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 75dbafc0..d8f4287f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -238,7 +238,7 @@ }, "rust-analyzer.cargo.allFeatures": { "type": "boolean", - "default": true, + "default": false, "description": "Activate all available features" }, "rust-analyzer.cargo.features": { @@ -319,7 +319,7 @@ }, "rust-analyzer.checkOnSave.allFeatures": { "type": "boolean", - "default": true, + "default": false, "markdownDescription": "Check with all features (will be passed as `--all-features`)" }, "rust-analyzer.inlayHints.enable": { From 6a58f49045a144b497be7668b4b97a01d45653a0 Mon Sep 17 00:00:00 2001 From: Mikhail Rakhmanov Date: Tue, 2 Jun 2020 22:21:48 +0200 Subject: [PATCH 740/819] Preliminary implementation of lazy CodeAssits --- rust-analyzer/editors/code/src/client.ts | 76 ++++++++++++---------- rust-analyzer/editors/code/src/commands.ts | 19 +++++- rust-analyzer/editors/code/src/lsp_ext.ts | 7 ++ rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 65 insertions(+), 38 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index d64f9a3f..a25091f7 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -1,8 +1,11 @@ import * as lc from 'vscode-languageclient'; import * as vscode from 'vscode'; +import * as ra from '../src/lsp_ext'; +import * as Is from 'vscode-languageclient/lib/utils/is'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; +import { assert } from './util'; export function createClient(serverPath: string, cwd: string): lc.LanguageClient { // '.' Is the fallback if no folder is open @@ -32,6 +35,8 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient if (res === undefined) throw new Error('busy'); return res; }, + // Using custom handling of CodeActions where each code action is resloved lazily + // That's why we are not waiting for any command or edits async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) { const params: lc.CodeActionParams = { textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), @@ -43,32 +48,38 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient const result: (vscode.CodeAction | vscode.Command)[] = []; const groups = new Map(); for (const item of values) { + // In our case we expect to get code edits only from diagnostics if (lc.CodeAction.is(item)) { + assert(!item.command, "We don't expect to receive commands in CodeActions"); const action = client.protocol2CodeConverter.asCodeAction(item); - const group = actionGroup(item); - if (isSnippetEdit(item) || group) { - action.command = { - command: "rust-analyzer.applySnippetWorkspaceEdit", - title: "", - arguments: [action.edit], - }; - action.edit = undefined; - } - - if (group) { - let entry = groups.get(group); - if (!entry) { - entry = { index: result.length, items: [] }; - groups.set(group, entry); - result.push(action); - } - entry.items.push(action); - } else { + result.push(action); + continue; + } + assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here"); + const action = new vscode.CodeAction(item.title); + const group = (item as any).group; + const id = (item as any).id; + const resolveParams: ra.ResolveCodeActionParams = { + id: id, + // TODO: delete after discussions if needed + label: item.title, + codeActionParams: params + }; + action.command = { + command: "rust-analyzer.resolveCodeAction", + title: item.title, + arguments: [resolveParams], + }; + if (group) { + let entry = groups.get(group); + if (!entry) { + entry = { index: result.length, items: [] }; + groups.set(group, entry); result.push(action); } + entry.items.push(action); } else { - const command = client.protocol2CodeConverter.asCommand(item); - result.push(command); + result.push(action); } } for (const [group, { index, items }] of groups) { @@ -80,7 +91,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient command: "rust-analyzer.applyActionGroup", title: "", arguments: [items.map((item) => { - return { label: item.title, edit: item.command!!.arguments!![0] }; + return { label: item.title, arguments: item.command!!.arguments!![0] }; })], }; result[index] = action; @@ -119,24 +130,17 @@ class ExperimentalFeatures implements lc.StaticFeature { const caps: any = capabilities.experimental ?? {}; caps.snippetTextEdit = true; caps.codeActionGroup = true; + caps.resolveCodeAction = true; capabilities.experimental = caps; } initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { } } -function isSnippetEdit(action: lc.CodeAction): boolean { - const documentChanges = action.edit?.documentChanges ?? []; - for (const edit of documentChanges) { - if (lc.TextDocumentEdit.is(edit)) { - if (edit.edits.some((indel) => (indel as any).insertTextFormat === lc.InsertTextFormat.Snippet)) { - return true; - } - } - } - return false; -} - -function actionGroup(action: lc.CodeAction): string | undefined { - return (action as any).group; +function isCodeActionWithoutEditsAndCommands(value: any): boolean { + const candidate: lc.CodeAction = value; + return candidate && Is.string(candidate.title) && + (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, lc.Diagnostic.is)) && + (candidate.kind === void 0 || Is.string(candidate.kind)) && + (candidate.edit === void 0 && candidate.command === void 0); } diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 534d2a98..3e9c3aa0 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -343,10 +343,25 @@ export function showReferences(ctx: Ctx): Cmd { } export function applyActionGroup(_ctx: Ctx): Cmd { - return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => { + return async (actions: { label: string; arguments: ra.ResolveCodeActionParams }[]) => { const selectedAction = await vscode.window.showQuickPick(actions); if (!selectedAction) return; - await applySnippetWorkspaceEdit(selectedAction.edit); + vscode.commands.executeCommand( + 'rust-analyzer.resolveCodeAction', + selectedAction.arguments, + ); + }; +} + +export function resolveCodeAction(ctx: Ctx): Cmd { + const client = ctx.client; + return async (params: ra.ResolveCodeActionParams) => { + const item: lc.WorkspaceEdit = await client.sendRequest(ra.resolveCodeAction, params); + if (!item) { + return; + } + const edit = client.protocol2CodeConverter.asWorkspaceEdit(item); + await applySnippetWorkspaceEdit(edit); }; } diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 3e0b6069..f881bae4 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -33,6 +33,13 @@ export const matchingBrace = new lc.RequestType("experimental/parentModule"); +export interface ResolveCodeActionParams { + id: string; + label: string; + codeActionParams: lc.CodeActionParams; +} +export const resolveCodeAction = new lc.RequestType('experimental/resolveCodeAction'); + export interface JoinLinesParams { textDocument: lc.TextDocumentIdentifier; ranges: lc.Range[]; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index b7337621..a92c676f 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -98,6 +98,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('debugSingle', commands.debugSingle); ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); + ctx.registerCommand('resolveCodeAction', commands.resolveCodeAction); ctx.registerCommand('applyActionGroup', commands.applyActionGroup); ctx.pushCleanup(activateTaskProvider(workspaceFolder)); From 5d6501e30b84e4219c5d7061d55081bf2d61e156 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 3 Jun 2020 14:48:38 +0200 Subject: [PATCH 741/819] Document rust-project.json --- rust-analyzer/editors/code/package.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index d8f4287f..30ab7ba4 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -475,6 +475,25 @@ "markdownDescription": "Whether to show Implementations lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true + }, + "rust-analyzer.linkedProjects": { + "markdownDescription": [ + "Disable project auto-discovery in favor of explicitly specified set of projects.", + "Elements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format" + ], + "type": "array", + "items": { + "type": [ + "string", + "object" + ] + }, + "default": null + }, + "rust-analyzer.withSysroot": { + "markdownDescription": "Internal config for debugging, disables loading of sysroot crates", + "type": "boolean", + "default": true } } }, From 3ca7e74ec974ea4b770b4f62c418fa1b4c52e12f Mon Sep 17 00:00:00 2001 From: Mikhail Rakhmanov Date: Wed, 3 Jun 2020 18:39:01 +0200 Subject: [PATCH 742/819] Fix review comments --- rust-analyzer/editors/code/src/client.ts | 2 -- rust-analyzer/editors/code/src/lsp_ext.ts | 1 - 2 files changed, 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index a25091f7..40ad1e3c 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -61,8 +61,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient const id = (item as any).id; const resolveParams: ra.ResolveCodeActionParams = { id: id, - // TODO: delete after discussions if needed - label: item.title, codeActionParams: params }; action.command = { diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 35d73ce3..9793b926 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -35,7 +35,6 @@ export const parentModule = new lc.RequestType('experimental/resolveCodeAction'); From 7458b4dce68272a57cd8544def290007edb75493 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 3 Jun 2020 14:15:54 +0300 Subject: [PATCH 743/819] Add hover actions as LSP extension --- rust-analyzer/editors/code/package.json | 16 ++++++-- rust-analyzer/editors/code/src/client.ts | 45 +++++++++++++++++++++++ rust-analyzer/editors/code/src/config.ts | 13 +++++-- rust-analyzer/editors/code/src/lsp_ext.ts | 12 ++++++ 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 30ab7ba4..b9c57db3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -462,17 +462,27 @@ "default": true }, "rust-analyzer.lens.run": { - "markdownDescription": "Whether to show Run lens. Only applies when `#rust-analyzer.lens.enable#` is set.", + "markdownDescription": "Whether to show `Run` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true }, "rust-analyzer.lens.debug": { - "markdownDescription": "Whether to show Debug lens. Only applies when `#rust-analyzer.lens.enable#` is set.", + "markdownDescription": "Whether to show `Debug` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", "type": "boolean", "default": true }, "rust-analyzer.lens.implementations": { - "markdownDescription": "Whether to show Implementations lens. Only applies when `#rust-analyzer.lens.enable#` is set.", + "markdownDescription": "Whether to show `Implementations` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", + "type": "boolean", + "default": true + }, + "rust-analyzer.hoverActions.enable": { + "description": "Whether to show HoverActions in Rust files.", + "type": "boolean", + "default": true + }, + "rust-analyzer.hoverActions.implementations": { + "markdownDescription": "Whether to show `Implementations` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", "type": "boolean", "default": true }, diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 40ad1e3c..9df67028 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -7,6 +7,29 @@ import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.pr import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; import { assert } from './util'; +function toTrusted(obj: vscode.MarkedString): vscode.MarkedString { + const md = obj; + if (md && md.value.includes("```rust")) { + md.isTrusted = true; + return md; + } + return obj; +} + +function renderCommand(cmd: CommandLink) { + return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; +} + +function renderHoverActions(actions: CommandLinkGroup[]): vscode.MarkdownString { + const text = actions.map(group => + (group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ') + ).join('___'); + + const result = new vscode.MarkdownString(text); + result.isTrusted = true; + return result; +} + export function createClient(serverPath: string, cwd: string): lc.LanguageClient { // '.' Is the fallback if no folder is open // TODO?: Workspace folders support Uri's (eg: file://test.txt). @@ -35,6 +58,27 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient if (res === undefined) throw new Error('busy'); return res; }, + async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, _next: lc.ProvideHoverSignature) { + return client.sendRequest(lc.HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then( + (result) => { + const hover = client.protocol2CodeConverter.asHover(result); + if (hover) { + // Workaround to support command links (trusted vscode.MarkdownString) in hovers + // https://github.com/microsoft/vscode/issues/33577 + hover.contents = hover.contents.map(toTrusted); + + const actions = (result).actions; + if (actions) { + hover.contents.push(renderHoverActions(actions)); + } + } + return hover; + }, + (error) => { + client.logFailedRequest(lc.HoverRequest.type, error); + return Promise.resolve(null); + }); + }, // Using custom handling of CodeActions where each code action is resloved lazily // That's why we are not waiting for any command or edits async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) { @@ -129,6 +173,7 @@ class ExperimentalFeatures implements lc.StaticFeature { caps.snippetTextEdit = true; caps.codeActionGroup = true; caps.resolveCodeAction = true; + caps.hoverActions = true; capabilities.experimental = caps; } initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index e8abf828..d8f0037d 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -16,10 +16,8 @@ export class Config { "files", "highlighting", "updates.channel", - "lens.enable", - "lens.run", - "lens.debug", - "lens.implementations", + "lens", // works as lens.* + "hoverActions", // works as hoverActions.* ] .map(opt => `${this.rootSection}.${opt}`); @@ -132,4 +130,11 @@ export class Config { implementations: this.get("lens.implementations"), }; } + + get hoverActions() { + return { + enable: this.get("hoverActions.enable"), + implementations: this.get("hoverActions.implementations"), + }; + } } diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 9793b926..e16ea799 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -90,3 +90,15 @@ export interface SsrParams { parseOnly: boolean; } export const ssr = new lc.RequestType('experimental/ssr'); + +export interface CommandLink extends lc.Command { + /** + * A tooltip for the command, when represented in the UI. + */ + tooltip?: string; +} + +export interface CommandLinkGroup { + title?: string; + commands: CommandLink[]; +} From df4ce07fd37fc6be38b7e96d776a29b918a7f17f Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 3 Jun 2020 14:34:11 +0300 Subject: [PATCH 744/819] Add hover actions LSP extension documentation. --- rust-analyzer/editors/code/src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 9df67028..f2094b5c 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -66,7 +66,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient // Workaround to support command links (trusted vscode.MarkdownString) in hovers // https://github.com/microsoft/vscode/issues/33577 hover.contents = hover.contents.map(toTrusted); - + const actions = (result).actions; if (actions) { hover.contents.push(renderHoverActions(actions)); From 95c8e53995727b20b4e1141ddf5356a75cfe5228 Mon Sep 17 00:00:00 2001 From: vsrs Date: Fri, 5 Jun 2020 15:25:01 +0300 Subject: [PATCH 745/819] Remove hover contents marking as trusted. Hover contents might be extracted from raw doc comments and need some validation. --- rust-analyzer/editors/code/src/client.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index f2094b5c..65ad573d 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -7,20 +7,11 @@ import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.pr import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; import { assert } from './util'; -function toTrusted(obj: vscode.MarkedString): vscode.MarkedString { - const md = obj; - if (md && md.value.includes("```rust")) { - md.isTrusted = true; - return md; - } - return obj; -} - -function renderCommand(cmd: CommandLink) { +function renderCommand(cmd: ra.CommandLink) { return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; } -function renderHoverActions(actions: CommandLinkGroup[]): vscode.MarkdownString { +function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString { const text = actions.map(group => (group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ') ).join('___'); @@ -63,10 +54,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient (result) => { const hover = client.protocol2CodeConverter.asHover(result); if (hover) { - // Workaround to support command links (trusted vscode.MarkdownString) in hovers - // https://github.com/microsoft/vscode/issues/33577 - hover.contents = hover.contents.map(toTrusted); - const actions = (result).actions; if (actions) { hover.contents.push(renderHoverActions(actions)); From ea2c73b356aed91db8d9d2790c3c08a6b900083a Mon Sep 17 00:00:00 2001 From: vsrs Date: Sat, 6 Jun 2020 15:12:17 +0300 Subject: [PATCH 746/819] Fix Run lens. --- rust-analyzer/editors/code/src/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 5c790741..bb060cfe 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -110,7 +110,7 @@ export function createTask(runnable: ra.Runnable): vscode.Task { switch (runnable.kind) { case "cargo": command = toolchain.getPathForExecutable("cargo"); } - const args = runnable.args.cargoArgs; + const args = [...runnable.args.cargoArgs]; // should be a copy! if (runnable.args.executableArgs.length > 0) { args.push('--', ...runnable.args.executableArgs); } From dfd816ec041e18373c6874c9c030043c439c9c6c Mon Sep 17 00:00:00 2001 From: vsrs Date: Sat, 6 Jun 2020 14:30:29 +0300 Subject: [PATCH 747/819] Add Run|Debug hover actions --- rust-analyzer/editors/code/package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9c57db3..7fdb5c27 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -486,6 +486,16 @@ "type": "boolean", "default": true }, + "rust-analyzer.hoverActions.run": { + "markdownDescription": "Whether to show `Run` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", + "type": "boolean", + "default": true + }, + "rust-analyzer.hoverActions.debug": { + "markdownDescription": "Whether to show `Debug` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", + "type": "boolean", + "default": true + }, "rust-analyzer.linkedProjects": { "markdownDescription": [ "Disable project auto-discovery in favor of explicitly specified set of projects.", From d21e8a7affba11776d001f73b707abd047786d6f Mon Sep 17 00:00:00 2001 From: Vincent Isambart Date: Sun, 7 Jun 2020 12:07:00 +0900 Subject: [PATCH 748/819] Fix VSCode settings --- rust-analyzer/editors/code/package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index b9c57db3..859ab447 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -487,10 +487,7 @@ "default": true }, "rust-analyzer.linkedProjects": { - "markdownDescription": [ - "Disable project auto-discovery in favor of explicitly specified set of projects.", - "Elements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format" - ], + "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects. \nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format", "type": "array", "items": { "type": [ From 93a6a23a718caa08787afba615258f1c90f7fc97 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Wed, 10 Jun 2020 08:51:11 +0200 Subject: [PATCH 749/819] Added the rust-analyzer.checkOnSave.features option. --- rust-analyzer/editors/code/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 779d7e1b..6389499e 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -322,6 +322,14 @@ "default": false, "markdownDescription": "Check with all features (will be passed as `--all-features`)" }, + "rust-analyzer.checkOnSave.features": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "List of features to activate. Set to `rust-analyzer.cargo.features` if empty." + }, "rust-analyzer.inlayHints.enable": { "type": "boolean", "default": true, From 6904db044b591026903022edfe6aadbc27c44a76 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Wed, 10 Jun 2020 09:27:25 +0200 Subject: [PATCH 750/819] Most of the checkOnSafe options now default to the cargo equivalent. --- rust-analyzer/editors/code/package.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 6389499e..647c8368 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -318,9 +318,12 @@ "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" }, "rust-analyzer.checkOnSave.allFeatures": { - "type": "boolean", - "default": false, - "markdownDescription": "Check with all features (will be passed as `--all-features`)" + "type": [ + "null", + "boolean" + ], + "default": null, + "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `rust-analyzer.cargo.allFeatures`." }, "rust-analyzer.checkOnSave.features": { "type": "array", @@ -328,7 +331,7 @@ "type": "string" }, "default": [], - "description": "List of features to activate. Set to `rust-analyzer.cargo.features` if empty." + "description": "List of features to activate. Defaults to `rust-analyzer.cargo.features`." }, "rust-analyzer.inlayHints.enable": { "type": "boolean", From 628c0f242a7be3a2c06c647b8b1fd7adcd9de299 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Wed, 10 Jun 2020 09:37:26 +0200 Subject: [PATCH 751/819] checkOnSafe.features and checkOnSafe.allFeatures now work identically. --- rust-analyzer/editors/code/package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 647c8368..e2027970 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -326,11 +326,14 @@ "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `rust-analyzer.cargo.allFeatures`." }, "rust-analyzer.checkOnSave.features": { - "type": "array", + "type": [ + "null", + "array" + ], "items": { "type": "string" }, - "default": [], + "default": null, "description": "List of features to activate. Defaults to `rust-analyzer.cargo.features`." }, "rust-analyzer.inlayHints.enable": { From 3a94b2c4982e6a6089b2180817a0244c463cb428 Mon Sep 17 00:00:00 2001 From: Gabriel Valfridsson Date: Tue, 16 Jun 2020 22:26:33 +0200 Subject: [PATCH 752/819] Warnings as hint or info --- rust-analyzer/editors/code/package.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e2027970..3acc375f 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -525,6 +525,24 @@ "markdownDescription": "Internal config for debugging, disables loading of sysroot crates", "type": "boolean", "default": true + }, + "rust-analyzer.diagnostics.warningsAsInfo": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "description": "List of warnings that should be displayed with info severity.\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the problems panel.", + "default": [] + }, + "rust-analyzer.diagnostics.warningsAsHint": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in te problems panel.", + "default": [] } } }, From dbf91e13ed119cf940967fa9ce205052e36fbb88 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 10 Jun 2020 16:15:28 +0300 Subject: [PATCH 753/819] Fix rust-analyzer.debug.openDebugPane option --- rust-analyzer/editors/code/src/config.ts | 2 +- rust-analyzer/editors/code/src/debug.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index d8f0037d..22ebdf63 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -117,7 +117,7 @@ export class Config { return { engine: this.get("debug.engine"), engineSettings: this.get("debug.engineSettings"), - openUpDebugPane: this.get("debug.openUpDebugPane"), + openDebugPane: this.get("debug.openDebugPane"), sourceFileMap: sourceFileMap }; } diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index a0c9b3ab..61c12dbe 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -82,7 +82,7 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise Date: Wed, 10 Jun 2020 23:01:19 +0300 Subject: [PATCH 754/819] Add `rust-analyzer.gotoLocation` command --- rust-analyzer/editors/code/package.json | 5 +++++ rust-analyzer/editors/code/src/commands.ts | 14 ++++++++++++++ rust-analyzer/editors/code/src/config.ts | 3 +++ rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 23 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 3acc375f..e6ceb235 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -510,6 +510,11 @@ "type": "boolean", "default": true }, + "rust-analyzer.hoverActions.gotoTypeDef": { + "markdownDescription": "Whether to show `Go to Type Definition` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", + "type": "boolean", + "default": true + }, "rust-analyzer.linkedProjects": { "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects. \nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format", "type": "array", diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 3e9c3aa0..48a25495 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -353,6 +353,20 @@ export function applyActionGroup(_ctx: Ctx): Cmd { }; } +export function gotoLocation(ctx: Ctx): Cmd { + return async (locationLink: lc.LocationLink) => { + const client = ctx.client; + if (client) { + const uri = client.protocol2CodeConverter.asUri(locationLink.targetUri); + let range = client.protocol2CodeConverter.asRange(locationLink.targetSelectionRange); + // collapse the range to a cursor position + range = range.with({ end: range.start }); + + await vscode.window.showTextDocument(uri, { selection: range }); + } + }; +} + export function resolveCodeAction(ctx: Ctx): Cmd { const client = ctx.client; return async (params: ra.ResolveCodeActionParams) => { diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 22ebdf63..9591d4fe 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -135,6 +135,9 @@ export class Config { return { enable: this.get("hoverActions.enable"), implementations: this.get("hoverActions.implementations"), + run: this.get("hoverActions.run"), + debug: this.get("hoverActions.debug"), + gotoTypeDef: this.get("hoverActions.gotoTypeDef"), }; } } diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a92c676f..270fbcb6 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -100,6 +100,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); ctx.registerCommand('resolveCodeAction', commands.resolveCodeAction); ctx.registerCommand('applyActionGroup', commands.applyActionGroup); + ctx.registerCommand('gotoLocation', commands.gotoLocation); ctx.pushCleanup(activateTaskProvider(workspaceFolder)); From ba6dfc656fc82fc75c1778463218df070db9649f Mon Sep 17 00:00:00 2001 From: veetaha Date: Sun, 10 May 2020 18:35:33 +0300 Subject: [PATCH 755/819] Migrate flycheck to fully-lsp-compatible progress reports (introduce ra_progress crate) --- rust-analyzer/editors/code/src/main.ts | 3 - .../editors/code/src/status_display.ts | 100 ------------------ 2 files changed, 103 deletions(-) delete mode 100644 rust-analyzer/editors/code/src/status_display.ts diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a92c676f..16a94fce 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -5,7 +5,6 @@ import { promises as fs, PathLike } from "fs"; import * as commands from './commands'; import { activateInlayHints } from './inlay_hints'; -import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { Config, NIGHTLY_TAG } from './config'; import { log, assert, isValidExecutable } from './util'; @@ -103,8 +102,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.pushCleanup(activateTaskProvider(workspaceFolder)); - activateStatusDisplay(ctx); - activateInlayHints(ctx); vscode.workspace.onDidChangeConfiguration( diff --git a/rust-analyzer/editors/code/src/status_display.ts b/rust-analyzer/editors/code/src/status_display.ts deleted file mode 100644 index f9cadc8a..00000000 --- a/rust-analyzer/editors/code/src/status_display.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as vscode from 'vscode'; - -import { WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd, Disposable } from 'vscode-languageclient'; - -import { Ctx } from './ctx'; - -const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; - -export function activateStatusDisplay(ctx: Ctx) { - const statusDisplay = new StatusDisplay(ctx.config.checkOnSave.command); - ctx.pushCleanup(statusDisplay); - const client = ctx.client; - if (client != null) { - ctx.pushCleanup(client.onProgress( - WorkDoneProgress.type, - 'rustAnalyzer/cargoWatcher', - params => statusDisplay.handleProgressNotification(params) - )); - } -} - -class StatusDisplay implements Disposable { - packageName?: string; - - private i: number = 0; - private statusBarItem: vscode.StatusBarItem; - private command: string; - private timer?: NodeJS.Timeout; - - constructor(command: string) { - this.statusBarItem = vscode.window.createStatusBarItem( - vscode.StatusBarAlignment.Left, - 10, - ); - this.command = command; - this.statusBarItem.hide(); - } - - show() { - this.packageName = undefined; - - this.timer = - this.timer || - setInterval(() => { - this.tick(); - this.refreshLabel(); - }, 300); - - this.statusBarItem.show(); - } - - hide() { - if (this.timer) { - clearInterval(this.timer); - this.timer = undefined; - } - - this.statusBarItem.hide(); - } - - dispose() { - if (this.timer) { - clearInterval(this.timer); - this.timer = undefined; - } - - this.statusBarItem.dispose(); - } - - refreshLabel() { - if (this.packageName) { - this.statusBarItem.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`; - } else { - this.statusBarItem.text = `${spinnerFrames[this.i]} cargo ${this.command}`; - } - } - - handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) { - switch (params.kind) { - case 'begin': - this.show(); - break; - - case 'report': - if (params.message) { - this.packageName = params.message; - this.refreshLabel(); - } - break; - - case 'end': - this.hide(); - break; - } - } - - private tick() { - this.i = (this.i + 1) % spinnerFrames.length; - } -} From e802ac0a502ab97c385fd80466cbc6a5019dda6f Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 19 Jun 2020 20:52:06 +0300 Subject: [PATCH 756/819] Update workaround comment --- rust-analyzer/editors/code/src/net.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index 49221393..f0b08542 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -124,8 +124,7 @@ async function downloadFile( return new Promise(resolve => { destFileStream.on("close", resolve); destFileStream.destroy(); - - // Details on workaround: https://github.com/rust-analyzer/rust-analyzer/pull/3092#discussion_r378191131 - // Issue at nodejs repo: https://github.com/nodejs/node/issues/31776 + // This workaround is awaiting to be removed when vscode moves to newer nodejs version: + // https://github.com/rust-analyzer/rust-analyzer/issues/3167 }); } From fa1691a664e0b4e14ea8110e6d4527fddd9719b6 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 20 Jun 2020 15:38:08 +0300 Subject: [PATCH 757/819] Download artifacts into tmp dir --- rust-analyzer/editors/code/src/main.ts | 16 +++++++- rust-analyzer/editors/code/src/net.ts | 55 +++++++++++++++++++++----- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 270fbcb6..670f2ebf 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -42,7 +42,16 @@ export async function activate(context: vscode.ExtensionContext) { const config = new Config(context); const state = new PersistentState(context.globalState); - const serverPath = await bootstrap(config, state); + const serverPath = await bootstrap(config, state).catch(err => { + let message = "Failed to bootstrap rust-analyzer."; + if (err.code === "EBUSY" || err.code === "ETXTBSY") { + message += " Other vscode windows might be using rust-analyzer, " + + "you should close them and reload this window to retry."; + } + message += " Open \"Help > Toggle Developer Tools > Console\" to see the logs"; + log.error("Bootstrap error", err); + throw new Error(message); + }); const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; if (workspaceFolder === undefined) { @@ -285,6 +294,11 @@ async function getServer(config: Config, state: PersistentState): Promise artifact.name === binaryName); assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); + // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. + await fs.unlink(dest).catch(err => { + if (err.code !== "ENOENT") throw err; + }); + await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 }); // Patching executable if that's NixOS. diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index f0b08542..0e7dd29c 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -1,7 +1,9 @@ import fetch from "node-fetch"; import * as vscode from "vscode"; -import * as fs from "fs"; import * as stream from "stream"; +import * as fs from "fs"; +import * as os from "os"; +import * as path from "path"; import * as util from "util"; import { log, assert } from "./util"; @@ -87,7 +89,7 @@ export async function download( } /** - * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`. + * Downloads file from `url` and stores it at `destFilePath` with `mode` (unix permissions). * `onProgress` callback is called on recieveing each chunk of bytes * to track the progress of downloading, it gets the already read and total * amount of bytes to read as its parameters. @@ -118,13 +120,46 @@ async function downloadFile( onProgress(readBytes, totalBytes); }); - const destFileStream = fs.createWriteStream(destFilePath, { mode }); - - await pipeline(res.body, destFileStream); - return new Promise(resolve => { - destFileStream.on("close", resolve); - destFileStream.destroy(); - // This workaround is awaiting to be removed when vscode moves to newer nodejs version: - // https://github.com/rust-analyzer/rust-analyzer/issues/3167 + // Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode + await withTempFile(async tempFilePath => { + const destFileStream = fs.createWriteStream(tempFilePath, { mode }); + await pipeline(res.body, destFileStream); + await new Promise(resolve => { + destFileStream.on("close", resolve); + destFileStream.destroy(); + // This workaround is awaiting to be removed when vscode moves to newer nodejs version: + // https://github.com/rust-analyzer/rust-analyzer/issues/3167 + }); + await moveFile(tempFilePath, destFilePath); }); } + +async function withTempFile(scope: (tempFilePath: string) => Promise) { + // Based on the great article: https://advancedweb.hu/secure-tempfiles-in-nodejs-without-dependencies/ + + // `.realpath()` should handle the cases where os.tmpdir() contains symlinks + const osTempDir = await fs.promises.realpath(os.tmpdir()); + + const tempDir = await fs.promises.mkdtemp(path.join(osTempDir, "rust-analyzer")); + + try { + return await scope(path.join(tempDir, "file")); + } finally { + // We are good citizens :D + void fs.promises.rmdir(tempDir, { recursive: true }).catch(log.error); + } +}; + +async function moveFile(src: fs.PathLike, dest: fs.PathLike) { + try { + await fs.promises.rename(src, dest); + } catch (err) { + if (err.code === 'EXDEV') { + // We are probably moving the file across partitions/devices + await fs.promises.copyFile(src, dest); + await fs.promises.unlink(src); + } else { + log.error(`Failed to rename the file ${src} -> ${dest}`, err); + } + } +} From 0b4bc6383250e4a494e0ae3ecd055ce783ebae51 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 22 Jun 2020 19:50:57 +0300 Subject: [PATCH 758/819] Hotfix skipping the first chunks of the artifacts --- rust-analyzer/editors/code/src/net.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index 0e7dd29c..9debdc57 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -114,15 +114,16 @@ async function downloadFile( log.debug("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); - let readBytes = 0; - res.body.on("data", (chunk: Buffer) => { - readBytes += chunk.length; - onProgress(readBytes, totalBytes); - }); - // Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode await withTempFile(async tempFilePath => { const destFileStream = fs.createWriteStream(tempFilePath, { mode }); + + let readBytes = 0; + res.body.on("data", (chunk: Buffer) => { + readBytes += chunk.length; + onProgress(readBytes, totalBytes); + }); + await pipeline(res.body, destFileStream); await new Promise(resolve => { destFileStream.on("close", resolve); From 9e62c7748aa216b5983bb1ad2d51aefd7386504d Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 22 Jun 2020 21:18:36 +0300 Subject: [PATCH 759/819] Make bootstrap error message more informative and better-fitting --- rust-analyzer/editors/code/src/main.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 670f2ebf..30175473 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -43,12 +43,16 @@ export async function activate(context: vscode.ExtensionContext) { const config = new Config(context); const state = new PersistentState(context.globalState); const serverPath = await bootstrap(config, state).catch(err => { - let message = "Failed to bootstrap rust-analyzer."; + let message = "bootstrap error. "; + if (err.code === "EBUSY" || err.code === "ETXTBSY") { - message += " Other vscode windows might be using rust-analyzer, " + - "you should close them and reload this window to retry."; + message += "Other vscode windows might be using rust-analyzer, "; + message += "you should close them and reload this window to retry. "; } - message += " Open \"Help > Toggle Developer Tools > Console\" to see the logs"; + + message += 'Open "Help > Toggle Developer Tools > Console" to see the logs '; + message += '(enable verbose logs with "rust-analyzer.trace.extension")'; + log.error("Bootstrap error", err); throw new Error(message); }); From cce6168dc6eeedc6fd328badd9c291c6829b5f5e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 22 Jun 2020 20:53:17 +0300 Subject: [PATCH 760/819] Never disable error logging on the frontend --- rust-analyzer/editors/code/src/util.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index fe3fb71c..fec4c329 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -26,7 +26,6 @@ export const log = new class { } error(message?: any, ...optionalParams: any[]): void { - if (!log.enabled) return; debugger; // eslint-disable-next-line no-console console.error(message, ...optionalParams); From f7e0b7db6d30840f3889bed4baac2f70783240f1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 22 Jun 2020 21:36:56 +0300 Subject: [PATCH 761/819] Decouple http file stream logic from temp dir logic --- rust-analyzer/editors/code/src/main.ts | 13 +++- rust-analyzer/editors/code/src/net.ts | 88 ++++++++++++++------------ 2 files changed, 57 insertions(+), 44 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 670f2ebf..7bae8bb3 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -178,7 +178,11 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); - await download(artifact.browser_download_url, dest, "Downloading rust-analyzer extension"); + await download({ + url: artifact.browser_download_url, + dest, + progressTitle: "Downloading rust-analyzer extension", + }); await vscode.commands.executeCommand("workbench.extensions.installExtension", vscode.Uri.file(dest)); await fs.unlink(dest); @@ -299,7 +303,12 @@ async function getServer(config: Config, state: PersistentState): Promise true).catch(_ => false)) { diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index 9debdc57..e02fd6d4 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -60,32 +60,40 @@ export interface GithubRelease { }>; } +interface DownloadOpts { + progressTitle: string; + url: string; + dest: string; + mode?: number; +} -export async function download( - downloadUrl: string, - destinationPath: string, - progressTitle: string, - { mode }: { mode?: number } = {}, -) { - await vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - cancellable: false, - title: progressTitle - }, - async (progress, _cancellationToken) => { - let lastPercentage = 0; - await downloadFile(downloadUrl, destinationPath, mode, (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPercentage +export async function download(opts: DownloadOpts) { + // Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode + await withTempDir(async tempDir => { + const tempFile = path.join(tempDir, path.basename(opts.dest)); + + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, + title: opts.progressTitle + }, + async (progress, _cancellationToken) => { + let lastPercentage = 0; + await downloadFile(opts.url, tempFile, opts.mode, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPercentage + }); + + lastPercentage = newPercentage; }); + } + ); - lastPercentage = newPercentage; - }); - } - ); + await moveFile(tempFile, opts.dest); + }); } /** @@ -114,28 +122,23 @@ async function downloadFile( log.debug("Downloading file of", totalBytes, "bytes size from", url, "to", destFilePath); - // Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode - await withTempFile(async tempFilePath => { - const destFileStream = fs.createWriteStream(tempFilePath, { mode }); - - let readBytes = 0; - res.body.on("data", (chunk: Buffer) => { - readBytes += chunk.length; - onProgress(readBytes, totalBytes); - }); + let readBytes = 0; + res.body.on("data", (chunk: Buffer) => { + readBytes += chunk.length; + onProgress(readBytes, totalBytes); + }); - await pipeline(res.body, destFileStream); - await new Promise(resolve => { - destFileStream.on("close", resolve); - destFileStream.destroy(); - // This workaround is awaiting to be removed when vscode moves to newer nodejs version: - // https://github.com/rust-analyzer/rust-analyzer/issues/3167 - }); - await moveFile(tempFilePath, destFilePath); + const destFileStream = fs.createWriteStream(destFilePath, { mode }); + await pipeline(res.body, destFileStream); + await new Promise(resolve => { + destFileStream.on("close", resolve); + destFileStream.destroy(); + // This workaround is awaiting to be removed when vscode moves to newer nodejs version: + // https://github.com/rust-analyzer/rust-analyzer/issues/3167 }); } -async function withTempFile(scope: (tempFilePath: string) => Promise) { +async function withTempDir(scope: (tempDirPath: string) => Promise) { // Based on the great article: https://advancedweb.hu/secure-tempfiles-in-nodejs-without-dependencies/ // `.realpath()` should handle the cases where os.tmpdir() contains symlinks @@ -144,7 +147,7 @@ async function withTempFile(scope: (tempFilePath: string) => Promise) { const tempDir = await fs.promises.mkdtemp(path.join(osTempDir, "rust-analyzer")); try { - return await scope(path.join(tempDir, "file")); + return await scope(tempDir); } finally { // We are good citizens :D void fs.promises.rmdir(tempDir, { recursive: true }).catch(log.error); @@ -161,6 +164,7 @@ async function moveFile(src: fs.PathLike, dest: fs.PathLike) { await fs.promises.unlink(src); } else { log.error(`Failed to rename the file ${src} -> ${dest}`, err); + throw err; } } } From 586fac02deba9b81f440638d32db24a90544d826 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 22 Jun 2020 23:57:36 +0300 Subject: [PATCH 762/819] Disrecommend trace.server: "verbose" for regular users --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index e6ceb235..68484a37 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -426,7 +426,7 @@ "Full log" ], "default": "off", - "description": "Trace requests to the rust-analyzer" + "description": "Trace requests to the rust-analyzer (this is usually overly verbose and not recommended for regular users)" }, "rust-analyzer.trace.extension": { "description": "Enable logging of VS Code extensions itself", From d6b0e5443395fe3bee212283d748ca8de03f83c7 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 18 Jun 2020 22:20:13 +0300 Subject: [PATCH 763/819] Add custom cargo runners --- rust-analyzer/editors/code/package.json | 8 +++ rust-analyzer/editors/code/src/commands.ts | 4 +- rust-analyzer/editors/code/src/config.ts | 4 ++ rust-analyzer/editors/code/src/main.ts | 2 +- rust-analyzer/editors/code/src/run.ts | 57 +++++++--------------- rust-analyzer/editors/code/src/tasks.ts | 54 +++++++++++++++----- 6 files changed, 73 insertions(+), 56 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 68484a37..f542a490 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -336,6 +336,14 @@ "default": null, "description": "List of features to activate. Defaults to `rust-analyzer.cargo.features`." }, + "rust-analyzer.cargoRunner": { + "type": [ + "null", + "string" + ], + "default": null, + "description": "Custom cargo runner extension ID." + }, "rust-analyzer.inlayHints.enable": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 48a25495..8c9d7802 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -394,7 +394,7 @@ export function run(ctx: Ctx): Cmd { item.detail = 'rerun'; prevRunnable = item; - const task = createTask(item.runnable); + const task = await createTask(item.runnable, ctx.config); return await vscode.tasks.executeTask(task); }; } @@ -404,7 +404,7 @@ export function runSingle(ctx: Ctx): Cmd { const editor = ctx.activeRustEditor; if (!editor) return; - const task = createTask(runnable); + const task = await createTask(runnable, ctx.config); task.group = vscode.TaskGroup.Build; task.presentationOptions = { reveal: vscode.TaskRevealKind.Always, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 9591d4fe..fc95a7de 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -110,6 +110,10 @@ export class Config { }; } + get cargoRunner() { + return this.get("cargoRunner"); + } + get debug() { // "/rustc/" used by suggestions only. const { ["/rustc/"]: _, ...sourceFileMap } = this.get>("debug.sourceFileMap"); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 12b4d051..5b4f453c 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -115,7 +115,7 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applyActionGroup', commands.applyActionGroup); ctx.registerCommand('gotoLocation', commands.gotoLocation); - ctx.pushCleanup(activateTaskProvider(workspaceFolder)); + ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config)); activateStatusDisplay(ctx); diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index bb060cfe..7ecdeeea 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -1,10 +1,11 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import * as ra from './lsp_ext'; -import * as toolchain from "./toolchain"; +import * as tasks from './tasks'; import { Ctx } from './ctx'; import { makeDebugConfig } from './debug'; +import { Config } from './config'; const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; @@ -95,52 +96,28 @@ export class RunnableQuickPick implements vscode.QuickPickItem { } } -interface CargoTaskDefinition extends vscode.TaskDefinition { - type: 'cargo'; - label: string; - command: string; - args: string[]; - env?: { [key: string]: string }; -} - -export function createTask(runnable: ra.Runnable): vscode.Task { - const TASK_SOURCE = 'Rust'; +export async function createTask(runnable: ra.Runnable, config: Config): Promise { + if (runnable.kind !== "cargo") { + // rust-analyzer supports only one kind, "cargo" + // do not use tasks.TASK_TYPE here, these are completely different meanings. - let command; - switch (runnable.kind) { - case "cargo": command = toolchain.getPathForExecutable("cargo"); + throw `Unexpected runnable kind: ${runnable.kind}`; } + const args = [...runnable.args.cargoArgs]; // should be a copy! if (runnable.args.executableArgs.length > 0) { args.push('--', ...runnable.args.executableArgs); } - const definition: CargoTaskDefinition = { - type: 'cargo', - label: runnable.label, - command, - args, + const definition: tasks.CargoTaskDefinition = { + type: tasks.TASK_TYPE, + command: args[0], // run, test, etc... + args: args.slice(1), + cwd: runnable.args.workspaceRoot, env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), }; - const execOption: vscode.ShellExecutionOptions = { - cwd: runnable.args.workspaceRoot || '.', - env: definition.env, - }; - const exec = new vscode.ShellExecution( - definition.command, - definition.args, - execOption, - ); - - const f = vscode.workspace.workspaceFolders![0]; - const t = new vscode.Task( - definition, - f, - definition.label, - TASK_SOURCE, - exec, - ['$rustc'], - ); - t.presentationOptions.clear = true; - return t; + const cargoTask = await tasks.buildCargoTask(definition, runnable.label, args, config.cargoRunner); + cargoTask.presentationOptions.clear = true; + + return cargoTask; } diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index 9748824d..e2c43fdd 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -1,11 +1,14 @@ import * as vscode from 'vscode'; import * as toolchain from "./toolchain"; +import { Config } from './config'; +import { log } from './util'; // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and // our configuration should be compatible with it so use the same key. -const TASK_TYPE = 'cargo'; +export const TASK_TYPE = 'cargo'; +export const TASK_SOURCE = 'rust'; -interface CargoTaskDefinition extends vscode.TaskDefinition { +export interface CargoTaskDefinition extends vscode.TaskDefinition { command?: string; args?: string[]; cwd?: string; @@ -14,9 +17,11 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { class CargoTaskProvider implements vscode.TaskProvider { private readonly target: vscode.WorkspaceFolder; + private readonly config: Config; - constructor(target: vscode.WorkspaceFolder) { + constructor(target: vscode.WorkspaceFolder, config: Config) { this.target = target; + this.config = config; } provideTasks(): vscode.Task[] { @@ -58,29 +63,52 @@ class CargoTaskProvider implements vscode.TaskProvider { }); } - resolveTask(task: vscode.Task): vscode.Task | undefined { + async resolveTask(task: vscode.Task): Promise { // VSCode calls this for every cargo task in the user's tasks.json, // we need to inform VSCode how to execute that command by creating // a ShellExecution for it. const definition = task.definition as CargoTaskDefinition; - if (definition.type === 'cargo' && definition.command) { + if (definition.type === TASK_TYPE && definition.command) { const args = [definition.command].concat(definition.args ?? []); - return new vscode.Task( - definition, - task.name, - 'rust', - new vscode.ShellExecution('cargo', args, definition), - ); + return await buildCargoTask(definition, task.name, args, this.config.cargoRunner); } return undefined; } } -export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { - const provider = new CargoTaskProvider(target); +export async function buildCargoTask(definition: CargoTaskDefinition, name: string, args: string[], customRunner?: string): Promise { + if (customRunner) { + const runnerCommand = `${customRunner}.createCargoTask`; + try { + const runnerArgs = { name, args, cwd: definition.cwd, env: definition.env, source: TASK_SOURCE }; + const task = await vscode.commands.executeCommand(runnerCommand, runnerArgs); + + if (task instanceof vscode.Task) { + return task; + } else if (task) { + log.debug("Invalid cargo task", task); + throw `Invalid task!`; + } + // fallback to default processing + + } catch (e) { + throw `Cargo runner '${customRunner}' failed! ${e}`; + } + } + + return new vscode.Task( + definition, + name, + TASK_SOURCE, + new vscode.ShellExecution(toolchain.cargoPath(), args, definition), + ); +} + +export function activateTaskProvider(target: vscode.WorkspaceFolder, config: Config): vscode.Disposable { + const provider = new CargoTaskProvider(target, config); return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); } From 62d2f5857d0b5057955999f0342eab3538dcbce0 Mon Sep 17 00:00:00 2001 From: vsrs Date: Fri, 19 Jun 2020 12:42:26 +0300 Subject: [PATCH 764/819] Switch to ShellExecution instead of full Task --- rust-analyzer/editors/code/src/run.ts | 3 +- rust-analyzer/editors/code/src/tasks.ts | 83 +++++++++++++------------ 2 files changed, 45 insertions(+), 41 deletions(-) diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 7ecdeeea..766b0511 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -116,7 +116,8 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), }; - const cargoTask = await tasks.buildCargoTask(definition, runnable.label, args, config.cargoRunner); + const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() + const cargoTask = await tasks.buildCargoTask(target, definition, runnable.label, args, config.cargoRunner, true); cargoTask.presentationOptions.clear = true; return cargoTask; diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index e2c43fdd..20ddb3a5 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -24,43 +24,28 @@ class CargoTaskProvider implements vscode.TaskProvider { this.config = config; } - provideTasks(): vscode.Task[] { + async provideTasks(): Promise { // Detect Rust tasks. Currently we do not do any actual detection // of tasks (e.g. aliases in .cargo/config) and just return a fixed // set of tasks that always exist. These tasks cannot be removed in // tasks.json - only tweaked. - const cargoPath = toolchain.cargoPath(); - - return [ + const defs = [ { command: 'build', group: vscode.TaskGroup.Build }, { command: 'check', group: vscode.TaskGroup.Build }, { command: 'test', group: vscode.TaskGroup.Test }, { command: 'clean', group: vscode.TaskGroup.Clean }, { command: 'run', group: undefined }, - ] - .map(({ command, group }) => { - const vscodeTask = new vscode.Task( - // The contents of this object end up in the tasks.json entries. - { - type: TASK_TYPE, - command, - }, - // The scope of the task - workspace or specific folder (global - // is not supported). - this.target, - // The task name, and task source. These are shown in the UI as - // `${source}: ${name}`, e.g. `rust: cargo build`. - `cargo ${command}`, - 'rust', - // What to do when this command is executed. - new vscode.ShellExecution(cargoPath, [command]), - // Problem matchers. - ['$rustc'], - ); - vscodeTask.group = group; - return vscodeTask; - }); + ]; + + const tasks: vscode.Task[] = []; + for (const def of defs) { + const vscodeTask = await buildCargoTask(this.target, { type: TASK_TYPE, command: def.command }, `cargo ${def.command}`, [def.command], this.config.cargoRunner); + vscodeTask.group = def.group; + tasks.push(vscodeTask); + } + + return tasks; } async resolveTask(task: vscode.Task): Promise { @@ -73,38 +58,56 @@ class CargoTaskProvider implements vscode.TaskProvider { if (definition.type === TASK_TYPE && definition.command) { const args = [definition.command].concat(definition.args ?? []); - return await buildCargoTask(definition, task.name, args, this.config.cargoRunner); + return await buildCargoTask(this.target, definition, task.name, args, this.config.cargoRunner); } return undefined; } } -export async function buildCargoTask(definition: CargoTaskDefinition, name: string, args: string[], customRunner?: string): Promise { +export async function buildCargoTask( + target: vscode.WorkspaceFolder, + definition: CargoTaskDefinition, + name: string, + args: string[], + customRunner?: string, + throwOnError: boolean = false +): Promise { + + let exec: vscode.ShellExecution | undefined = undefined; + if (customRunner) { - const runnerCommand = `${customRunner}.createCargoTask`; + const runnerCommand = `${customRunner}.buildShellExecution`; try { - const runnerArgs = { name, args, cwd: definition.cwd, env: definition.env, source: TASK_SOURCE }; - const task = await vscode.commands.executeCommand(runnerCommand, runnerArgs); - - if (task instanceof vscode.Task) { - return task; - } else if (task) { - log.debug("Invalid cargo task", task); - throw `Invalid task!`; + const runnerArgs = { kind: TASK_TYPE, args, cwd: definition.cwd, env: definition.env }; + const customExec = await vscode.commands.executeCommand(runnerCommand, runnerArgs); + if (customExec) { + if (customExec instanceof vscode.ShellExecution) { + exec = customExec as vscode.ShellExecution; + } else { + log.debug("Invalid cargo ShellExecution", customExec); + throw "Invalid cargo ShellExecution."; + } } // fallback to default processing } catch (e) { - throw `Cargo runner '${customRunner}' failed! ${e}`; + if (throwOnError) throw `Cargo runner '${customRunner}' failed! ${e}`; + // fallback to default processing } } + if (!exec) { + exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition) + } + return new vscode.Task( definition, + target, name, TASK_SOURCE, - new vscode.ShellExecution(toolchain.cargoPath(), args, definition), + exec, + ['$rustc'] ); } From 7b7c185d6b4f90cba2077a7b2885f211a14b83fe Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 24 Jun 2020 11:50:14 +0300 Subject: [PATCH 765/819] Fix ts lints --- rust-analyzer/editors/code/src/tasks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/tasks.ts b/rust-analyzer/editors/code/src/tasks.ts index 20ddb3a5..14abbd5b 100644 --- a/rust-analyzer/editors/code/src/tasks.ts +++ b/rust-analyzer/editors/code/src/tasks.ts @@ -83,7 +83,7 @@ export async function buildCargoTask( const customExec = await vscode.commands.executeCommand(runnerCommand, runnerArgs); if (customExec) { if (customExec instanceof vscode.ShellExecution) { - exec = customExec as vscode.ShellExecution; + exec = customExec; } else { log.debug("Invalid cargo ShellExecution", customExec); throw "Invalid cargo ShellExecution."; @@ -98,7 +98,7 @@ export async function buildCargoTask( } if (!exec) { - exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition) + exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition); } return new vscode.Task( From 7fcecfa9cf9f2e4dd964ab1aea702edd593c6206 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 24 Jun 2020 13:19:14 +0300 Subject: [PATCH 766/819] Don't mess with messy temp dir and just download into extension dir Temp dirs are messy. Dealing with them requires handling quite a bunch of edge cases. As proposed by lnicola this seems better to just put the temp files in the extension dir and not care much about suddenly leaving garbage. Instead we get shorter and less platform-caveat-y code. We will also assume users don't try to issue a download in different vscode windows simultaneously --- rust-analyzer/editors/code/src/net.ts | 80 ++++++++------------------- 1 file changed, 23 insertions(+), 57 deletions(-) diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index e02fd6d4..7c77530b 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -2,8 +2,6 @@ import fetch from "node-fetch"; import * as vscode from "vscode"; import * as stream from "stream"; import * as fs from "fs"; -import * as os from "os"; -import * as path from "path"; import * as util from "util"; import { log, assert } from "./util"; @@ -68,32 +66,31 @@ interface DownloadOpts { } export async function download(opts: DownloadOpts) { - // Put the artifact into a temporary folder to prevent partially downloaded files when user kills vscode - await withTempDir(async tempDir => { - const tempFile = path.join(tempDir, path.basename(opts.dest)); - - await vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - cancellable: false, - title: opts.progressTitle - }, - async (progress, _cancellationToken) => { - let lastPercentage = 0; - await downloadFile(opts.url, tempFile, opts.mode, (readBytes, totalBytes) => { - const newPercentage = (readBytes / totalBytes) * 100; - progress.report({ - message: newPercentage.toFixed(0) + "%", - increment: newPercentage - lastPercentage - }); - - lastPercentage = newPercentage; + // Put artifact into a temporary file (in the same dir for simplicity) + // to prevent partially downloaded files when user kills vscode + const tempFile = `${opts.dest}.tmp`; + + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Notification, + cancellable: false, + title: opts.progressTitle + }, + async (progress, _cancellationToken) => { + let lastPercentage = 0; + await downloadFile(opts.url, tempFile, opts.mode, (readBytes, totalBytes) => { + const newPercentage = (readBytes / totalBytes) * 100; + progress.report({ + message: newPercentage.toFixed(0) + "%", + increment: newPercentage - lastPercentage }); - } - ); - await moveFile(tempFile, opts.dest); - }); + lastPercentage = newPercentage; + }); + } + ); + + await fs.promises.rename(tempFile, opts.dest); } /** @@ -137,34 +134,3 @@ async function downloadFile( // https://github.com/rust-analyzer/rust-analyzer/issues/3167 }); } - -async function withTempDir(scope: (tempDirPath: string) => Promise) { - // Based on the great article: https://advancedweb.hu/secure-tempfiles-in-nodejs-without-dependencies/ - - // `.realpath()` should handle the cases where os.tmpdir() contains symlinks - const osTempDir = await fs.promises.realpath(os.tmpdir()); - - const tempDir = await fs.promises.mkdtemp(path.join(osTempDir, "rust-analyzer")); - - try { - return await scope(tempDir); - } finally { - // We are good citizens :D - void fs.promises.rmdir(tempDir, { recursive: true }).catch(log.error); - } -}; - -async function moveFile(src: fs.PathLike, dest: fs.PathLike) { - try { - await fs.promises.rename(src, dest); - } catch (err) { - if (err.code === 'EXDEV') { - // We are probably moving the file across partitions/devices - await fs.promises.copyFile(src, dest); - await fs.promises.unlink(src); - } else { - log.error(`Failed to rename the file ${src} -> ${dest}`, err); - throw err; - } - } -} From ebbe487e1047d7068e00a4a1566bac1418d69f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 24 Jun 2020 14:09:12 +0300 Subject: [PATCH 767/819] Remove namedExports config --- rust-analyzer/editors/code/rollup.config.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 58360eab..4b4c47f4 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -11,12 +11,7 @@ export default { resolve({ preferBuiltins: true }), - commonjs({ - namedExports: { - // squelch missing import warnings - 'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes', 'WorkDoneProgress', 'WorkDoneProgressBegin', 'WorkDoneProgressReport', 'WorkDoneProgressEnd'] - } - }) + commonjs() ], external: [...nodeBuiltins, 'vscode'], output: { From 0a6b65eae1102dd3d06f6ca03f69b6aa24a5e4f0 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 25 Jun 2020 01:00:30 +0300 Subject: [PATCH 768/819] Append 10 random hex chars to temp artifact files --- rust-analyzer/editors/code/src/net.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index 7c77530b..86609288 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -1,8 +1,10 @@ import fetch from "node-fetch"; import * as vscode from "vscode"; import * as stream from "stream"; +import * as crypto from "crypto"; import * as fs from "fs"; import * as util from "util"; +import * as path from "path"; import { log, assert } from "./util"; const pipeline = util.promisify(stream.pipeline); @@ -68,7 +70,9 @@ interface DownloadOpts { export async function download(opts: DownloadOpts) { // Put artifact into a temporary file (in the same dir for simplicity) // to prevent partially downloaded files when user kills vscode - const tempFile = `${opts.dest}.tmp`; + const dest = path.parse(opts.dest); + const randomHex = crypto.randomBytes(5).toString("hex"); + const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`); await vscode.window.withProgress( { From 26f6d90ab5957c1199ab773c00f75e6c1d04e82f Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Sat, 27 Jun 2020 21:26:28 +1000 Subject: [PATCH 769/819] Fix SSR prompt following #4919 --- rust-analyzer/editors/code/src/commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 8c9d7802..5a1bc7f5 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -158,7 +158,7 @@ export function ssr(ctx: Ctx): Cmd { const options: vscode.InputBoxOptions = { value: "() ==>> ()", - prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", + prompt: "Enter request, for example 'Foo($a) ==> Foo::new($a)' ", validateInput: async (x: string) => { try { await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); From 5e164d8174791e98edaa408bef2c71d2046d1410 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 27 Jun 2020 17:53:50 +0200 Subject: [PATCH 770/819] Add light-weight snapshot testing library with editor integration --- rust-analyzer/editors/code/src/lsp_ext.ts | 1 + rust-analyzer/editors/code/src/run.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index e16ea799..fdb99956 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -60,6 +60,7 @@ export interface Runnable { workspaceRoot?: string; cargoArgs: string[]; executableArgs: string[]; + expectTest?: boolean; }; } export const runnables = new lc.RequestType("experimental/runnables"); diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 766b0511..e1430e31 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -108,12 +108,16 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise if (runnable.args.executableArgs.length > 0) { args.push('--', ...runnable.args.executableArgs); } + const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" }; + if (runnable.args.expectTest) { + env["UPDATE_EXPECT"] = "1"; + } const definition: tasks.CargoTaskDefinition = { type: tasks.TASK_TYPE, command: args[0], // run, test, etc... args: args.slice(1), cwd: runnable.args.workspaceRoot, - env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), + env: Object.assign({}, process.env as { [key: string]: string }, env), }; const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() From edab90175b11ae449f8a37661df6642d77f476ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sat, 27 Jun 2020 20:36:09 +0300 Subject: [PATCH 771/819] Bump some npm deps --- rust-analyzer/editors/code/package-lock.json | 952 ++++++++----------- rust-analyzer/editors/code/package.json | 20 +- 2 files changed, 381 insertions(+), 591 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 3b4a3168..6655afb3 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -5,27 +5,27 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "version": "7.10.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.3.tgz", + "integrity": "sha512-fDx9eNW0qz0WkUeqL6tXEXzVlPh6Y5aCDEZesl0xBGA8ndRukX91Uk44ZqnkECp01NAZUdCAl+aiQNGi0k88Eg==", "dev": true, "requires": { - "@babel/highlight": "^7.8.3" + "@babel/highlight": "^7.10.3" } }, "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "version": "7.10.3", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.3.tgz", + "integrity": "sha512-bU8JvtlYpJSBPuj1VUmKpFGaDZuLxASky3LhaKj3bmpSTY6VWooSM8msk+Z0CZoErFye2tlABF6yDkT3FOPAXw==", "dev": true }, "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "version": "7.10.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.3.tgz", + "integrity": "sha512-Ih9B/u7AtgEnySE2L2F0Xm0GaM729XqqLfHkalTsbjXGyqmf/6M0Cu0WpvqueUlW+xk88BHw9Nkpj49naU+vWw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.0", + "@babel/helper-validator-identifier": "^7.10.3", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } @@ -46,9 +46,9 @@ } }, "@rollup/plugin-node-resolve": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.0.0.tgz", - "integrity": "sha512-5poJCChrkVggXXND/sQ7yNqwjUNT4fP31gpRWCnSNnlXuUXTCMHT33xZrTGxgjm5Rl18MHj7iEzlCT8rYWwQSA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.1.0.tgz", + "integrity": "sha512-ovq7ZM3JJYUUmEjjO+H8tnUdmQmdQudJB7xruX8LFZ1W2q8jXdPUS6SsIYip8ByOApu4RR7729Am9WhCeCMiHA==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8", @@ -89,19 +89,12 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", - "dev": true - }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", "dev": true, "requires": { - "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } @@ -125,9 +118,9 @@ "dev": true }, "@types/node": { - "version": "14.0.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", - "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==", + "version": "14.0.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", + "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==", "dev": true }, "@types/node-fetch": { @@ -156,18 +149,46 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz", - "integrity": "sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.4.0.tgz", + "integrity": "sha512-wfkpiqaEVhZIuQRmudDszc01jC/YR7gMSxa6ulhggAe/Hs0KVIuo9wzvFiDbG3JD5pRFQoqnf4m7REDsUvBnMQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.0.0", + "@typescript-eslint/experimental-utils": "3.4.0", + "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" }, "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz", + "integrity": "sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "3.4.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz", + "integrity": "sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", @@ -177,33 +198,33 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz", - "integrity": "sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz", + "integrity": "sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "3.0.0", + "@typescript-eslint/typescript-estree": "3.4.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.0.tgz", - "integrity": "sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.4.0.tgz", + "integrity": "sha512-ZUGI/de44L5x87uX5zM14UYcbn79HSXUR+kzcqU42gH0AgpdB/TjuJy3m4ezI7Q/jk3wTQd755mxSDLhQP79KA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.0.0", - "@typescript-eslint/typescript-estree": "3.0.0", + "@typescript-eslint/experimental-utils": "3.4.0", + "@typescript-eslint/typescript-estree": "3.4.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz", - "integrity": "sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz", + "integrity": "sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw==", "dev": true, "requires": { "debug": "^4.1.1", @@ -224,9 +245,9 @@ } }, "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", + "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", "dev": true }, "acorn-jsx": { @@ -262,23 +283,6 @@ "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", "dev": true }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - }, - "dependencies": { - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - } - } - }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -313,6 +317,18 @@ "sprintf-js": "~1.0.2" } }, + "array.prototype.map": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", + "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "es-array-method-boxes-properly": "^1.0.0", + "is-string": "^1.0.4" + } + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -344,9 +360,9 @@ "dev": true }, "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, "boolbase": { @@ -415,12 +431,6 @@ "supports-color": "^5.3.0" } }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, "cheerio": { "version": "1.0.0-rc.3", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", @@ -436,36 +446,21 @@ } }, "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", + "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.1", + "fsevents": "~2.1.2", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" + "readdirp": "~3.3.0" } }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -483,29 +478,6 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -566,9 +538,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -649,9 +621,9 @@ "dev": true }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "doctrine": { @@ -719,11 +691,20 @@ } }, "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "enquirer": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.5.tgz", + "integrity": "sha512-BNT1C08P9XD0vNg3J475yIUG+mVdp9T6towYFHUv897X0KoHBjB1shyrNmhmtHWKP17iSWgo7Gqh7BBuzLZMSA==", + "dev": true, + "requires": { + "ansi-colors": "^3.2.1" + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -731,22 +712,43 @@ "dev": true }, "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", + "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", + "is-callable": "^1.2.0", + "is-regex": "^1.1.0", "object-inspect": "^1.7.0", "object-keys": "^1.1.1", "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, + "es-get-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", + "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", + "dev": true, + "requires": { + "es-abstract": "^1.17.4", + "has-symbols": "^1.0.1", + "is-arguments": "^1.0.4", + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-string": "^1.0.5", + "isarray": "^2.0.5" } }, "es-to-primitive": { @@ -782,9 +784,9 @@ "dev": true }, "eslint": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz", - "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.3.1.tgz", + "integrity": "sha512-cQC/xj9bhWUcyi/RuMbRtC3I0eW8MH0jhRELSvpKYkWep3C6YZ2OkvcvJVUeO6gcunABmzptbXBuDoXsjHmfTA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -793,10 +795,11 @@ "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.0", "eslint-utils": "^2.0.0", - "eslint-visitor-keys": "^1.1.0", - "espree": "^7.0.0", + "eslint-visitor-keys": "^1.2.0", + "espree": "^7.1.0", "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -806,7 +809,6 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -836,9 +838,9 @@ } }, "chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -860,6 +862,22 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "eslint-scope": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -909,14 +927,22 @@ "dev": true }, "espree": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", - "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.1.0.tgz", + "integrity": "sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw==", "dev": true, "requires": { - "acorn": "^7.1.1", + "acorn": "^7.2.0", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^1.2.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "esprima": { @@ -969,21 +995,10 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-json-stable-stringify": { @@ -1007,15 +1022,6 @@ "pend": "~1.2.0" } }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -1035,12 +1041,13 @@ } }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, "flat": { @@ -1238,15 +1245,6 @@ } } }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -1285,78 +1283,11 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "inquirer": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", - "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.5.3", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true }, "is-binary-path": { "version": "2.1.0", @@ -1374,9 +1305,9 @@ "dev": true }, "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", "dev": true }, "is-date-object": { @@ -1392,9 +1323,9 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-glob": { @@ -1406,6 +1337,12 @@ "is-extglob": "^2.1.1" } }, + "is-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", + "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "dev": true + }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -1428,14 +1365,26 @@ } }, "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", "dev": true, "requires": { - "has": "^1.0.3" + "has-symbols": "^1.0.1" } }, + "is-set": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", + "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", + "dev": true + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -1445,12 +1394,34 @@ "has-symbols": "^1.0.1" } }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "iterate-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", + "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", + "dev": true + }, + "iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dev": true, + "requires": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1505,13 +1476,12 @@ } }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { @@ -1596,12 +1566,6 @@ "mime-db": "1.44.0" } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1627,37 +1591,44 @@ } }, "mocha": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", - "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", "dev": true, "requires": { - "ansi-colors": "3.2.3", + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.0", + "chokidar": "3.3.1", "debug": "3.2.6", - "diff": "3.5.0", + "diff": "4.0.2", "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", + "find-up": "4.1.0", + "glob": "7.1.6", "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", "log-symbols": "3.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", + "ms": "2.1.2", "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", + "promise.allsettled": "1.0.2", + "serialize-javascript": "3.0.0", + "strip-json-comments": "3.0.1", + "supports-color": "7.1.0", + "which": "2.0.2", "wide-align": "1.1.3", + "workerpool": "6.0.0", "yargs": "13.3.2", "yargs-parser": "13.1.2", "yargs-unparser": "1.6.0" }, "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -1667,19 +1638,11 @@ "ms": "^2.1.1" } }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, "js-yaml": { "version": "3.13.1", @@ -1691,34 +1654,19 @@ "esprima": "^4.0.0" } }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", "dev": true }, "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "isexe": "^2.0.0" + "has-flag": "^4.0.0" } } } @@ -1741,24 +1689,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "node-fetch": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", @@ -1780,9 +1710,9 @@ } }, "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", "dev": true }, "object-keys": { @@ -1803,16 +1733,6 @@ "object-keys": "^1.0.11" } }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1822,15 +1742,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -1883,12 +1794,12 @@ } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" } }, "p-try": { @@ -1933,9 +1844,9 @@ } }, "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "path-is-absolute": { @@ -1980,6 +1891,19 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, + "promise.allsettled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", + "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "dev": true, + "requires": { + "array.prototype.map": "^1.0.1", + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "iterate-value": "^1.0.0" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -2013,12 +1937,12 @@ } }, "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", + "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", "dev": true, "requires": { - "picomatch": "^2.0.4" + "picomatch": "^2.0.7" } }, "regexpp": { @@ -2054,16 +1978,6 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -2074,54 +1988,31 @@ } }, "rollup": { - "version": "2.10.9", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.9.tgz", - "integrity": "sha512-dY/EbjiWC17ZCUSyk14hkxATAMAShkMsD43XmZGWjLrgFj15M3Dw2kEkA9ns64BiLFm9PKN6vTQw8neHwK74eg==", + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.18.1.tgz", + "integrity": "sha512-w4X77ADA+WTGlapC8Z6yggdJtODw3SBl6R2LSkA7ZW5MtdkgcB7sfaSD1UWyx8diXbMcGIb0eI9gCx/dyqOgNQ==", "dev": true, "requires": { "fsevents": "~2.1.2" } }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, - "rxjs": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", - "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - }, - "dependencies": { - "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", - "dev": true - } - } - }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", + "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==", + "dev": true + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -2149,12 +2040,6 @@ "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, "slice-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", @@ -2164,14 +2049,6 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } } }, "sourcemap-codec": { @@ -2187,14 +2064,31 @@ "dev": true }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, "string.prototype.trimend": { @@ -2207,28 +2101,6 @@ "es-abstract": "^1.17.5" } }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - } - }, "string.prototype.trimstart": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", @@ -2282,46 +2154,6 @@ "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } } }, "text-table": { @@ -2330,21 +2162,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2409,9 +2226,9 @@ } }, "typescript": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz", + "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==", "dev": true }, "typescript-formatter": { @@ -2458,9 +2275,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", "dev": true }, "vsce": { @@ -2537,9 +2354,9 @@ "integrity": "sha512-tZFUSbyjUcrh+qQf13ALX4QDdOfDX0cVaBFgy7ktJ0VwS7AW/yRKgGPSxVqqP9OCMNPdqP57O5q47w2pEwfaUg==" }, "vscode-test": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.3.0.tgz", - "integrity": "sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.4.0.tgz", + "integrity": "sha512-Jt7HNGvSE0+++Tvtq5wc4hiXLIr2OjDShz/gbAfM/mahQpy4rKBnmOK33D+MR67ATWviQhl+vpmU3p/qwSH/Pg==", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", @@ -2577,12 +2394,6 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -2610,6 +2421,12 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "workerpool": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", + "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "dev": true + }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -2627,29 +2444,6 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -2706,43 +2500,39 @@ "yargs-parser": "^13.1.2" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "p-limit": "^2.0.0" } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true } } }, diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index f542a490..1d38c5bf 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -40,23 +40,23 @@ }, "devDependencies": { "@rollup/plugin-commonjs": "^12.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", - "@types/glob": "^7.1.1", + "@rollup/plugin-node-resolve": "^8.1.0", + "@types/glob": "^7.1.2", "@types/mocha": "^7.0.2", - "@types/node": "^14.0.5", + "@types/node": "^14.0.14", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.1", - "@typescript-eslint/eslint-plugin": "^3.0.0", - "@typescript-eslint/parser": "^3.0.0", - "eslint": "^7.0.0", + "@typescript-eslint/eslint-plugin": "^3.4.0", + "@typescript-eslint/parser": "^3.4.0", + "eslint": "^7.3.1", "glob": "^7.1.6", - "mocha": "^7.1.2", - "rollup": "^2.10.7", + "mocha": "^8.0.1", + "rollup": "^2.18.1", "tslib": "^2.0.0", - "typescript": "^3.9.3", + "typescript": "^3.9.5", "typescript-formatter": "^7.2.2", "vsce": "^1.75.0", - "vscode-test": "^1.3.0" + "vscode-test": "^1.4.0" }, "activationEvents": [ "onLanguage:rust", From 9d468eb180dad5badfcc641711fdefeda2f36888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sat, 27 Jun 2020 22:37:03 +0300 Subject: [PATCH 772/819] Bump @rollup/plugin-commonjs --- rust-analyzer/editors/code/package-lock.json | 14 +++++++------- rust-analyzer/editors/code/package.json | 2 +- rust-analyzer/editors/code/rollup.config.js | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 6655afb3..0b732124 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -31,9 +31,9 @@ } }, "@rollup/plugin-commonjs": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-12.0.0.tgz", - "integrity": "sha512-8+mDQt1QUmN+4Y9D3yCG8AJNewuTSLYPJVzKKUZ+lGeQrI+bV12Tc5HCyt2WdlnG6ihIL/DPbKRJlB40DX40mw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-13.0.0.tgz", + "integrity": "sha512-Anxc3qgkAi7peAyesTqGYidG5GRim9jtg8xhmykNaZkImtvjA7Wsqep08D2mYsqw1IF7rA3lYfciLgzUSgRoqw==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8", @@ -1356,12 +1356,12 @@ "dev": true }, "is-reference": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", - "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", "dev": true, "requires": { - "@types/estree": "0.0.39" + "@types/estree": "*" } }, "is-regex": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 1d38c5bf..085e7b6d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -39,7 +39,7 @@ "vscode-languageclient": "7.0.0-next.1" }, "devDependencies": { - "@rollup/plugin-commonjs": "^12.0.0", + "@rollup/plugin-commonjs": "^13.0.0", "@rollup/plugin-node-resolve": "^8.1.0", "@types/glob": "^7.1.2", "@types/mocha": "^7.0.2", diff --git a/rust-analyzer/editors/code/rollup.config.js b/rust-analyzer/editors/code/rollup.config.js index 4b4c47f4..27abf75a 100644 --- a/rust-analyzer/editors/code/rollup.config.js +++ b/rust-analyzer/editors/code/rollup.config.js @@ -16,7 +16,6 @@ export default { external: [...nodeBuiltins, 'vscode'], output: { file: './out/src/main.js', - format: 'cjs', - exports: 'named' + format: 'cjs' } }; From b28e66b8e009974282de8f54c22a49837cf9de71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 28 Jun 2020 09:34:48 +0300 Subject: [PATCH 773/819] Downgrade @types/node --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index 0b732124..e2ffe451 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -118,9 +118,9 @@ "dev": true }, "@types/node": { - "version": "14.0.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", - "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==", + "version": "12.12.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz", + "integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==", "dev": true }, "@types/node-fetch": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 085e7b6d..97a901c3 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -43,7 +43,7 @@ "@rollup/plugin-node-resolve": "^8.1.0", "@types/glob": "^7.1.2", "@types/mocha": "^7.0.2", - "@types/node": "^14.0.14", + "@types/node": "^12.8.1", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.1", "@typescript-eslint/eslint-plugin": "^3.4.0", From 140a34f13fe61f882d408099e14e8473a2e56f30 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Mon, 29 Jun 2020 19:17:35 +1000 Subject: [PATCH 774/819] Show notification while SSR is in progress Ideally we would (a) show progress and (b) allow cancellation, but at least now there's some indication to the user that something is happening. --- rust-analyzer/editors/code/src/commands.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 8c9d7802..5606b6e9 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -171,9 +171,15 @@ export function ssr(ctx: Ctx): Cmd { const request = await vscode.window.showInputBox(options); if (!request) return; - const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); - - await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: "Structured search replace in progress...", + cancellable: false, + }, async (_progress, _token) => { + const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); + + await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); + }); }; } From 71744a22d5ff8bc396226884608bbfa2b73cce94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 29 Jun 2020 19:05:48 +0300 Subject: [PATCH 775/819] Use newer @types/node --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 97a901c3..c76f874d 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -43,7 +43,7 @@ "@rollup/plugin-node-resolve": "^8.1.0", "@types/glob": "^7.1.2", "@types/mocha": "^7.0.2", - "@types/node": "^12.8.1", + "@types/node": "^12.12.0", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.1", "@typescript-eslint/eslint-plugin": "^3.4.0", From 2a70d424efe2633272dedf6a64653937c2acc4f8 Mon Sep 17 00:00:00 2001 From: Matthijs Brobbel Date: Tue, 30 Jun 2020 17:42:54 +0200 Subject: [PATCH 776/819] Fix a typo --- rust-analyzer/editors/code/rust.tmGrammar.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/rust.tmGrammar.json b/rust-analyzer/editors/code/rust.tmGrammar.json index ab87cd39..0be2583d 100644 --- a/rust-analyzer/editors/code/rust.tmGrammar.json +++ b/rust-analyzer/editors/code/rust.tmGrammar.json @@ -268,7 +268,7 @@ "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" }, { - "comment": "Invokation of a macro", + "comment": "Invocation of a macro", "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", "captures": { "1": { @@ -683,4 +683,4 @@ ] } } -} \ No newline at end of file +} From 2796410179b587eac3a1b2552daa376aced46083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 1 Jul 2020 07:52:04 +0300 Subject: [PATCH 777/819] Be more strict with `@types/node` Co-authored-by: Veetaha --- rust-analyzer/editors/code/package-lock.json | 6 +++--- rust-analyzer/editors/code/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/package-lock.json b/rust-analyzer/editors/code/package-lock.json index e2ffe451..4f94c2dc 100644 --- a/rust-analyzer/editors/code/package-lock.json +++ b/rust-analyzer/editors/code/package-lock.json @@ -118,9 +118,9 @@ "dev": true }, "@types/node": { - "version": "12.12.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz", - "integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==", + "version": "12.7.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz", + "integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==", "dev": true }, "@types/node-fetch": { diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index c76f874d..fcb101fc 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -43,7 +43,7 @@ "@rollup/plugin-node-resolve": "^8.1.0", "@types/glob": "^7.1.2", "@types/mocha": "^7.0.2", - "@types/node": "^12.12.0", + "@types/node": "~12.7.0", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.44.1", "@typescript-eslint/eslint-plugin": "^3.4.0", From abccc6c855c7e25f515840516c15310a9cad754c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jul 2020 14:57:59 +0200 Subject: [PATCH 778/819] Add reload workspace command --- rust-analyzer/editors/code/package.json | 8 ++++---- rust-analyzer/editors/code/src/commands.ts | 4 ++-- rust-analyzer/editors/code/src/lsp_ext.ts | 2 +- rust-analyzer/editors/code/src/main.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index fcb101fc..af0a5c85 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -61,7 +61,7 @@ "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", - "onCommand:rust-analyzer.collectGarbage", + "onCommand:rust-analyzer.reloadWorkspace", "workspaceContains:**/Cargo.toml" ], "main": "./out/src/main", @@ -143,8 +143,8 @@ "category": "Rust Analyzer" }, { - "command": "rust-analyzer.collectGarbage", - "title": "Run garbage collection", + "command": "rust-analyzer.reloadWorkspace", + "title": "Reload workspace", "category": "Rust Analyzer" }, { @@ -815,7 +815,7 @@ "when": "inRustProject" }, { - "command": "rust-analyzer.collectGarbage", + "command": "rust-analyzer.reloadWorkspace", "when": "inRustProject" }, { diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 0e78f510..19a9c2a0 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -330,8 +330,8 @@ export function expandMacro(ctx: Ctx): Cmd { }; } -export function collectGarbage(ctx: Ctx): Cmd { - return async () => ctx.client.sendRequest(ra.collectGarbage, null); +export function reloadWorkspace(ctx: Ctx): Cmd { + return async () => ctx.client.sendRequest(ra.reloadWorkspace, null); } export function showReferences(ctx: Ctx): Cmd { diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index fdb99956..981b6f40 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -6,7 +6,7 @@ import * as lc from "vscode-languageclient"; export const analyzerStatus = new lc.RequestType("rust-analyzer/analyzerStatus"); -export const collectGarbage = new lc.RequestType("rust-analyzer/collectGarbage"); +export const reloadWorkspace = new lc.RequestType("rust-analyzer/reloadWorkspace"); export interface SyntaxTreeParams { textDocument: lc.TextDocumentIdentifier; diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5ceab8b4..2982b9cb 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -88,7 +88,7 @@ export async function activate(context: vscode.ExtensionContext) { }); ctx.registerCommand('analyzerStatus', commands.analyzerStatus); - ctx.registerCommand('collectGarbage', commands.collectGarbage); + ctx.registerCommand('reloadWorkspace', commands.reloadWorkspace); ctx.registerCommand('matchingBrace', commands.matchingBrace); ctx.registerCommand('joinLines', commands.joinLines); ctx.registerCommand('parentModule', commands.parentModule); From 32a96fd68171714ed6195d279ccb7bbd5a8513b1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 2 Jul 2020 04:56:50 +0300 Subject: [PATCH 779/819] Always install required nightly extension if current one is not nightly --- rust-analyzer/editors/code/src/main.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5ceab8b4..1ad75a03 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -152,13 +152,17 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi return; }; - const lastCheck = state.lastCheck; const now = Date.now(); + if (config.package.releaseTag === NIGHTLY_TAG) { + // Check if we should poll github api for the new nightly version + // if we haven't done it during the past hour + const lastCheck = state.lastCheck; - const anHour = 60 * 60 * 1000; - const shouldDownloadNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour; + const anHour = 60 * 60 * 1000; + const shouldCheckForNewNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour; - if (!shouldDownloadNightly) return; + if (!shouldCheckForNewNightly) return; + } const release = await fetchRelease("nightly").catch((e) => { log.error(e); From 1694a6908c768d3bda81899d9372b4e86fc29414 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 2 Jul 2020 05:19:02 +0300 Subject: [PATCH 780/819] Force showing extension activation error pop-up notification --- rust-analyzer/editors/code/src/main.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5ceab8b4..ed26c887 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -19,6 +19,16 @@ let ctx: Ctx | undefined; const RUST_PROJECT_CONTEXT_NAME = "inRustProject"; export async function activate(context: vscode.ExtensionContext) { + // For some reason vscode not always shows pop-up error notifications + // when an extension fails to activate, so we do it explicitly by ourselves. + // FIXME: remove this bit of code once vscode fixes this issue: https://github.com/microsoft/vscode/issues/101242 + await tryActivate(context).catch(err => { + void vscode.window.showErrorMessage(`Cannot activate rust-analyzer: ${err.message}`); + throw err; + }); +} + +async function tryActivate(context: vscode.ExtensionContext) { // Register a "dumb" onEnter command for the case where server fails to // start. // @@ -58,9 +68,7 @@ export async function activate(context: vscode.ExtensionContext) { const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; if (workspaceFolder === undefined) { - const err = "Cannot activate rust-analyzer when no folder is opened"; - void vscode.window.showErrorMessage(err); - throw new Error(err); + throw new Error("no folder is opened"); } // Note: we try to start the server before we activate type hints so that it From f0dc8edfa8f04cbd660e7d35e1c3872b631ec5ac Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Jul 2020 12:37:04 +0200 Subject: [PATCH 781/819] Implement StatusBar --- rust-analyzer/editors/code/src/client.ts | 1 + rust-analyzer/editors/code/src/ctx.ts | 43 ++++++++++++++++++++++- rust-analyzer/editors/code/src/lsp_ext.ts | 3 ++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 65ad573d..3e5915c2 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -161,6 +161,7 @@ class ExperimentalFeatures implements lc.StaticFeature { caps.codeActionGroup = true; caps.resolveCodeAction = true; caps.hoverActions = true; + caps.statusNotification = true; capabilities.experimental = caps; } initialize(_capabilities: lc.ServerCapabilities, _documentSelector: lc.DocumentSelector | undefined): void { diff --git a/rust-analyzer/editors/code/src/ctx.ts b/rust-analyzer/editors/code/src/ctx.ts index 41df1199..6e767bab 100644 --- a/rust-analyzer/editors/code/src/ctx.ts +++ b/rust-analyzer/editors/code/src/ctx.ts @@ -1,9 +1,11 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; +import * as ra from './lsp_ext'; import { Config } from './config'; import { createClient } from './client'; import { isRustEditor, RustEditor } from './util'; +import { Status } from './lsp_ext'; export class Ctx { private constructor( @@ -11,6 +13,7 @@ export class Ctx { private readonly extCtx: vscode.ExtensionContext, readonly client: lc.LanguageClient, readonly serverPath: string, + readonly statusBar: vscode.StatusBarItem, ) { } @@ -22,9 +25,18 @@ export class Ctx { cwd: string, ): Promise { const client = createClient(serverPath, cwd); - const res = new Ctx(config, extCtx, client, serverPath); + + const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); + extCtx.subscriptions.push(statusBar); + statusBar.text = "rust-analyzer"; + statusBar.tooltip = "ready"; + statusBar.show(); + + const res = new Ctx(config, extCtx, client, serverPath, statusBar); + res.pushCleanup(client.start()); await client.onReady(); + client.onNotification(ra.status, (status) => res.setStatus(status)); return res; } @@ -54,6 +66,35 @@ export class Ctx { return this.extCtx.subscriptions; } + setStatus(status: Status) { + switch (status) { + case "loading": + this.statusBar.text = "$(sync~spin) rust-analyzer"; + this.statusBar.tooltip = "Loading the project"; + this.statusBar.command = undefined; + this.statusBar.color = undefined; + break; + case "ready": + this.statusBar.text = "rust-analyzer"; + this.statusBar.tooltip = "Ready"; + this.statusBar.command = undefined; + this.statusBar.color = undefined; + break; + case "invalid": + this.statusBar.text = "$(error) rust-analyzer"; + this.statusBar.tooltip = "Failed to load the project"; + this.statusBar.command = undefined; + this.statusBar.color = new vscode.ThemeColor("notificationsErrorIcon.foreground"); + break; + case "needsReload": + this.statusBar.text = "$(warning) rust-analyzer"; + this.statusBar.tooltip = "Click to reload"; + this.statusBar.command = "rust-analyzer.reloadWorkspace"; + this.statusBar.color = new vscode.ThemeColor("notificationsWarningIcon.foreground"); + break; + } + } + pushCleanup(d: Disposable) { this.extCtx.subscriptions.push(d); } diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index 981b6f40..bf470323 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -6,6 +6,9 @@ import * as lc from "vscode-languageclient"; export const analyzerStatus = new lc.RequestType("rust-analyzer/analyzerStatus"); +export type Status = "loading" | "ready" | "invalid" | "needsReload"; +export const status = new lc.NotificationType("rust-analyzer/status"); + export const reloadWorkspace = new lc.RequestType("rust-analyzer/reloadWorkspace"); export interface SyntaxTreeParams { From ca24ad199d9fdf4038e033966075704fca6e5521 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Sun, 28 Jun 2020 19:59:39 -0400 Subject: [PATCH 782/819] Pass CodeActionKind through our middleware to populate menus --- rust-analyzer/editors/code/src/client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust-analyzer/editors/code/src/client.ts b/rust-analyzer/editors/code/src/client.ts index 3e5915c2..41ffac7b 100644 --- a/rust-analyzer/editors/code/src/client.ts +++ b/rust-analyzer/editors/code/src/client.ts @@ -66,7 +66,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient return Promise.resolve(null); }); }, - // Using custom handling of CodeActions where each code action is resloved lazily + // Using custom handling of CodeActions where each code action is resolved lazily // That's why we are not waiting for any command or edits async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) { const params: lc.CodeActionParams = { @@ -87,7 +87,8 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient continue; } assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here"); - const action = new vscode.CodeAction(item.title); + const kind = client.protocol2CodeConverter.asCodeActionKind((item as any).kind); + const action = new vscode.CodeAction(item.title, kind); const group = (item as any).group; const id = (item as any).id; const resolveParams: ra.ResolveCodeActionParams = { @@ -116,6 +117,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient result[index] = items[0]; } else { const action = new vscode.CodeAction(group); + action.kind = items[0].kind; action.command = { command: "rust-analyzer.applyActionGroup", title: "", From b4539e131f09fbc9dc747e3af997ce36475369b7 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 19:47:40 +0300 Subject: [PATCH 783/819] Add runnable env support. --- rust-analyzer/editors/code/package.json | 29 ++++++++++++++++++++++++ rust-analyzer/editors/code/src/config.ts | 6 +++++ rust-analyzer/editors/code/src/debug.ts | 16 ++++++++----- rust-analyzer/editors/code/src/run.ts | 29 ++++++++++++++++++++---- 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index af0a5c85..7c8b2fbe 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -344,6 +344,35 @@ "default": null, "description": "Custom cargo runner extension ID." }, + "rust-analyzer.runnableEnv": { + "anyOf": [ + { + "type": "null" + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "mask": { + "type": "string", + "description": "Runnable name mask" + }, + "env": { + "type": "object", + "description": "Variables in form of { \"key\": \"value\"}" + } + } + } + }, + { + "type": "object", + "description": "Variables in form of { \"key\": \"value\"}" + } + ], + "default": null, + "description": "Environment variables passed to the runnable launched using `Test ` or `Debug` lens or `rust-analyzer.run` command." + }, "rust-analyzer.inlayHints.enable": { "type": "boolean", "default": true, diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index fc95a7de..a317aabc 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -5,6 +5,8 @@ export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; +export type RunnableEnvCfg = Record | [{ mask?: string, env: Record; }] + export class Config { readonly extensionId = "matklad.rust-analyzer"; @@ -114,6 +116,10 @@ export class Config { return this.get("cargoRunner"); } + get runnableEnv() { + return this.get("runnableEnv"); + } + get debug() { // "/rustc/" used by suggestions only. const { ["/rustc/"]: _, ...sourceFileMap } = this.get>("debug.sourceFileMap"); diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 61c12dbe..525d2692 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -5,9 +5,10 @@ import * as ra from './lsp_ext'; import { Cargo } from './toolchain'; import { Ctx } from "./ctx"; +import { prepareEnv } from "./run"; const debugOutput = vscode.window.createOutputChannel("Debug"); -type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; +type DebugConfigProvider = (config: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record) => vscode.DebugConfiguration; export async function makeDebugConfig(ctx: Ctx, runnable: ra.Runnable): Promise { const scope = ctx.activeRustEditor?.document.uri; @@ -92,7 +93,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { return executable; } -function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { +function getLldbDebugConfig(runnable: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: "lldb", request: "launch", @@ -130,11 +132,12 @@ function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFil args: runnable.args.executableArgs, cwd: runnable.args.workspaceRoot, sourceMap: sourceFileMap, - sourceLanguages: ["rust"] + sourceLanguages: ["rust"], + env }; } -function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { +function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg", request: "launch", @@ -142,6 +145,7 @@ function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFi program: executable, args: runnable.args.executableArgs, cwd: runnable.args.workspaceRoot, - sourceFileMap: sourceFileMap, + sourceFileMap, + env, }; } diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index e1430e31..d7c7c489 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -96,6 +96,28 @@ export class RunnableQuickPick implements vscode.QuickPickItem { } } +export function prepareEnv(runnable: ra.Runnable, config: Config): Record { + const env: Record = { "RUST_BACKTRACE": "short" }; + + if (runnable.args.expectTest) { + env["UPDATE_EXPECT"] = "1"; + } + + if (config.runnableEnv) { + if (Array.isArray(config.runnableEnv)) { + for (const it of config.runnableEnv) { + if (!it.mask || new RegExp(it.mask).test(runnable.label)) { + Object.assign(env, it.env); + } + } + } else { + Object.assign(env, config.runnableEnv as Record); + } + } + + return env; +} + export async function createTask(runnable: ra.Runnable, config: Config): Promise { if (runnable.kind !== "cargo") { // rust-analyzer supports only one kind, "cargo" @@ -108,16 +130,13 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise if (runnable.args.executableArgs.length > 0) { args.push('--', ...runnable.args.executableArgs); } - const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" }; - if (runnable.args.expectTest) { - env["UPDATE_EXPECT"] = "1"; - } + const definition: tasks.CargoTaskDefinition = { type: tasks.TASK_TYPE, command: args[0], // run, test, etc... args: args.slice(1), cwd: runnable.args.workspaceRoot, - env: Object.assign({}, process.env as { [key: string]: string }, env), + env: prepareEnv(runnable, config), }; const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() From 64efbbebcd288d4487d6fabd3e934cecd709b4fb Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 21:33:26 +0300 Subject: [PATCH 784/819] Add tests --- rust-analyzer/editors/code/src/config.ts | 4 +- rust-analyzer/editors/code/src/debug.ts | 2 +- rust-analyzer/editors/code/src/run.ts | 14 +-- .../code/tests/unit/runnable_env.test.ts | 118 ++++++++++++++++++ 4 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 rust-analyzer/editors/code/tests/unit/runnable_env.test.ts diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index a317aabc..3257275c 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -5,7 +5,7 @@ export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; -export type RunnableEnvCfg = Record | [{ mask?: string, env: Record; }] +export type RunnableEnvCfg = undefined | Record | { mask?: string, env: Record; }[]; export class Config { readonly extensionId = "matklad.rust-analyzer"; @@ -117,7 +117,7 @@ export class Config { } get runnableEnv() { - return this.get("runnableEnv"); + return this.get("runnableEnv"); } get debug() { diff --git a/rust-analyzer/editors/code/src/debug.ts b/rust-analyzer/editors/code/src/debug.ts index 525d2692..bd92c5b6 100644 --- a/rust-analyzer/editors/code/src/debug.ts +++ b/rust-analyzer/editors/code/src/debug.ts @@ -93,7 +93,7 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { +export function prepareEnv(runnable: ra.Runnable, runnableEnvCfg: RunnableEnvCfg): Record { const env: Record = { "RUST_BACKTRACE": "short" }; if (runnable.args.expectTest) { env["UPDATE_EXPECT"] = "1"; } - if (config.runnableEnv) { - if (Array.isArray(config.runnableEnv)) { - for (const it of config.runnableEnv) { + if (runnableEnvCfg) { + if (Array.isArray(runnableEnvCfg)) { + for (const it of runnableEnvCfg) { if (!it.mask || new RegExp(it.mask).test(runnable.label)) { Object.assign(env, it.env); } } } else { - Object.assign(env, config.runnableEnv as Record); + Object.assign(env, runnableEnvCfg as Record); } } @@ -136,7 +136,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise command: args[0], // run, test, etc... args: args.slice(1), cwd: runnable.args.workspaceRoot, - env: prepareEnv(runnable, config), + env: prepareEnv(runnable, config.runnableEnv), }; const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() diff --git a/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts b/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts new file mode 100644 index 00000000..979d497d --- /dev/null +++ b/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts @@ -0,0 +1,118 @@ +import * as assert from 'assert'; +import { prepareEnv } from '../../src/run'; +import { RunnableEnvCfg } from '../../src/config'; +import * as ra from '../../src/lsp_ext'; + +function make_runnable(label: string): ra.Runnable { + return { + label, + kind: "cargo", + args: { + cargoArgs: [], + executableArgs: [] + } + } +} + +function fakePrepareEnv(runnable_name: string, config: RunnableEnvCfg) : Record { + const runnable = make_runnable(runnable_name); + return prepareEnv(runnable, config); +} + +suite('Runnable env', () => { + test('Global config works', () => { + const bin_env = fakePrepareEnv("run project_name", {"GLOBAL": "g"}); + assert.equal(bin_env["GLOBAL"], "g"); + + const test_env = fakePrepareEnv("test some::mod::test_name", {"GLOBAL": "g"}); + assert.equal(test_env["GLOBAL"], "g"); + }); + + test('null mask works', () => { + const config = [ + { + env: { DATA: "data" } + } + ]; + const bin_env = fakePrepareEnv("run project_name", config); + assert.equal(bin_env["DATA"], "data"); + + const test_env = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(test_env["DATA"], "data"); + }); + + test('order works', () => { + const config = [ + { + env: { DATA: "data" } + }, + { + env: { DATA: "newdata" } + } + ]; + const bin_env = fakePrepareEnv("run project_name", config); + assert.equal(bin_env["DATA"], "newdata"); + + const test_env = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(test_env["DATA"], "newdata"); + }); + + test('mask works', () => { + const config = [ + { + env: { DATA: "data" } + }, + { + mask: "^run", + env: { DATA: "rundata" } + }, + { + mask: "special_test$", + env: { DATA: "special_test" } + } + ]; + const bin_env = fakePrepareEnv("run project_name", config); + assert.equal(bin_env["DATA"], "rundata"); + + const test_env = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(test_env["DATA"], "data"); + + const special_test_env = fakePrepareEnv("test some::mod::special_test", config); + assert.equal(special_test_env["DATA"], "special_test"); + }); + + test('exact test name works', () => { + const config = [ + { + env: { DATA: "data" } + }, + { + mask: "some::mod::test_name", + env: { DATA: "test special" } + } + ]; + const test_env = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(test_env["DATA"], "test special"); + + const special_test_env = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(special_test_env["DATA"], "data"); + }); + + test('test mod name works', () => { + const config = [ + { + env: { DATA: "data" } + }, + { + mask: "some::mod", + env: { DATA: "mod special" } + } + ]; + const test_env = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(test_env["DATA"], "mod special"); + + const special_test_env = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(special_test_env["DATA"], "mod special"); + }); + +}); From b919dfcec62487cc0c3f580d999671b5caea4f53 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 22:08:33 +0300 Subject: [PATCH 785/819] code linting --- rust-analyzer/editors/code/src/config.ts | 2 +- rust-analyzer/editors/code/src/run.ts | 2 +- .../code/tests/unit/runnable_env.test.ts | 60 +++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 3257275c..23975c72 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -5,7 +5,7 @@ export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; -export type RunnableEnvCfg = undefined | Record | { mask?: string, env: Record; }[]; +export type RunnableEnvCfg = undefined | Record | { mask?: string; env: Record }[]; export class Config { readonly extensionId = "matklad.rust-analyzer"; diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index 4a5c6ad4..c0995461 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -111,7 +111,7 @@ export function prepareEnv(runnable: ra.Runnable, runnableEnvCfg: RunnableEnvCfg } } } else { - Object.assign(env, runnableEnvCfg as Record); + Object.assign(env, runnableEnvCfg); } } diff --git a/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts b/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts index 979d497d..f2f53e91 100644 --- a/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts +++ b/rust-analyzer/editors/code/tests/unit/runnable_env.test.ts @@ -3,7 +3,7 @@ import { prepareEnv } from '../../src/run'; import { RunnableEnvCfg } from '../../src/config'; import * as ra from '../../src/lsp_ext'; -function make_runnable(label: string): ra.Runnable { +function makeRunnable(label: string): ra.Runnable { return { label, kind: "cargo", @@ -11,21 +11,21 @@ function make_runnable(label: string): ra.Runnable { cargoArgs: [], executableArgs: [] } - } + }; } -function fakePrepareEnv(runnable_name: string, config: RunnableEnvCfg) : Record { - const runnable = make_runnable(runnable_name); +function fakePrepareEnv(runnableName: string, config: RunnableEnvCfg): Record { + const runnable = makeRunnable(runnableName); return prepareEnv(runnable, config); } suite('Runnable env', () => { test('Global config works', () => { - const bin_env = fakePrepareEnv("run project_name", {"GLOBAL": "g"}); - assert.equal(bin_env["GLOBAL"], "g"); + const binEnv = fakePrepareEnv("run project_name", { "GLOBAL": "g" }); + assert.equal(binEnv["GLOBAL"], "g"); - const test_env = fakePrepareEnv("test some::mod::test_name", {"GLOBAL": "g"}); - assert.equal(test_env["GLOBAL"], "g"); + const testEnv = fakePrepareEnv("test some::mod::test_name", { "GLOBAL": "g" }); + assert.equal(testEnv["GLOBAL"], "g"); }); test('null mask works', () => { @@ -34,11 +34,11 @@ suite('Runnable env', () => { env: { DATA: "data" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "data"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "data"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "data"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "data"); }); test('order works', () => { @@ -50,11 +50,11 @@ suite('Runnable env', () => { env: { DATA: "newdata" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "newdata"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "newdata"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "newdata"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "newdata"); }); test('mask works', () => { @@ -71,14 +71,14 @@ suite('Runnable env', () => { env: { DATA: "special_test" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "rundata"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "rundata"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "data"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "data"); - const special_test_env = fakePrepareEnv("test some::mod::special_test", config); - assert.equal(special_test_env["DATA"], "special_test"); + const specialTestEnv = fakePrepareEnv("test some::mod::special_test", config); + assert.equal(specialTestEnv["DATA"], "special_test"); }); test('exact test name works', () => { @@ -91,11 +91,11 @@ suite('Runnable env', () => { env: { DATA: "test special" } } ]; - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "test special"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "test special"); - const special_test_env = fakePrepareEnv("test some::mod::another_test", config); - assert.equal(special_test_env["DATA"], "data"); + const specialTestEnv = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(specialTestEnv["DATA"], "data"); }); test('test mod name works', () => { @@ -108,11 +108,11 @@ suite('Runnable env', () => { env: { DATA: "mod special" } } ]; - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "mod special"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "mod special"); - const special_test_env = fakePrepareEnv("test some::mod::another_test", config); - assert.equal(special_test_env["DATA"], "mod special"); + const specialTestEnv = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(specialTestEnv["DATA"], "mod special"); }); }); From acec5cfa0a2409281438358b7e5faedd8526565d Mon Sep 17 00:00:00 2001 From: vsrs Date: Fri, 3 Jul 2020 14:56:30 +0300 Subject: [PATCH 786/819] Fix workspaceRoot --- rust-analyzer/editors/code/src/run.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/run.ts b/rust-analyzer/editors/code/src/run.ts index c0995461..de68f27a 100644 --- a/rust-analyzer/editors/code/src/run.ts +++ b/rust-analyzer/editors/code/src/run.ts @@ -103,6 +103,8 @@ export function prepareEnv(runnable: ra.Runnable, runnableEnvCfg: RunnableEnvCfg env["UPDATE_EXPECT"] = "1"; } + Object.assign(env, process.env as { [key: string]: string }); + if (runnableEnvCfg) { if (Array.isArray(runnableEnvCfg)) { for (const it of runnableEnvCfg) { @@ -135,7 +137,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise type: tasks.TASK_TYPE, command: args[0], // run, test, etc... args: args.slice(1), - cwd: runnable.args.workspaceRoot, + cwd: runnable.args.workspaceRoot || ".", env: prepareEnv(runnable, config.runnableEnv), }; From 374d0de39fba06a027b037c2a75b27901963d0d3 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Fri, 3 Jul 2020 09:12:20 -0400 Subject: [PATCH 787/819] Fix typo in description of vscode setting --- rust-analyzer/editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index af0a5c85..938df475 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -554,7 +554,7 @@ "items": { "type": "string" }, - "description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in te problems panel.", + "description": "List of warnings warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", "default": [] } } From 954d8d4e68cc8838bcd4422b459a5b4abcc35320 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 5 Jul 2020 17:42:52 +0300 Subject: [PATCH 788/819] Improve client logging (use output channel and more log levels) --- rust-analyzer/editors/code/src/config.ts | 8 +-- rust-analyzer/editors/code/src/main.ts | 6 +-- .../editors/code/src/persistent_state.ts | 2 +- rust-analyzer/editors/code/src/util.ts | 51 +++++++++++++++---- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/rust-analyzer/editors/code/src/config.ts b/rust-analyzer/editors/code/src/config.ts index 23975c72..033b04b6 100644 --- a/rust-analyzer/editors/code/src/config.ts +++ b/rust-analyzer/editors/code/src/config.ts @@ -39,10 +39,10 @@ export class Config { private refreshLogging() { log.setEnabled(this.traceExtension); - log.debug( - "Extension version:", this.package.version, - "using configuration:", this.cfg - ); + log.info("Extension version:", this.package.version); + + const cfg = Object.entries(this.cfg).filter(([_, val]) => !(val instanceof Function)); + log.info("Using configuration", Object.fromEntries(cfg)); } private async onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) { diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index a1521a93..5877be8b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -59,8 +59,8 @@ async function tryActivate(context: vscode.ExtensionContext) { message += "you should close them and reload this window to retry. "; } - message += 'Open "Help > Toggle Developer Tools > Console" to see the logs '; - message += '(enable verbose logs with "rust-analyzer.trace.extension")'; + message += 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). '; + message += 'To enable verbose logs use { "rust-analyzer.trace.extension": true }'; log.error("Bootstrap error", err); throw new Error(message); @@ -214,7 +214,7 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise< ); } - log.debug("Using server binary at", path); + log.info("Using server binary at", path); if (!isValidExecutable(path)) { throw new Error(`Failed to execute ${path} --version`); diff --git a/rust-analyzer/editors/code/src/persistent_state.ts b/rust-analyzer/editors/code/src/persistent_state.ts index 138d11b8..5705eed8 100644 --- a/rust-analyzer/editors/code/src/persistent_state.ts +++ b/rust-analyzer/editors/code/src/persistent_state.ts @@ -4,7 +4,7 @@ import { log } from './util'; export class PersistentState { constructor(private readonly globalState: vscode.Memento) { const { lastCheck, releaseId, serverVersion } = this; - log.debug("PersistentState: ", { lastCheck, releaseId, serverVersion }); + log.info("PersistentState:", { lastCheck, releaseId, serverVersion }); } /** diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index fec4c329..78fe6f5d 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,7 +1,9 @@ import * as lc from "vscode-languageclient"; +import * as fs from "fs"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; import { spawnSync } from "child_process"; +import { inspect } from "util"; export function assert(condition: boolean, explanation: string): asserts condition { try { @@ -14,21 +16,46 @@ export function assert(condition: boolean, explanation: string): asserts conditi export const log = new class { private enabled = true; + private readonly output = vscode.window.createOutputChannel("Rust Analyzer Client"); setEnabled(yes: boolean): void { log.enabled = yes; } - debug(message?: any, ...optionalParams: any[]): void { + // Hint: the type [T, ...T[]] means a non-empty array + debug(...msg: [unknown, ...unknown[]]): void { if (!log.enabled) return; - // eslint-disable-next-line no-console - console.log(message, ...optionalParams); + log.write("DEBUG", ...msg); + log.output.toString(); } - error(message?: any, ...optionalParams: any[]): void { + info(...msg: [unknown, ...unknown[]]): void { + log.write("INFO", ...msg); + } + + warn(...msg: [unknown, ...unknown[]]): void { + debugger; + log.write("WARN", ...msg); + } + + error(...msg: [unknown, ...unknown[]]): void { debugger; - // eslint-disable-next-line no-console - console.error(message, ...optionalParams); + log.write("ERROR", ...msg); + log.output.show(true); + } + + private write(label: string, ...messageParts: unknown[]): void { + const message = messageParts.map(log.stringify).join(" "); + const dateTime = new Date().toLocaleString(); + log.output.appendLine(`${label} [${dateTime}]: ${message}`); + } + + private stringify(val: unknown): string { + if (typeof val === "string") return val; + return inspect(val, { + colors: false, + depth: 6, // heuristic + }); } }; @@ -46,7 +73,7 @@ export async function sendRequestWithRetry( ); } catch (error) { if (delay === null) { - log.error("LSP request timed out", { method: reqType.method, param, error }); + log.warn("LSP request timed out", { method: reqType.method, param, error }); throw error; } @@ -55,7 +82,7 @@ export async function sendRequestWithRetry( } if (error.code !== lc.ErrorCodes.ContentModified) { - log.error("LSP request failed", { method: reqType.method, param, error }); + log.warn("LSP request failed", { method: reqType.method, param, error }); throw error; } @@ -87,11 +114,15 @@ export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { export function isValidExecutable(path: string): boolean { log.debug("Checking availability of a binary at", path); + if (!fs.existsSync(path)) return false; + const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); - log.debug(res, "--version output:", res.output); + const isSuccess = res.status === 0; + const printOutput = isSuccess ? log.debug : log.warn; + printOutput(path, "--version:", res); - return res.status === 0; + return isSuccess; } /** Sets ['when'](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) clause contexts */ From 2c88563bcc6e264a56c4e027ca4bef57eb73af08 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 5 Jul 2020 21:05:38 +0300 Subject: [PATCH 789/819] Dispose logger on extension deactivation --- rust-analyzer/editors/code/src/main.ts | 2 ++ rust-analyzer/editors/code/src/util.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5877be8b..f2298193 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -49,6 +49,8 @@ async function tryActivate(context: vscode.ExtensionContext) { ); context.subscriptions.push(defaultOnEnter); + context.subscriptions.push(log); + const config = new Config(context); const state = new PersistentState(context.globalState); const serverPath = await bootstrap(config, state).catch(err => { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 78fe6f5d..6b07d448 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -18,6 +18,10 @@ export const log = new class { private enabled = true; private readonly output = vscode.window.createOutputChannel("Rust Analyzer Client"); + dispose() { + log.output.dispose(); + } + setEnabled(yes: boolean): void { log.enabled = yes; } From 7b6be111b5345ec2e9e3c92dbcd40d8879ede158 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 5 Jul 2020 21:10:31 +0300 Subject: [PATCH 790/819] Revert "Dispose logger on extension deactivation" This reverts commit 2c88563bcc6e264a56c4e027ca4bef57eb73af08. That commit was wrong because we use-after-free the logger --- rust-analyzer/editors/code/src/main.ts | 2 -- rust-analyzer/editors/code/src/util.ts | 4 ---- 2 files changed, 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index f2298193..5877be8b 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -49,8 +49,6 @@ async function tryActivate(context: vscode.ExtensionContext) { ); context.subscriptions.push(defaultOnEnter); - context.subscriptions.push(log); - const config = new Config(context); const state = new PersistentState(context.globalState); const serverPath = await bootstrap(config, state).catch(err => { diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 6b07d448..78fe6f5d 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -18,10 +18,6 @@ export const log = new class { private enabled = true; private readonly output = vscode.window.createOutputChannel("Rust Analyzer Client"); - dispose() { - log.output.dispose(); - } - setEnabled(yes: boolean): void { log.enabled = yes; } From 1586fab4402e2f883ca9ecaf1ba40f1e062fc7f9 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 6 Jul 2020 13:39:08 +0300 Subject: [PATCH 791/819] Fix: allow for binaries from $PATH to pass validity check --- rust-analyzer/editors/code/src/util.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/rust-analyzer/editors/code/src/util.ts b/rust-analyzer/editors/code/src/util.ts index 78fe6f5d..970fedb3 100644 --- a/rust-analyzer/editors/code/src/util.ts +++ b/rust-analyzer/editors/code/src/util.ts @@ -1,5 +1,4 @@ import * as lc from "vscode-languageclient"; -import * as fs from "fs"; import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; import { spawnSync } from "child_process"; @@ -114,15 +113,12 @@ export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { export function isValidExecutable(path: string): boolean { log.debug("Checking availability of a binary at", path); - if (!fs.existsSync(path)) return false; - const res = spawnSync(path, ["--version"], { encoding: 'utf8' }); - const isSuccess = res.status === 0; - const printOutput = isSuccess ? log.debug : log.warn; + const printOutput = res.error && (res.error as any).code !== 'ENOENT' ? log.warn : log.debug; printOutput(path, "--version:", res); - return isSuccess; + return res.status === 0; } /** Sets ['when'](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) clause contexts */ From 2cc0d8ac082ebbbb557d7cb19e5a8bb284ac0f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 6 Jul 2020 14:29:19 +0300 Subject: [PATCH 792/819] Disable ES module interop --- rust-analyzer/editors/code/tests/unit/index.ts | 4 ++-- rust-analyzer/editors/code/tsconfig.json | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rust-analyzer/editors/code/tests/unit/index.ts b/rust-analyzer/editors/code/tests/unit/index.ts index 5165720b..b7d8d214 100644 --- a/rust-analyzer/editors/code/tests/unit/index.ts +++ b/rust-analyzer/editors/code/tests/unit/index.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import Mocha from 'mocha'; -import glob from 'glob'; +import * as Mocha from 'mocha'; +import * as glob from 'glob'; export function run(): Promise { // Create the mocha test diff --git a/rust-analyzer/editors/code/tsconfig.json b/rust-analyzer/editors/code/tsconfig.json index 32d1a865..c9f34824 100644 --- a/rust-analyzer/editors/code/tsconfig.json +++ b/rust-analyzer/editors/code/tsconfig.json @@ -6,8 +6,6 @@ "lib": [ "es2019" ], - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, "sourceMap": true, "rootDir": ".", "strict": true, From 5f755a23485cbc973794613235f638c9655c6072 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Tue, 7 Jul 2020 12:09:37 +0300 Subject: [PATCH 793/819] Consider EPERM error as other vscode processes using rust-analyzer --- rust-analyzer/editors/code/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 5877be8b..4b990afa 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -54,7 +54,7 @@ async function tryActivate(context: vscode.ExtensionContext) { const serverPath = await bootstrap(config, state).catch(err => { let message = "bootstrap error. "; - if (err.code === "EBUSY" || err.code === "ETXTBSY") { + if (err.code === "EBUSY" || err.code === "ETXTBSY" || err.code === "EPERM") { message += "Other vscode windows might be using rust-analyzer, "; message += "you should close them and reload this window to retry. "; } From f4c9ac5aa0da7252f44c27ea5dfa59f53ed948ea Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 7 Jul 2020 12:10:14 +0200 Subject: [PATCH 794/819] Add a command to compute memory usage statistics --- rust-analyzer/editors/code/package.json | 10 +++++++ rust-analyzer/editors/code/src/commands.ts | 32 ++++++++++++++++++++++ rust-analyzer/editors/code/src/lsp_ext.ts | 1 + rust-analyzer/editors/code/src/main.ts | 1 + 4 files changed, 44 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 4b47fc9d..743a2290 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -61,6 +61,7 @@ "activationEvents": [ "onLanguage:rust", "onCommand:rust-analyzer.analyzerStatus", + "onCommand:rust-analyzer.memoryUsage", "onCommand:rust-analyzer.reloadWorkspace", "workspaceContains:**/Cargo.toml" ], @@ -142,6 +143,11 @@ "title": "Status", "category": "Rust Analyzer" }, + { + "command": "rust-analyzer.memoryUsage", + "title": "Memory Usage (Clears Database)", + "category": "Rust Analyzer" + }, { "command": "rust-analyzer.reloadWorkspace", "title": "Reload workspace", @@ -843,6 +849,10 @@ "command": "rust-analyzer.analyzerStatus", "when": "inRustProject" }, + { + "command": "rust-analyzer.memoryUsage", + "when": "inRustProject" + }, { "command": "rust-analyzer.reloadWorkspace", "when": "inRustProject" diff --git a/rust-analyzer/editors/code/src/commands.ts b/rust-analyzer/editors/code/src/commands.ts index 19a9c2a0..1f3a7cf7 100644 --- a/rust-analyzer/editors/code/src/commands.ts +++ b/rust-analyzer/editors/code/src/commands.ts @@ -55,6 +55,38 @@ export function analyzerStatus(ctx: Ctx): Cmd { }; } +export function memoryUsage(ctx: Ctx): Cmd { + const tdcp = new class implements vscode.TextDocumentContentProvider { + readonly uri = vscode.Uri.parse('rust-analyzer-memory://memory'); + readonly eventEmitter = new vscode.EventEmitter(); + + provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult { + if (!vscode.window.activeTextEditor) return ''; + + return ctx.client.sendRequest(ra.memoryUsage, null).then((mem) => { + return 'Per-query memory usage:\n' + mem + '\n(note: database has been cleared)'; + }); + } + + get onDidChange(): vscode.Event { + return this.eventEmitter.event; + } + }(); + + ctx.pushCleanup( + vscode.workspace.registerTextDocumentContentProvider( + 'rust-analyzer-memory', + tdcp, + ), + ); + + return async () => { + tdcp.eventEmitter.fire(tdcp.uri); + const document = await vscode.workspace.openTextDocument(tdcp.uri); + return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); + }; +} + export function matchingBrace(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; diff --git a/rust-analyzer/editors/code/src/lsp_ext.ts b/rust-analyzer/editors/code/src/lsp_ext.ts index bf470323..5f32cb40 100644 --- a/rust-analyzer/editors/code/src/lsp_ext.ts +++ b/rust-analyzer/editors/code/src/lsp_ext.ts @@ -5,6 +5,7 @@ import * as lc from "vscode-languageclient"; export const analyzerStatus = new lc.RequestType("rust-analyzer/analyzerStatus"); +export const memoryUsage = new lc.RequestType("rust-analyzer/memoryUsage"); export type Status = "loading" | "ready" | "invalid" | "needsReload"; export const status = new lc.NotificationType("rust-analyzer/status"); diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index 4b990afa..eda95ae5 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -96,6 +96,7 @@ async function tryActivate(context: vscode.ExtensionContext) { }); ctx.registerCommand('analyzerStatus', commands.analyzerStatus); + ctx.registerCommand('memoryUsage', commands.memoryUsage); ctx.registerCommand('reloadWorkspace', commands.reloadWorkspace); ctx.registerCommand('matchingBrace', commands.matchingBrace); ctx.registerCommand('joinLines', commands.joinLines); From a42bc0c5bd970d983e07746f8368eef5b39a8df3 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 21 Jun 2020 15:58:34 +0300 Subject: [PATCH 795/819] Gzip artifacts Co-authored-by: bjorn3 Override miniz_oxide to build it with optimizations Building this crate with optimizations decreases the gzipping part of `cargo xtask dist` from `30-40s` down to `3s`, the overhead for `rustc` to apply optimizations is miserable on this background --- rust-analyzer/editors/code/src/main.ts | 17 +++++++++-------- rust-analyzer/editors/code/src/net.ts | 16 ++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/rust-analyzer/editors/code/src/main.ts b/rust-analyzer/editors/code/src/main.ts index eda95ae5..bd99d696 100644 --- a/rust-analyzer/editors/code/src/main.ts +++ b/rust-analyzer/editors/code/src/main.ts @@ -274,13 +274,13 @@ async function getServer(config: Config, state: PersistentState): Promise true, () => false); if (!exists) { await state.updateServerVersion(undefined); @@ -309,7 +309,7 @@ async function getServer(config: Config, state: PersistentState): Promise artifact.name === binaryName); + const artifact = release.assets.find(artifact => artifact.name === `rust-analyzer-${platform}.gz`); assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. @@ -321,6 +321,7 @@ async function getServer(config: Config, state: PersistentState): Promise { let lastPercentage = 0; - await downloadFile(opts.url, tempFile, opts.mode, (readBytes, totalBytes) => { + await downloadFile(opts.url, tempFile, opts.mode, !!opts.gunzip, (readBytes, totalBytes) => { const newPercentage = (readBytes / totalBytes) * 100; progress.report({ message: newPercentage.toFixed(0) + "%", @@ -97,16 +99,11 @@ export async function download(opts: DownloadOpts) { await fs.promises.rename(tempFile, opts.dest); } -/** - * Downloads file from `url` and stores it at `destFilePath` with `mode` (unix permissions). - * `onProgress` callback is called on recieveing each chunk of bytes - * to track the progress of downloading, it gets the already read and total - * amount of bytes to read as its parameters. - */ async function downloadFile( url: string, destFilePath: fs.PathLike, mode: number | undefined, + gunzip: boolean, onProgress: (readBytes: number, totalBytes: number) => void ): Promise { const res = await fetch(url); @@ -130,7 +127,10 @@ async function downloadFile( }); const destFileStream = fs.createWriteStream(destFilePath, { mode }); - await pipeline(res.body, destFileStream); + const srcStream = gunzip ? res.body.pipe(zlib.createGunzip()) : res.body; + + await pipeline(srcStream, destFileStream); + await new Promise(resolve => { destFileStream.on("close", resolve); destFileStream.destroy(); From b396bc85419b922994548680dfd709a8c29925e1 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 8 Jul 2020 14:47:34 +0300 Subject: [PATCH 796/819] Workaround rollup messing up default imports --- rust-analyzer/editors/code/src/net.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-analyzer/editors/code/src/net.ts b/rust-analyzer/editors/code/src/net.ts index 53c9e91c..681eaa9c 100644 --- a/rust-analyzer/editors/code/src/net.ts +++ b/rust-analyzer/editors/code/src/net.ts @@ -1,4 +1,7 @@ -import fetch from "node-fetch"; +// Replace with `import fetch from "node-fetch"` once this is fixed in rollup: +// https://github.com/rollup/plugins/issues/491 +const fetch = require("node-fetch") as typeof import("node-fetch")["default"]; + import * as vscode from "vscode"; import * as stream from "stream"; import * as crypto from "crypto"; From fe3ef97e4513afa6d5b02b6f111bed7f2f7481e7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Jul 2020 15:27:34 +0200 Subject: [PATCH 797/819] Automatically reload project info on Cargo.toml changes --- rust-analyzer/editors/code/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-analyzer/editors/code/package.json b/rust-analyzer/editors/code/package.json index 743a2290..aac4ba94 100644 --- a/rust-analyzer/editors/code/package.json +++ b/rust-analyzer/editors/code/package.json @@ -237,6 +237,11 @@ "default": true, "markdownDescription": "Whether to show `can't find Cargo.toml` error message" }, + "rust-analyzer.cargo.autoreload": { + "type": "boolean", + "default": true, + "markdownDescription": "Automatically refresh project info via `cargo metadata` on Cargo.toml changes" + }, "rust-analyzer.cargo.noDefaultFeatures": { "type": "boolean", "default": false, From 2f1480fb4053f480940731d7de852590e90a7611 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 14 Jul 2020 01:05:19 +0200 Subject: [PATCH 798/819] Bump lodash --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5cd587f3..d01b359c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -766,9 +766,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "log-symbols": { From df3035b1e49a1b3b2be0b08f3696179692a17ae7 Mon Sep 17 00:00:00 2001 From: Timo Freiberg Date: Wed, 22 Jul 2020 17:44:02 +0200 Subject: [PATCH 799/819] Fix snippetTextEdits applying to other files vscode.window.visibleTextEditors only contains editors whose contents are being displayed at the moment, so the previous logic only worked if the other file for which a snippetTextEdit is being received was visible in a separate split. Ported from rust-analyzer: https://github.com/rust-analyzer/rust-analyzer/pull/5480 --- rust-analyzer/editors/code/src/snippets.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust-analyzer/editors/code/src/snippets.ts b/rust-analyzer/editors/code/src/snippets.ts index bcb3f2cc..258b4998 100644 --- a/rust-analyzer/editors/code/src/snippets.ts +++ b/rust-analyzer/editors/code/src/snippets.ts @@ -6,6 +6,10 @@ export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); const [uri, edits] = edit.entries()[0]; + if (vscode.window.activeTextEditor?.document.uri !== uri) { + // `vscode.window.visibleTextEditors` only contains editors whose contents are being displayed + await vscode.window.showTextDocument(uri, {}); + } const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); if (!editor) return; await applySnippetTextEdits(editor, edits); From 83187cf61d991f193df36fb4df203295c67f7efb Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Tue, 28 Jul 2020 18:26:19 +0300 Subject: [PATCH 800/819] Fix: respect `rust-client.disableRustup` setting when using rust-analyzer --- package.json | 2 +- src/rustAnalyzer.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8aa60d33..6f611e61 100644 --- a/package.json +++ b/package.json @@ -221,7 +221,7 @@ "rust-client.disableRustup": { "type": "boolean", "default": false, - "description": "Disable usage of rustup and use rustc/rls from PATH." + "description": "Disable usage of rustup and use rustc/rls/rust-analyzer from PATH." }, "rust-client.channel": { "anyOf": [ diff --git a/src/rustAnalyzer.ts b/src/rustAnalyzer.ts index 459312ef..fd6837a1 100644 --- a/src/rustAnalyzer.ts +++ b/src/rustAnalyzer.ts @@ -216,8 +216,11 @@ export async function createLanguageClient( rustAnalyzer: { path?: string; releaseTag: string }; }, ): Promise { - await rustup.ensureToolchain(config.rustup); - await rustup.ensureComponents(config.rustup, REQUIRED_COMPONENTS); + if (!config.rustup.disabled) { + await rustup.ensureToolchain(config.rustup); + await rustup.ensureComponents(config.rustup, REQUIRED_COMPONENTS); + } + if (!config.rustAnalyzer.path) { await getServer({ askBeforeDownload: true, From 6097b378f17fa8bc5b90f82a7d0185228c555f95 Mon Sep 17 00:00:00 2001 From: Thomas Hebb Date: Sun, 9 Aug 2020 15:31:44 -0700 Subject: [PATCH 801/819] rust-analyzer: Listen for new "roots scanned" message to indicate progress As of rust-analyzer/rust-analyzer@dad1333b48c3, the "rustAnalyzer/startup" message has been replaced with a functionally-equivalent[1] "rustAnalyzer/roots scanned" message. Since we're still looking for the old message, which is no longer sent at all, our progress UI hangs on "Starting" when using rust-analyzer. Listen for the new message instead to fix this. [1] At least, it appears functionally equivalent to me, but I don't know anything about rust-analyzer's internals so I could be wrong. --- src/rustAnalyzer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rustAnalyzer.ts b/src/rustAnalyzer.ts index 459312ef..d0a69d97 100644 --- a/src/rustAnalyzer.ts +++ b/src/rustAnalyzer.ts @@ -285,7 +285,7 @@ async function setupGlobalProgress(client: lc.LanguageClient) { if (newState === lc.State.Starting) { await client.onReady(); - const RUST_ANALYZER_PROGRESS = 'rustAnalyzer/startup'; + const RUST_ANALYZER_PROGRESS = 'rustAnalyzer/roots scanned'; client.onProgress( new lc.ProgressType<{ kind: 'begin' | 'report' | 'end'; From 1287a654735efec509a99eab44a0f6953fbdae7f Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 17 Aug 2020 15:16:48 +0200 Subject: [PATCH 802/819] Temporarily ignore rust-analyzer/ wrt. formatting --- .prettierignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..ad17a14e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +# FIXME: Only ignore the pending changes to be merged into this extension +rust-analyzer/ From 660b412701fe2ea62fad180c40ee4f8a60571c61 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 17 Aug 2020 23:10:37 +0200 Subject: [PATCH 803/819] Migrate from TSLint to ESLint The former is soft-deprecated and new projects are encouraged to use the latter; it's also officially endorsed by the TypeScript project. Rust Analyzer has already migrated and by doing so ourselves before merging it should make the merger easier. --- .eslintrc.json | 55 +++ .vscodeignore | 1 + package-lock.json | 814 ++++++++++++++++++++++++++++++++--- package.json | 8 +- src/extension.ts | 4 +- src/rls.ts | 4 +- src/rustAnalyzer.ts | 6 +- src/rustup.ts | 4 +- src/utils/workspace.ts | 1 + test/runTest.ts | 1 - test/suite/extension.test.ts | 1 - test/suite/index.ts | 2 +- tslint.json | 20 - 13 files changed, 833 insertions(+), 88 deletions(-) create mode 100644 .eslintrc.json delete mode 100644 tslint.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..82a0c9e4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,55 @@ +{ + "env": { + "es6": true, + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "prettier", + "prettier/@typescript-eslint" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "rules": { + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_" + } + ], + "eqeqeq": ["error", "always", { "null": "ignore" }], + "prefer-const": "error", + "@typescript-eslint/member-delimiter-style": [ + "error", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/semi": [ + "error", + "always" + ], + // TODO: Silenced during TSLint -> ESLint conversion; consider enabling them + "no-useless-escape": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/require-await": "off" + } +} diff --git a/.vscodeignore b/.vscodeignore index 096aefe8..eef38112 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -9,6 +9,7 @@ src/** **/.prettierignore **/.eslintignore prettier.config.js +.eslintrc.json vsc-extension-quickstart.md **/tsconfig.json **/tslint.json diff --git a/package-lock.json b/package-lock.json index d01b359c..1777d43a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,18 @@ "integrity": "sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==", "dev": true }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -47,6 +59,12 @@ "@types/node": "*" } }, + "@types/json-schema": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", + "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -81,6 +99,137 @@ "integrity": "sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.9.1.tgz", + "integrity": "sha512-XIr+Mfv7i4paEdBf0JFdIl9/tVxyj+rlilWIfZ97Be0lZ7hPvUbS5iHt9Glc8kRI53dsr0PcAEudbf8rO2wGgg==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "3.9.1", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", + "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/typescript-estree": "3.9.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.1.tgz", + "integrity": "sha512-y5QvPFUn4Vl4qM40lI+pNWhTcOWtpZAJ8pOEQ21fTTW4xTJkRplMjMRje7LYTXqVKKX9GJhcyweMz2+W1J5bMg==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "3.9.1", + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/typescript-estree": "3.9.1", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/types": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", + "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", + "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/visitor-keys": "3.9.1", + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", + "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "acorn": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", + "dev": true + }, + "acorn-jsx": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "dev": true + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -90,6 +239,18 @@ "es6-promisify": "^5.0.0" } }, + "ajv": { + "version": "6.12.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz", + "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -126,6 +287,12 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -178,10 +345,10 @@ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, "camelcase": { @@ -321,6 +488,28 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -363,6 +552,12 @@ "type-detect": "^4.0.0" } }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -396,6 +591,15 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "dom-serializer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", @@ -437,6 +641,23 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + } + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -494,18 +715,245 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint": { + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.7.0.tgz", + "integrity": "sha512-1KUxLzos0ZVsyL81PnRN335nDtQ8/vZUD6uMtWbF+5zDtjKcsklIi78XoE0MVL93QvWTu+E5y44VyyCsOMBrIg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.0", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^1.3.0", + "espree": "^7.2.0", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "eslint-config-prettier": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "dev": true, + "requires": { + "get-stdin": "^6.0.0" + } + }, + "eslint-scope": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, + "espree": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz", + "integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==", + "dev": true, + "requires": { + "acorn": "^7.3.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.3.0" + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -515,6 +963,15 @@ "pend": "~1.2.0" } }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -533,6 +990,34 @@ "is-buffer": "~2.0.3" } }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, "form-data": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", @@ -556,6 +1041,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -568,6 +1059,12 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -582,6 +1079,24 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -666,6 +1181,28 @@ "debug": "^3.1.0" } }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -700,12 +1237,27 @@ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-regex": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", @@ -746,6 +1298,28 @@ "esprima": "^4.0.0" } }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "linkify-it": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.1.0.tgz", @@ -842,14 +1416,6 @@ "dev": true, "requires": { "minimist": "^1.2.5" - }, - "dependencies": { - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - } } }, "mocha": { @@ -920,6 +1486,12 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "node-environment-flags": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", @@ -987,6 +1559,20 @@ "wrappy": "1" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "os": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", @@ -1039,6 +1625,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-semver": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", @@ -1069,10 +1664,10 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, "pathval": { @@ -1087,12 +1682,30 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "prettier": { "version": "1.19.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -1113,6 +1726,12 @@ "util-deprecate": "^1.0.1" } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -1125,14 +1744,11 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "resolve": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", - "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true }, "rimraf": { "version": "2.7.1", @@ -1161,6 +1777,32 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -1252,6 +1894,52 @@ "has-flag": "^3.0.0" } }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "tmp": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", @@ -1267,37 +1955,10 @@ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, - "tslint": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz", - "integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - } - }, - "tslint-config-prettier": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", - "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", - "dev": true - }, "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -1309,12 +1970,27 @@ "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, "typed-rest-client": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.2.0.tgz", @@ -1343,6 +2019,15 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", @@ -1355,6 +2040,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "v8-compile-cache": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", + "dev": true + }, "vsce": { "version": "1.64.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.64.0.tgz", @@ -1453,6 +2144,12 @@ "string-width": "^1.0.2 || 2" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -1498,6 +2195,15 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", diff --git a/package.json b/package.json index 6f611e61..42baed29 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "vscode:prepublish": "npm run check:version && npm run lint && npm run compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", - "lint": "tslint --config ./tslint.json './src/**/*.ts'", + "lint": "eslint --ext ts src", "test": "node ./out/test/runTest.js", "prettier": "prettier **/*.ts", "check:version": "node cmd/check-version.js", @@ -60,12 +60,14 @@ "@types/node": "^12.8.1", "@types/node-fetch": "^2.5.7", "@types/vscode": "^1.43.0", + "@typescript-eslint/eslint-plugin": "^3.9.1", + "@typescript-eslint/parser": "^3.9.1", "chai": "^4.2.0", + "eslint": "^7.7.0", + "eslint-config-prettier": "^6.11.0", "glob": "^7.1.4", "mocha": "^6.2.3", "prettier": "^1.19.1", - "tslint": "^5.14.0", - "tslint-config-prettier": "^1.18.0", "typescript": "^3.8.3", "vsce": "^1.63.0", "vscode-test": "^1.3.0" diff --git a/src/extension.ts b/src/extension.ts index a235e0a5..51b45081 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -126,6 +126,7 @@ function whenChangingWorkspaceFolders(e: WorkspaceFoldersChangeEvent) { } // Don't use URI as it's unreliable the same path might not become the same URI. +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const workspaces: Map = new Map(); /** @@ -186,6 +187,7 @@ export class ClientWorkspace { /** * Attempts to start a server instance, if not configured otherwise via * applicable `rust-client.autoStartRls` setting. + * * @returns whether the server has started. */ public async autoStart() { @@ -232,7 +234,7 @@ export class ClientWorkspace { await this.lc.stop(); } - this.disposables.forEach(d => d.dispose()); + this.disposables.forEach(d => void d.dispose()); } public async restart() { diff --git a/src/rls.ts b/src/rls.ts index 35cde52b..89809f8c 100644 --- a/src/rls.ts +++ b/src/rls.ts @@ -209,10 +209,10 @@ async function makeRlsEnv( console.info(`Setting sysroot to`, sysroot); if (opts.setLibPath) { - function appendEnv(envVar: string, newComponent: string) { + const appendEnv = (envVar: string, newComponent: string) => { const old = process.env[envVar]; return old ? `${newComponent}:${old}` : newComponent; - } + }; const newComponent = path.join(sysroot, 'lib'); env.DYLD_LIBRARY_PATH = appendEnv('DYLD_LIBRARY_PATH', newComponent); env.LD_LIBRARY_PATH = appendEnv('LD_LIBRARY_PATH', newComponent); diff --git a/src/rustAnalyzer.ts b/src/rustAnalyzer.ts index f36a00f7..385986a3 100644 --- a/src/rustAnalyzer.ts +++ b/src/rustAnalyzer.ts @@ -81,7 +81,7 @@ interface Metadata { releaseTag: string; } -async function readMetadata(): Promise { +async function readMetadata(): Promise> { const stateDir = metadataDir(); if (!stateDir) { return { kind: 'error', code: 'NotSupported' }; @@ -93,8 +93,8 @@ async function readMetadata(): Promise { } const contents = await readFile(filePath, 'utf8'); - const obj = JSON.parse(contents); - return typeof obj === 'object' ? obj : {}; + const obj = JSON.parse(contents) as unknown; + return typeof obj === 'object' ? (obj as Record) : {}; } async function writeMetadata(config: Metadata) { diff --git a/src/rustup.ts b/src/rustup.ts index 34663a5f..7b256b2f 100644 --- a/src/rustup.ts +++ b/src/rustup.ts @@ -233,10 +233,10 @@ export function parseActiveToolchain(rustupOutput: string): string { } export async function getVersion(config: RustupConfig): Promise { - const versionRegex = /rustup ([0-9]+\.[0-9]+\.[0-9]+)/; + const VERSION_REGEX = /rustup ([0-9]+\.[0-9]+\.[0-9]+)/; const output = await exec(`${config.path} --version`); - const versionMatch = output.stdout.toString().match(versionRegex); + const versionMatch = VERSION_REGEX.exec(output.stdout.toString()); if (versionMatch && versionMatch.length >= 2) { return versionMatch[1]; } else { diff --git a/src/utils/workspace.ts b/src/utils/workspace.ts index 29323d94..c9e35e32 100644 --- a/src/utils/workspace.ts +++ b/src/utils/workspace.ts @@ -16,6 +16,7 @@ export function nearestParentWorkspace( // algorithm that will strip one folder at a time and check if that folder contains "Cargo.toml" let current = filePath; + // eslint-disable-next-line no-constant-condition while (true) { const old = current; current = path.dirname(current); diff --git a/test/runTest.ts b/test/runTest.ts index 6dd78f56..168489b7 100644 --- a/test/runTest.ts +++ b/test/runTest.ts @@ -1,5 +1,4 @@ import * as path from 'path'; -// tslint:disable-next-line: no-implicit-dependencies import { runTests } from 'vscode-test'; (async () => { diff --git a/test/suite/extension.test.ts b/test/suite/extension.test.ts index 8f70df5c..8cd23864 100644 --- a/test/suite/extension.test.ts +++ b/test/suite/extension.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; import * as path from 'path'; import * as vscode from 'vscode'; -// tslint:disable-next-line: no-duplicate-imports import { Disposable, Uri } from 'vscode'; import * as extension from '../../src/extension'; diff --git a/test/suite/index.ts b/test/suite/index.ts index 6c1c4e84..bb0d90a4 100644 --- a/test/suite/index.ts +++ b/test/suite/index.ts @@ -4,7 +4,7 @@ import * as path from 'path'; export function run( testsRoot: string, - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any cb: (error: any, failures?: number) => void, ): void { // Create the mocha test diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 2a205657..00000000 --- a/tslint.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "defaultSeverity": "error", - - "extends": ["tslint:latest", "tslint-config-prettier"], - "linterOptions": { - "exclude": ["node_modules/**"] - }, - "rules": { - "no-any": true, - "no-implicit-dependencies": [true, ["vscode"]], - "interface-name": [true, "never-prefix"], - "variable-name": [true, "allow-leading-underscore"], - "member-ordering": [true, {"order": "fields-first"}], - "arrow-return-shorthand": true, - - "object-literal-sort-keys": false, - "no-console": false, - "no-shadowed-variable": false - } -} From ea81c15e558ad9f9fbd433d847d5e1811ec057da Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 18 Aug 2020 11:39:45 +0200 Subject: [PATCH 804/819] Rename rust-icon.png to just icon.png --- rust-icon.png => icon.png | Bin package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename rust-icon.png => icon.png (100%) diff --git a/rust-icon.png b/icon.png similarity index 100% rename from rust-icon.png rename to icon.png diff --git a/package.json b/package.json index 42baed29..6f3f7244 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Rust for Visual Studio Code (powered by Rust Language Server/Rust Analyzer). Provides lints, code completion and navigation, formatting and more.", "version": "0.7.8", "publisher": "rust-lang", - "icon": "rust-icon.png", + "icon": "icon.png", "galleryBanner": { "color": "#336356", "theme": "dark" From 96b7528c64e771f4b66971d2e787fe92c7629ea0 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 18 Aug 2020 16:50:36 +0200 Subject: [PATCH 805/819] Setup prettier to work recursively for all TS files --- .prettierignore | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.prettierignore b/.prettierignore index ad17a14e..812c3232 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,7 @@ # FIXME: Only ignore the pending changes to be merged into this extension -rust-analyzer/ +/rust-analyzer + +# From .gitignore +out +node_modules +.vscode-test diff --git a/package.json b/package.json index 6f3f7244..d380eaf0 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "watch": "tsc -watch -p ./", "lint": "eslint --ext ts src", "test": "node ./out/test/runTest.js", - "prettier": "prettier **/*.ts", + "prettier": "prettier '**/*.ts'", "check:version": "node cmd/check-version.js", "installDevExtension": "npm install && ./node_modules/.bin/vsce package -o ./out/rls-vscode-dev.vsix && code --install-extension ./out/rls-vscode-dev.vsix" }, From 90a99fa7ca33748c0e3ce2e443a542d38d2df4cd Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 19 Aug 2020 22:13:18 +0200 Subject: [PATCH 806/819] Fix prettier glob for Windows --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d380eaf0..ff858f4a 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "watch": "tsc -watch -p ./", "lint": "eslint --ext ts src", "test": "node ./out/test/runTest.js", - "prettier": "prettier '**/*.ts'", + "prettier": "prettier \"**/*.ts\"", "check:version": "node cmd/check-version.js", "installDevExtension": "npm install && ./node_modules/.bin/vsce package -o ./out/rls-vscode-dev.vsix && code --install-extension ./out/rls-vscode-dev.vsix" }, From 23a0b5fa1066ed675dbc6b92df4d15b6fcd806f8 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 18 Aug 2020 17:07:31 +0200 Subject: [PATCH 807/819] Degrade ESLint no-unused-vars lint to warning --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 82a0c9e4..227b627e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,7 +18,7 @@ "plugins": ["@typescript-eslint"], "rules": { "@typescript-eslint/no-unused-vars": [ - "error", + "warn", { "argsIgnorePattern": "^_" } From 2f57d62745e03be34c29c58ca67d37f8f4129a41 Mon Sep 17 00:00:00 2001 From: chansuke Date: Thu, 29 Oct 2020 19:52:04 +0900 Subject: [PATCH 808/819] Add documentation for MacOS X keyboard --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c608a41a..97cce3c7 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,8 @@ too many. If you want more, check out ### Tasks The plugin provides tasks for building, running, and testing using the relevant -cargo commands. You can build using ctrl+shift+b. Access other tasks via -`Run Task` in the command palette. +cargo commands. You can build using ctrl+shift+b(Win/Linux), cmd+shift+b(macOS). +Access other tasks via `Run Task` in the command palette. The plugin writes these into `tasks.json`. The plugin will not overwrite existing tasks, so you can customise these tasks. To refresh back to the From c3a7621e4e6127f54125690788b192d249319250 Mon Sep 17 00:00:00 2001 From: chansuke Date: Thu, 29 Oct 2020 20:11:14 +0900 Subject: [PATCH 809/819] Update `node-fetch` to prevent vulnerability --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1777d43a..1a30fd24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1503,9 +1503,9 @@ } }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "nth-check": { "version": "1.0.2", diff --git a/package.json b/package.json index ff858f4a..9f4e49ab 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "installDevExtension": "npm install && ./node_modules/.bin/vsce package -o ./out/rls-vscode-dev.vsix && code --install-extension ./out/rls-vscode-dev.vsix" }, "dependencies": { - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "vscode-languageclient": "^6.0.0" }, "devDependencies": { From 3f39e430c8b457bc95b41bf696469c31ec1b7f04 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sun, 1 Nov 2020 13:07:44 +0000 Subject: [PATCH 810/819] Add a single GHA check for bors See https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors --- .github/workflows/nodejs.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 3f9f40cb..1cd767ee 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -37,3 +37,16 @@ jobs: if: runner.os == 'Linux' - run: npm test if: runner.os != 'Linux' + + # https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors + build_result: + name: bors build finished + runs-on: ubuntu-latest + needs: ["build"] + steps: + - name: Mark the job as successful + run: exit 0 + if: success() + - name: Mark the job as unsuccessful + run: exit 1 + if: "!success()" From 2f05df189336ba620558a6e51f46687f3eec6b32 Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Sun, 21 Feb 2021 22:13:49 +0800 Subject: [PATCH 811/819] Tweak repo address --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9f4e49ab..206a9238 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "license": "(MIT OR Apache-2.0)", "repository": { "type": "git", - "url": "https://github.com/rust-lang/rls-vscode" + "url": "https://github.com/rust-lang/vscode-rust" }, "bugs": { - "url": "https://github.com/rust-lang/rls-vscode/issues" + "url": "https://github.com/rust-lang/vscode-rust/issues" }, "categories": [ "Programming Languages", From a93456ce5029ffb1037f05020b1fe2437ba6fccd Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:39:05 +0200 Subject: [PATCH 812/819] Add deprecation notification pop up --- src/extension.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 51b45081..3c941627 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,6 +32,17 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { + await window.showWarningMessage( + "rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons", + "Open in your browser", "Open in a new editor tab" + ).then(button => { + commands.executeCommand( + 'vscode.open', + button == "Open browser" + ? Uri.parse('https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer') + : Uri.parse("vscode:extension/rust-lang.rust-analyzer") + ); + }); context.subscriptions.push( ...[ configureLanguage(), From 3f544964502f40aa22b7456eebc1e793f6d741b8 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:42:24 +0200 Subject: [PATCH 813/819] Add deprecation notice to README and title --- README.md | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 97cce3c7..e9d263bb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Rust support for Visual Studio Code +# Rust support for Visual Studio Code (deprecated) [![](https://vsmarketplacebadge.apphb.com/version/rust-lang.rust.svg)](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust) [![VSCode + Node.js CI](https://img.shields.io/github/workflow/status/rust-lang/rls-vscode/VSCode%20+%20Node.js%20CI.svg?logo=github)](https://github.com/rust-lang/rls-vscode/actions?query=workflow%3A%22VSCode+%2B+Node.js+CI%22) +> Note: This extension has been deprecated in favor of the [rust-analyzer project](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). + Adds language support for Rust to Visual Studio Code. Supports: * code completion diff --git a/package.json b/package.json index 206a9238..8e196b1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rust", - "displayName": "Rust", + "displayName": "Rust (deprecated)", "description": "Rust for Visual Studio Code (powered by Rust Language Server/Rust Analyzer). Provides lints, code completion and navigation, formatting and more.", "version": "0.7.8", "publisher": "rust-lang", From 3eafd7d7b2a43e7d5380699b15abb77a2dbeb2de Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:50:21 +0200 Subject: [PATCH 814/819] Format --- src/extension.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 3c941627..0a7b78fc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,17 +32,22 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { - await window.showWarningMessage( - "rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons", - "Open in your browser", "Open in a new editor tab" - ).then(button => { - commands.executeCommand( - 'vscode.open', - button == "Open browser" - ? Uri.parse('https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer') - : Uri.parse("vscode:extension/rust-lang.rust-analyzer") - ); - }); + await window + .showWarningMessage( + 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', + 'Open in your browser', + 'Open in a new editor tab', + ) + .then(button => { + commands.executeCommand( + 'vscode.open', + button === 'Open browser' + ? Uri.parse( + 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', + ) + : Uri.parse('vscode:extension/rust-lang.rust-analyzer'), + ); + }); context.subscriptions.push( ...[ configureLanguage(), From 95e89e7702294b099d2ff42aae3d3fdfb835bb77 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 25 May 2022 12:40:32 +0200 Subject: [PATCH 815/819] Add config to disable deprecation warning --- package.json | 5 +++++ src/extension.ts | 54 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 8e196b1c..8b8f096e 100644 --- a/package.json +++ b/package.json @@ -485,6 +485,11 @@ ], "default": null, "description": "When specified, uses the rust-analyzer binary at a given path" + }, + "rust-client.ignoreDeprecationWarning": { + "type": "boolean", + "default": false, + "description": "Whether to surpress the deprecation notification on start up." } } }, diff --git a/src/extension.ts b/src/extension.ts index 0a7b78fc..6a9bcecf 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,22 +32,43 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { - await window - .showWarningMessage( - 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', - 'Open in your browser', - 'Open in a new editor tab', - ) - .then(button => { - commands.executeCommand( - 'vscode.open', - button === 'Open browser' - ? Uri.parse( - 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', - ) - : Uri.parse('vscode:extension/rust-lang.rust-analyzer'), - ); - }); + const config = workspace.getConfiguration(); + if (!config.get('rust-client.ignoreDeprecationWarning', false)) { + window + .showWarningMessage( + 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', + 'Open in your browser', + 'Open in a new editor tab', + 'Disable Warning', + ) + .then(button => { + switch (button) { + case 'Disable Warning': + config.update( + 'rust-client.ignoreDeprecationWarning', + true, + ConfigurationTarget.Global, + ); + break; + case 'Open in your browser': + commands.executeCommand( + 'vscode.open', + Uri.parse( + 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', + ), + ); + break; + case 'Open in a new editor tab': + commands.executeCommand( + 'vscode.open', + Uri.parse('vscode:extension/rust-lang.rust-analyzer'), + ); + break; + default: + } + }); + } + context.subscriptions.push( ...[ configureLanguage(), @@ -62,7 +83,6 @@ export async function activate(context: ExtensionContext): Promise { // Migrate the users of multi-project setup for RLS to disable the setting // entirely (it's always on now) - const config = workspace.getConfiguration(); if ( typeof config.get( 'rust-client.enableMultiProjectSetup', From 0388a39ce61ae81536a689f35d1c007e12e51cee Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 25 May 2022 13:09:11 +0200 Subject: [PATCH 816/819] Update deprecation config key --- package.json | 2 +- src/extension.ts | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 8b8f096e..1f7e75ca 100644 --- a/package.json +++ b/package.json @@ -486,7 +486,7 @@ "default": null, "description": "When specified, uses the rust-analyzer binary at a given path" }, - "rust-client.ignoreDeprecationWarning": { + "rust.ignore_deprecation_warning": { "type": "boolean", "default": false, "description": "Whether to surpress the deprecation notification on start up." diff --git a/src/extension.ts b/src/extension.ts index 6a9bcecf..6225e05a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,8 +32,20 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { + context.subscriptions.push( + ...[ + configureLanguage(), + ...registerCommands(), + workspace.onDidChangeWorkspaceFolders(whenChangingWorkspaceFolders), + window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor), + ], + ); + // Manually trigger the first event to start up server instance if necessary, + // since VSCode doesn't do that on startup by itself. + onDidChangeActiveTextEditor(window.activeTextEditor); + const config = workspace.getConfiguration(); - if (!config.get('rust-client.ignoreDeprecationWarning', false)) { + if (!config.get('rust.ignore_deprecation_warning', false)) { window .showWarningMessage( 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', @@ -45,7 +57,7 @@ export async function activate(context: ExtensionContext): Promise { switch (button) { case 'Disable Warning': config.update( - 'rust-client.ignoreDeprecationWarning', + 'rust.ignore_deprecation_warning', true, ConfigurationTarget.Global, ); @@ -69,18 +81,6 @@ export async function activate(context: ExtensionContext): Promise { }); } - context.subscriptions.push( - ...[ - configureLanguage(), - ...registerCommands(), - workspace.onDidChangeWorkspaceFolders(whenChangingWorkspaceFolders), - window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor), - ], - ); - // Manually trigger the first event to start up server instance if necessary, - // since VSCode doesn't do that on startup by itself. - onDidChangeActiveTextEditor(window.activeTextEditor); - // Migrate the users of multi-project setup for RLS to disable the setting // entirely (it's always on now) if ( From efe5bd180eee05d2bf193c445451d27679843237 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 9 Nov 2022 17:38:10 -0800 Subject: [PATCH 817/819] Bump version to 0.7.9 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1a30fd24..0403b9d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rust", - "version": "0.7.8", + "version": "0.7.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1f7e75ca..94f49402 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "rust", "displayName": "Rust (deprecated)", "description": "Rust for Visual Studio Code (powered by Rust Language Server/Rust Analyzer). Provides lints, code completion and navigation, formatting and more.", - "version": "0.7.8", + "version": "0.7.9", "publisher": "rust-lang", "icon": "icon.png", "galleryBanner": { From 772027e4c790d83a1a15c35a06da1b9dd1bf4838 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 9 Nov 2022 17:39:36 -0800 Subject: [PATCH 818/819] Make README notice larger. --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e9d263bb..4268755e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,13 @@ [![](https://vsmarketplacebadge.apphb.com/version/rust-lang.rust.svg)](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust) [![VSCode + Node.js CI](https://img.shields.io/github/workflow/status/rust-lang/rls-vscode/VSCode%20+%20Node.js%20CI.svg?logo=github)](https://github.com/rust-lang/rls-vscode/actions?query=workflow%3A%22VSCode+%2B+Node.js+CI%22) -> Note: This extension has been deprecated in favor of the [rust-analyzer project](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). +---- + +> **Warning** +> # This extension is no longer maintained. +> This has been replaced by the [**rust-analyzer extension**](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). + +----- Adds language support for Rust to Visual Studio Code. Supports: From 0c49e2bd1ba95ebdbfdf911e8ca609c2be096027 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 15 Nov 2022 07:52:50 -0800 Subject: [PATCH 819/819] Update changelog for 0.7.9 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e347e1e8..c7523af3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ### Unreleased +### 0.7.9 - 2022-11-15 + +* This final version marks this extension as no longer supported. + Use the [rust-lang.rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) extension instead. + ### 0.7.8 - 2020-05-13 * Rebrand extension as RLS-agnostic