aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package-lock.json145
-rw-r--r--editors/code/package.json25
-rw-r--r--editors/code/ra_syntax_tree.tmGrammar.json2
-rw-r--r--editors/code/src/commands/syntax_tree.ts37
-rw-r--r--editors/code/src/source_change.ts8
-rw-r--r--editors/code/src/tasks.ts103
6 files changed, 222 insertions, 98 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json
index e11cffd68..55ba5351d 100644
--- a/editors/code/package-lock.json
+++ b/editors/code/package-lock.json
@@ -25,25 +25,27 @@
25 } 25 }
26 }, 26 },
27 "@rollup/plugin-commonjs": { 27 "@rollup/plugin-commonjs": {
28 "version": "11.0.2", 28 "version": "11.1.0",
29 "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz", 29 "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz",
30 "integrity": "sha512-MPYGZr0qdbV5zZj8/2AuomVpnRVXRU5XKXb3HVniwRoRCreGlf5kOE081isNWeiLIi6IYkwTX9zE0/c7V8g81g==", 30 "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==",
31 "dev": true, 31 "dev": true,
32 "requires": { 32 "requires": {
33 "@rollup/pluginutils": "^3.0.0", 33 "@rollup/pluginutils": "^3.0.8",
34 "commondir": "^1.0.1",
34 "estree-walker": "^1.0.1", 35 "estree-walker": "^1.0.1",
36 "glob": "^7.1.2",
35 "is-reference": "^1.1.2", 37 "is-reference": "^1.1.2",
36 "magic-string": "^0.25.2", 38 "magic-string": "^0.25.2",
37 "resolve": "^1.11.0" 39 "resolve": "^1.11.0"
38 } 40 }
39 }, 41 },
40 "@rollup/plugin-node-resolve": { 42 "@rollup/plugin-node-resolve": {
41 "version": "7.1.1", 43 "version": "7.1.3",
42 "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.1.tgz", 44 "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz",
43 "integrity": "sha512-14ddhD7TnemeHE97a4rLOhobfYvUVcaYuqTnL8Ti7Jxi9V9Jr5LY7Gko4HZ5k4h4vqQM0gBQt6tsp9xXW94WPA==", 45 "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==",
44 "dev": true, 46 "dev": true,
45 "requires": { 47 "requires": {
46 "@rollup/pluginutils": "^3.0.6", 48 "@rollup/pluginutils": "^3.0.8",
47 "@types/resolve": "0.0.8", 49 "@types/resolve": "0.0.8",
48 "builtin-modules": "^3.1.0", 50 "builtin-modules": "^3.1.0",
49 "is-module": "^1.0.0", 51 "is-module": "^1.0.0",
@@ -51,12 +53,14 @@
51 } 53 }
52 }, 54 },
53 "@rollup/pluginutils": { 55 "@rollup/pluginutils": {
54 "version": "3.0.8", 56 "version": "3.0.9",
55 "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.8.tgz", 57 "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.9.tgz",
56 "integrity": "sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw==", 58 "integrity": "sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==",
57 "dev": true, 59 "dev": true,
58 "requires": { 60 "requires": {
59 "estree-walker": "^1.0.1" 61 "@types/estree": "0.0.39",
62 "estree-walker": "^1.0.1",
63 "micromatch": "^4.0.2"
60 } 64 }
61 }, 65 },
62 "@types/color-name": { 66 "@types/color-name": {
@@ -84,15 +88,15 @@
84 "dev": true 88 "dev": true
85 }, 89 },
86 "@types/node": { 90 "@types/node": {
87 "version": "12.12.34", 91 "version": "12.12.37",
88 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.34.tgz", 92 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz",
89 "integrity": "sha512-BneGN0J9ke24lBRn44hVHNeDlrXRYF+VRp0HbSUNnEZahXGAysHZIqnf/hER6aabdBgzM4YOV4jrR8gj4Zfi0g==", 93 "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==",
90 "dev": true 94 "dev": true
91 }, 95 },
92 "@types/node-fetch": { 96 "@types/node-fetch": {
93 "version": "2.5.5", 97 "version": "2.5.6",
94 "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.5.tgz", 98 "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.6.tgz",
95 "integrity": "sha512-IWwjsyYjGw+em3xTvWVQi5MgYKbRs0du57klfTaZkv/B24AEQ/p/IopNeqIYNy3EsfHOpg8ieQSDomPcsYMHpA==", 99 "integrity": "sha512-2w0NTwMWF1d3NJMK0Uiq2UNN8htVCyOWOD0jIPjPgC5Ph/YP4dVhs9YxxcMcuLuwAslz0dVEcZQUaqkLs3IzOQ==",
96 "dev": true, 100 "dev": true,
97 "requires": { 101 "requires": {
98 "@types/node": "*", 102 "@types/node": "*",
@@ -115,25 +119,25 @@
115 "dev": true 119 "dev": true
116 }, 120 },
117 "@typescript-eslint/eslint-plugin": { 121 "@typescript-eslint/eslint-plugin": {
118 "version": "2.27.0", 122 "version": "2.29.0",
119 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz", 123 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.29.0.tgz",
120 "integrity": "sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==", 124 "integrity": "sha512-X/YAY7azKirENm4QRpT7OVmzok02cSkqeIcLmdz6gXUQG4Hk0Fi9oBAynSAyNXeGdMRuZvjBa0c1Lu0dn/u6VA==",
121 "dev": true, 125 "dev": true,
122 "requires": { 126 "requires": {
123 "@typescript-eslint/experimental-utils": "2.27.0", 127 "@typescript-eslint/experimental-utils": "2.29.0",
124 "functional-red-black-tree": "^1.0.1", 128 "functional-red-black-tree": "^1.0.1",
125 "regexpp": "^3.0.0", 129 "regexpp": "^3.0.0",
126 "tsutils": "^3.17.1" 130 "tsutils": "^3.17.1"
127 } 131 }
128 }, 132 },
129 "@typescript-eslint/experimental-utils": { 133 "@typescript-eslint/experimental-utils": {
130 "version": "2.27.0", 134 "version": "2.29.0",
131 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz", 135 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz",
132 "integrity": "sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==", 136 "integrity": "sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw==",
133 "dev": true, 137 "dev": true,
134 "requires": { 138 "requires": {
135 "@types/json-schema": "^7.0.3", 139 "@types/json-schema": "^7.0.3",
136 "@typescript-eslint/typescript-estree": "2.27.0", 140 "@typescript-eslint/typescript-estree": "2.29.0",
137 "eslint-scope": "^5.0.0", 141 "eslint-scope": "^5.0.0",
138 "eslint-utils": "^2.0.0" 142 "eslint-utils": "^2.0.0"
139 }, 143 },
@@ -150,21 +154,21 @@
150 } 154 }
151 }, 155 },
152 "@typescript-eslint/parser": { 156 "@typescript-eslint/parser": {
153 "version": "2.27.0", 157 "version": "2.29.0",
154 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.27.0.tgz", 158 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.29.0.tgz",
155 "integrity": "sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==", 159 "integrity": "sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA==",
156 "dev": true, 160 "dev": true,
157 "requires": { 161 "requires": {
158 "@types/eslint-visitor-keys": "^1.0.0", 162 "@types/eslint-visitor-keys": "^1.0.0",
159 "@typescript-eslint/experimental-utils": "2.27.0", 163 "@typescript-eslint/experimental-utils": "2.29.0",
160 "@typescript-eslint/typescript-estree": "2.27.0", 164 "@typescript-eslint/typescript-estree": "2.29.0",
161 "eslint-visitor-keys": "^1.1.0" 165 "eslint-visitor-keys": "^1.1.0"
162 } 166 }
163 }, 167 },
164 "@typescript-eslint/typescript-estree": { 168 "@typescript-eslint/typescript-estree": {
165 "version": "2.27.0", 169 "version": "2.29.0",
166 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz", 170 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz",
167 "integrity": "sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==", 171 "integrity": "sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA==",
168 "dev": true, 172 "dev": true,
169 "requires": { 173 "requires": {
170 "debug": "^4.1.1", 174 "debug": "^4.1.1",
@@ -287,6 +291,15 @@
287 "concat-map": "0.0.1" 291 "concat-map": "0.0.1"
288 } 292 }
289 }, 293 },
294 "braces": {
295 "version": "3.0.2",
296 "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
297 "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
298 "dev": true,
299 "requires": {
300 "fill-range": "^7.0.1"
301 }
302 },
290 "buffer-crc32": { 303 "buffer-crc32": {
291 "version": "0.2.13", 304 "version": "0.2.13",
292 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", 305 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@@ -387,6 +400,12 @@
387 "integrity": "sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==", 400 "integrity": "sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==",
388 "dev": true 401 "dev": true
389 }, 402 },
403 "commondir": {
404 "version": "1.0.1",
405 "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
406 "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
407 "dev": true
408 },
390 "concat-map": { 409 "concat-map": {
391 "version": "0.0.1", 410 "version": "0.0.1",
392 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 411 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -728,6 +747,15 @@
728 "flat-cache": "^2.0.1" 747 "flat-cache": "^2.0.1"
729 } 748 }
730 }, 749 },
750 "fill-range": {
751 "version": "7.0.1",
752 "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
753 "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
754 "dev": true,
755 "requires": {
756 "to-regex-range": "^5.0.1"
757 }
758 },
731 "flat-cache": { 759 "flat-cache": {
732 "version": "2.0.1", 760 "version": "2.0.1",
733 "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", 761 "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
@@ -763,9 +791,9 @@
763 "dev": true 791 "dev": true
764 }, 792 },
765 "fsevents": { 793 "fsevents": {
766 "version": "2.1.2", 794 "version": "2.1.3",
767 "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", 795 "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
768 "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", 796 "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
769 "dev": true, 797 "dev": true,
770 "optional": true 798 "optional": true
771 }, 799 },
@@ -983,6 +1011,12 @@
983 "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", 1011 "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=",
984 "dev": true 1012 "dev": true
985 }, 1013 },
1014 "is-number": {
1015 "version": "7.0.0",
1016 "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
1017 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
1018 "dev": true
1019 },
986 "is-promise": { 1020 "is-promise": {
987 "version": "2.1.0", 1021 "version": "2.1.0",
988 "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", 1022 "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
@@ -1114,6 +1148,16 @@
1114 "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", 1148 "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=",
1115 "dev": true 1149 "dev": true
1116 }, 1150 },
1151 "micromatch": {
1152 "version": "4.0.2",
1153 "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
1154 "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
1155 "dev": true,
1156 "requires": {
1157 "braces": "^3.0.1",
1158 "picomatch": "^2.0.5"
1159 }
1160 },
1117 "mime": { 1161 "mime": {
1118 "version": "1.6.0", 1162 "version": "1.6.0",
1119 "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1163 "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@@ -1322,6 +1366,12 @@
1322 "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", 1366 "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
1323 "dev": true 1367 "dev": true
1324 }, 1368 },
1369 "picomatch": {
1370 "version": "2.2.2",
1371 "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
1372 "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
1373 "dev": true
1374 },
1325 "prelude-ls": { 1375 "prelude-ls": {
1326 "version": "1.1.2", 1376 "version": "1.1.2",
1327 "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 1377 "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
@@ -1373,9 +1423,9 @@
1373 "dev": true 1423 "dev": true
1374 }, 1424 },
1375 "resolve": { 1425 "resolve": {
1376 "version": "1.15.1", 1426 "version": "1.16.1",
1377 "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", 1427 "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz",
1378 "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", 1428 "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==",
1379 "dev": true, 1429 "dev": true,
1380 "requires": { 1430 "requires": {
1381 "path-parse": "^1.0.6" 1431 "path-parse": "^1.0.6"
@@ -1407,9 +1457,9 @@
1407 } 1457 }
1408 }, 1458 },
1409 "rollup": { 1459 "rollup": {
1410 "version": "2.3.3", 1460 "version": "2.7.1",
1411 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.3.tgz", 1461 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.7.1.tgz",
1412 "integrity": "sha512-uJ9VNWk80mb4wDCSfd1AyHoSc9TrWbkZtnO6wbsMTp9muSWkT26Dvc99MX1yGCOTvUN1Skw/KpFzKdUDuZKTXA==", 1462 "integrity": "sha512-c1FCjY8HK1nAq0bTZHaR72ZknpP7p0EjxbcVc6BcmtOosurK//P5jtwxX+f/4fgtbrjczqf0uvR+EdtxpriE8g==",
1413 "dev": true, 1463 "dev": true,
1414 "requires": { 1464 "requires": {
1415 "fsevents": "~2.1.2" 1465 "fsevents": "~2.1.2"
@@ -1629,6 +1679,15 @@
1629 "os-tmpdir": "~1.0.2" 1679 "os-tmpdir": "~1.0.2"
1630 } 1680 }
1631 }, 1681 },
1682 "to-regex-range": {
1683 "version": "5.0.1",
1684 "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
1685 "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
1686 "dev": true,
1687 "requires": {
1688 "is-number": "^7.0.0"
1689 }
1690 },
1632 "tslib": { 1691 "tslib": {
1633 "version": "1.11.1", 1692 "version": "1.11.1",
1634 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", 1693 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
diff --git a/editors/code/package.json b/editors/code/package.json
index 5ce59e54a..b8aaa07d8 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -37,15 +37,15 @@
37 "vscode-languageclient": "7.0.0-next.1" 37 "vscode-languageclient": "7.0.0-next.1"
38 }, 38 },
39 "devDependencies": { 39 "devDependencies": {
40 "@rollup/plugin-commonjs": "^11.0.2", 40 "@rollup/plugin-commonjs": "^11.1.0",
41 "@rollup/plugin-node-resolve": "^7.1.1", 41 "@rollup/plugin-node-resolve": "^7.1.3",
42 "@types/node": "^12.12.34", 42 "@types/node": "^12.12.37",
43 "@types/node-fetch": "^2.5.5", 43 "@types/node-fetch": "^2.5.6",
44 "@types/vscode": "^1.44.0", 44 "@types/vscode": "^1.44.0",
45 "@typescript-eslint/eslint-plugin": "^2.27.0", 45 "@typescript-eslint/eslint-plugin": "^2.29.0",
46 "@typescript-eslint/parser": "^2.27.0", 46 "@typescript-eslint/parser": "^2.29.0",
47 "eslint": "^6.8.0", 47 "eslint": "^6.8.0",
48 "rollup": "^2.3.3", 48 "rollup": "^2.7.1",
49 "tslib": "^1.11.1", 49 "tslib": "^1.11.1",
50 "typescript": "^3.8.3", 50 "typescript": "^3.8.3",
51 "typescript-formatter": "^7.2.2", 51 "typescript-formatter": "^7.2.2",
@@ -166,11 +166,6 @@
166 "command": "rust-analyzer.joinLines", 166 "command": "rust-analyzer.joinLines",
167 "key": "ctrl+shift+j", 167 "key": "ctrl+shift+j",
168 "when": "editorTextFocus && editorLangId == rust" 168 "when": "editorTextFocus && editorLangId == rust"
169 },
170 {
171 "command": "rust-analyzer.onEnter",
172 "key": "enter",
173 "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
174 } 169 }
175 ], 170 ],
176 "configuration": { 171 "configuration": {
@@ -389,7 +384,7 @@
389 "type": "boolean", 384 "type": "boolean",
390 "default": false 385 "default": false
391 }, 386 },
392 "rust-analyzer.procMacro.enabled": { 387 "rust-analyzer.procMacro.enable": {
393 "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", 388 "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.",
394 "type": "boolean", 389 "type": "boolean",
395 "default": false 390 "default": false
@@ -517,6 +512,10 @@
517 "id": "union", 512 "id": "union",
518 "description": "Style for C-style untagged unions", 513 "description": "Style for C-style untagged unions",
519 "superType": "type" 514 "superType": "type"
515 },
516 {
517 "id": "unresolvedReference",
518 "description": "Style for names which can not be resolved due to compilation errors"
520 } 519 }
521 ], 520 ],
522 "semanticTokenModifiers": [ 521 "semanticTokenModifiers": [
diff --git a/editors/code/ra_syntax_tree.tmGrammar.json b/editors/code/ra_syntax_tree.tmGrammar.json
index 0d72a3e36..431d414f6 100644
--- a/editors/code/ra_syntax_tree.tmGrammar.json
+++ b/editors/code/ra_syntax_tree.tmGrammar.json
@@ -9,7 +9,7 @@
9 ], 9 ],
10 "repository": { 10 "repository": {
11 "node_type": { 11 "node_type": {
12 "match": "^\\s*([A-Z_]+?)@", 12 "match": "^\\s*([A-Z_][A-Z_0-9]*?)@",
13 "captures": { 13 "captures": {
14 "1": { 14 "1": {
15 "name": "entity.name.class" 15 "name": "entity.name.class"
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts
index b7a397414..cfcf47b2f 100644
--- a/editors/code/src/commands/syntax_tree.ts
+++ b/editors/code/src/commands/syntax_tree.ts
@@ -198,7 +198,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D
198 return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astFileRange); 198 return new vscode.Hover(["```rust\n" + rustSourceCode + "\n```"], astFileRange);
199 } 199 }
200 200
201 private findAstNodeRange(astLine: vscode.TextLine) { 201 private findAstNodeRange(astLine: vscode.TextLine): vscode.Range {
202 const lineOffset = astLine.range.start; 202 const lineOffset = astLine.range.start;
203 const begin = lineOffset.translate(undefined, astLine.firstNonWhitespaceCharacterIndex); 203 const begin = lineOffset.translate(undefined, astLine.firstNonWhitespaceCharacterIndex);
204 const end = lineOffset.translate(undefined, astLine.text.trimEnd().length); 204 const end = lineOffset.translate(undefined, astLine.text.trimEnd().length);
@@ -209,10 +209,43 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D
209 const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); 209 const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine);
210 if (!parsedRange) return; 210 if (!parsedRange) return;
211 211
212 const [begin, end] = parsedRange.slice(1).map(off => doc.positionAt(+off)); 212 const [begin, end] = parsedRange
213 .slice(1)
214 .map(off => this.positionAt(doc, +off));
213 215
214 return new vscode.Range(begin, end); 216 return new vscode.Range(begin, end);
215 } 217 }
218
219 // Memoize the last value, otherwise the CPU is at 100% single core
220 // with quadratic lookups when we build rust2Ast cache
221 cache?: { doc: vscode.TextDocument; offset: number; line: number };
222
223 positionAt(doc: vscode.TextDocument, targetOffset: number): vscode.Position {
224 if (doc.eol === vscode.EndOfLine.LF) {
225 return doc.positionAt(targetOffset);
226 }
227
228 // Shitty workaround for crlf line endings
229 // We are still in this prehistoric era of carriage returns here...
230
231 let line = 0;
232 let offset = 0;
233
234 const cache = this.cache;
235 if (cache?.doc === doc && cache.offset <= targetOffset) {
236 ({ line, offset } = cache);
237 }
238
239 while (true) {
240 const lineLenWithLf = doc.lineAt(line).text.length + 1;
241 if (offset + lineLenWithLf > targetOffset) {
242 this.cache = { doc, offset, line };
243 return doc.positionAt(targetOffset + line);
244 }
245 offset += lineLenWithLf;
246 line += 1;
247 }
248 }
216} 249}
217 250
218class Lazy<T> { 251class Lazy<T> {
diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts
index 399a150c6..af8f1df51 100644
--- a/editors/code/src/source_change.ts
+++ b/editors/code/src/source_change.ts
@@ -37,11 +37,13 @@ export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) {
37 toReveal.position, 37 toReveal.position,
38 ); 38 );
39 const editor = vscode.window.activeTextEditor; 39 const editor = vscode.window.activeTextEditor;
40 if (!editor || editor.document.uri.toString() !== uri.toString()) { 40 if (!editor || !editor.selection.isEmpty) {
41 return; 41 return;
42 } 42 }
43 if (!editor.selection.isEmpty) { 43
44 return; 44 if (editor.document.uri !== uri) {
45 const doc = await vscode.workspace.openTextDocument(uri);
46 await vscode.window.showTextDocument(doc);
45 } 47 }
46 editor.selection = new vscode.Selection(position, position); 48 editor.selection = new vscode.Selection(position, position);
47 editor.revealRange( 49 editor.revealRange(
diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts
index fa1c4a951..1366c76d6 100644
--- a/editors/code/src/tasks.ts
+++ b/editors/code/src/tasks.ts
@@ -4,49 +4,80 @@ import * as vscode from 'vscode';
4// our configuration should be compatible with it so use the same key. 4// our configuration should be compatible with it so use the same key.
5const TASK_TYPE = 'cargo'; 5const TASK_TYPE = 'cargo';
6 6
7export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { 7interface CargoTaskDefinition extends vscode.TaskDefinition {
8 const provider: vscode.TaskProvider = { 8 command?: string;
9 args?: string[];
10 cwd?: string;
11 env?: { [key: string]: string };
12}
13
14class CargoTaskProvider implements vscode.TaskProvider {
15 private readonly target: vscode.WorkspaceFolder;
16
17 constructor(target: vscode.WorkspaceFolder) {
18 this.target = target;
19 }
20
21 provideTasks(): vscode.Task[] {
9 // Detect Rust tasks. Currently we do not do any actual detection 22 // Detect Rust tasks. Currently we do not do any actual detection
10 // of tasks (e.g. aliases in .cargo/config) and just return a fixed 23 // of tasks (e.g. aliases in .cargo/config) and just return a fixed
11 // set of tasks that always exist. These tasks cannot be removed in 24 // set of tasks that always exist. These tasks cannot be removed in
12 // tasks.json - only tweaked. 25 // tasks.json - only tweaked.
13 provideTasks: () => getStandardCargoTasks(target),
14 26
15 // We don't need to implement this. 27 return [
16 resolveTask: () => undefined, 28 { command: 'build', group: vscode.TaskGroup.Build },
17 }; 29 { command: 'check', group: vscode.TaskGroup.Build },
30 { command: 'test', group: vscode.TaskGroup.Test },
31 { command: 'clean', group: vscode.TaskGroup.Clean },
32 { command: 'run', group: undefined },
33 ]
34 .map(({ command, group }) => {
35 const vscodeTask = new vscode.Task(
36 // The contents of this object end up in the tasks.json entries.
37 {
38 type: TASK_TYPE,
39 command,
40 },
41 // The scope of the task - workspace or specific folder (global
42 // is not supported).
43 this.target,
44 // The task name, and task source. These are shown in the UI as
45 // `${source}: ${name}`, e.g. `rust: cargo build`.
46 `cargo ${command}`,
47 'rust',
48 // What to do when this command is executed.
49 new vscode.ShellExecution('cargo', [command]),
50 // Problem matchers.
51 ['$rustc'],
52 );
53 vscodeTask.group = group;
54 return vscodeTask;
55 });
56 }
18 57
19 return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); 58 resolveTask(task: vscode.Task): vscode.Task | undefined {
20} 59 // VSCode calls this for every cargo task in the user's tasks.json,
60 // we need to inform VSCode how to execute that command by creating
61 // a ShellExecution for it.
21 62
22function getStandardCargoTasks(target: vscode.WorkspaceFolder): vscode.Task[] { 63 const definition = task.definition as CargoTaskDefinition;
23 return [ 64
24 { command: 'build', group: vscode.TaskGroup.Build }, 65 if (definition.type === 'cargo' && definition.command) {
25 { command: 'check', group: vscode.TaskGroup.Build }, 66 const args = [definition.command].concat(definition.args ?? []);
26 { command: 'test', group: vscode.TaskGroup.Test }, 67
27 { command: 'clean', group: vscode.TaskGroup.Clean }, 68 return new vscode.Task(
28 { command: 'run', group: undefined }, 69 definition,
29 ] 70 task.name,
30 .map(({ command, group }) => {
31 const vscodeTask = new vscode.Task(
32 // The contents of this object end up in the tasks.json entries.
33 {
34 type: TASK_TYPE,
35 command,
36 },
37 // The scope of the task - workspace or specific folder (global
38 // is not supported).
39 target,
40 // The task name, and task source. These are shown in the UI as
41 // `${source}: ${name}`, e.g. `rust: cargo build`.
42 `cargo ${command}`,
43 'rust', 71 'rust',
44 // What to do when this command is executed. 72 new vscode.ShellExecution('cargo', args, definition),
45 new vscode.ShellExecution('cargo', [command]),
46 // Problem matchers.
47 ['$rustc'],
48 ); 73 );
49 vscodeTask.group = group; 74 }
50 return vscodeTask; 75
51 }); 76 return undefined;
77 }
52} 78}
79
80export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable {
81 const provider = new CargoTaskProvider(target);
82 return vscode.tasks.registerTaskProvider(TASK_TYPE, provider);
83} \ No newline at end of file