From da0c8d96d4d612d63058f0d4eba0e6f4348fa2a3 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 10:23:32 -0700 Subject: Tweak the textmate fallback scopes to be consistent with builtin TextMate grammar and other languages --- editors/code/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index c6fc13519..a86d0ad0d 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -596,28 +596,28 @@ "support.type.primitive" ], "lifetime": [ - "entity.name.lifetime.rust" + "entity.name.type.lifetime" ], "typeAlias": [ - "entity.name.typeAlias" + "entity.name.type.typeAlias" ], "union": [ - "entity.name.union" + "entity.name.type.union" ], "struct": [ "entity.name.type.struct" ], - "keyword.unsafe": [ - "keyword.other.unsafe" - ], "keyword": [ - "keyword" + "keyword.other" ], "keyword.controlFlow": [ "keyword.control" ], "variable.constant": [ - "entity.name.constant" + "variable.other.constant" + ], + "formatSpecifier": [ + "punctuation.section.embedded" ] } } -- cgit v1.2.3 From a91d15c80c337dd1afb0eddd5eb048010d098ac7 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:24:59 -0700 Subject: Import built-in textmate grammar, with no changes --- editors/code/.vscodeignore | 1 + editors/code/package.json | 5 + editors/code/rust.tmGrammar.json | 692 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 698 insertions(+) create mode 100644 editors/code/rust.tmGrammar.json (limited to 'editors/code') 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 @@ !package.json !package-lock.json !ra_syntax_tree.tmGrammar.json +!rust.tmGrammar.json !icon.png !README.md diff --git a/editors/code/package.json b/editors/code/package.json index a86d0ad0d..40ae3ab9e 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -478,6 +478,11 @@ } ], "grammars": [ + { + "language": "rust", + "scopeName": "source.rust", + "path": "rust.tmGrammar.json" + }, { "language": "ra_syntax_tree", "scopeName": "source.ra_syntax_tree", diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json new file mode 100644 index 000000000..784bd8c9a --- /dev/null +++ b/editors/code/rust.tmGrammar.json @@ -0,0 +1,692 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f", + "name": "Rust", + "scopeName": "source.rust", + "patterns": [ + { + "comment": "Implementation", + "begin": "\\b(impl)\\b", + "end": "\\{", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#where" + }, + { + "name": "storage.type.rust", + "match": "\\bfor\\b" + }, + { + "include": "#type" + } + ] + }, + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + }, + { + "include": "#line_doc_comment" + }, + { + "include": "#line_comment" + }, + { + "comment": "Attribute", + "name": "meta.attribute.rust", + "begin": "#\\!?\\[", + "end": "\\]", + "patterns": [ + { + "include": "#string_literal" + }, + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + }, + { + "include": "#line_doc_comment" + }, + { + "include": "#line_comment" + } + ] + }, + { + "comment": "Single-quote string literal (character)", + "name": "string.quoted.single.rust", + "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]?|.))'" + }, + { + "include": "#string_literal" + }, + { + "include": "#raw_string_literal" + }, + { + "comment": "Floating point literal (fraction)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b" + }, + { + "comment": "Floating point literal (exponent)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b" + }, + { + "comment": "Floating point literal (typed)", + "name": "constant.numeric.float.rust", + "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b" + }, + { + "comment": "Integer literal (decimal)", + "name": "constant.numeric.integer.decimal.rust", + "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (hexadecimal)", + "name": "constant.numeric.integer.hexadecimal.rust", + "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (octal)", + "name": "constant.numeric.integer.octal.rust", + "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Integer literal (binary)", + "name": "constant.numeric.integer.binary.rust", + "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b" + }, + { + "comment": "Static storage modifier", + "name": "storage.modifier.static.rust", + "match": "\\bstatic\\b" + }, + { + "comment": "Boolean constant", + "name": "constant.language.boolean.rust", + "match": "\\b(true|false)\\b" + }, + { + "comment": "Control keyword", + "name": "keyword.control.rust", + "match": "\\b(async|await|break|continue|else|if|in|for|loop|match|return|try|while)\\b" + }, + { + "comment": "Keyword", + "name": "keyword.other.rust", + "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b" + }, + { + "comment": "Reserved keyword", + "name": "invalid.deprecated.rust", + "match": "\\b(abstract|alignof|become|do|final|macro|offsetof|override|priv|proc|pure|sizeof|typeof|virtual|yield)\\b" + }, + { + "include": "#unsafe" + }, + { + "include": "#sigils" + }, + { + "include": "#self" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#box" + }, + { + "include": "#lifetime" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#const" + }, + { + "include": "#pub" + }, + { + "comment": "Miscellaneous operator", + "name": "keyword.operator.misc.rust", + "match": "(=>|::|\\bas\\b)" + }, + { + "comment": "Comparison operator", + "name": "keyword.operator.comparison.rust", + "match": "(&&|\\|\\||==|!=)" + }, + { + "comment": "Assignment operator", + "name": "keyword.operator.assignment.rust", + "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)" + }, + { + "comment": "Arithmetic operator", + "name": "keyword.operator.arithmetic.rust", + "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)" + }, + { + "comment": "Comparison operator (second group because of regex precedence)", + "name": "keyword.operator.comparison.rust", + "match": "(<=|>=|<|>)" + }, + { + "include": "#core_types" + }, + { + "include": "#core_vars" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "comment": "Built-in macro", + "name": "support.function.builtin.rust", + "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)!" + }, + { + "comment": "Core macro", + "name": "support.function.core.rust", + "match": "\\b(panic|assert|assert_eq|assert_ne|debug_assert|debug_assert_eq|debug_assert_ne|try|write|writeln|unreachable|unimplemented)!" + }, + { + "comment": "Standard library macro", + "name": "support.function.std.rust", + "match": "\\b(format|print|println|eprint|eprintln|select|vec)!" + }, + { + "comment": "Logging macro", + "name": "support.function.log.rust", + "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" + }, + { + "comment": "Invokation of a macro", + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", + "captures": { + "1": { + "name": "entity.name.function.macro.rust" + } + } + }, + { + "comment": "Function call", + "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", + "captures": { + "1": { + "name": "entity.name.function.rust" + } + } + }, + { + "comment": "Function call with type parameters", + "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()", + "end": "\\(", + "captures": { + "1": { + "name": "entity.name.function.rust" + }, + "2": { + "name": "keyword.operator.misc.rust" + } + }, + "patterns": [ + { + "include": "#type_params" + } + ] + }, + { + "comment": "Function definition", + "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)", + "end": "[\\{;]", + "beginCaptures": { + "1": { + "name": "keyword.other.fn.rust" + }, + "2": { + "name": "entity.name.function.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#self" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#const" + }, + { + "include": "#where" + }, + { + "include": "#unsafe" + }, + { + "comment": "Function arguments", + "match": "\bfn\b", + "name": "keyword.other.fn.rust" + } + ] + }, + { + "comment": "Type declaration", + "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": "[\\{\\(;]", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + }, + "2": { + "name": "entity.name.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + }, + { + "include": "#core_types" + }, + { + "include": "#pub" + }, + { + "include": "#where" + } + ] + }, + { + "comment": "Type alias", + "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": ";", + "beginCaptures": { + "1": { + "name": "storage.type.rust" + }, + "2": { + "name": "entity.name.type.rust" + } + }, + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#lifetime" + }, + { + "include": "#ref_lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + } + ] + } + ], + "repository": { + "block_doc_comment": { + "comment": "Block documentation comment", + "name": "comment.block.documentation.rust", + "begin": "/\\*[\\*!](?![\\*/])", + "end": "\\*/", + "patterns": [ + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + } + ] + }, + "block_comment": { + "comment": "Block comment", + "name": "comment.block.rust", + "begin": "/\\*", + "end": "\\*/", + "patterns": [ + { + "include": "#block_doc_comment" + }, + { + "include": "#block_comment" + } + ] + }, + "line_doc_comment": { + "comment": "Single-line documentation comment", + "name": "comment.line.documentation.rust", + "begin": "//[!/](?=[^/])", + "end": "$" + }, + "line_comment": { + "comment": "Single-line comment", + "name": "comment.line.double-slash.rust", + "begin": "//", + "end": "$" + }, + "escaped_character": { + "name": "constant.character.escape.rust", + "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]?|.)" + }, + "string_literal": { + "comment": "Double-quote string literal", + "name": "string.quoted.double.rust", + "begin": "b?\"", + "end": "\"", + "patterns": [ + { + "include": "#escaped_character" + } + ] + }, + "raw_string_literal": { + "comment": "Raw double-quote string literal", + "name": "string.quoted.double.raw.rust", + "begin": "b?r(#*)\"", + "end": "\"\\1" + }, + "sigils": { + "comment": "Sigil", + "name": "keyword.operator.sigil.rust", + "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" + }, + "self": { + "comment": "Self variable", + "name": "variable.language.rust", + "match": "\\bself\\b" + }, + "mut": { + "comment": "Mutable storage modifier", + "name": "storage.modifier.mut.rust", + "match": "\\bmut\\b" + }, + "dyn": { + "comment": "Dynamic modifier", + "name": "storage.modifier.dyn.rust", + "match": "\\bdyn\\b" + }, + "impl": { + "comment": "Existential type modifier", + "name": "storage.modifier.impl.rust", + "match": "\\bimpl\\b" + }, + "box": { + "comment": "Box storage modifier", + "name": "storage.modifier.box.rust", + "match": "\\bbox\\b" + }, + "const": { + "comment": "Const storage modifier", + "name": "storage.modifier.const.rust", + "match": "\\bconst\\b" + }, + "pub": { + "comment": "Visibility modifier", + "name": "storage.modifier.visibility.rust", + "match": "\\bpub\\b" + }, + "unsafe": { + "comment": "Unsafe code keyword", + "name": "keyword.other.unsafe.rust", + "match": "\\bunsafe\\b" + }, + "where": { + "comment": "Generic where clause", + "name": "keyword.other.where.rust", + "match": "\\bwhere\\b" + }, + "lifetime": { + "comment": "Named lifetime", + "name": "storage.modifier.lifetime.rust", + "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b", + "captures": { + "1": { + "name": "entity.name.lifetime.rust" + } + } + }, + "ref_lifetime": { + "comment": "Reference with named lifetime", + "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b", + "captures": { + "1": { + "name": "storage.modifier.lifetime.rust" + }, + "2": { + "name": "entity.name.lifetime.rust" + } + } + }, + "core_types": { + "comment": "Built-in/core type", + "name": "storage.type.core.rust", + "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" + }, + "core_vars": { + "comment": "Core type variant", + "name": "support.constant.core.rust", + "match": "\\b(Some|None|Ok|Err)\\b" + }, + "core_marker": { + "comment": "Core trait (marker)", + "name": "support.type.marker.rust", + "match": "\\b(Copy|Send|Sized|Sync)\\b" + }, + "core_traits": { + "comment": "Core trait", + "name": "support.type.core.rust", + "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b" + }, + "std_types": { + "comment": "Standard library type", + "name": "storage.class.std.rust", + "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" + }, + "std_traits": { + "comment": "Standard library trait", + "name": "support.type.std.rust", + "match": "\\b(ToOwned|ToString)\\b" + }, + "type": { + "comment": "A type", + "name": "entity.name.type.rust", + "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b" + }, + "type_params": { + "comment": "Type parameters", + "name": "meta.type_params.rust", + "begin": "<(?![=<])", + "end": "(?", + "patterns": [ + { + "include": "#block_comment" + }, + { + "include": "#line_comment" + }, + { + "include": "#sigils" + }, + { + "include": "#mut" + }, + { + "include": "#dyn" + }, + { + "include": "#impl" + }, + { + "include": "#lifetime" + }, + { + "include": "#core_types" + }, + { + "include": "#core_marker" + }, + { + "include": "#core_traits" + }, + { + "include": "#std_types" + }, + { + "include": "#std_traits" + }, + { + "include": "#type_params" + } + ] + } + } +} \ No newline at end of file -- cgit v1.2.3 From d5d154ba3f6823feeaaa62c2238711bcf0c43c53 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:32:08 -0700 Subject: Color lifetimes like types --- editors/code/rust.tmGrammar.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 784bd8c9a..16497abb0 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -586,23 +586,15 @@ }, "lifetime": { "comment": "Named lifetime", - "name": "storage.modifier.lifetime.rust", - "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b", - "captures": { - "1": { - "name": "entity.name.lifetime.rust" - } - } + "name": "entity.name.type.lifetime.rust", + "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, "ref_lifetime": { "comment": "Reference with named lifetime", - "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b", + "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "storage.modifier.lifetime.rust" - }, - "2": { - "name": "entity.name.lifetime.rust" + "name": "entity.name.type.lifetime.rust" } } }, -- cgit v1.2.3 From 0881c889bf728a0e151c828cff93116d14769158 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:34:28 -0700 Subject: Color sigil like keyword --- editors/code/rust.tmGrammar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 16497abb0..034038830 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -536,7 +536,7 @@ }, "sigils": { "comment": "Sigil", - "name": "keyword.operator.sigil.rust", + "name": "keyword.other.sigil.rust", "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" }, "self": { -- cgit v1.2.3 From 60e8e56dfad5d8066246bf8b2e587f0867b79d8c Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 12:57:32 -0700 Subject: Color core types as types, not keywords --- editors/code/rust.tmGrammar.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 034038830..c14dc09ab 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -600,7 +600,7 @@ }, "core_types": { "comment": "Built-in/core type", - "name": "storage.type.core.rust", + "name": "entity.name.type.core.rust", "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" }, "core_vars": { @@ -610,22 +610,22 @@ }, "core_marker": { "comment": "Core trait (marker)", - "name": "support.type.marker.rust", + "name": "entity.name.type.marker.rust", "match": "\\b(Copy|Send|Sized|Sync)\\b" }, "core_traits": { "comment": "Core trait", - "name": "support.type.core.rust", + "name": "entity.name.type.core.rust", "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b" }, "std_types": { "comment": "Standard library type", - "name": "storage.class.std.rust", + "name": "entity.name.type.class.std.rust", "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" }, "std_traits": { "comment": "Standard library trait", - "name": "support.type.std.rust", + "name": "entity.name.type.std.rust", "match": "\\b(ToOwned|ToString)\\b" }, "type": { -- cgit v1.2.3 From e86379ad1509ce33bdceea167fb5b50fda5f7083 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 9 May 2020 13:00:06 -0700 Subject: No longer true --- editors/code/rust.tmGrammar.json | 6 ------ 1 file changed, 6 deletions(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index c14dc09ab..d27528447 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -1,10 +1,4 @@ { - "information_for_contributors": [ - "This file has been converted from https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson", - "If you want to provide a fix or improvement, please create a pull request against the original repository.", - "Once accepted there, we are happy to receive an update request." - ], - "version": "https://github.com/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f", "name": "Rust", "scopeName": "source.rust", "patterns": [ -- cgit v1.2.3 From 46566d7a791d758447980a03b13fd79a76c76a0f Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 11:01:56 -0700 Subject: Color `as` as a keyword --- editors/code/rust.tmGrammar.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index d27528447..6fe16d794 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -159,7 +159,7 @@ { "comment": "Keyword", "name": "keyword.other.rust", - "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b" + "match": "\\b(crate|extern|mod|let|ref|use|super|move|as)\\b" }, { "comment": "Reserved keyword", @@ -202,7 +202,7 @@ { "comment": "Miscellaneous operator", "name": "keyword.operator.misc.rust", - "match": "(=>|::|\\bas\\b)" + "match": "(=>|::)" }, { "comment": "Comparison operator", -- cgit v1.2.3 From 2d2b32abe5edc6102a8800dedcc40bb3ac8bc393 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 13:32:42 -0700 Subject: Change lifetimes back to keyword-ish, tweak builtins for consistency between TextMate and semantic --- editors/code/package.json | 2 +- editors/code/rust.tmGrammar.json | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 40ae3ab9e..f46684c76 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -601,7 +601,7 @@ "support.type.primitive" ], "lifetime": [ - "entity.name.type.lifetime" + "storage.modifier.lifetime.rust" ], "typeAlias": [ "entity.name.type.typeAlias" diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 6fe16d794..c5ac9a99e 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -580,22 +580,25 @@ }, "lifetime": { "comment": "Named lifetime", - "name": "entity.name.type.lifetime.rust", + "name": "storage.modifier.lifetime.rust", "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, "ref_lifetime": { "comment": "Reference with named lifetime", - "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b", + "match": "(&)('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "entity.name.type.lifetime.rust" + "name": "keyword.other.sigil.rust" + }, + "2": { + "name": "storage.modifier.lifetime.rust" } } }, "core_types": { "comment": "Built-in/core type", - "name": "entity.name.type.core.rust", - "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" + "name": "support.type.primitive", + "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self)\\b" }, "core_vars": { "comment": "Core type variant", @@ -615,7 +618,7 @@ "std_types": { "comment": "Standard library type", "name": "entity.name.type.class.std.rust", - "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" + "match": "\\b(Box|String|Vec|Path|PathBuf|Option|Result)\\b" }, "std_traits": { "comment": "Standard library trait", -- cgit v1.2.3 From 97428b6d52d25f810dbd7d7a8d787740c58bfbd2 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sun, 10 May 2020 15:36:47 -0700 Subject: Put sigil back to keyword.operator --- editors/code/rust.tmGrammar.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index c5ac9a99e..27982c13a 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -530,7 +530,7 @@ }, "sigils": { "comment": "Sigil", - "name": "keyword.other.sigil.rust", + "name": "keyword.operator.sigil.rust", "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" }, "self": { @@ -588,7 +588,7 @@ "match": "(&)('[a-zA-Z_][a-zA-Z0-9_]*)\\b", "captures": { "1": { - "name": "keyword.other.sigil.rust" + "name": "keyword.operator.sigil.rust" }, "2": { "name": "storage.modifier.lifetime.rust" -- cgit v1.2.3