diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/rust.tmGrammar.json | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index f0c5c3cf3..450116df2 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 | }, |
@@ -1042,7 +1043,7 @@ | |||
1042 | { | 1043 | { |
1043 | "comment": "variables", | 1044 | "comment": "variables", |
1044 | "name": "variable.other.rust", | 1045 | "name": "variable.other.rust", |
1045 | "match": "\\b(?<!\\.)[a-z0-9_]+\\b" | 1046 | "match": "\\b(?<!\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b" |
1046 | } | 1047 | } |
1047 | ] | 1048 | ] |
1048 | } | 1049 | } |