From 26b4b1e2fb06f54e2974835077c2e970b2e0f2b8 Mon Sep 17 00:00:00 2001 From: Dusty Pomerleau Date: Thu, 22 Oct 2020 13:03:04 +1100 Subject: fix: prevent line comments inside block comments - prevent line comments inside block comments - prevent underscore-prefixed functions and macros from receiving comment scope --- editors/code/rust.tmGrammar.json | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index 3be565195..f0c5c3cf3 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json @@ -24,6 +24,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -184,6 +187,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -211,6 +217,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -231,6 +240,9 @@ } ] }, + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -277,23 +289,22 @@ { "comment": "documentation comments", "name": "comment.line.documentation.rust", - "match": "^\\s*///.*", - "patterns": [ - { - "include": "#comments" - } - ] + "match": "^\\s*///.*" }, { "comment": "line comments", "name": "comment.line.double-slash.rust", - "match": "\\s*//.*", - "patterns": [ - { - "include": "#comments" - } - ] + "match": "\\s*//.*" }, + { + "comment": "inferred types, wildcard patterns, ignored params", + "name": "comment.char.underscore.rust", + "match": "\\b_\\w*\\b[^!(]" + } + ] + }, + "block-comments": { + "patterns": [ { "comment": "block comments", "name": "comment.block.rust", @@ -301,7 +312,7 @@ "end": "\\*/", "patterns": [ { - "include": "#comments" + "include": "#block-comments" } ] }, @@ -312,14 +323,9 @@ "end": "\\*/", "patterns": [ { - "include": "#comments" + "include": "#block-comments" } ] - }, - { - "comment": "inferred types, wildcard patterns, ignored params", - "name": "comment.char.underscore.rust", - "match": "\\b_\\w*\\b" } ] }, @@ -450,6 +456,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -516,6 +525,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, @@ -797,6 +809,9 @@ } }, "patterns": [ + { + "include": "#block-comments" + }, { "include": "#comments" }, -- cgit v1.2.3