diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package-lock.json | 30 | ||||
-rw-r--r-- | editors/code/package.json | 6 | ||||
-rw-r--r-- | editors/code/rust.tmGrammar.json | 120 | ||||
-rw-r--r-- | editors/code/src/run.ts | 4 | ||||
-rw-r--r-- | editors/code/src/util.ts | 5 |
5 files changed, 98 insertions, 67 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 33d60d4dd..83ef00058 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -2409,32 +2409,32 @@ | |||
2409 | } | 2409 | } |
2410 | }, | 2410 | }, |
2411 | "vscode-jsonrpc": { | 2411 | "vscode-jsonrpc": { |
2412 | "version": "6.0.0-next.5", | 2412 | "version": "6.0.0-next.7", |
2413 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0-next.5.tgz", | 2413 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0-next.7.tgz", |
2414 | "integrity": "sha512-IAgsltQPwg/pXOPsdXgbUTCaO9VSKZwirZN5SGtkdYQ/R3VjeC4v00WTVvoNayWMZpoC3O9u0ogqmsKzKhVasQ==" | 2414 | "integrity": "sha512-1nG+6cuTtpzmXe7yYfO9GCkYlyV6Ai+jDnwidHiT2T7zhc+bJM+VTtc0T/CdTlDyTNTqIcCj0V1nD4TcVjJ7Ug==" |
2415 | }, | 2415 | }, |
2416 | "vscode-languageclient": { | 2416 | "vscode-languageclient": { |
2417 | "version": "7.0.0-next.9", | 2417 | "version": "7.0.0-next.12", |
2418 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.9.tgz", | 2418 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.12.tgz", |
2419 | "integrity": "sha512-lFO+rN/i72CM2va6iKXq1lD7pJg8J93KEXf0w0boWVqU+DJhWzLrV3pXl8Xk1nCv//qOAyhlc/nx2KZCTeRF/A==", | 2419 | "integrity": "sha512-OrzvOvhS5o26C0KctTJC7hkwh3avCwkVhllzy42AqwpIUZ3p2aVqkSG2uVxaeodq8ThBb3TLgtg50vxyWs6FEg==", |
2420 | "requires": { | 2420 | "requires": { |
2421 | "semver": "^6.3.0", | 2421 | "semver": "^6.3.0", |
2422 | "vscode-languageserver-protocol": "3.16.0-next.7" | 2422 | "vscode-languageserver-protocol": "3.16.0-next.10" |
2423 | } | 2423 | } |
2424 | }, | 2424 | }, |
2425 | "vscode-languageserver-protocol": { | 2425 | "vscode-languageserver-protocol": { |
2426 | "version": "3.16.0-next.7", | 2426 | "version": "3.16.0-next.10", |
2427 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.7.tgz", | 2427 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.10.tgz", |
2428 | "integrity": "sha512-tOjrg+K3RddJ547zpC9/LAgTbzadkPuHlqJFFWIcKjVhiJOh73XyY+Ngcu9wukGaTsuSGjJ0W8rlmwanixa0FQ==", | 2428 | "integrity": "sha512-YRTctHUZvts0Z1xXKNYU0ha0o+Tlgtwr+6O8OmDquM086N8exiSKBMwMC+Ra1QtIE+1mfW43Wxsme2FnMkAS9A==", |
2429 | "requires": { | 2429 | "requires": { |
2430 | "vscode-jsonrpc": "6.0.0-next.5", | 2430 | "vscode-jsonrpc": "6.0.0-next.7", |
2431 | "vscode-languageserver-types": "3.16.0-next.3" | 2431 | "vscode-languageserver-types": "3.16.0-next.4" |
2432 | } | 2432 | } |
2433 | }, | 2433 | }, |
2434 | "vscode-languageserver-types": { | 2434 | "vscode-languageserver-types": { |
2435 | "version": "3.16.0-next.3", | 2435 | "version": "3.16.0-next.4", |
2436 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.3.tgz", | 2436 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.4.tgz", |
2437 | "integrity": "sha512-s/z5ZqSe7VpoXJ6JQcvwRiPPA3nG0nAcJ/HH03zoU6QaFfnkcgPK+HshC3WKPPnC2G08xA0iRB6h7kmyBB5Adg==" | 2437 | "integrity": "sha512-NlKJyGcET/ZBCCLBYIPaGo2c37R03bPYeWXozUtnjyye7+9dhlbMSODyoG2INcQf8zFmB4qhm2UOJjgYEgPCNA==" |
2438 | }, | 2438 | }, |
2439 | "vscode-test": { | 2439 | "vscode-test": { |
2440 | "version": "1.4.0", | 2440 | "version": "1.4.0", |
diff --git a/editors/code/package.json b/editors/code/package.json index 4bd3117fc..eccafccdd 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -36,7 +36,7 @@ | |||
36 | }, | 36 | }, |
37 | "dependencies": { | 37 | "dependencies": { |
38 | "node-fetch": "^2.6.1", | 38 | "node-fetch": "^2.6.1", |
39 | "vscode-languageclient": "7.0.0-next.9" | 39 | "vscode-languageclient": "7.0.0-next.12" |
40 | }, | 40 | }, |
41 | "devDependencies": { | 41 | "devDependencies": { |
42 | "@rollup/plugin-commonjs": "^13.0.2", | 42 | "@rollup/plugin-commonjs": "^13.0.2", |
@@ -929,6 +929,10 @@ | |||
929 | { | 929 | { |
930 | "id": "consuming", | 930 | "id": "consuming", |
931 | "description": "Style for non-Copy lvalues consumed by method/function call" | 931 | "description": "Style for non-Copy lvalues consumed by method/function call" |
932 | }, | ||
933 | { | ||
934 | "id": "callable", | ||
935 | "description": "Style for variables/parameters that can be used in call expressions" | ||
932 | } | 936 | } |
933 | ], | 937 | ], |
934 | "semanticTokenScopes": [ | 938 | "semanticTokenScopes": [ |
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 3ddd14f9c..1b8cc713a 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json | |||
@@ -25,6 +25,9 @@ | |||
25 | }, | 25 | }, |
26 | "patterns": [ | 26 | "patterns": [ |
27 | { | 27 | { |
28 | "include": "#block-comments" | ||
29 | }, | ||
30 | { | ||
28 | "include": "#comments" | 31 | "include": "#comments" |
29 | }, | 32 | }, |
30 | { | 33 | { |
@@ -155,7 +158,7 @@ | |||
155 | }, | 158 | }, |
156 | { | 159 | { |
157 | "comment": "modules", | 160 | "comment": "modules", |
158 | "match": "(mod)\\s+([a-z][A-Za-z0-9_]*)", | 161 | "match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)", |
159 | "captures": { | 162 | "captures": { |
160 | "1": { | 163 | "1": { |
161 | "name": "keyword.control.rust" | 164 | "name": "keyword.control.rust" |
@@ -185,6 +188,9 @@ | |||
185 | }, | 188 | }, |
186 | "patterns": [ | 189 | "patterns": [ |
187 | { | 190 | { |
191 | "include": "#block-comments" | ||
192 | }, | ||
193 | { | ||
188 | "include": "#comments" | 194 | "include": "#comments" |
189 | }, | 195 | }, |
190 | { | 196 | { |
@@ -212,6 +218,9 @@ | |||
212 | }, | 218 | }, |
213 | "patterns": [ | 219 | "patterns": [ |
214 | { | 220 | { |
221 | "include": "#block-comments" | ||
222 | }, | ||
223 | { | ||
215 | "include": "#comments" | 224 | "include": "#comments" |
216 | }, | 225 | }, |
217 | { | 226 | { |
@@ -232,6 +241,9 @@ | |||
232 | ] | 241 | ] |
233 | }, | 242 | }, |
234 | { | 243 | { |
244 | "include": "#block-comments" | ||
245 | }, | ||
246 | { | ||
235 | "include": "#comments" | 247 | "include": "#comments" |
236 | }, | 248 | }, |
237 | { | 249 | { |
@@ -277,23 +289,17 @@ | |||
277 | { | 289 | { |
278 | "comment": "documentation comments", | 290 | "comment": "documentation comments", |
279 | "name": "comment.line.documentation.rust", | 291 | "name": "comment.line.documentation.rust", |
280 | "match": "^\\s*///.*", | 292 | "match": "^\\s*///.*" |
281 | "patterns": [ | ||
282 | { | ||
283 | "include": "#comments" | ||
284 | } | ||
285 | ] | ||
286 | }, | 293 | }, |
287 | { | 294 | { |
288 | "comment": "line comments", | 295 | "comment": "line comments", |
289 | "name": "comment.line.double-slash.rust", | 296 | "name": "comment.line.double-slash.rust", |
290 | "match": "\\s*//.*", | 297 | "match": "\\s*//.*" |
291 | "patterns": [ | 298 | } |
292 | { | 299 | ] |
293 | "include": "#comments" | 300 | }, |
294 | } | 301 | "block-comments": { |
295 | ] | 302 | "patterns": [ |
296 | }, | ||
297 | { | 303 | { |
298 | "comment": "block comments", | 304 | "comment": "block comments", |
299 | "name": "comment.block.rust", | 305 | "name": "comment.block.rust", |
@@ -301,7 +307,7 @@ | |||
301 | "end": "\\*/", | 307 | "end": "\\*/", |
302 | "patterns": [ | 308 | "patterns": [ |
303 | { | 309 | { |
304 | "include": "#comments" | 310 | "include": "#block-comments" |
305 | } | 311 | } |
306 | ] | 312 | ] |
307 | }, | 313 | }, |
@@ -312,14 +318,9 @@ | |||
312 | "end": "\\*/", | 318 | "end": "\\*/", |
313 | "patterns": [ | 319 | "patterns": [ |
314 | { | 320 | { |
315 | "include": "#comments" | 321 | "include": "#block-comments" |
316 | } | 322 | } |
317 | ] | 323 | ] |
318 | }, | ||
319 | { | ||
320 | "comment": "inferred types, wildcard patterns, ignored params", | ||
321 | "name": "comment.char.underscore.rust", | ||
322 | "match": "\\b_\\w*\\b" | ||
323 | } | 324 | } |
324 | ] | 325 | ] |
325 | }, | 326 | }, |
@@ -426,9 +427,21 @@ | |||
426 | "functions": { | 427 | "functions": { |
427 | "patterns": [ | 428 | "patterns": [ |
428 | { | 429 | { |
430 | "comment": "pub as a function", | ||
431 | "match": "\\b(pub)(\\()", | ||
432 | "captures": { | ||
433 | "1": { | ||
434 | "name": "keyword.other.rust" | ||
435 | }, | ||
436 | "2": { | ||
437 | "name": "punctuation.brackets.round.rust" | ||
438 | } | ||
439 | } | ||
440 | }, | ||
441 | { | ||
429 | "comment": "function definition", | 442 | "comment": "function definition", |
430 | "name": "meta.function.definition.rust", | 443 | "name": "meta.function.definition.rust", |
431 | "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))", | 444 | "begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))", |
432 | "beginCaptures": { | 445 | "beginCaptures": { |
433 | "1": { | 446 | "1": { |
434 | "name": "keyword.control.fn.rust" | 447 | "name": "keyword.control.fn.rust" |
@@ -451,6 +464,9 @@ | |||
451 | }, | 464 | }, |
452 | "patterns": [ | 465 | "patterns": [ |
453 | { | 466 | { |
467 | "include": "#block-comments" | ||
468 | }, | ||
469 | { | ||
454 | "include": "#comments" | 470 | "include": "#comments" |
455 | }, | 471 | }, |
456 | { | 472 | { |
@@ -494,18 +510,12 @@ | |||
494 | { | 510 | { |
495 | "comment": "function/method calls, chaining", | 511 | "comment": "function/method calls, chaining", |
496 | "name": "meta.function.call.rust", | 512 | "name": "meta.function.call.rust", |
497 | "begin": "(?:(pub)|(?:(\\.)?([A-Za-z0-9_]+)))(\\()", | 513 | "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()", |
498 | "beginCaptures": { | 514 | "beginCaptures": { |
499 | "1": { | 515 | "1": { |
500 | "name": "keyword.other.rust" | ||
501 | }, | ||
502 | "2": { | ||
503 | "name": "keyword.operator.access.dot.rust" | ||
504 | }, | ||
505 | "3": { | ||
506 | "name": "entity.name.function.rust" | 516 | "name": "entity.name.function.rust" |
507 | }, | 517 | }, |
508 | "4": { | 518 | "2": { |
509 | "name": "punctuation.brackets.round.rust" | 519 | "name": "punctuation.brackets.round.rust" |
510 | } | 520 | } |
511 | }, | 521 | }, |
@@ -517,6 +527,9 @@ | |||
517 | }, | 527 | }, |
518 | "patterns": [ | 528 | "patterns": [ |
519 | { | 529 | { |
530 | "include": "#block-comments" | ||
531 | }, | ||
532 | { | ||
520 | "include": "#comments" | 533 | "include": "#comments" |
521 | }, | 534 | }, |
522 | { | 535 | { |
@@ -628,10 +641,28 @@ | |||
628 | }, | 641 | }, |
629 | { | 642 | { |
630 | "comment": "less than, greater than (special case)", | 643 | "comment": "less than, greater than (special case)", |
631 | "match": "(^|\\s)(?<!=)([<>])\\s", | 644 | "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", |
632 | "captures": { | 645 | "captures": { |
646 | "1": { | ||
647 | "name": "punctuation.brackets.round.rust" | ||
648 | }, | ||
633 | "2": { | 649 | "2": { |
650 | "name": "punctuation.brackets.square.rust" | ||
651 | }, | ||
652 | "3": { | ||
653 | "name": "punctuation.brackets.curly.rust" | ||
654 | }, | ||
655 | "4": { | ||
634 | "name": "keyword.operator.comparison.rust" | 656 | "name": "keyword.operator.comparison.rust" |
657 | }, | ||
658 | "5": { | ||
659 | "name": "punctuation.brackets.round.rust" | ||
660 | }, | ||
661 | "6": { | ||
662 | "name": "punctuation.brackets.square.rust" | ||
663 | }, | ||
664 | "7": { | ||
665 | "name": "punctuation.brackets.curly.rust" | ||
635 | } | 666 | } |
636 | } | 667 | } |
637 | }, | 668 | }, |
@@ -694,23 +725,15 @@ | |||
694 | "interpolations": { | 725 | "interpolations": { |
695 | "comment": "curly brace interpolations", | 726 | "comment": "curly brace interpolations", |
696 | "name": "meta.interpolation.rust", | 727 | "name": "meta.interpolation.rust", |
697 | "begin": "{", | 728 | "match": "({)[^\"{}]*(})", |
698 | "beginCaptures": { | 729 | "captures": { |
699 | "0": { | 730 | "1": { |
700 | "name": "punctuation.definition.interpolation.rust" | 731 | "name": "punctuation.definition.interpolation.rust" |
701 | } | 732 | }, |
702 | }, | 733 | "2": { |
703 | "end": "}", | ||
704 | "endCaptures": { | ||
705 | "0": { | ||
706 | "name": "punctuation.definition.interpolation.rust" | 734 | "name": "punctuation.definition.interpolation.rust" |
707 | } | 735 | } |
708 | }, | 736 | } |
709 | "patterns": [ | ||
710 | { | ||
711 | "include": "#interpolations" | ||
712 | } | ||
713 | ] | ||
714 | }, | 737 | }, |
715 | "lifetimes": { | 738 | "lifetimes": { |
716 | "patterns": [ | 739 | "patterns": [ |
@@ -806,6 +829,9 @@ | |||
806 | }, | 829 | }, |
807 | "patterns": [ | 830 | "patterns": [ |
808 | { | 831 | { |
832 | "include": "#block-comments" | ||
833 | }, | ||
834 | { | ||
809 | "include": "#comments" | 835 | "include": "#comments" |
810 | }, | 836 | }, |
811 | { | 837 | { |
@@ -980,7 +1006,7 @@ | |||
980 | "name": "punctuation.definition.string.rust" | 1006 | "name": "punctuation.definition.string.rust" |
981 | } | 1007 | } |
982 | }, | 1008 | }, |
983 | "end": "(\")(#*)", | 1009 | "end": "(\")(\\2)", |
984 | "endCaptures": { | 1010 | "endCaptures": { |
985 | "1": { | 1011 | "1": { |
986 | "name": "punctuation.definition.string.rust" | 1012 | "name": "punctuation.definition.string.rust" |
@@ -1035,7 +1061,7 @@ | |||
1035 | { | 1061 | { |
1036 | "comment": "variables", | 1062 | "comment": "variables", |
1037 | "name": "variable.other.rust", | 1063 | "name": "variable.other.rust", |
1038 | "match": "\\b(?<!\\.)[a-z0-9_]+\\b" | 1064 | "match": "\\b(?<!\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b" |
1039 | } | 1065 | } |
1040 | ] | 1066 | ] |
1041 | } | 1067 | } |
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 459b7f250..17573cd82 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -129,7 +129,9 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
129 | } | 129 | } |
130 | 130 | ||
131 | const args = [...runnable.args.cargoArgs]; // should be a copy! | 131 | const args = [...runnable.args.cargoArgs]; // should be a copy! |
132 | args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options. | 132 | if (runnable.args.cargoExtraArgs) { |
133 | args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options. | ||
134 | } | ||
133 | if (runnable.args.executableArgs.length > 0) { | 135 | if (runnable.args.executableArgs.length > 0) { |
134 | args.push('--', ...runnable.args.executableArgs); | 136 | args.push('--', ...runnable.args.executableArgs); |
135 | } | 137 | } |
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 08159b43c..53492a445 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts | |||
@@ -75,12 +75,11 @@ export async function sendRequestWithRetry<TParam, TRet>( | |||
75 | log.warn("LSP request timed out", { method: reqType.method, param, error }); | 75 | log.warn("LSP request timed out", { method: reqType.method, param, error }); |
76 | throw error; | 76 | throw error; |
77 | } | 77 | } |
78 | 78 | if (error.code === lc.LSPErrorCodes.RequestCancelled) { | |
79 | if (error.code === lc.ErrorCodes.RequestCancelled) { | ||
80 | throw error; | 79 | throw error; |
81 | } | 80 | } |
82 | 81 | ||
83 | if (error.code !== lc.ErrorCodes.ContentModified) { | 82 | if (error.code !== lc.LSPErrorCodes.ContentModified) { |
84 | log.warn("LSP request failed", { method: reqType.method, param, error }); | 83 | log.warn("LSP request failed", { method: reqType.method, param, error }); |
85 | throw error; | 84 | throw error; |
86 | } | 85 | } |