aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/.vscodeignore1
-rw-r--r--editors/code/package-lock.json92
-rw-r--r--editors/code/package.json50
-rw-r--r--editors/code/rust.tmGrammar.json681
-rw-r--r--editors/code/src/commands/ssr.ts2
-rw-r--r--editors/code/src/commands/syntax_tree.ts2
6 files changed, 763 insertions, 65 deletions
diff --git a/editors/code/.vscodeignore b/editors/code/.vscodeignore
index ac411f8e2..257b744bf 100644
--- a/editors/code/.vscodeignore
+++ b/editors/code/.vscodeignore
@@ -3,5 +3,6 @@
3!package.json 3!package.json
4!package-lock.json 4!package-lock.json
5!ra_syntax_tree.tmGrammar.json 5!ra_syntax_tree.tmGrammar.json
6!rust.tmGrammar.json
6!icon.png 7!icon.png
7!README.md 8!README.md
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json
index 71c627a2a..06178990f 100644
--- a/editors/code/package-lock.json
+++ b/editors/code/package-lock.json
@@ -88,15 +88,15 @@
88 "dev": true 88 "dev": true
89 }, 89 },
90 "@types/node": { 90 "@types/node": {
91 "version": "12.12.37", 91 "version": "12.12.39",
92 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz", 92 "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz",
93 "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==", 93 "integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==",
94 "dev": true 94 "dev": true
95 }, 95 },
96 "@types/node-fetch": { 96 "@types/node-fetch": {
97 "version": "2.5.6", 97 "version": "2.5.7",
98 "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.6.tgz", 98 "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz",
99 "integrity": "sha512-2w0NTwMWF1d3NJMK0Uiq2UNN8htVCyOWOD0jIPjPgC5Ph/YP4dVhs9YxxcMcuLuwAslz0dVEcZQUaqkLs3IzOQ==", 99 "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==",
100 "dev": true, 100 "dev": true,
101 "requires": { 101 "requires": {
102 "@types/node": "*", 102 "@types/node": "*",
@@ -113,31 +113,31 @@
113 } 113 }
114 }, 114 },
115 "@types/vscode": { 115 "@types/vscode": {
116 "version": "1.44.0", 116 "version": "1.45.0",
117 "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.44.0.tgz", 117 "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.0.tgz",
118 "integrity": "sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==", 118 "integrity": "sha512-b0Gyir7sPBCqiKLygAhn/AYVfzWD+SMPkWltBrIuPEyTOxSU1wVApWY/FcxYO2EWTRacoubTl4+gvZf86RkecA==",
119 "dev": true 119 "dev": true
120 }, 120 },
121 "@typescript-eslint/eslint-plugin": { 121 "@typescript-eslint/eslint-plugin": {
122 "version": "2.29.0", 122 "version": "2.33.0",
123 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.29.0.tgz", 123 "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.33.0.tgz",
124 "integrity": "sha512-X/YAY7azKirENm4QRpT7OVmzok02cSkqeIcLmdz6gXUQG4Hk0Fi9oBAynSAyNXeGdMRuZvjBa0c1Lu0dn/u6VA==", 124 "integrity": "sha512-QV6P32Btu1sCI/kTqjTNI/8OpCYyvlGjW5vD8MpTIg+HGE5S88HtT1G+880M4bXlvXj/NjsJJG0aGcVh0DdbeQ==",
125 "dev": true, 125 "dev": true,
126 "requires": { 126 "requires": {
127 "@typescript-eslint/experimental-utils": "2.29.0", 127 "@typescript-eslint/experimental-utils": "2.33.0",
128 "functional-red-black-tree": "^1.0.1", 128 "functional-red-black-tree": "^1.0.1",
129 "regexpp": "^3.0.0", 129 "regexpp": "^3.0.0",
130 "tsutils": "^3.17.1" 130 "tsutils": "^3.17.1"
131 } 131 }
132 }, 132 },
133 "@typescript-eslint/experimental-utils": { 133 "@typescript-eslint/experimental-utils": {
134 "version": "2.29.0", 134 "version": "2.33.0",
135 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz", 135 "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.33.0.tgz",
136 "integrity": "sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw==", 136 "integrity": "sha512-qzPM2AuxtMrRq78LwyZa8Qn6gcY8obkIrBs1ehqmQADwkYzTE1Pb4y2W+U3rE/iFkSWcWHG2LS6MJfj6SmHApg==",
137 "dev": true, 137 "dev": true,
138 "requires": { 138 "requires": {
139 "@types/json-schema": "^7.0.3", 139 "@types/json-schema": "^7.0.3",
140 "@typescript-eslint/typescript-estree": "2.29.0", 140 "@typescript-eslint/typescript-estree": "2.33.0",
141 "eslint-scope": "^5.0.0", 141 "eslint-scope": "^5.0.0",
142 "eslint-utils": "^2.0.0" 142 "eslint-utils": "^2.0.0"
143 }, 143 },
@@ -154,21 +154,21 @@
154 } 154 }
155 }, 155 },
156 "@typescript-eslint/parser": { 156 "@typescript-eslint/parser": {
157 "version": "2.29.0", 157 "version": "2.33.0",
158 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.29.0.tgz", 158 "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.33.0.tgz",
159 "integrity": "sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA==", 159 "integrity": "sha512-AUtmwUUhJoH6yrtxZMHbRUEMsC2G6z5NSxg9KsROOGqNXasM71I8P2NihtumlWTUCRld70vqIZ6Pm4E5PAziEA==",
160 "dev": true, 160 "dev": true,
161 "requires": { 161 "requires": {
162 "@types/eslint-visitor-keys": "^1.0.0", 162 "@types/eslint-visitor-keys": "^1.0.0",
163 "@typescript-eslint/experimental-utils": "2.29.0", 163 "@typescript-eslint/experimental-utils": "2.33.0",
164 "@typescript-eslint/typescript-estree": "2.29.0", 164 "@typescript-eslint/typescript-estree": "2.33.0",
165 "eslint-visitor-keys": "^1.1.0" 165 "eslint-visitor-keys": "^1.1.0"
166 } 166 }
167 }, 167 },
168 "@typescript-eslint/typescript-estree": { 168 "@typescript-eslint/typescript-estree": {
169 "version": "2.29.0", 169 "version": "2.33.0",
170 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz", 170 "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.33.0.tgz",
171 "integrity": "sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA==", 171 "integrity": "sha512-d8rY6/yUxb0+mEwTShCQF2zYQdLlqihukNfG9IUlLYz5y1CH6G/9XYbrxQLq3Z14RNvkCC6oe+OcFlyUpwUbkg==",
172 "dev": true, 172 "dev": true,
173 "requires": { 173 "requires": {
174 "debug": "^4.1.1", 174 "debug": "^4.1.1",
@@ -176,8 +176,16 @@
176 "glob": "^7.1.6", 176 "glob": "^7.1.6",
177 "is-glob": "^4.0.1", 177 "is-glob": "^4.0.1",
178 "lodash": "^4.17.15", 178 "lodash": "^4.17.15",
179 "semver": "^6.3.0", 179 "semver": "^7.3.2",
180 "tsutils": "^3.17.1" 180 "tsutils": "^3.17.1"
181 },
182 "dependencies": {
183 "semver": {
184 "version": "7.3.2",
185 "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
186 "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
187 "dev": true
188 }
181 } 189 }
182 }, 190 },
183 "acorn": { 191 "acorn": {
@@ -1160,18 +1168,18 @@
1160 "dev": true 1168 "dev": true
1161 }, 1169 },
1162 "mime-db": { 1170 "mime-db": {
1163 "version": "1.43.0", 1171 "version": "1.44.0",
1164 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", 1172 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
1165 "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", 1173 "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
1166 "dev": true 1174 "dev": true
1167 }, 1175 },
1168 "mime-types": { 1176 "mime-types": {
1169 "version": "2.1.26", 1177 "version": "2.1.27",
1170 "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", 1178 "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
1171 "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", 1179 "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
1172 "dev": true, 1180 "dev": true,
1173 "requires": { 1181 "requires": {
1174 "mime-db": "1.43.0" 1182 "mime-db": "1.44.0"
1175 } 1183 }
1176 }, 1184 },
1177 "mimic-fn": { 1185 "mimic-fn": {
@@ -1452,9 +1460,9 @@
1452 } 1460 }
1453 }, 1461 },
1454 "rollup": { 1462 "rollup": {
1455 "version": "2.7.1", 1463 "version": "2.10.0",
1456 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.7.1.tgz", 1464 "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.0.tgz",
1457 "integrity": "sha512-c1FCjY8HK1nAq0bTZHaR72ZknpP7p0EjxbcVc6BcmtOosurK//P5jtwxX+f/4fgtbrjczqf0uvR+EdtxpriE8g==", 1465 "integrity": "sha512-7BmpEfUN9P6esJzWIn3DmR//90mW6YwYB1t3y48LpF8ITpYtL8s1kEirMKqUu44dVH/6a/rs0EuwYVL3FuRDoA==",
1458 "dev": true, 1466 "dev": true,
1459 "requires": { 1467 "requires": {
1460 "fsevents": "~2.1.2" 1468 "fsevents": "~2.1.2"
@@ -1684,9 +1692,9 @@
1684 } 1692 }
1685 }, 1693 },
1686 "tslib": { 1694 "tslib": {
1687 "version": "1.11.1", 1695 "version": "1.12.0",
1688 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", 1696 "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.12.0.tgz",
1689 "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", 1697 "integrity": "sha512-5rxCQkP0kytf4H1T4xz1imjxaUUPMvc5aWp0rJ/VMIN7ClRiH1FwFvBt8wOeMasp/epeUnmSW6CixSIePtiLqA==",
1690 "dev": true 1698 "dev": true
1691 }, 1699 },
1692 "tsutils": { 1700 "tsutils": {
@@ -1730,9 +1738,9 @@
1730 } 1738 }
1731 }, 1739 },
1732 "typescript": { 1740 "typescript": {
1733 "version": "3.8.3", 1741 "version": "3.9.2",
1734 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", 1742 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz",
1735 "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", 1743 "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==",
1736 "dev": true 1744 "dev": true
1737 }, 1745 },
1738 "typescript-formatter": { 1746 "typescript-formatter": {
diff --git a/editors/code/package.json b/editors/code/package.json
index ec325ad3f..4e7e3faf7 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.45.0"
25 }, 25 },
26 "enableProposedApi": true, 26 "enableProposedApi": true,
27 "scripts": { 27 "scripts": {
@@ -39,15 +39,15 @@
39 "devDependencies": { 39 "devDependencies": {
40 "@rollup/plugin-commonjs": "^11.1.0", 40 "@rollup/plugin-commonjs": "^11.1.0",
41 "@rollup/plugin-node-resolve": "^7.1.3", 41 "@rollup/plugin-node-resolve": "^7.1.3",
42 "@types/node": "^12.12.37", 42 "@types/node": "^12.12.39",
43 "@types/node-fetch": "^2.5.6", 43 "@types/node-fetch": "^2.5.7",
44 "@types/vscode": "^1.44.0", 44 "@types/vscode": "^1.45.0",
45 "@typescript-eslint/eslint-plugin": "^2.29.0", 45 "@typescript-eslint/eslint-plugin": "^2.33.0",
46 "@typescript-eslint/parser": "^2.29.0", 46 "@typescript-eslint/parser": "^2.33.0",
47 "eslint": "^6.8.0", 47 "eslint": "^6.8.0",
48 "rollup": "^2.7.1", 48 "rollup": "^2.10.0",
49 "tslib": "^1.11.1", 49 "tslib": "^1.12.0",
50 "typescript": "^3.8.3", 50 "typescript": "^3.9.2",
51 "typescript-formatter": "^7.2.2", 51 "typescript-formatter": "^7.2.2",
52 "vsce": "^1.75.0" 52 "vsce": "^1.75.0"
53 }, 53 },
@@ -489,6 +489,11 @@
489 ], 489 ],
490 "grammars": [ 490 "grammars": [
491 { 491 {
492 "language": "rust",
493 "scopeName": "source.rust",
494 "path": "rust.tmGrammar.json"
495 },
496 {
492 "language": "ra_syntax_tree", 497 "language": "ra_syntax_tree",
493 "scopeName": "source.ra_syntax_tree", 498 "scopeName": "source.ra_syntax_tree",
494 "path": "ra_syntax_tree.tmGrammar.json" 499 "path": "ra_syntax_tree.tmGrammar.json"
@@ -600,34 +605,37 @@
600 "language": "rust", 605 "language": "rust",
601 "scopes": { 606 "scopes": {
602 "attribute": [ 607 "attribute": [
603 "meta.attribute" 608 "meta.attribute.rust"
604 ], 609 ],
605 "builtinType": [ 610 "builtinType": [
606 "support.type.primitive" 611 "support.type.primitive.rust"
607 ], 612 ],
608 "lifetime": [ 613 "lifetime": [
609 "entity.name.lifetime.rust" 614 "storage.modifier.lifetime.rust"
610 ], 615 ],
611 "typeAlias": [ 616 "typeAlias": [
612 "entity.name.typeAlias" 617 "entity.name.type.typeAlias.rust"
613 ], 618 ],
614 "union": [ 619 "union": [
615 "entity.name.union" 620 "entity.name.type.union.rust"
616 ], 621 ],
617 "struct": [ 622 "struct": [
618 "entity.name.type.struct" 623 "entity.name.type.struct.rust"
619 ],
620 "keyword.unsafe": [
621 "keyword.other.unsafe"
622 ], 624 ],
623 "keyword": [ 625 "keyword": [
624 "keyword" 626 "keyword.other.rust"
625 ], 627 ],
626 "keyword.controlFlow": [ 628 "keyword.controlFlow": [
627 "keyword.control" 629 "keyword.control.rust"
628 ], 630 ],
629 "variable.constant": [ 631 "variable.constant": [
630 "entity.name.constant" 632 "variable.other.constant.rust"
633 ],
634 "formatSpecifier": [
635 "punctuation.section.embedded.rust"
636 ],
637 "*.mutable": [
638 "markup.underline"
631 ] 639 ]
632 } 640 }
633 } 641 }
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json
new file mode 100644
index 000000000..aa0811326
--- /dev/null
+++ b/editors/code/rust.tmGrammar.json
@@ -0,0 +1,681 @@
1{
2 "name": "Rust",
3 "scopeName": "source.rust",
4 "patterns": [
5 {
6 "comment": "Implementation",
7 "begin": "\\b(impl)\\b",
8 "end": "\\{",
9 "beginCaptures": {
10 "1": {
11 "name": "storage.type.rust"
12 }
13 },
14 "patterns": [
15 {
16 "include": "#block_comment"
17 },
18 {
19 "include": "#line_comment"
20 },
21 {
22 "include": "#sigils"
23 },
24 {
25 "include": "#mut"
26 },
27 {
28 "include": "#dyn"
29 },
30 {
31 "include": "#ref_lifetime"
32 },
33 {
34 "include": "#core_types"
35 },
36 {
37 "include": "#core_marker"
38 },
39 {
40 "include": "#core_traits"
41 },
42 {
43 "include": "#std_types"
44 },
45 {
46 "include": "#std_traits"
47 },
48 {
49 "include": "#type_params"
50 },
51 {
52 "include": "#where"
53 },
54 {
55 "name": "storage.type.rust",
56 "match": "\\bfor\\b"
57 },
58 {
59 "include": "#type"
60 }
61 ]
62 },
63 {
64 "include": "#block_doc_comment"
65 },
66 {
67 "include": "#block_comment"
68 },
69 {
70 "include": "#line_doc_comment"
71 },
72 {
73 "include": "#line_comment"
74 },
75 {
76 "comment": "Attribute",
77 "name": "meta.attribute.rust",
78 "begin": "#\\!?\\[",
79 "end": "\\]",
80 "patterns": [
81 {
82 "include": "#string_literal"
83 },
84 {
85 "include": "#block_doc_comment"
86 },
87 {
88 "include": "#block_comment"
89 },
90 {
91 "include": "#line_doc_comment"
92 },
93 {
94 "include": "#line_comment"
95 }
96 ]
97 },
98 {
99 "comment": "Single-quote string literal (character)",
100 "name": "string.quoted.single.rust",
101 "match": "b?'([^'\\\\]|\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'"
102 },
103 {
104 "include": "#string_literal"
105 },
106 {
107 "include": "#raw_string_literal"
108 },
109 {
110 "comment": "Floating point literal (fraction)",
111 "name": "constant.numeric.float.rust",
112 "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b"
113 },
114 {
115 "comment": "Floating point literal (exponent)",
116 "name": "constant.numeric.float.rust",
117 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b"
118 },
119 {
120 "comment": "Floating point literal (typed)",
121 "name": "constant.numeric.float.rust",
122 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b"
123 },
124 {
125 "comment": "Integer literal (decimal)",
126 "name": "constant.numeric.integer.decimal.rust",
127 "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b"
128 },
129 {
130 "comment": "Integer literal (hexadecimal)",
131 "name": "constant.numeric.integer.hexadecimal.rust",
132 "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b"
133 },
134 {
135 "comment": "Integer literal (octal)",
136 "name": "constant.numeric.integer.octal.rust",
137 "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b"
138 },
139 {
140 "comment": "Integer literal (binary)",
141 "name": "constant.numeric.integer.binary.rust",
142 "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b"
143 },
144 {
145 "comment": "Static storage modifier",
146 "name": "storage.modifier.static.rust",
147 "match": "\\bstatic\\b"
148 },
149 {
150 "comment": "Boolean constant",
151 "name": "constant.language.boolean.rust",
152 "match": "\\b(true|false)\\b"
153 },
154 {
155 "comment": "Control keyword",
156 "name": "keyword.control.rust",
157 "match": "\\b(async|await|break|continue|else|if|in|for|loop|match|return|try|while)\\b"
158 },
159 {
160 "comment": "Keyword",
161 "name": "keyword.other.rust",
162 "match": "\\b(crate|extern|mod|let|ref|use|super|move|as)\\b"
163 },
164 {
165 "comment": "Reserved keyword",
166 "name": "invalid.deprecated.rust",
167 "match": "\\b(abstract|alignof|become|do|final|macro|offsetof|override|priv|proc|pure|sizeof|typeof|virtual|yield)\\b"
168 },
169 {
170 "include": "#unsafe"
171 },
172 {
173 "include": "#sigils"
174 },
175 {
176 "include": "#self"
177 },
178 {
179 "include": "#mut"
180 },
181 {
182 "include": "#dyn"
183 },
184 {
185 "include": "#impl"
186 },
187 {
188 "include": "#box"
189 },
190 {
191 "include": "#lifetime"
192 },
193 {
194 "include": "#ref_lifetime"
195 },
196 {
197 "include": "#const"
198 },
199 {
200 "include": "#pub"
201 },
202 {
203 "comment": "Miscellaneous operator",
204 "name": "keyword.operator.misc.rust",
205 "match": "(=>|::)"
206 },
207 {
208 "comment": "Comparison operator",
209 "name": "keyword.operator.comparison.rust",
210 "match": "(&&|\\|\\||==|!=)"
211 },
212 {
213 "comment": "Assignment operator",
214 "name": "keyword.operator.assignment.rust",
215 "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)"
216 },
217 {
218 "comment": "Arithmetic operator",
219 "name": "keyword.operator.arithmetic.rust",
220 "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)"
221 },
222 {
223 "comment": "Comparison operator (second group because of regex precedence)",
224 "name": "keyword.operator.comparison.rust",
225 "match": "(<=|>=|<|>)"
226 },
227 {
228 "include": "#core_types"
229 },
230 {
231 "include": "#core_vars"
232 },
233 {
234 "include": "#core_marker"
235 },
236 {
237 "include": "#core_traits"
238 },
239 {
240 "include": "#std_types"
241 },
242 {
243 "include": "#std_traits"
244 },
245 {
246 "comment": "Built-in macro",
247 "name": "support.function.builtin.rust",
248 "match": "\\b(macro_rules|compile_error|format_args|env|option_env|concat_idents|concat|line|column|file|stringify|include|include_str|include_bytes|module_path|cfg)!"
249 },
250 {
251 "comment": "Core macro",
252 "name": "support.function.core.rust",
253 "match": "\\b(panic|assert|assert_eq|assert_ne|debug_assert|debug_assert_eq|debug_assert_ne|try|write|writeln|unreachable|unimplemented)!"
254 },
255 {
256 "comment": "Standard library macro",
257 "name": "support.function.std.rust",
258 "match": "\\b(format|print|println|eprint|eprintln|select|vec)!"
259 },
260 {
261 "comment": "Logging macro",
262 "name": "support.function.log.rust",
263 "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!"
264 },
265 {
266 "comment": "Invokation of a macro",
267 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]",
268 "captures": {
269 "1": {
270 "name": "entity.name.function.macro.rust"
271 }
272 }
273 },
274 {
275 "comment": "Function call",
276 "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(",
277 "captures": {
278 "1": {
279 "name": "entity.name.function.rust"
280 }
281 }
282 },
283 {
284 "comment": "Function call with type parameters",
285 "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()",
286 "end": "\\(",
287 "captures": {
288 "1": {
289 "name": "entity.name.function.rust"
290 },
291 "2": {
292 "name": "keyword.operator.misc.rust"
293 }
294 },
295 "patterns": [
296 {
297 "include": "#type_params"
298 }
299 ]
300 },
301 {
302 "comment": "Function definition",
303 "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)",
304 "end": "[\\{;]",
305 "beginCaptures": {
306 "1": {
307 "name": "keyword.other.fn.rust"
308 },
309 "2": {
310 "name": "entity.name.function.rust"
311 }
312 },
313 "patterns": [
314 {
315 "include": "#block_comment"
316 },
317 {
318 "include": "#line_comment"
319 },
320 {
321 "include": "#sigils"
322 },
323 {
324 "include": "#self"
325 },
326 {
327 "include": "#mut"
328 },
329 {
330 "include": "#dyn"
331 },
332 {
333 "include": "#impl"
334 },
335 {
336 "include": "#ref_lifetime"
337 },
338 {
339 "include": "#core_types"
340 },
341 {
342 "include": "#core_marker"
343 },
344 {
345 "include": "#core_traits"
346 },
347 {
348 "include": "#std_types"
349 },
350 {
351 "include": "#std_traits"
352 },
353 {
354 "include": "#type_params"
355 },
356 {
357 "include": "#const"
358 },
359 {
360 "include": "#where"
361 },
362 {
363 "include": "#unsafe"
364 },
365 {
366 "comment": "Function arguments",
367 "match": "\bfn\b",
368 "name": "keyword.other.fn.rust"
369 }
370 ]
371 },
372 {
373 "comment": "Type declaration",
374 "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
375 "end": "[\\{\\(;]",
376 "beginCaptures": {
377 "1": {
378 "name": "storage.type.rust"
379 },
380 "2": {
381 "name": "entity.name.type.rust"
382 }
383 },
384 "patterns": [
385 {
386 "include": "#block_comment"
387 },
388 {
389 "include": "#line_comment"
390 },
391 {
392 "include": "#core_traits"
393 },
394 {
395 "include": "#std_traits"
396 },
397 {
398 "include": "#type_params"
399 },
400 {
401 "include": "#core_types"
402 },
403 {
404 "include": "#pub"
405 },
406 {
407 "include": "#where"
408 }
409 ]
410 },
411 {
412 "comment": "Type alias",
413 "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
414 "end": ";",
415 "beginCaptures": {
416 "1": {
417 "name": "storage.type.rust"
418 },
419 "2": {
420 "name": "entity.name.type.rust"
421 }
422 },
423 "patterns": [
424 {
425 "include": "#block_comment"
426 },
427 {
428 "include": "#line_comment"
429 },
430 {
431 "include": "#sigils"
432 },
433 {
434 "include": "#mut"
435 },
436 {
437 "include": "#dyn"
438 },
439 {
440 "include": "#impl"
441 },
442 {
443 "include": "#lifetime"
444 },
445 {
446 "include": "#ref_lifetime"
447 },
448 {
449 "include": "#core_types"
450 },
451 {
452 "include": "#core_marker"
453 },
454 {
455 "include": "#core_traits"
456 },
457 {
458 "include": "#std_types"
459 },
460 {
461 "include": "#std_traits"
462 },
463 {
464 "include": "#type_params"
465 }
466 ]
467 }
468 ],
469 "repository": {
470 "block_doc_comment": {
471 "comment": "Block documentation comment",
472 "name": "comment.block.documentation.rust",
473 "begin": "/\\*[\\*!](?![\\*/])",
474 "end": "\\*/",
475 "patterns": [
476 {
477 "include": "#block_doc_comment"
478 },
479 {
480 "include": "#block_comment"
481 }
482 ]
483 },
484 "block_comment": {
485 "comment": "Block comment",
486 "name": "comment.block.rust",
487 "begin": "/\\*",
488 "end": "\\*/",
489 "patterns": [
490 {
491 "include": "#block_doc_comment"
492 },
493 {
494 "include": "#block_comment"
495 }
496 ]
497 },
498 "line_doc_comment": {
499 "comment": "Single-line documentation comment",
500 "name": "comment.line.documentation.rust",
501 "begin": "//[!/](?=[^/])",
502 "end": "$"
503 },
504 "line_comment": {
505 "comment": "Single-line comment",
506 "name": "comment.line.double-slash.rust",
507 "begin": "//",
508 "end": "$"
509 },
510 "escaped_character": {
511 "name": "constant.character.escape.rust",
512 "match": "\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)"
513 },
514 "string_literal": {
515 "comment": "Double-quote string literal",
516 "name": "string.quoted.double.rust",
517 "begin": "b?\"",
518 "end": "\"",
519 "patterns": [
520 {
521 "include": "#escaped_character"
522 }
523 ]
524 },
525 "raw_string_literal": {
526 "comment": "Raw double-quote string literal",
527 "name": "string.quoted.double.raw.rust",
528 "begin": "b?r(#*)\"",
529 "end": "\"\\1"
530 },
531 "sigils": {
532 "comment": "Sigil",
533 "name": "keyword.operator.sigil.rust",
534 "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)"
535 },
536 "self": {
537 "comment": "Self variable",
538 "name": "variable.language.rust",
539 "match": "\\bself\\b"
540 },
541 "mut": {
542 "comment": "Mutable storage modifier",
543 "name": "storage.modifier.mut.rust",
544 "match": "\\bmut\\b"
545 },
546 "dyn": {
547 "comment": "Dynamic modifier",
548 "name": "storage.modifier.dyn.rust",
549 "match": "\\bdyn\\b"
550 },
551 "impl": {
552 "comment": "Existential type modifier",
553 "name": "storage.modifier.impl.rust",
554 "match": "\\bimpl\\b"
555 },
556 "box": {
557 "comment": "Box storage modifier",
558 "name": "storage.modifier.box.rust",
559 "match": "\\bbox\\b"
560 },
561 "const": {
562 "comment": "Const storage modifier",
563 "name": "storage.modifier.const.rust",
564 "match": "\\bconst\\b"
565 },
566 "pub": {
567 "comment": "Visibility modifier",
568 "name": "storage.modifier.visibility.rust",
569 "match": "\\bpub\\b"
570 },
571 "unsafe": {
572 "comment": "Unsafe code keyword",
573 "name": "keyword.other.unsafe.rust",
574 "match": "\\bunsafe\\b"
575 },
576 "where": {
577 "comment": "Generic where clause",
578 "name": "keyword.other.where.rust",
579 "match": "\\bwhere\\b"
580 },
581 "lifetime": {
582 "comment": "Named lifetime",
583 "name": "storage.modifier.lifetime.rust",
584 "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b"
585 },
586 "ref_lifetime": {
587 "comment": "Reference with named lifetime",
588 "match": "(&)('[a-zA-Z_][a-zA-Z0-9_]*)\\b",
589 "captures": {
590 "1": {
591 "name": "keyword.operator.sigil.rust"
592 },
593 "2": {
594 "name": "storage.modifier.lifetime.rust"
595 }
596 }
597 },
598 "core_types": {
599 "comment": "Built-in/core type",
600 "name": "support.type.primitive.rust",
601 "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self)\\b"
602 },
603 "core_vars": {
604 "comment": "Core type variant",
605 "name": "support.constant.core.rust",
606 "match": "\\b(Some|None|Ok|Err)\\b"
607 },
608 "core_marker": {
609 "comment": "Core trait (marker)",
610 "name": "entity.name.type.marker.rust",
611 "match": "\\b(Copy|Send|Sized|Sync)\\b"
612 },
613 "core_traits": {
614 "comment": "Core trait",
615 "name": "entity.name.type.core.rust",
616 "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b"
617 },
618 "std_types": {
619 "comment": "Standard library type",
620 "name": "entity.name.type.class.std.rust",
621 "match": "\\b(Box|String|Vec|Path|PathBuf|Option|Result)\\b"
622 },
623 "std_traits": {
624 "comment": "Standard library trait",
625 "name": "entity.name.type.std.rust",
626 "match": "\\b(ToOwned|ToString)\\b"
627 },
628 "type": {
629 "comment": "A type",
630 "name": "entity.name.type.rust",
631 "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b"
632 },
633 "type_params": {
634 "comment": "Type parameters",
635 "name": "meta.type_params.rust",
636 "begin": "<(?![=<])",
637 "end": "(?<![-])>",
638 "patterns": [
639 {
640 "include": "#block_comment"
641 },
642 {
643 "include": "#line_comment"
644 },
645 {
646 "include": "#sigils"
647 },
648 {
649 "include": "#mut"
650 },
651 {
652 "include": "#dyn"
653 },
654 {
655 "include": "#impl"
656 },
657 {
658 "include": "#lifetime"
659 },
660 {
661 "include": "#core_types"
662 },
663 {
664 "include": "#core_marker"
665 },
666 {
667 "include": "#core_traits"
668 },
669 {
670 "include": "#std_types"
671 },
672 {
673 "include": "#std_traits"
674 },
675 {
676 "include": "#type_params"
677 }
678 ]
679 }
680 }
681} \ No newline at end of file
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts
index 6fee051fd..4ef8cdf04 100644
--- a/editors/code/src/commands/ssr.ts
+++ b/editors/code/src/commands/ssr.ts
@@ -11,7 +11,7 @@ export function ssr(ctx: Ctx): Cmd {
11 11
12 const options: vscode.InputBoxOptions = { 12 const options: vscode.InputBoxOptions = {
13 value: "() ==>> ()", 13 value: "() ==>> ()",
14 prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", 14 prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
15 validateInput: async (x: string) => { 15 validateInput: async (x: string) => {
16 try { 16 try {
17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); 17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts
index b80a18a47..a5446c327 100644
--- a/editors/code/src/commands/syntax_tree.ts
+++ b/editors/code/src/commands/syntax_tree.ts
@@ -206,7 +206,7 @@ class AstInspector implements vscode.HoverProvider, vscode.DefinitionProvider, D
206 } 206 }
207 207
208 private parseRustTextRange(doc: vscode.TextDocument, astLine: string): undefined | vscode.Range { 208 private parseRustTextRange(doc: vscode.TextDocument, astLine: string): undefined | vscode.Range {
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 212 const [begin, end] = parsedRange