aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package-lock.json564
-rw-r--r--editors/code/package.json47
-rw-r--r--editors/code/rust.tmGrammar.json9
-rw-r--r--editors/code/src/ast_inspector.ts (renamed from editors/code/src/commands/syntax_tree.ts)88
-rw-r--r--editors/code/src/commands.ts370
-rw-r--r--editors/code/src/commands/analyzer_status.ts51
-rw-r--r--editors/code/src/commands/expand_macro.ts66
-rw-r--r--editors/code/src/commands/join_lines.ts22
-rw-r--r--editors/code/src/commands/matching_brace.ts27
-rw-r--r--editors/code/src/commands/on_enter.ts35
-rw-r--r--editors/code/src/commands/parent_module.ts29
-rw-r--r--editors/code/src/commands/server_version.ts15
-rw-r--r--editors/code/src/commands/ssr.ts30
-rw-r--r--editors/code/src/config.ts2
-rw-r--r--editors/code/src/debug.ts2
-rw-r--r--editors/code/src/inlay_hints.ts2
-rw-r--r--editors/code/src/lsp_ext.ts84
-rw-r--r--editors/code/src/main.ts2
-rw-r--r--editors/code/src/run.ts (renamed from editors/code/src/commands/runnables.ts)26
-rw-r--r--editors/code/src/rust-analyzer-api.ts125
-rw-r--r--editors/code/src/snippets.ts (renamed from editors/code/src/commands/index.ts)58
-rw-r--r--editors/code/src/source_change.ts54
-rw-r--r--editors/code/src/util.ts9
23 files changed, 852 insertions, 865 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json
index c322b02c8..3b4a31682 100644
--- a/editors/code/package-lock.json
+++ b/editors/code/package-lock.json
@@ -13,21 +13,27 @@
13 "@babel/highlight": "^7.8.3" 13 "@babel/highlight": "^7.8.3"
14 } 14 }
15 }, 15 },
16 "@babel/helper-validator-identifier": {
17 "version": "7.9.5",
18 "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz",
19 "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==",
20 "dev": true
21 },
16 "@babel/highlight": { 22 "@babel/highlight": {
17 "version": "7.8.3", 23 "version": "7.9.0",
18 "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", 24 "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
19 "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", 25 "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
20 "dev": true, 26 "dev": true,
21 "requires": { 27 "requires": {
28 "@babel/helper-validator-identifier": "^7.9.0",
22 "chalk": "^2.0.0", 29 "chalk": "^2.0.0",
23 "esutils": "^2.0.2",
24 "js-tokens": "^4.0.0" 30 "js-tokens": "^4.0.0"
25 } 31 }
26 }, 32 },
27 "@rollup/plugin-commonjs": { 33 "@rollup/plugin-commonjs": {
28 "version": "11.1.0", 34 "version": "12.0.0",
29 "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", 35 "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-12.0.0.tgz",
30 "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", 36 "integrity": "sha512-8+mDQt1QUmN+4Y9D3yCG8AJNewuTSLYPJVzKKUZ+lGeQrI+bV12Tc5HCyt2WdlnG6ihIL/DPbKRJlB40DX40mw==",
31 "dev": true, 37 "dev": true,
32 "requires": { 38 "requires": {
33 "@rollup/pluginutils": "^3.0.8", 39 "@rollup/pluginutils": "^3.0.8",
@@ -40,27 +46,29 @@
40 } 46 }
41 }, 47 },
42 "@rollup/plugin-node-resolve": { 48 "@rollup/plugin-node-resolve": {
43 "version": "7.1.3", 49 "version": "8.0.0",
44 "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", 50 "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.0.0.tgz",
45 "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", 51 "integrity": "sha512-5poJCChrkVggXXND/sQ7yNqwjUNT4fP31gpRWCnSNnlXuUXTCMHT33xZrTGxgjm5Rl18MHj7iEzlCT8rYWwQSA==",
46 "dev": true, 52 "dev": true,
47 "requires": { 53 "requires": {
48 "@rollup/pluginutils": "^3.0.8", 54 "@rollup/pluginutils": "^3.0.8",
49 "@types/resolve": "0.0.8", 55 "@types/resolve": "0.0.8",
50 "builtin-modules": "^3.1.0", 56 "builtin-modules": "^3.1.0",
57 "deep-freeze": "^0.0.1",
58 "deepmerge": "^4.2.2",
51 "is-module": "^1.0.0", 59 "is-module": "^1.0.0",
52 "resolve": "^1.14.2" 60 "resolve": "^1.14.2"
53 } 61 }
54 }, 62 },
55 "@rollup/pluginutils": { 63 "@rollup/pluginutils": {
56 "version": "3.0.9", 64 "version": "3.0.10",
57 "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.9.tgz", 65 "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.10.tgz",
58 "integrity": "sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==", 66 "integrity": "sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==",
59 "dev": true, 67 "dev": true,
60 "requires": { 68 "requires": {
61 "@types/estree": "0.0.39", 69 "@types/estree": "0.0.39",
62 "estree-walker": "^1.0.1", 70 "estree-walker": "^1.0.1",
63 "micromatch": "^4.0.2" 71 "picomatch": "^2.2.2"
64 } 72 }
65 }, 73 },
66 "@types/color-name": { 74 "@types/color-name": {
@@ -117,9 +125,9 @@
117 "dev": true 125 "dev": true
118 }, 126 },
119 "@types/node": { 127 "@types/node": {
120 "version": "12.12.39", 128 "version": "14.0.5",
121 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz", 129 "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz",
122 "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==", 130 "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==",
123 "dev": true 131 "dev": true
124 }, 132 },
125 "@types/node-fetch": { 133 "@types/node-fetch": {
@@ -148,56 +156,54 @@
148 "dev": true 156 "dev": true
149 }, 157 },
150 "@typescript-eslint/eslint-plugin": { 158 "@typescript-eslint/eslint-plugin": {
151 "version": "2.33.0", 159 "version": "3.0.0",
152 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.33.0.tgz", 160 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz",
153 "integrity": "sha512-QV6P32Btu1sCI/kTqjTNI/8OpCYyvlGjW5vD8MpTIg+HGE5S88HtT1G+880M4bXlvXj/NjsJJG0aGcVh0DdbeQ==", 161 "integrity": "sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==",
154 "dev": true, 162 "dev": true,
155 "requires": { 163 "requires": {
156 "@typescript-eslint/experimental-utils": "2.33.0", 164 "@typescript-eslint/experimental-utils": "3.0.0",
157 "functional-red-black-tree": "^1.0.1", 165 "functional-red-black-tree": "^1.0.1",
158 "regexpp": "^3.0.0", 166 "regexpp": "^3.0.0",
167 "semver": "^7.3.2",
159 "tsutils": "^3.17.1" 168 "tsutils": "^3.17.1"
169 },
170 "dependencies": {
171 "semver": {
172 "version": "7.3.2",
173 "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
174 "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
175 "dev": true
176 }
160 } 177 }
161 }, 178 },
162 "@typescript-eslint/experimental-utils": { 179 "@typescript-eslint/experimental-utils": {
163 "version": "2.33.0", 180 "version": "3.0.0",
164 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.33.0.tgz", 181 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz",
165 "integrity": "sha512-qzPM2AuxtMrRq78LwyZa8Qn6gcY8obkIrBs1ehqmQADwkYzTE1Pb4y2W+U3rE/iFkSWcWHG2LS6MJfj6SmHApg==", 182 "integrity": "sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==",
166 "dev": true, 183 "dev": true,
167 "requires": { 184 "requires": {
168 "@types/json-schema": "^7.0.3", 185 "@types/json-schema": "^7.0.3",
169 "@typescript-eslint/typescript-estree": "2.33.0", 186 "@typescript-eslint/typescript-estree": "3.0.0",
170 "eslint-scope": "^5.0.0", 187 "eslint-scope": "^5.0.0",
171 "eslint-utils": "^2.0.0" 188 "eslint-utils": "^2.0.0"
172 },
173 "dependencies": {
174 "eslint-utils": {
175 "version": "2.0.0",
176 "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz",
177 "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==",
178 "dev": true,
179 "requires": {
180 "eslint-visitor-keys": "^1.1.0"
181 }
182 }
183 } 189 }
184 }, 190 },
185 "@typescript-eslint/parser": { 191 "@typescript-eslint/parser": {
186 "version": "2.33.0", 192 "version": "3.0.0",
187 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.33.0.tgz", 193 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.0.tgz",
188 "integrity": "sha512-AUtmwUUhJoH6yrtxZMHbRUEMsC2G6z5NSxg9KsROOGqNXasM71I8P2NihtumlWTUCRld70vqIZ6Pm4E5PAziEA==", 194 "integrity": "sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==",
189 "dev": true, 195 "dev": true,
190 "requires": { 196 "requires": {
191 "@types/eslint-visitor-keys": "^1.0.0", 197 "@types/eslint-visitor-keys": "^1.0.0",
192 "@typescript-eslint/experimental-utils": "2.33.0", 198 "@typescript-eslint/experimental-utils": "3.0.0",
193 "@typescript-eslint/typescript-estree": "2.33.0", 199 "@typescript-eslint/typescript-estree": "3.0.0",
194 "eslint-visitor-keys": "^1.1.0" 200 "eslint-visitor-keys": "^1.1.0"
195 } 201 }
196 }, 202 },
197 "@typescript-eslint/typescript-estree": { 203 "@typescript-eslint/typescript-estree": {
198 "version": "2.33.0", 204 "version": "3.0.0",
199 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.33.0.tgz", 205 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz",
200 "integrity": "sha512-d8rY6/yUxb0+mEwTShCQF2zYQdLlqihukNfG9IUlLYz5y1CH6G/9XYbrxQLq3Z14RNvkCC6oe+OcFlyUpwUbkg==", 206 "integrity": "sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==",
201 "dev": true, 207 "dev": true,
202 "requires": { 208 "requires": {
203 "debug": "^4.1.1", 209 "debug": "^4.1.1",
@@ -218,9 +224,9 @@
218 } 224 }
219 }, 225 },
220 "acorn": { 226 "acorn": {
221 "version": "7.1.1", 227 "version": "7.2.0",
222 "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", 228 "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz",
223 "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", 229 "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==",
224 "dev": true 230 "dev": true
225 }, 231 },
226 "acorn-jsx": { 232 "acorn-jsx": {
@@ -239,9 +245,9 @@
239 } 245 }
240 }, 246 },
241 "ajv": { 247 "ajv": {
242 "version": "6.12.0", 248 "version": "6.12.2",
243 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", 249 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
244 "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", 250 "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
245 "dev": true, 251 "dev": true,
246 "requires": { 252 "requires": {
247 "fast-deep-equal": "^3.1.1", 253 "fast-deep-equal": "^3.1.1",
@@ -455,9 +461,9 @@
455 } 461 }
456 }, 462 },
457 "cli-width": { 463 "cli-width": {
458 "version": "2.2.0", 464 "version": "2.2.1",
459 "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", 465 "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz",
460 "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", 466 "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
461 "dev": true 467 "dev": true
462 }, 468 },
463 "cliui": { 469 "cliui": {
@@ -471,6 +477,12 @@
471 "wrap-ansi": "^5.1.0" 477 "wrap-ansi": "^5.1.0"
472 }, 478 },
473 "dependencies": { 479 "dependencies": {
480 "ansi-regex": {
481 "version": "4.1.0",
482 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
483 "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
484 "dev": true
485 },
474 "emoji-regex": { 486 "emoji-regex": {
475 "version": "7.0.3", 487 "version": "7.0.3",
476 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 488 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -493,6 +505,15 @@
493 "is-fullwidth-code-point": "^2.0.0", 505 "is-fullwidth-code-point": "^2.0.0",
494 "strip-ansi": "^5.1.0" 506 "strip-ansi": "^5.1.0"
495 } 507 }
508 },
509 "strip-ansi": {
510 "version": "5.2.0",
511 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
512 "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
513 "dev": true,
514 "requires": {
515 "ansi-regex": "^4.1.0"
516 }
496 } 517 }
497 } 518 }
498 }, 519 },
@@ -545,24 +566,14 @@
545 "dev": true 566 "dev": true
546 }, 567 },
547 "cross-spawn": { 568 "cross-spawn": {
548 "version": "6.0.5", 569 "version": "7.0.2",
549 "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", 570 "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz",
550 "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", 571 "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==",
551 "dev": true, 572 "dev": true,
552 "requires": { 573 "requires": {
553 "nice-try": "^1.0.4", 574 "path-key": "^3.1.0",
554 "path-key": "^2.0.1", 575 "shebang-command": "^2.0.0",
555 "semver": "^5.5.0", 576 "which": "^2.0.1"
556 "shebang-command": "^1.2.0",
557 "which": "^1.2.9"
558 },
559 "dependencies": {
560 "semver": {
561 "version": "5.7.1",
562 "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
563 "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
564 "dev": true
565 }
566 } 577 }
567 }, 578 },
568 "css-select": { 579 "css-select": {
@@ -598,12 +609,24 @@
598 "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", 609 "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
599 "dev": true 610 "dev": true
600 }, 611 },
612 "deep-freeze": {
613 "version": "0.0.1",
614 "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz",
615 "integrity": "sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ=",
616 "dev": true
617 },
601 "deep-is": { 618 "deep-is": {
602 "version": "0.1.3", 619 "version": "0.1.3",
603 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 620 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
604 "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", 621 "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
605 "dev": true 622 "dev": true
606 }, 623 },
624 "deepmerge": {
625 "version": "4.2.2",
626 "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
627 "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
628 "dev": true
629 },
607 "define-properties": { 630 "define-properties": {
608 "version": "1.1.3", 631 "version": "1.1.3",
609 "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 632 "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
@@ -759,22 +782,22 @@
759 "dev": true 782 "dev": true
760 }, 783 },
761 "eslint": { 784 "eslint": {
762 "version": "6.8.0", 785 "version": "7.1.0",
763 "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", 786 "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz",
764 "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", 787 "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==",
765 "dev": true, 788 "dev": true,
766 "requires": { 789 "requires": {
767 "@babel/code-frame": "^7.0.0", 790 "@babel/code-frame": "^7.0.0",
768 "ajv": "^6.10.0", 791 "ajv": "^6.10.0",
769 "chalk": "^2.1.0", 792 "chalk": "^4.0.0",
770 "cross-spawn": "^6.0.5", 793 "cross-spawn": "^7.0.2",
771 "debug": "^4.0.1", 794 "debug": "^4.0.1",
772 "doctrine": "^3.0.0", 795 "doctrine": "^3.0.0",
773 "eslint-scope": "^5.0.0", 796 "eslint-scope": "^5.0.0",
774 "eslint-utils": "^1.4.3", 797 "eslint-utils": "^2.0.0",
775 "eslint-visitor-keys": "^1.1.0", 798 "eslint-visitor-keys": "^1.1.0",
776 "espree": "^6.1.2", 799 "espree": "^7.0.0",
777 "esquery": "^1.0.1", 800 "esquery": "^1.2.0",
778 "esutils": "^2.0.2", 801 "esutils": "^2.0.2",
779 "file-entry-cache": "^5.0.1", 802 "file-entry-cache": "^5.0.1",
780 "functional-red-black-tree": "^1.0.1", 803 "functional-red-black-tree": "^1.0.1",
@@ -787,27 +810,76 @@
787 "is-glob": "^4.0.0", 810 "is-glob": "^4.0.0",
788 "js-yaml": "^3.13.1", 811 "js-yaml": "^3.13.1",
789 "json-stable-stringify-without-jsonify": "^1.0.1", 812 "json-stable-stringify-without-jsonify": "^1.0.1",
790 "levn": "^0.3.0", 813 "levn": "^0.4.1",
791 "lodash": "^4.17.14", 814 "lodash": "^4.17.14",
792 "minimatch": "^3.0.4", 815 "minimatch": "^3.0.4",
793 "mkdirp": "^0.5.1",
794 "natural-compare": "^1.4.0", 816 "natural-compare": "^1.4.0",
795 "optionator": "^0.8.3", 817 "optionator": "^0.9.1",
796 "progress": "^2.0.0", 818 "progress": "^2.0.0",
797 "regexpp": "^2.0.1", 819 "regexpp": "^3.1.0",
798 "semver": "^6.1.2", 820 "semver": "^7.2.1",
799 "strip-ansi": "^5.2.0", 821 "strip-ansi": "^6.0.0",
800 "strip-json-comments": "^3.0.1", 822 "strip-json-comments": "^3.1.0",
801 "table": "^5.2.3", 823 "table": "^5.2.3",
802 "text-table": "^0.2.0", 824 "text-table": "^0.2.0",
803 "v8-compile-cache": "^2.0.3" 825 "v8-compile-cache": "^2.0.3"
804 }, 826 },
805 "dependencies": { 827 "dependencies": {
806 "regexpp": { 828 "ansi-styles": {
829 "version": "4.2.1",
830 "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
831 "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
832 "dev": true,
833 "requires": {
834 "@types/color-name": "^1.1.1",
835 "color-convert": "^2.0.1"
836 }
837 },
838 "chalk": {
839 "version": "4.0.0",
840 "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
841 "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
842 "dev": true,
843 "requires": {
844 "ansi-styles": "^4.1.0",
845 "supports-color": "^7.1.0"
846 }
847 },
848 "color-convert": {
807 "version": "2.0.1", 849 "version": "2.0.1",
808 "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", 850 "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
809 "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", 851 "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
852 "dev": true,
853 "requires": {
854 "color-name": "~1.1.4"
855 }
856 },
857 "color-name": {
858 "version": "1.1.4",
859 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
860 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
861 "dev": true
862 },
863 "has-flag": {
864 "version": "4.0.0",
865 "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
866 "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
810 "dev": true 867 "dev": true
868 },
869 "semver": {
870 "version": "7.3.2",
871 "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
872 "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
873 "dev": true
874 },
875 "supports-color": {
876 "version": "7.1.0",
877 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
878 "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
879 "dev": true,
880 "requires": {
881 "has-flag": "^4.0.0"
882 }
811 } 883 }
812 } 884 }
813 }, 885 },
@@ -822,9 +894,9 @@
822 } 894 }
823 }, 895 },
824 "eslint-utils": { 896 "eslint-utils": {
825 "version": "1.4.3", 897 "version": "2.0.0",
826 "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", 898 "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz",
827 "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", 899 "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==",
828 "dev": true, 900 "dev": true,
829 "requires": { 901 "requires": {
830 "eslint-visitor-keys": "^1.1.0" 902 "eslint-visitor-keys": "^1.1.0"
@@ -837,9 +909,9 @@
837 "dev": true 909 "dev": true
838 }, 910 },
839 "espree": { 911 "espree": {
840 "version": "6.2.1", 912 "version": "7.0.0",
841 "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", 913 "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz",
842 "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", 914 "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==",
843 "dev": true, 915 "dev": true,
844 "requires": { 916 "requires": {
845 "acorn": "^7.1.1", 917 "acorn": "^7.1.1",
@@ -854,12 +926,20 @@
854 "dev": true 926 "dev": true
855 }, 927 },
856 "esquery": { 928 "esquery": {
857 "version": "1.1.0", 929 "version": "1.3.1",
858 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz", 930 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz",
859 "integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==", 931 "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==",
860 "dev": true, 932 "dev": true,
861 "requires": { 933 "requires": {
862 "estraverse": "^4.0.0" 934 "estraverse": "^5.1.0"
935 },
936 "dependencies": {
937 "estraverse": {
938 "version": "5.1.0",
939 "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz",
940 "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==",
941 "dev": true
942 }
863 } 943 }
864 }, 944 },
865 "esrecurse": { 945 "esrecurse": {
@@ -984,9 +1064,9 @@
984 } 1064 }
985 }, 1065 },
986 "flatted": { 1066 "flatted": {
987 "version": "2.0.1", 1067 "version": "2.0.2",
988 "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", 1068 "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
989 "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", 1069 "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
990 "dev": true 1070 "dev": true
991 }, 1071 },
992 "form-data": { 1072 "form-data": {
@@ -1046,9 +1126,9 @@
1046 } 1126 }
1047 }, 1127 },
1048 "glob-parent": { 1128 "glob-parent": {
1049 "version": "5.1.0", 1129 "version": "5.1.1",
1050 "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", 1130 "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
1051 "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", 1131 "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
1052 "dev": true, 1132 "dev": true,
1053 "requires": { 1133 "requires": {
1054 "is-glob": "^4.0.1" 1134 "is-glob": "^4.0.1"
@@ -1267,15 +1347,6 @@
1267 "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 1347 "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
1268 "dev": true 1348 "dev": true
1269 }, 1349 },
1270 "strip-ansi": {
1271 "version": "6.0.0",
1272 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
1273 "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
1274 "dev": true,
1275 "requires": {
1276 "ansi-regex": "^5.0.0"
1277 }
1278 },
1279 "supports-color": { 1350 "supports-color": {
1280 "version": "7.1.0", 1351 "version": "7.1.0",
1281 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", 1352 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
@@ -1347,12 +1418,6 @@
1347 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 1418 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
1348 "dev": true 1419 "dev": true
1349 }, 1420 },
1350 "is-promise": {
1351 "version": "2.1.0",
1352 "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
1353 "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
1354 "dev": true
1355 },
1356 "is-reference": { 1421 "is-reference": {
1357 "version": "1.1.4", 1422 "version": "1.1.4",
1358 "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", 1423 "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz",
@@ -1393,9 +1458,9 @@
1393 "dev": true 1458 "dev": true
1394 }, 1459 },
1395 "js-yaml": { 1460 "js-yaml": {
1396 "version": "3.13.1", 1461 "version": "3.14.0",
1397 "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", 1462 "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
1398 "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", 1463 "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
1399 "dev": true, 1464 "dev": true,
1400 "requires": { 1465 "requires": {
1401 "argparse": "^1.0.7", 1466 "argparse": "^1.0.7",
@@ -1421,13 +1486,13 @@
1421 "dev": true 1486 "dev": true
1422 }, 1487 },
1423 "levn": { 1488 "levn": {
1424 "version": "0.3.0", 1489 "version": "0.4.1",
1425 "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 1490 "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
1426 "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", 1491 "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
1427 "dev": true, 1492 "dev": true,
1428 "requires": { 1493 "requires": {
1429 "prelude-ls": "~1.1.2", 1494 "prelude-ls": "^1.2.1",
1430 "type-check": "~0.3.2" 1495 "type-check": "~0.4.0"
1431 } 1496 }
1432 }, 1497 },
1433 "linkify-it": { 1498 "linkify-it": {
@@ -1510,16 +1575,6 @@
1510 "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", 1575 "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=",
1511 "dev": true 1576 "dev": true
1512 }, 1577 },
1513 "micromatch": {
1514 "version": "4.0.2",
1515 "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
1516 "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
1517 "dev": true,
1518 "requires": {
1519 "braces": "^3.0.1",
1520 "picomatch": "^2.0.5"
1521 }
1522 },
1523 "mime": { 1578 "mime": {
1524 "version": "1.6.0", 1579 "version": "1.6.0",
1525 "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1580 "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@@ -1563,18 +1618,18 @@
1563 "dev": true 1618 "dev": true
1564 }, 1619 },
1565 "mkdirp": { 1620 "mkdirp": {
1566 "version": "0.5.3", 1621 "version": "0.5.5",
1567 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", 1622 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
1568 "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", 1623 "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
1569 "dev": true, 1624 "dev": true,
1570 "requires": { 1625 "requires": {
1571 "minimist": "^1.2.5" 1626 "minimist": "^1.2.5"
1572 } 1627 }
1573 }, 1628 },
1574 "mocha": { 1629 "mocha": {
1575 "version": "7.1.2", 1630 "version": "7.2.0",
1576 "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", 1631 "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz",
1577 "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", 1632 "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==",
1578 "dev": true, 1633 "dev": true,
1579 "requires": { 1634 "requires": {
1580 "ansi-colors": "3.2.3", 1635 "ansi-colors": "3.2.3",
@@ -1626,13 +1681,14 @@
1626 "path-is-absolute": "^1.0.0" 1681 "path-is-absolute": "^1.0.0"
1627 } 1682 }
1628 }, 1683 },
1629 "mkdirp": { 1684 "js-yaml": {
1630 "version": "0.5.5", 1685 "version": "3.13.1",
1631 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", 1686 "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
1632 "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", 1687 "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
1633 "dev": true, 1688 "dev": true,
1634 "requires": { 1689 "requires": {
1635 "minimist": "^1.2.5" 1690 "argparse": "^1.0.7",
1691 "esprima": "^4.0.0"
1636 } 1692 }
1637 }, 1693 },
1638 "ms": { 1694 "ms": {
@@ -1655,6 +1711,15 @@
1655 "requires": { 1711 "requires": {
1656 "has-flag": "^3.0.0" 1712 "has-flag": "^3.0.0"
1657 } 1713 }
1714 },
1715 "which": {
1716 "version": "1.3.1",
1717 "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
1718 "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
1719 "dev": true,
1720 "requires": {
1721 "isexe": "^2.0.0"
1722 }
1658 } 1723 }
1659 } 1724 }
1660 }, 1725 },
@@ -1676,12 +1741,6 @@
1676 "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 1741 "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
1677 "dev": true 1742 "dev": true
1678 }, 1743 },
1679 "nice-try": {
1680 "version": "1.0.5",
1681 "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
1682 "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
1683 "dev": true
1684 },
1685 "node-environment-flags": { 1744 "node-environment-flags": {
1686 "version": "1.0.6", 1745 "version": "1.0.6",
1687 "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", 1746 "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz",
@@ -1773,17 +1832,17 @@
1773 } 1832 }
1774 }, 1833 },
1775 "optionator": { 1834 "optionator": {
1776 "version": "0.8.3", 1835 "version": "0.9.1",
1777 "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", 1836 "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
1778 "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", 1837 "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
1779 "dev": true, 1838 "dev": true,
1780 "requires": { 1839 "requires": {
1781 "deep-is": "~0.1.3", 1840 "deep-is": "^0.1.3",
1782 "fast-levenshtein": "~2.0.6", 1841 "fast-levenshtein": "^2.0.6",
1783 "levn": "~0.3.0", 1842 "levn": "^0.4.1",
1784 "prelude-ls": "~1.1.2", 1843 "prelude-ls": "^1.2.1",
1785 "type-check": "~0.3.2", 1844 "type-check": "^0.4.0",
1786 "word-wrap": "~1.2.3" 1845 "word-wrap": "^1.2.3"
1787 } 1846 }
1788 }, 1847 },
1789 "os": { 1848 "os": {
@@ -1886,9 +1945,9 @@
1886 "dev": true 1945 "dev": true
1887 }, 1946 },
1888 "path-key": { 1947 "path-key": {
1889 "version": "2.0.1", 1948 "version": "3.1.1",
1890 "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", 1949 "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
1891 "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", 1950 "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
1892 "dev": true 1951 "dev": true
1893 }, 1952 },
1894 "path-parse": { 1953 "path-parse": {
@@ -1910,9 +1969,9 @@
1910 "dev": true 1969 "dev": true
1911 }, 1970 },
1912 "prelude-ls": { 1971 "prelude-ls": {
1913 "version": "1.1.2", 1972 "version": "1.2.1",
1914 "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 1973 "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
1915 "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", 1974 "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
1916 "dev": true 1975 "dev": true
1917 }, 1976 },
1918 "progress": { 1977 "progress": {
@@ -1981,9 +2040,9 @@
1981 "dev": true 2040 "dev": true
1982 }, 2041 },
1983 "resolve": { 2042 "resolve": {
1984 "version": "1.16.1", 2043 "version": "1.17.0",
1985 "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", 2044 "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
1986 "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==", 2045 "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
1987 "dev": true, 2046 "dev": true,
1988 "requires": { 2047 "requires": {
1989 "path-parse": "^1.0.6" 2048 "path-parse": "^1.0.6"
@@ -2015,30 +2074,35 @@
2015 } 2074 }
2016 }, 2075 },
2017 "rollup": { 2076 "rollup": {
2018 "version": "2.10.0", 2077 "version": "2.10.9",
2019 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.0.tgz", 2078 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.9.tgz",
2020 "integrity": "sha512-7BmpEfUN9P6esJzWIn3DmR//90mW6YwYB1t3y48LpF8ITpYtL8s1kEirMKqUu44dVH/6a/rs0EuwYVL3FuRDoA==", 2079 "integrity": "sha512-dY/EbjiWC17ZCUSyk14hkxATAMAShkMsD43XmZGWjLrgFj15M3Dw2kEkA9ns64BiLFm9PKN6vTQw8neHwK74eg==",
2021 "dev": true, 2080 "dev": true,
2022 "requires": { 2081 "requires": {
2023 "fsevents": "~2.1.2" 2082 "fsevents": "~2.1.2"
2024 } 2083 }
2025 }, 2084 },
2026 "run-async": { 2085 "run-async": {
2027 "version": "2.4.0", 2086 "version": "2.4.1",
2028 "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", 2087 "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
2029 "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", 2088 "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==",
2030 "dev": true, 2089 "dev": true
2031 "requires": {
2032 "is-promise": "^2.1.0"
2033 }
2034 }, 2090 },
2035 "rxjs": { 2091 "rxjs": {
2036 "version": "6.5.4", 2092 "version": "6.5.5",
2037 "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", 2093 "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz",
2038 "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", 2094 "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==",
2039 "dev": true, 2095 "dev": true,
2040 "requires": { 2096 "requires": {
2041 "tslib": "^1.9.0" 2097 "tslib": "^1.9.0"
2098 },
2099 "dependencies": {
2100 "tslib": {
2101 "version": "1.13.0",
2102 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
2103 "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
2104 "dev": true
2105 }
2042 } 2106 }
2043 }, 2107 },
2044 "safe-buffer": { 2108 "safe-buffer": {
@@ -2065,18 +2129,18 @@
2065 "dev": true 2129 "dev": true
2066 }, 2130 },
2067 "shebang-command": { 2131 "shebang-command": {
2068 "version": "1.2.0", 2132 "version": "2.0.0",
2069 "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 2133 "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
2070 "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 2134 "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
2071 "dev": true, 2135 "dev": true,
2072 "requires": { 2136 "requires": {
2073 "shebang-regex": "^1.0.0" 2137 "shebang-regex": "^3.0.0"
2074 } 2138 }
2075 }, 2139 },
2076 "shebang-regex": { 2140 "shebang-regex": {
2077 "version": "1.0.0", 2141 "version": "3.0.0",
2078 "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 2142 "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
2079 "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 2143 "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
2080 "dev": true 2144 "dev": true
2081 }, 2145 },
2082 "sigmund": { 2146 "sigmund": {
@@ -2086,9 +2150,9 @@
2086 "dev": true 2150 "dev": true
2087 }, 2151 },
2088 "signal-exit": { 2152 "signal-exit": {
2089 "version": "3.0.2", 2153 "version": "3.0.3",
2090 "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", 2154 "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
2091 "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", 2155 "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
2092 "dev": true 2156 "dev": true
2093 }, 2157 },
2094 "slice-ansi": { 2158 "slice-ansi": {
@@ -2131,17 +2195,6 @@
2131 "emoji-regex": "^8.0.0", 2195 "emoji-regex": "^8.0.0",
2132 "is-fullwidth-code-point": "^3.0.0", 2196 "is-fullwidth-code-point": "^3.0.0",
2133 "strip-ansi": "^6.0.0" 2197 "strip-ansi": "^6.0.0"
2134 },
2135 "dependencies": {
2136 "strip-ansi": {
2137 "version": "6.0.0",
2138 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
2139 "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
2140 "dev": true,
2141 "requires": {
2142 "ansi-regex": "^5.0.0"
2143 }
2144 }
2145 } 2198 }
2146 }, 2199 },
2147 "string.prototype.trimend": { 2200 "string.prototype.trimend": {
@@ -2196,26 +2249,18 @@
2196 } 2249 }
2197 }, 2250 },
2198 "strip-ansi": { 2251 "strip-ansi": {
2199 "version": "5.2.0", 2252 "version": "6.0.0",
2200 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 2253 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
2201 "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 2254 "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
2202 "dev": true, 2255 "dev": true,
2203 "requires": { 2256 "requires": {
2204 "ansi-regex": "^4.1.0" 2257 "ansi-regex": "^5.0.0"
2205 },
2206 "dependencies": {
2207 "ansi-regex": {
2208 "version": "4.1.0",
2209 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
2210 "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
2211 "dev": true
2212 }
2213 } 2258 }
2214 }, 2259 },
2215 "strip-json-comments": { 2260 "strip-json-comments": {
2216 "version": "3.0.1", 2261 "version": "3.1.0",
2217 "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", 2262 "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz",
2218 "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", 2263 "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==",
2219 "dev": true 2264 "dev": true
2220 }, 2265 },
2221 "supports-color": { 2266 "supports-color": {
@@ -2239,6 +2284,12 @@
2239 "string-width": "^3.0.0" 2284 "string-width": "^3.0.0"
2240 }, 2285 },
2241 "dependencies": { 2286 "dependencies": {
2287 "ansi-regex": {
2288 "version": "4.1.0",
2289 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
2290 "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
2291 "dev": true
2292 },
2242 "emoji-regex": { 2293 "emoji-regex": {
2243 "version": "7.0.3", 2294 "version": "7.0.3",
2244 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 2295 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -2261,6 +2312,15 @@
2261 "is-fullwidth-code-point": "^2.0.0", 2312 "is-fullwidth-code-point": "^2.0.0",
2262 "strip-ansi": "^5.1.0" 2313 "strip-ansi": "^5.1.0"
2263 } 2314 }
2315 },
2316 "strip-ansi": {
2317 "version": "5.2.0",
2318 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
2319 "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
2320 "dev": true,
2321 "requires": {
2322 "ansi-regex": "^4.1.0"
2323 }
2264 } 2324 }
2265 } 2325 }
2266 }, 2326 },
@@ -2295,9 +2355,9 @@
2295 } 2355 }
2296 }, 2356 },
2297 "tslib": { 2357 "tslib": {
2298 "version": "1.12.0", 2358 "version": "2.0.0",
2299 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.12.0.tgz", 2359 "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz",
2300 "integrity": "sha512-5rxCQkP0kytf4H1T4xz1imjxaUUPMvc5aWp0rJ/VMIN7ClRiH1FwFvBt8wOeMasp/epeUnmSW6CixSIePtiLqA==", 2360 "integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==",
2301 "dev": true 2361 "dev": true
2302 }, 2362 },
2303 "tsutils": { 2363 "tsutils": {
@@ -2307,6 +2367,14 @@
2307 "dev": true, 2367 "dev": true,
2308 "requires": { 2368 "requires": {
2309 "tslib": "^1.8.1" 2369 "tslib": "^1.8.1"
2370 },
2371 "dependencies": {
2372 "tslib": {
2373 "version": "1.13.0",
2374 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
2375 "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
2376 "dev": true
2377 }
2310 } 2378 }
2311 }, 2379 },
2312 "tunnel": { 2380 "tunnel": {
@@ -2316,12 +2384,12 @@
2316 "dev": true 2384 "dev": true
2317 }, 2385 },
2318 "type-check": { 2386 "type-check": {
2319 "version": "0.3.2", 2387 "version": "0.4.0",
2320 "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 2388 "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
2321 "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", 2389 "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
2322 "dev": true, 2390 "dev": true,
2323 "requires": { 2391 "requires": {
2324 "prelude-ls": "~1.1.2" 2392 "prelude-ls": "^1.2.1"
2325 } 2393 }
2326 }, 2394 },
2327 "type-fest": { 2395 "type-fest": {
@@ -2341,9 +2409,9 @@
2341 } 2409 }
2342 }, 2410 },
2343 "typescript": { 2411 "typescript": {
2344 "version": "3.9.2", 2412 "version": "3.9.3",
2345 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", 2413 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz",
2346 "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", 2414 "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==",
2347 "dev": true 2415 "dev": true
2348 }, 2416 },
2349 "typescript-formatter": { 2417 "typescript-formatter": {
@@ -2480,9 +2548,9 @@
2480 } 2548 }
2481 }, 2549 },
2482 "which": { 2550 "which": {
2483 "version": "1.3.1", 2551 "version": "2.0.2",
2484 "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 2552 "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
2485 "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 2553 "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
2486 "dev": true, 2554 "dev": true,
2487 "requires": { 2555 "requires": {
2488 "isexe": "^2.0.0" 2556 "isexe": "^2.0.0"
@@ -2553,6 +2621,12 @@
2553 "strip-ansi": "^5.0.0" 2621 "strip-ansi": "^5.0.0"
2554 }, 2622 },
2555 "dependencies": { 2623 "dependencies": {
2624 "ansi-regex": {
2625 "version": "4.1.0",
2626 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
2627 "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
2628 "dev": true
2629 },
2556 "emoji-regex": { 2630 "emoji-regex": {
2557 "version": "7.0.3", 2631 "version": "7.0.3",
2558 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 2632 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -2575,6 +2649,15 @@
2575 "is-fullwidth-code-point": "^2.0.0", 2649 "is-fullwidth-code-point": "^2.0.0",
2576 "strip-ansi": "^5.1.0" 2650 "strip-ansi": "^5.1.0"
2577 } 2651 }
2652 },
2653 "strip-ansi": {
2654 "version": "5.2.0",
2655 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
2656 "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
2657 "dev": true,
2658 "requires": {
2659 "ansi-regex": "^4.1.0"
2660 }
2578 } 2661 }
2579 } 2662 }
2580 }, 2663 },
@@ -2623,6 +2706,12 @@
2623 "yargs-parser": "^13.1.2" 2706 "yargs-parser": "^13.1.2"
2624 }, 2707 },
2625 "dependencies": { 2708 "dependencies": {
2709 "ansi-regex": {
2710 "version": "4.1.0",
2711 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
2712 "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
2713 "dev": true
2714 },
2626 "emoji-regex": { 2715 "emoji-regex": {
2627 "version": "7.0.3", 2716 "version": "7.0.3",
2628 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 2717 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -2645,6 +2734,15 @@
2645 "is-fullwidth-code-point": "^2.0.0", 2734 "is-fullwidth-code-point": "^2.0.0",
2646 "strip-ansi": "^5.1.0" 2735 "strip-ansi": "^5.1.0"
2647 } 2736 }
2737 },
2738 "strip-ansi": {
2739 "version": "5.2.0",
2740 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
2741 "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
2742 "dev": true,
2743 "requires": {
2744 "ansi-regex": "^4.1.0"
2745 }
2648 } 2746 }
2649 } 2747 }
2650 }, 2748 },
diff --git a/editors/code/package.json b/editors/code/package.json
index 1eebe0608..acf3ca4b5 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -21,7 +21,7 @@
21 "Programming Languages" 21 "Programming Languages"
22 ], 22 ],
23 "engines": { 23 "engines": {
24 "vscode": "^1.44.0" 24 "vscode": "^1.44.1"
25 }, 25 },
26 "enableProposedApi": true, 26 "enableProposedApi": true,
27 "scripts": { 27 "scripts": {
@@ -39,21 +39,21 @@
39 "vscode-languageclient": "7.0.0-next.1" 39 "vscode-languageclient": "7.0.0-next.1"
40 }, 40 },
41 "devDependencies": { 41 "devDependencies": {
42 "@rollup/plugin-commonjs": "^11.1.0", 42 "@rollup/plugin-commonjs": "^12.0.0",
43 "@rollup/plugin-node-resolve": "^7.1.3", 43 "@rollup/plugin-node-resolve": "^8.0.0",
44 "@types/glob": "^7.1.1", 44 "@types/glob": "^7.1.1",
45 "@types/mocha": "^7.0.2", 45 "@types/mocha": "^7.0.2",
46 "@types/node": "^12.12.39", 46 "@types/node": "^14.0.5",
47 "@types/node-fetch": "^2.5.7", 47 "@types/node-fetch": "^2.5.7",
48 "@types/vscode": "^1.44.0", 48 "@types/vscode": "^1.44.1",
49 "@typescript-eslint/eslint-plugin": "^2.33.0", 49 "@typescript-eslint/eslint-plugin": "^3.0.0",
50 "@typescript-eslint/parser": "^2.33.0", 50 "@typescript-eslint/parser": "^3.0.0",
51 "eslint": "^6.8.0", 51 "eslint": "^7.0.0",
52 "glob": "^7.1.6", 52 "glob": "^7.1.6",
53 "mocha": "^7.1.2", 53 "mocha": "^7.1.2",
54 "rollup": "^2.10.0", 54 "rollup": "^2.10.7",
55 "tslib": "^1.12.0", 55 "tslib": "^2.0.0",
56 "typescript": "^3.9.2", 56 "typescript": "^3.9.3",
57 "typescript-formatter": "^7.2.2", 57 "typescript-formatter": "^7.2.2",
58 "vsce": "^1.75.0", 58 "vsce": "^1.75.0",
59 "vscode-test": "^1.3.0" 59 "vscode-test": "^1.3.0"
@@ -166,6 +166,11 @@
166 "command": "rust-analyzer.serverVersion", 166 "command": "rust-analyzer.serverVersion",
167 "title": "Show RA Version", 167 "title": "Show RA Version",
168 "category": "Rust Analyzer" 168 "category": "Rust Analyzer"
169 },
170 {
171 "command": "rust-analyzer.toggleInlayHints",
172 "title": "Toggle inlay hints",
173 "category": "Rust Analyzer"
169 } 174 }
170 ], 175 ],
171 "keybindings": [ 176 "keybindings": [
@@ -582,6 +587,11 @@
582 "description": "Style for attributes" 587 "description": "Style for attributes"
583 }, 588 },
584 { 589 {
590 "id": "boolean",
591 "description": "Style for boolean literals",
592 "superType": "keyword"
593 },
594 {
585 "id": "builtinType", 595 "id": "builtinType",
586 "description": "Style for builtin types", 596 "description": "Style for builtin types",
587 "superType": "type" 597 "superType": "type"
@@ -591,6 +601,11 @@
591 "description": "Style for lifetimes" 601 "description": "Style for lifetimes"
592 }, 602 },
593 { 603 {
604 "id": "selfKeyword",
605 "description": "Style for the self keyword",
606 "superType": "keyword"
607 },
608 {
594 "id": "typeAlias", 609 "id": "typeAlias",
595 "description": "Style for type aliases", 610 "description": "Style for type aliases",
596 "superType": "type" 611 "superType": "type"
@@ -611,6 +626,10 @@
611 ], 626 ],
612 "semanticTokenModifiers": [ 627 "semanticTokenModifiers": [
613 { 628 {
629 "id": "attribute",
630 "description": "Style for elements within attributes"
631 },
632 {
614 "id": "constant", 633 "id": "constant",
615 "description": "Style for compile-time constants" 634 "description": "Style for compile-time constants"
616 }, 635 },
@@ -637,6 +656,12 @@
637 "attribute": [ 656 "attribute": [
638 "meta.attribute.rust" 657 "meta.attribute.rust"
639 ], 658 ],
659 "function.attribute": [
660 "entity.name.function.attribute.rust"
661 ],
662 "boolean": [
663 "constant.language.boolean.rust"
664 ],
640 "builtinType": [ 665 "builtinType": [
641 "support.type.primitive.rust" 666 "support.type.primitive.rust"
642 ], 667 ],
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json
index aa0811326..ab87cd39f 100644
--- a/editors/code/rust.tmGrammar.json
+++ b/editors/code/rust.tmGrammar.json
@@ -75,8 +75,13 @@
75 { 75 {
76 "comment": "Attribute", 76 "comment": "Attribute",
77 "name": "meta.attribute.rust", 77 "name": "meta.attribute.rust",
78 "begin": "#\\!?\\[", 78 "begin": "#\\!?\\[(\\w*)",
79 "end": "\\]", 79 "end": "\\]",
80 "captures": {
81 "1": {
82 "name": "entity.name.function.attribute.rust"
83 }
84 },
80 "patterns": [ 85 "patterns": [
81 { 86 {
82 "include": "#string_literal" 87 "include": "#string_literal"
@@ -202,7 +207,7 @@
202 { 207 {
203 "comment": "Miscellaneous operator", 208 "comment": "Miscellaneous operator",
204 "name": "keyword.operator.misc.rust", 209 "name": "keyword.operator.misc.rust",
205 "match": "(=>|::)" 210 "match": "(=>|::|\\?)"
206 }, 211 },
207 { 212 {
208 "comment": "Comparison operator", 213 "comment": "Comparison operator",
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/ast_inspector.ts
index a5446c327..4fdd167bd 100644
--- a/editors/code/src/commands/syntax_tree.ts
+++ b/editors/code/src/ast_inspector.ts
@@ -1,93 +1,15 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api';
3
4import { Ctx, Cmd, Disposable } from '../ctx';
5import { isRustDocument, RustEditor, isRustEditor, sleep } from '../util';
6
7const AST_FILE_SCHEME = "rust-analyzer";
8
9// Opens the virtual file that will show the syntax tree
10//
11// The contents of the file come from the `TextDocumentContentProvider`
12export function syntaxTree(ctx: Ctx): Cmd {
13 const tdcp = new TextDocumentContentProvider(ctx);
14
15 void new AstInspector(ctx);
16
17 ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp));
18 ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", {
19 brackets: [["[", ")"]],
20 }));
21
22 return async () => {
23 const editor = vscode.window.activeTextEditor;
24 const rangeEnabled = !!editor && !editor.selection.isEmpty;
25
26 const uri = rangeEnabled
27 ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`)
28 : tdcp.uri;
29
30 const document = await vscode.workspace.openTextDocument(uri);
31
32 tdcp.eventEmitter.fire(uri);
33
34 void await vscode.window.showTextDocument(document, {
35 viewColumn: vscode.ViewColumn.Two,
36 preserveFocus: true
37 });
38 };
39}
40
41class TextDocumentContentProvider implements vscode.TextDocumentContentProvider {
42 readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast');
43 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>();
44
45
46 constructor(private readonly ctx: Ctx) {
47 vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions);
48 vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, ctx.subscriptions);
49 }
50
51 private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) {
52 if (isRustDocument(event.document)) {
53 // We need to order this after language server updates, but there's no API for that.
54 // Hence, good old sleep().
55 void sleep(10).then(() => this.eventEmitter.fire(this.uri));
56 }
57 }
58 private onDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined) {
59 if (editor && isRustEditor(editor)) {
60 this.eventEmitter.fire(this.uri);
61 }
62 }
63
64 provideTextDocumentContent(uri: vscode.Uri, ct: vscode.CancellationToken): vscode.ProviderResult<string> {
65 const rustEditor = this.ctx.activeRustEditor;
66 if (!rustEditor) return '';
67
68 // When the range based query is enabled we take the range of the selection
69 const range = uri.query === 'range=true' && !rustEditor.selection.isEmpty
70 ? this.ctx.client.code2ProtocolConverter.asRange(rustEditor.selection)
71 : null;
72
73 const params = { textDocument: { uri: rustEditor.document.uri.toString() }, range, };
74 return this.ctx.client.sendRequest(ra.syntaxTree, params, ct);
75 }
76
77 get onDidChange(): vscode.Event<vscode.Uri> {
78 return this.eventEmitter.event;
79 }
80}
81 2
3import { Ctx, Disposable } from './ctx';
4import { RustEditor, isRustEditor } from './util';
82 5
83// FIXME: consider implementing this via the Tree View API? 6// FIXME: consider implementing this via the Tree View API?
84// https://code.visualstudio.com/api/extension-guides/tree-view 7// https://code.visualstudio.com/api/extension-guides/tree-view
85class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, Disposable { 8export class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, Disposable {
86 private readonly astDecorationType = vscode.window.createTextEditorDecorationType({ 9 private readonly astDecorationType = vscode.window.createTextEditorDecorationType({
87 borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'), 10 borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'),
88 borderStyle: "solid", 11 borderStyle: "solid",
89 borderWidth: "2px", 12 borderWidth: "2px",
90
91 }); 13 });
92 private rustEditor: undefined | RustEditor; 14 private rustEditor: undefined | RustEditor;
93 15
@@ -113,7 +35,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D
113 }); 35 });
114 36
115 constructor(ctx: Ctx) { 37 constructor(ctx: Ctx) {
116 ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: AST_FILE_SCHEME }, this)); 38 ctx.pushCleanup(vscode.languages.registerHoverProvider({ scheme: 'rust-analyzer' }, this));
117 ctx.pushCleanup(vscode.languages.registerDefinitionProvider({ language: "rust" }, this)); 39 ctx.pushCleanup(vscode.languages.registerDefinitionProvider({ language: "rust" }, this));
118 vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, ctx.subscriptions); 40 vscode.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, ctx.subscriptions);
119 vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions); 41 vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions);
@@ -146,7 +68,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D
146 } 68 }
147 69
148 private findAstTextEditor(): undefined | vscode.TextEditor { 70 private findAstTextEditor(): undefined | vscode.TextEditor {
149 return vscode.window.visibleTextEditors.find(it => it.document.uri.scheme === AST_FILE_SCHEME); 71 return vscode.window.visibleTextEditors.find(it => it.document.uri.scheme === 'rust-analyzer');
150 } 72 }
151 73
152 private setRustEditor(newRustEditor: undefined | RustEditor) { 74 private setRustEditor(newRustEditor: undefined | RustEditor) {
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
new file mode 100644
index 000000000..86302db37
--- /dev/null
+++ b/editors/code/src/commands.ts
@@ -0,0 +1,370 @@
1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
3import * as ra from './lsp_ext';
4
5import { Ctx, Cmd } from './ctx';
6import { applySnippetWorkspaceEdit, applySnippetTextEdits } from './snippets';
7import { spawnSync } from 'child_process';
8import { RunnableQuickPick, selectRunnable, createTask } from './run';
9import { AstInspector } from './ast_inspector';
10import { isRustDocument, sleep, isRustEditor } from './util';
11
12export * from './ast_inspector';
13export * from './run';
14
15export function analyzerStatus(ctx: Ctx): Cmd {
16 const tdcp = new class implements vscode.TextDocumentContentProvider {
17 readonly uri = vscode.Uri.parse('rust-analyzer-status://status');
18 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>();
19
20 provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult<string> {
21 if (!vscode.window.activeTextEditor) return '';
22
23 return ctx.client.sendRequest(ra.analyzerStatus, null);
24 }
25
26 get onDidChange(): vscode.Event<vscode.Uri> {
27 return this.eventEmitter.event;
28 }
29 }();
30
31 let poller: NodeJS.Timer | undefined = undefined;
32
33 ctx.pushCleanup(
34 vscode.workspace.registerTextDocumentContentProvider(
35 'rust-analyzer-status',
36 tdcp,
37 ),
38 );
39
40 ctx.pushCleanup({
41 dispose() {
42 if (poller !== undefined) {
43 clearInterval(poller);
44 }
45 },
46 });
47
48 return async () => {
49 if (poller === undefined) {
50 poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000);
51 }
52 const document = await vscode.workspace.openTextDocument(tdcp.uri);
53 return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true);
54 };
55}
56
57export function matchingBrace(ctx: Ctx): Cmd {
58 return async () => {
59 const editor = ctx.activeRustEditor;
60 const client = ctx.client;
61 if (!editor || !client) return;
62
63 const response = await client.sendRequest(ra.matchingBrace, {
64 textDocument: { uri: editor.document.uri.toString() },
65 positions: editor.selections.map(s =>
66 client.code2ProtocolConverter.asPosition(s.active),
67 ),
68 });
69 editor.selections = editor.selections.map((sel, idx) => {
70 const active = client.protocol2CodeConverter.asPosition(
71 response[idx],
72 );
73 const anchor = sel.isEmpty ? active : sel.anchor;
74 return new vscode.Selection(anchor, active);
75 });
76 editor.revealRange(editor.selection);
77 };
78}
79
80export function joinLines(ctx: Ctx): Cmd {
81 return async () => {
82 const editor = ctx.activeRustEditor;
83 const client = ctx.client;
84 if (!editor || !client) return;
85
86 const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, {
87 ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)),
88 textDocument: { uri: editor.document.uri.toString() },
89 });
90 editor.edit((builder) => {
91 client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => {
92 builder.replace(edit.range, edit.newText);
93 });
94 });
95 };
96}
97
98export function onEnter(ctx: Ctx): Cmd {
99 async function handleKeypress() {
100 const editor = ctx.activeRustEditor;
101 const client = ctx.client;
102
103 if (!editor || !client) return false;
104
105 const lcEdits = await client.sendRequest(ra.onEnter, {
106 textDocument: { uri: editor.document.uri.toString() },
107 position: client.code2ProtocolConverter.asPosition(
108 editor.selection.active,
109 ),
110 }).catch(_error => {
111 // client.logFailedRequest(OnEnterRequest.type, error);
112 return null;
113 });
114 if (!lcEdits) return false;
115
116 const edits = client.protocol2CodeConverter.asTextEdits(lcEdits);
117 await applySnippetTextEdits(editor, edits);
118 return true;
119 }
120
121 return async () => {
122 if (await handleKeypress()) return;
123
124 await vscode.commands.executeCommand('default:type', { text: '\n' });
125 };
126}
127
128export function parentModule(ctx: Ctx): Cmd {
129 return async () => {
130 const editor = ctx.activeRustEditor;
131 const client = ctx.client;
132 if (!editor || !client) return;
133
134 const response = await client.sendRequest(ra.parentModule, {
135 textDocument: { uri: editor.document.uri.toString() },
136 position: client.code2ProtocolConverter.asPosition(
137 editor.selection.active,
138 ),
139 });
140 const loc = response[0];
141 if (!loc) return;
142
143 const uri = client.protocol2CodeConverter.asUri(loc.targetUri);
144 const range = client.protocol2CodeConverter.asRange(loc.targetRange);
145
146 const doc = await vscode.workspace.openTextDocument(uri);
147 const e = await vscode.window.showTextDocument(doc);
148 e.selection = new vscode.Selection(range.start, range.start);
149 e.revealRange(range, vscode.TextEditorRevealType.InCenter);
150 };
151}
152
153export function ssr(ctx: Ctx): Cmd {
154 return async () => {
155 const client = ctx.client;
156 if (!client) return;
157
158 const options: vscode.InputBoxOptions = {
159 value: "() ==>> ()",
160 prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
161 validateInput: async (x: string) => {
162 try {
163 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
164 } catch (e) {
165 return e.toString();
166 }
167 return null;
168 }
169 };
170 const request = await vscode.window.showInputBox(options);
171 if (!request) return;
172
173 const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false });
174
175 await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
176 };
177}
178
179export function serverVersion(ctx: Ctx): Cmd {
180 return async () => {
181 const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
182 const commitHash = stdout.slice(`rust-analyzer `.length).trim();
183 const { releaseTag } = ctx.config.package;
184
185 void vscode.window.showInformationMessage(
186 `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})`
187 );
188 };
189}
190
191export function toggleInlayHints(ctx: Ctx): Cmd {
192 return async () => {
193 await vscode
194 .workspace
195 .getConfiguration(`${ctx.config.rootSection}.inlayHints`)
196 .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Workspace);
197 };
198}
199
200export function run(ctx: Ctx): Cmd {
201 let prevRunnable: RunnableQuickPick | undefined;
202
203 return async () => {
204 const item = await selectRunnable(ctx, prevRunnable);
205 if (!item) return;
206
207 item.detail = 'rerun';
208 prevRunnable = item;
209 const task = createTask(item.runnable);
210 return await vscode.tasks.executeTask(task);
211 };
212}
213
214// Opens the virtual file that will show the syntax tree
215//
216// The contents of the file come from the `TextDocumentContentProvider`
217export function syntaxTree(ctx: Ctx): Cmd {
218 const tdcp = new class implements vscode.TextDocumentContentProvider {
219 readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast');
220 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>();
221 constructor() {
222 vscode.workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, ctx.subscriptions);
223 vscode.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor, this, ctx.subscriptions);
224 }
225
226 private onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) {
227 if (isRustDocument(event.document)) {
228 // We need to order this after language server updates, but there's no API for that.
229 // Hence, good old sleep().
230 void sleep(10).then(() => this.eventEmitter.fire(this.uri));
231 }
232 }
233 private onDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined) {
234 if (editor && isRustEditor(editor)) {
235 this.eventEmitter.fire(this.uri);
236 }
237 }
238
239 provideTextDocumentContent(uri: vscode.Uri, ct: vscode.CancellationToken): vscode.ProviderResult<string> {
240 const rustEditor = ctx.activeRustEditor;
241 if (!rustEditor) return '';
242
243 // When the range based query is enabled we take the range of the selection
244 const range = uri.query === 'range=true' && !rustEditor.selection.isEmpty
245 ? ctx.client.code2ProtocolConverter.asRange(rustEditor.selection)
246 : null;
247
248 const params = { textDocument: { uri: rustEditor.document.uri.toString() }, range, };
249 return ctx.client.sendRequest(ra.syntaxTree, params, ct);
250 }
251
252 get onDidChange(): vscode.Event<vscode.Uri> {
253 return this.eventEmitter.event;
254 }
255 };
256
257 void new AstInspector(ctx);
258
259 ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp));
260 ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", {
261 brackets: [["[", ")"]],
262 }));
263
264 return async () => {
265 const editor = vscode.window.activeTextEditor;
266 const rangeEnabled = !!editor && !editor.selection.isEmpty;
267
268 const uri = rangeEnabled
269 ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`)
270 : tdcp.uri;
271
272 const document = await vscode.workspace.openTextDocument(uri);
273
274 tdcp.eventEmitter.fire(uri);
275
276 void await vscode.window.showTextDocument(document, {
277 viewColumn: vscode.ViewColumn.Two,
278 preserveFocus: true
279 });
280 };
281}
282
283
284// Opens the virtual file that will show the syntax tree
285//
286// The contents of the file come from the `TextDocumentContentProvider`
287export function expandMacro(ctx: Ctx): Cmd {
288 function codeFormat(expanded: ra.ExpandedMacro): string {
289 let result = `// Recursive expansion of ${expanded.name}! macro\n`;
290 result += '// ' + '='.repeat(result.length - 3);
291 result += '\n\n';
292 result += expanded.expansion;
293
294 return result;
295 }
296
297 const tdcp = new class implements vscode.TextDocumentContentProvider {
298 uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs');
299 eventEmitter = new vscode.EventEmitter<vscode.Uri>();
300 async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> {
301 const editor = vscode.window.activeTextEditor;
302 const client = ctx.client;
303 if (!editor || !client) return '';
304
305 const position = editor.selection.active;
306
307 const expanded = await client.sendRequest(ra.expandMacro, {
308 textDocument: { uri: editor.document.uri.toString() },
309 position,
310 });
311
312 if (expanded == null) return 'Not available';
313
314 return codeFormat(expanded);
315 }
316
317 get onDidChange(): vscode.Event<vscode.Uri> {
318 return this.eventEmitter.event;
319 }
320 }();
321
322 ctx.pushCleanup(
323 vscode.workspace.registerTextDocumentContentProvider(
324 'rust-analyzer',
325 tdcp,
326 ),
327 );
328
329 return async () => {
330 const document = await vscode.workspace.openTextDocument(tdcp.uri);
331 tdcp.eventEmitter.fire(tdcp.uri);
332 return vscode.window.showTextDocument(
333 document,
334 vscode.ViewColumn.Two,
335 true,
336 );
337 };
338}
339
340export function collectGarbage(ctx: Ctx): Cmd {
341 return async () => ctx.client.sendRequest(ra.collectGarbage, null);
342}
343
344export function showReferences(ctx: Ctx): Cmd {
345 return (uri: string, position: lc.Position, locations: lc.Location[]) => {
346 const client = ctx.client;
347 if (client) {
348 vscode.commands.executeCommand(
349 'editor.action.showReferences',
350 vscode.Uri.parse(uri),
351 client.protocol2CodeConverter.asPosition(position),
352 locations.map(client.protocol2CodeConverter.asLocation),
353 );
354 }
355 };
356}
357
358export function applyActionGroup(_ctx: Ctx): Cmd {
359 return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => {
360 const selectedAction = await vscode.window.showQuickPick(actions);
361 if (!selectedAction) return;
362 await applySnippetWorkspaceEdit(selectedAction.edit);
363 };
364}
365
366export function applySnippetWorkspaceEditCommand(_ctx: Ctx): Cmd {
367 return async (edit: vscode.WorkspaceEdit) => {
368 await applySnippetWorkspaceEdit(edit);
369 };
370}
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts
deleted file mode 100644
index 09daa3402..000000000
--- a/editors/code/src/commands/analyzer_status.ts
+++ /dev/null
@@ -1,51 +0,0 @@
1import * as vscode from 'vscode';
2
3import * as ra from '../rust-analyzer-api';
4import { Ctx, Cmd } from '../ctx';
5
6// Shows status of rust-analyzer (for debugging)
7export function analyzerStatus(ctx: Ctx): Cmd {
8 let poller: NodeJS.Timer | undefined = undefined;
9 const tdcp = new TextDocumentContentProvider(ctx);
10
11 ctx.pushCleanup(
12 vscode.workspace.registerTextDocumentContentProvider(
13 'rust-analyzer-status',
14 tdcp,
15 ),
16 );
17
18 ctx.pushCleanup({
19 dispose() {
20 if (poller !== undefined) {
21 clearInterval(poller);
22 }
23 },
24 });
25
26 return async () => {
27 if (poller === undefined) {
28 poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000);
29 }
30 const document = await vscode.workspace.openTextDocument(tdcp.uri);
31 return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true);
32 };
33}
34
35class TextDocumentContentProvider implements vscode.TextDocumentContentProvider {
36 readonly uri = vscode.Uri.parse('rust-analyzer-status://status');
37 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>();
38
39 constructor(private readonly ctx: Ctx) {
40 }
41
42 provideTextDocumentContent(_uri: vscode.Uri): vscode.ProviderResult<string> {
43 if (!vscode.window.activeTextEditor) return '';
44
45 return this.ctx.client.sendRequest(ra.analyzerStatus, null);
46 }
47
48 get onDidChange(): vscode.Event<vscode.Uri> {
49 return this.eventEmitter.event;
50 }
51}
diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts
deleted file mode 100644
index 23f2ef1d5..000000000
--- a/editors/code/src/commands/expand_macro.ts
+++ /dev/null
@@ -1,66 +0,0 @@
1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api';
3
4import { Ctx, Cmd } from '../ctx';
5
6// Opens the virtual file that will show the syntax tree
7//
8// The contents of the file come from the `TextDocumentContentProvider`
9export function expandMacro(ctx: Ctx): Cmd {
10 const tdcp = new TextDocumentContentProvider(ctx);
11 ctx.pushCleanup(
12 vscode.workspace.registerTextDocumentContentProvider(
13 'rust-analyzer',
14 tdcp,
15 ),
16 );
17
18 return async () => {
19 const document = await vscode.workspace.openTextDocument(tdcp.uri);
20 tdcp.eventEmitter.fire(tdcp.uri);
21 return vscode.window.showTextDocument(
22 document,
23 vscode.ViewColumn.Two,
24 true,
25 );
26 };
27}
28
29function codeFormat(expanded: ra.ExpandedMacro): string {
30 let result = `// Recursive expansion of ${expanded.name}! macro\n`;
31 result += '// ' + '='.repeat(result.length - 3);
32 result += '\n\n';
33 result += expanded.expansion;
34
35 return result;
36}
37
38class TextDocumentContentProvider
39 implements vscode.TextDocumentContentProvider {
40 uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs');
41 eventEmitter = new vscode.EventEmitter<vscode.Uri>();
42
43 constructor(private readonly ctx: Ctx) {
44 }
45
46 async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> {
47 const editor = vscode.window.activeTextEditor;
48 const client = this.ctx.client;
49 if (!editor || !client) return '';
50
51 const position = editor.selection.active;
52
53 const expanded = await client.sendRequest(ra.expandMacro, {
54 textDocument: { uri: editor.document.uri.toString() },
55 position,
56 });
57
58 if (expanded == null) return 'Not available';
59
60 return codeFormat(expanded);
61 }
62
63 get onDidChange(): vscode.Event<vscode.Uri> {
64 return this.eventEmitter.event;
65 }
66}
diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts
deleted file mode 100644
index 0bf1ee6e6..000000000
--- a/editors/code/src/commands/join_lines.ts
+++ /dev/null
@@ -1,22 +0,0 @@
1import * as ra from '../rust-analyzer-api';
2import * as lc from 'vscode-languageclient';
3
4import { Ctx, Cmd } from '../ctx';
5
6export function joinLines(ctx: Ctx): Cmd {
7 return async () => {
8 const editor = ctx.activeRustEditor;
9 const client = ctx.client;
10 if (!editor || !client) return;
11
12 const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, {
13 ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)),
14 textDocument: { uri: editor.document.uri.toString() },
15 });
16 editor.edit((builder) => {
17 client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => {
18 builder.replace(edit.range, edit.newText);
19 });
20 });
21 };
22}
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts
deleted file mode 100644
index a60776e2d..000000000
--- a/editors/code/src/commands/matching_brace.ts
+++ /dev/null
@@ -1,27 +0,0 @@
1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api';
3
4import { Ctx, Cmd } from '../ctx';
5
6export function matchingBrace(ctx: Ctx): Cmd {
7 return async () => {
8 const editor = ctx.activeRustEditor;
9 const client = ctx.client;
10 if (!editor || !client) return;
11
12 const response = await client.sendRequest(ra.findMatchingBrace, {
13 textDocument: { uri: editor.document.uri.toString() },
14 offsets: editor.selections.map(s =>
15 client.code2ProtocolConverter.asPosition(s.active),
16 ),
17 });
18 editor.selections = editor.selections.map((sel, idx) => {
19 const active = client.protocol2CodeConverter.asPosition(
20 response[idx],
21 );
22 const anchor = sel.isEmpty ? active : sel.anchor;
23 return new vscode.Selection(anchor, active);
24 });
25 editor.revealRange(editor.selection);
26 };
27}
diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts
deleted file mode 100644
index a7871c31e..000000000
--- a/editors/code/src/commands/on_enter.ts
+++ /dev/null
@@ -1,35 +0,0 @@
1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api';
3
4import { Cmd, Ctx } from '../ctx';
5import { applySnippetWorkspaceEdit } from '.';
6
7async function handleKeypress(ctx: Ctx) {
8 const editor = ctx.activeRustEditor;
9 const client = ctx.client;
10
11 if (!editor || !client) return false;
12
13 const change = await client.sendRequest(ra.onEnter, {
14 textDocument: { uri: editor.document.uri.toString() },
15 position: client.code2ProtocolConverter.asPosition(
16 editor.selection.active,
17 ),
18 }).catch(_error => {
19 // client.logFailedRequest(OnEnterRequest.type, error);
20 return null;
21 });
22 if (!change) return false;
23
24 const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change);
25 await applySnippetWorkspaceEdit(workspaceEdit);
26 return true;
27}
28
29export function onEnter(ctx: Ctx): Cmd {
30 return async () => {
31 if (await handleKeypress(ctx)) return;
32
33 await vscode.commands.executeCommand('default:type', { text: '\n' });
34 };
35}
diff --git a/editors/code/src/commands/parent_module.ts b/editors/code/src/commands/parent_module.ts
deleted file mode 100644
index 8f78ddd71..000000000
--- a/editors/code/src/commands/parent_module.ts
+++ /dev/null
@@ -1,29 +0,0 @@
1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api';
3
4import { Ctx, Cmd } from '../ctx';
5
6export function parentModule(ctx: Ctx): Cmd {
7 return async () => {
8 const editor = ctx.activeRustEditor;
9 const client = ctx.client;
10 if (!editor || !client) return;
11
12 const response = await client.sendRequest(ra.parentModule, {
13 textDocument: { uri: editor.document.uri.toString() },
14 position: client.code2ProtocolConverter.asPosition(
15 editor.selection.active,
16 ),
17 });
18 const loc = response[0];
19 if (loc == null) return;
20
21 const uri = client.protocol2CodeConverter.asUri(loc.uri);
22 const range = client.protocol2CodeConverter.asRange(loc.range);
23
24 const doc = await vscode.workspace.openTextDocument(uri);
25 const e = await vscode.window.showTextDocument(doc);
26 e.selection = new vscode.Selection(range.start, range.start);
27 e.revealRange(range, vscode.TextEditorRevealType.InCenter);
28 };
29}
diff --git a/editors/code/src/commands/server_version.ts b/editors/code/src/commands/server_version.ts
deleted file mode 100644
index d64ac726e..000000000
--- a/editors/code/src/commands/server_version.ts
+++ /dev/null
@@ -1,15 +0,0 @@
1import * as vscode from "vscode";
2import { spawnSync } from "child_process";
3import { Ctx, Cmd } from '../ctx';
4
5export function serverVersion(ctx: Ctx): Cmd {
6 return async () => {
7 const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
8 const commitHash = stdout.slice(`rust-analyzer `.length).trim();
9 const { releaseTag } = ctx.config.package;
10
11 void vscode.window.showInformationMessage(
12 `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})`
13 );
14 };
15}
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts
deleted file mode 100644
index 5d40a64d2..000000000
--- a/editors/code/src/commands/ssr.ts
+++ /dev/null
@@ -1,30 +0,0 @@
1import * as vscode from 'vscode';
2import * as ra from "../rust-analyzer-api";
3
4import { Ctx, Cmd } from '../ctx';
5
6export function ssr(ctx: Ctx): Cmd {
7 return async () => {
8 const client = ctx.client;
9 if (!client) return;
10
11 const options: vscode.InputBoxOptions = {
12 value: "() ==>> ()",
13 prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
14 validateInput: async (x: string) => {
15 try {
16 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
17 } catch (e) {
18 return e.toString();
19 }
20 return null;
21 }
22 };
23 const request = await vscode.window.showInputBox(options);
24 if (!request) return;
25
26 const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false });
27
28 await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
29 };
30}
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index ee294fbe3..e8abf8284 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -8,7 +8,7 @@ export const NIGHTLY_TAG = "nightly";
8export class Config { 8export class Config {
9 readonly extensionId = "matklad.rust-analyzer"; 9 readonly extensionId = "matklad.rust-analyzer";
10 10
11 private readonly rootSection = "rust-analyzer"; 11 readonly rootSection = "rust-analyzer";
12 private readonly requiresReloadOpts = [ 12 private readonly requiresReloadOpts = [
13 "serverPath", 13 "serverPath",
14 "cargo", 14 "cargo",
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index d3fe588e8..027504ecd 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -1,7 +1,7 @@
1import * as os from "os"; 1import * as os from "os";
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3import * as path from 'path'; 3import * as path from 'path';
4import * as ra from './rust-analyzer-api'; 4import * as ra from './lsp_ext';
5 5
6import { Cargo } from './cargo'; 6import { Cargo } from './cargo';
7import { Ctx } from "./ctx"; 7import { Ctx } from "./ctx";
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index a2b07d003..9e6d6045f 100644
--- a/editors/code/src/inlay_hints.ts
+++ b/editors/code/src/inlay_hints.ts
@@ -1,6 +1,6 @@
1import * as lc from "vscode-languageclient"; 1import * as lc from "vscode-languageclient";
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3import * as ra from './rust-analyzer-api'; 3import * as ra from './lsp_ext';
4 4
5import { Ctx, Disposable } from './ctx'; 5import { Ctx, Disposable } from './ctx';
6import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, sleep } from './util'; 6import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, sleep } from './util';
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
new file mode 100644
index 000000000..4da12eb30
--- /dev/null
+++ b/editors/code/src/lsp_ext.ts
@@ -0,0 +1,84 @@
1/**
2 * This file mirrors `crates/rust-analyzer/src/req.rs` declarations.
3 */
4
5import * as lc from "vscode-languageclient";
6
7export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus");
8
9export const collectGarbage = new lc.RequestType<null, null, void>("rust-analyzer/collectGarbage");
10
11export interface SyntaxTreeParams {
12 textDocument: lc.TextDocumentIdentifier;
13 range: lc.Range | null;
14}
15export const syntaxTree = new lc.RequestType<SyntaxTreeParams, string, void>("rust-analyzer/syntaxTree");
16
17
18export interface ExpandMacroParams {
19 textDocument: lc.TextDocumentIdentifier;
20 position: lc.Position;
21}
22export interface ExpandedMacro {
23 name: string;
24 expansion: string;
25}
26export const expandMacro = new lc.RequestType<ExpandMacroParams, ExpandedMacro | null, void>("rust-analyzer/expandMacro");
27
28export interface MatchingBraceParams {
29 textDocument: lc.TextDocumentIdentifier;
30 positions: lc.Position[];
31}
32export const matchingBrace = new lc.RequestType<MatchingBraceParams, lc.Position[], void>("experimental/matchingBrace");
33
34export const parentModule = new lc.RequestType<lc.TextDocumentPositionParams, lc.LocationLink[], void>("experimental/parentModule");
35
36export interface JoinLinesParams {
37 textDocument: lc.TextDocumentIdentifier;
38 ranges: lc.Range[];
39}
40export const joinLines = new lc.RequestType<JoinLinesParams, lc.TextEdit[], void>("experimental/joinLines");
41
42export const onEnter = new lc.RequestType<lc.TextDocumentPositionParams, lc.TextEdit[], void>("experimental/onEnter");
43
44export interface RunnablesParams {
45 textDocument: lc.TextDocumentIdentifier;
46 position: lc.Position | null;
47}
48export interface Runnable {
49 range: lc.Range;
50 label: string;
51 bin: string;
52 args: string[];
53 extraArgs: string[];
54 env: { [key: string]: string };
55 cwd: string | null;
56}
57export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("rust-analyzer/runnables");
58
59export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint;
60
61export namespace InlayHint {
62 export const enum Kind {
63 TypeHint = "TypeHint",
64 ParamHint = "ParameterHint",
65 ChainingHint = "ChainingHint",
66 }
67 interface Common {
68 range: lc.Range;
69 label: string;
70 }
71 export type TypeHint = Common & { kind: Kind.TypeHint };
72 export type ParamHint = Common & { kind: Kind.ParamHint };
73 export type ChainingHint = Common & { kind: Kind.ChainingHint };
74}
75export interface InlayHintsParams {
76 textDocument: lc.TextDocumentIdentifier;
77}
78export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("rust-analyzer/inlayHints");
79
80export interface SsrParams {
81 query: string;
82 parseOnly: boolean;
83}
84export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>('experimental/ssr');
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 3405634f3..31ac81ee8 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -86,12 +86,12 @@ export async function activate(context: vscode.ExtensionContext) {
86 86
87 ctx.registerCommand('ssr', commands.ssr); 87 ctx.registerCommand('ssr', commands.ssr);
88 ctx.registerCommand('serverVersion', commands.serverVersion); 88 ctx.registerCommand('serverVersion', commands.serverVersion);
89 ctx.registerCommand('toggleInlayHints', commands.toggleInlayHints);
89 90
90 // Internal commands which are invoked by the server. 91 // Internal commands which are invoked by the server.
91 ctx.registerCommand('runSingle', commands.runSingle); 92 ctx.registerCommand('runSingle', commands.runSingle);
92 ctx.registerCommand('debugSingle', commands.debugSingle); 93 ctx.registerCommand('debugSingle', commands.debugSingle);
93 ctx.registerCommand('showReferences', commands.showReferences); 94 ctx.registerCommand('showReferences', commands.showReferences);
94 ctx.registerCommand('applySourceChange', commands.applySourceChange);
95 ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand); 95 ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand);
96 ctx.registerCommand('applyActionGroup', commands.applyActionGroup); 96 ctx.registerCommand('applyActionGroup', commands.applyActionGroup);
97 97
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/run.ts
index 0bd30fb07..2a7a429cf 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/run.ts
@@ -1,13 +1,13 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3import * as ra from '../rust-analyzer-api'; 3import * as ra from './lsp_ext';
4 4
5import { Ctx, Cmd } from '../ctx'; 5import { Ctx, Cmd } from './ctx';
6import { startDebugSession, getDebugConfiguration } from '../debug'; 6import { startDebugSession, getDebugConfiguration } from './debug';
7 7
8const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; 8const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }];
9 9
10async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debuggeeOnly = false, showButtons: boolean = true): Promise<RunnableQuickPick | undefined> { 10export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debuggeeOnly = false, showButtons: boolean = true): Promise<RunnableQuickPick | undefined> {
11 const editor = ctx.activeRustEditor; 11 const editor = ctx.activeRustEditor;
12 const client = ctx.client; 12 const client = ctx.client;
13 if (!editor || !client) return; 13 if (!editor || !client) return;
@@ -83,20 +83,6 @@ async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debugg
83 }); 83 });
84} 84}
85 85
86export function run(ctx: Ctx): Cmd {
87 let prevRunnable: RunnableQuickPick | undefined;
88
89 return async () => {
90 const item = await selectRunnable(ctx, prevRunnable);
91 if (!item) return;
92
93 item.detail = 'rerun';
94 prevRunnable = item;
95 const task = createTask(item.runnable);
96 return await vscode.tasks.executeTask(task);
97 };
98}
99
100export function runSingle(ctx: Ctx): Cmd { 86export function runSingle(ctx: Ctx): Cmd {
101 return async (runnable: ra.Runnable) => { 87 return async (runnable: ra.Runnable) => {
102 const editor = ctx.activeRustEditor; 88 const editor = ctx.activeRustEditor;
@@ -165,7 +151,7 @@ export function newDebugConfig(ctx: Ctx): Cmd {
165 }; 151 };
166} 152}
167 153
168class RunnableQuickPick implements vscode.QuickPickItem { 154export class RunnableQuickPick implements vscode.QuickPickItem {
169 public label: string; 155 public label: string;
170 public description?: string | undefined; 156 public description?: string | undefined;
171 public detail?: string | undefined; 157 public detail?: string | undefined;
@@ -184,7 +170,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition {
184 env?: { [key: string]: string }; 170 env?: { [key: string]: string };
185} 171}
186 172
187function createTask(spec: ra.Runnable): vscode.Task { 173export function createTask(spec: ra.Runnable): vscode.Task {
188 const TASK_SOURCE = 'Rust'; 174 const TASK_SOURCE = 'Rust';
189 const definition: CargoTaskDefinition = { 175 const definition: CargoTaskDefinition = {
190 type: 'cargo', 176 type: 'cargo',
diff --git a/editors/code/src/rust-analyzer-api.ts b/editors/code/src/rust-analyzer-api.ts
deleted file mode 100644
index 73f36432f..000000000
--- a/editors/code/src/rust-analyzer-api.ts
+++ /dev/null
@@ -1,125 +0,0 @@
1/**
2 * This file mirrors `crates/rust-analyzer/src/req.rs` declarations.
3 */
4
5import * as lc from "vscode-languageclient";
6
7type Option<T> = null | T;
8type Vec<T> = T[];
9type FxHashMap<K extends PropertyKey, V> = Record<K, V>;
10
11function request<TParams, TResult>(method: string) {
12 return new lc.RequestType<TParams, TResult, unknown>(`rust-analyzer/${method}`);
13}
14function notification<TParam>(method: string) {
15 return new lc.NotificationType<TParam>(method);
16}
17
18
19export const analyzerStatus = request<null, string>("analyzerStatus");
20
21
22export const collectGarbage = request<null, null>("collectGarbage");
23
24
25export interface SyntaxTreeParams {
26 textDocument: lc.TextDocumentIdentifier;
27 range: Option<lc.Range>;
28}
29export const syntaxTree = request<SyntaxTreeParams, string>("syntaxTree");
30
31
32export interface ExpandMacroParams {
33 textDocument: lc.TextDocumentIdentifier;
34 position: Option<lc.Position>;
35}
36export interface ExpandedMacro {
37 name: string;
38 expansion: string;
39}
40export const expandMacro = request<ExpandMacroParams, Option<ExpandedMacro>>("expandMacro");
41
42
43export interface FindMatchingBraceParams {
44 textDocument: lc.TextDocumentIdentifier;
45 offsets: Vec<lc.Position>;
46}
47export const findMatchingBrace = request<FindMatchingBraceParams, Vec<lc.Position>>("findMatchingBrace");
48
49
50export interface PublishDecorationsParams {
51 uri: string;
52 decorations: Vec<Decoration>;
53}
54export interface Decoration {
55 range: lc.Range;
56 tag: string;
57 bindingHash: Option<string>;
58}
59export const decorationsRequest = request<lc.TextDocumentIdentifier, Vec<Decoration>>("decorationsRequest");
60
61
62export const parentModule = request<lc.TextDocumentPositionParams, Vec<lc.Location>>("parentModule");
63
64
65export interface JoinLinesParams {
66 textDocument: lc.TextDocumentIdentifier;
67 ranges: lc.Range[];
68}
69export const joinLines = new lc.RequestType<JoinLinesParams, lc.TextEdit[], unknown>('experimental/joinLines');
70
71
72export const onEnter = request<lc.TextDocumentPositionParams, Option<lc.WorkspaceEdit>>("onEnter");
73
74export interface RunnablesParams {
75 textDocument: lc.TextDocumentIdentifier;
76 position: Option<lc.Position>;
77}
78export interface Runnable {
79 range: lc.Range;
80 label: string;
81 bin: string;
82 args: Vec<string>;
83 extraArgs: Vec<string>;
84 env: FxHashMap<string, string>;
85 cwd: Option<string>;
86}
87export const runnables = request<RunnablesParams, Vec<Runnable>>("runnables");
88
89export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint;
90
91export namespace InlayHint {
92 export const enum Kind {
93 TypeHint = "TypeHint",
94 ParamHint = "ParameterHint",
95 ChainingHint = "ChainingHint",
96 }
97 interface Common {
98 range: lc.Range;
99 label: string;
100 }
101 export type TypeHint = Common & { kind: Kind.TypeHint };
102 export type ParamHint = Common & { kind: Kind.ParamHint };
103 export type ChainingHint = Common & { kind: Kind.ChainingHint };
104}
105export interface InlayHintsParams {
106 textDocument: lc.TextDocumentIdentifier;
107}
108export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints");
109
110
111export interface SsrParams {
112 query: string;
113 parseOnly: boolean;
114}
115export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, unknown>('experimental/ssr');
116
117
118export const publishDecorations = notification<PublishDecorationsParams>("publishDecorations");
119
120
121export interface SourceChange {
122 label: string;
123 workspaceEdit: lc.WorkspaceEdit;
124 cursorPosition: Option<lc.TextDocumentPositionParams>;
125}
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/snippets.ts
index abb53a248..bcb3f2cc7 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/snippets.ts
@@ -1,59 +1,6 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
3import * as ra from '../rust-analyzer-api';
4 2
5import { Ctx, Cmd } from '../ctx'; 3import { assert } from './util';
6import * as sourceChange from '../source_change';
7import { assert } from '../util';
8
9export * from './analyzer_status';
10export * from './matching_brace';
11export * from './join_lines';
12export * from './on_enter';
13export * from './parent_module';
14export * from './syntax_tree';
15export * from './expand_macro';
16export * from './runnables';
17export * from './ssr';
18export * from './server_version';
19
20export function collectGarbage(ctx: Ctx): Cmd {
21 return async () => ctx.client.sendRequest(ra.collectGarbage, null);
22}
23
24export function showReferences(ctx: Ctx): Cmd {
25 return (uri: string, position: lc.Position, locations: lc.Location[]) => {
26 const client = ctx.client;
27 if (client) {
28 vscode.commands.executeCommand(
29 'editor.action.showReferences',
30 vscode.Uri.parse(uri),
31 client.protocol2CodeConverter.asPosition(position),
32 locations.map(client.protocol2CodeConverter.asLocation),
33 );
34 }
35 };
36}
37
38export function applySourceChange(ctx: Ctx): Cmd {
39 return async (change: ra.SourceChange) => {
40 await sourceChange.applySourceChange(ctx, change);
41 };
42}
43
44export function applyActionGroup(_ctx: Ctx): Cmd {
45 return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => {
46 const selectedAction = await vscode.window.showQuickPick(actions);
47 if (!selectedAction) return;
48 await applySnippetWorkspaceEdit(selectedAction.edit);
49 };
50}
51
52export function applySnippetWorkspaceEditCommand(_ctx: Ctx): Cmd {
53 return async (edit: vscode.WorkspaceEdit) => {
54 await applySnippetWorkspaceEdit(edit);
55 };
56}
57 4
58export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { 5export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) {
59 assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`); 6 assert(edit.entries().length === 1, `bad ws edit: ${JSON.stringify(edit)}`);
@@ -61,7 +8,10 @@ export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) {
61 8
62 const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString()); 9 const editor = vscode.window.visibleTextEditors.find((it) => it.document.uri.toString() === uri.toString());
63 if (!editor) return; 10 if (!editor) return;
11 await applySnippetTextEdits(editor, edits);
12}
64 13
14export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vscode.TextEdit[]) {
65 let selection: vscode.Selection | undefined = undefined; 15 let selection: vscode.Selection | undefined = undefined;
66 let lineDelta = 0; 16 let lineDelta = 0;
67 await editor.edit((builder) => { 17 await editor.edit((builder) => {
diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts
deleted file mode 100644
index af8f1df51..000000000
--- a/editors/code/src/source_change.ts
+++ /dev/null
@@ -1,54 +0,0 @@
1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
3import * as ra from './rust-analyzer-api';
4
5import { Ctx } from './ctx';
6
7export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) {
8 const client = ctx.client;
9 if (!client) return;
10
11 const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit(
12 change.workspaceEdit,
13 );
14 let created;
15 let moved;
16 if (change.workspaceEdit.documentChanges) {
17 for (const docChange of change.workspaceEdit.documentChanges) {
18 if (lc.CreateFile.is(docChange)) {
19 created = docChange.uri;
20 } else if (lc.RenameFile.is(docChange)) {
21 moved = docChange.newUri;
22 }
23 }
24 }
25 const toOpen = created || moved;
26 const toReveal = change.cursorPosition;
27 await vscode.workspace.applyEdit(wsEdit);
28 if (toOpen) {
29 const toOpenUri = vscode.Uri.parse(toOpen);
30 const doc = await vscode.workspace.openTextDocument(toOpenUri);
31 await vscode.window.showTextDocument(doc);
32 } else if (toReveal) {
33 const uri = client.protocol2CodeConverter.asUri(
34 toReveal.textDocument.uri,
35 );
36 const position = client.protocol2CodeConverter.asPosition(
37 toReveal.position,
38 );
39 const editor = vscode.window.activeTextEditor;
40 if (!editor || !editor.selection.isEmpty) {
41 return;
42 }
43
44 if (editor.document.uri !== uri) {
45 const doc = await vscode.workspace.openTextDocument(uri);
46 await vscode.window.showTextDocument(doc);
47 }
48 editor.selection = new vscode.Selection(position, position);
49 editor.revealRange(
50 new vscode.Range(position, position),
51 vscode.TextEditorRevealType.Default,
52 );
53 }
54}
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index 127a9e911..793c481fb 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -74,10 +74,11 @@ export type RustDocument = vscode.TextDocument & { languageId: "rust" };
74export type RustEditor = vscode.TextEditor & { document: RustDocument }; 74export type RustEditor = vscode.TextEditor & { document: RustDocument };
75 75
76export function isRustDocument(document: vscode.TextDocument): document is RustDocument { 76export function isRustDocument(document: vscode.TextDocument): document is RustDocument {
77 return document.languageId === 'rust' 77 // Prevent corrupted text (particularly via inlay hints) in diff views
78 // SCM diff views have the same URI as the on-disk document but not the same content 78 // by allowing only `file` schemes
79 && document.uri.scheme !== 'git' 79 // unfortunately extensions that use diff views not always set this
80 && document.uri.scheme !== 'svn'; 80 // to something different than 'file' (see ongoing bug: #4608)
81 return document.languageId === 'rust' && document.uri.scheme === 'file';
81} 82}
82 83
83export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { 84export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor {