aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package-lock.json145
-rw-r--r--editors/code/package.json14
-rw-r--r--editors/code/ra_syntax_tree.tmGrammar.json2
-rw-r--r--editors/code/src/commands/syntax_tree.ts37
4 files changed, 145 insertions, 53 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 0726167bd..ab0f25b2f 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",
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> {