aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json4
-rw-r--r--editors/code/rust.tmGrammar.json53
2 files changed, 40 insertions, 17 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 4bd3117fc..af845d7bc 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -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 f0c5c3cf3..1b8cc713a 100644
--- a/editors/code/rust.tmGrammar.json
+++ b/editors/code/rust.tmGrammar.json
@@ -158,7 +158,7 @@
158 }, 158 },
159 { 159 {
160 "comment": "modules", 160 "comment": "modules",
161 "match": "(mod)\\s+([a-z][A-Za-z0-9_]*)", 161 "match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)",
162 "captures": { 162 "captures": {
163 "1": { 163 "1": {
164 "name": "keyword.control.rust" 164 "name": "keyword.control.rust"
@@ -295,11 +295,6 @@
295 "comment": "line comments", 295 "comment": "line comments",
296 "name": "comment.line.double-slash.rust", 296 "name": "comment.line.double-slash.rust",
297 "match": "\\s*//.*" 297 "match": "\\s*//.*"
298 },
299 {
300 "comment": "inferred types, wildcard patterns, ignored params",
301 "name": "comment.char.underscore.rust",
302 "match": "\\b_\\w*\\b[^!(]"
303 } 298 }
304 ] 299 ]
305 }, 300 },
@@ -432,9 +427,21 @@
432 "functions": { 427 "functions": {
433 "patterns": [ 428 "patterns": [
434 { 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 {
435 "comment": "function definition", 442 "comment": "function definition",
436 "name": "meta.function.definition.rust", 443 "name": "meta.function.definition.rust",
437 "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))", 444 "begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))",
438 "beginCaptures": { 445 "beginCaptures": {
439 "1": { 446 "1": {
440 "name": "keyword.control.fn.rust" 447 "name": "keyword.control.fn.rust"
@@ -503,18 +510,12 @@
503 { 510 {
504 "comment": "function/method calls, chaining", 511 "comment": "function/method calls, chaining",
505 "name": "meta.function.call.rust", 512 "name": "meta.function.call.rust",
506 "begin": "(?:(pub)|(?:(\\.)?([A-Za-z0-9_]+)))(\\()", 513 "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()",
507 "beginCaptures": { 514 "beginCaptures": {
508 "1": { 515 "1": {
509 "name": "keyword.other.rust"
510 },
511 "2": {
512 "name": "keyword.operator.access.dot.rust"
513 },
514 "3": {
515 "name": "entity.name.function.rust" 516 "name": "entity.name.function.rust"
516 }, 517 },
517 "4": { 518 "2": {
518 "name": "punctuation.brackets.round.rust" 519 "name": "punctuation.brackets.round.rust"
519 } 520 }
520 }, 521 },
@@ -640,10 +641,28 @@
640 }, 641 },
641 { 642 {
642 "comment": "less than, greater than (special case)", 643 "comment": "less than, greater than (special case)",
643 "match": "(^|\\s)(?<!=)([<>])\\s", 644 "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",
644 "captures": { 645 "captures": {
646 "1": {
647 "name": "punctuation.brackets.round.rust"
648 },
645 "2": { 649 "2": {
650 "name": "punctuation.brackets.square.rust"
651 },
652 "3": {
653 "name": "punctuation.brackets.curly.rust"
654 },
655 "4": {
646 "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"
647 } 666 }
648 } 667 }
649 }, 668 },
@@ -1042,7 +1061,7 @@
1042 { 1061 {
1043 "comment": "variables", 1062 "comment": "variables",
1044 "name": "variable.other.rust", 1063 "name": "variable.other.rust",
1045 "match": "\\b(?<!\\.)[a-z0-9_]+\\b" 1064 "match": "\\b(?<!\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b"
1046 } 1065 }
1047 ] 1066 ]
1048 } 1067 }