From 8edffa8ed46065674a7d5e0776e6f28675c2391d Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Dec 2017 10:23:02 -0500 Subject: [PATCH 1/4] 'type' matches only elements (traits, structs, enums/enum variants) which are capitalized --- grammars/rust.cson | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars/rust.cson b/grammars/rust.cson index 7af0148..ab094df 100644 --- a/grammars/rust.cson +++ b/grammars/rust.cson @@ -145,7 +145,7 @@ 'type': { 'comment': 'A type' 'name': 'entity.name.type.rust' - 'match': '\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b' + 'match': '\\b([A-Z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b' } 'type_params': { 'comment': 'Type parameters' @@ -164,7 +164,7 @@ { 'include': '#std_types' } { 'include': '#std_traits' } { 'include': '#type_params' } - # { 'include': '#type' } + { 'include': '#type' } ] } } From a86270c228df72045f84b2c057f248923a573f6b Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Dec 2017 10:26:43 -0500 Subject: [PATCH 2/4] Match 'type' in attributes --- grammars/rust.cson | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grammars/rust.cson b/grammars/rust.cson index ab094df..11d6e01 100644 --- a/grammars/rust.cson +++ b/grammars/rust.cson @@ -147,6 +147,11 @@ 'name': 'entity.name.type.rust' 'match': '\\b([A-Z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b' } + 'identifier': { + 'comment': 'Any identifier not otherwise specified' + 'name': 'variable.other.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' @@ -215,6 +220,7 @@ { 'include': '#block_comment' } { 'include': '#line_doc_comment' } { 'include': '#line_comment' } + { 'include': '#type' } ] } # Strings From 4b5a84a4a0841da86e327f72175136c4f532f9cc Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Dec 2017 10:28:22 -0500 Subject: [PATCH 3/4] Match 'type' and 'identifier' in function definitions --- grammars/rust.cson | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grammars/rust.cson b/grammars/rust.cson index 11d6e01..8bbab41 100644 --- a/grammars/rust.cson +++ b/grammars/rust.cson @@ -414,6 +414,8 @@ 'match': '\bfn\b' 'name': 'keyword.other.fn.rust' } + { 'include': '#type' } + { 'include': '#identifier' } ] } # Type declaration From ddae39121496cab4e81d51b5211c8c2701867e79 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Dec 2017 10:29:51 -0500 Subject: [PATCH 4/4] Match 'type' and 'identifier' anywhere else --- grammars/rust.cson | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grammars/rust.cson b/grammars/rust.cson index 8bbab41..ce4e88a 100644 --- a/grammars/rust.cson +++ b/grammars/rust.cson @@ -462,4 +462,6 @@ { 'include': '#type_params' } ] } + { 'include': '#type' } + { 'include': '#identifier' } ]