diff options
author | Dusty Pomerleau <[email protected]> | 2020-10-22 03:03:04 +0100 |
---|---|---|
committer | Dusty Pomerleau <[email protected]> | 2020-10-22 03:33:06 +0100 |
commit | 26b4b1e2fb06f54e2974835077c2e970b2e0f2b8 (patch) | |
tree | da2feb8a812060e71c1f121c336dd3d56aa6a162 | |
parent | 9eb6cbb80b7d2ccf196745f8e53fc22ae0f73030 (diff) |
fix: prevent line comments inside block comments
- prevent line comments inside block comments
- prevent underscore-prefixed functions and macros from receiving comment scope
-rw-r--r-- | editors/code/rust.tmGrammar.json | 53 |
1 files 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 | |||
@@ -25,6 +25,9 @@ | |||
25 | }, | 25 | }, |
26 | "patterns": [ | 26 | "patterns": [ |
27 | { | 27 | { |
28 | "include": "#block-comments" | ||
29 | }, | ||
30 | { | ||
28 | "include": "#comments" | 31 | "include": "#comments" |
29 | }, | 32 | }, |
30 | { | 33 | { |
@@ -185,6 +188,9 @@ | |||
185 | }, | 188 | }, |
186 | "patterns": [ | 189 | "patterns": [ |
187 | { | 190 | { |
191 | "include": "#block-comments" | ||
192 | }, | ||
193 | { | ||
188 | "include": "#comments" | 194 | "include": "#comments" |
189 | }, | 195 | }, |
190 | { | 196 | { |
@@ -212,6 +218,9 @@ | |||
212 | }, | 218 | }, |
213 | "patterns": [ | 219 | "patterns": [ |
214 | { | 220 | { |
221 | "include": "#block-comments" | ||
222 | }, | ||
223 | { | ||
215 | "include": "#comments" | 224 | "include": "#comments" |
216 | }, | 225 | }, |
217 | { | 226 | { |
@@ -232,6 +241,9 @@ | |||
232 | ] | 241 | ] |
233 | }, | 242 | }, |
234 | { | 243 | { |
244 | "include": "#block-comments" | ||
245 | }, | ||
246 | { | ||
235 | "include": "#comments" | 247 | "include": "#comments" |
236 | }, | 248 | }, |
237 | { | 249 | { |
@@ -277,31 +289,30 @@ | |||
277 | { | 289 | { |
278 | "comment": "documentation comments", | 290 | "comment": "documentation comments", |
279 | "name": "comment.line.documentation.rust", | 291 | "name": "comment.line.documentation.rust", |
280 | "match": "^\\s*///.*", | 292 | "match": "^\\s*///.*" |
281 | "patterns": [ | ||
282 | { | ||
283 | "include": "#comments" | ||
284 | } | ||
285 | ] | ||
286 | }, | 293 | }, |
287 | { | 294 | { |
288 | "comment": "line comments", | 295 | "comment": "line comments", |
289 | "name": "comment.line.double-slash.rust", | 296 | "name": "comment.line.double-slash.rust", |
290 | "match": "\\s*//.*", | 297 | "match": "\\s*//.*" |
291 | "patterns": [ | ||
292 | { | ||
293 | "include": "#comments" | ||
294 | } | ||
295 | ] | ||
296 | }, | 298 | }, |
297 | { | 299 | { |
300 | "comment": "inferred types, wildcard patterns, ignored params", | ||
301 | "name": "comment.char.underscore.rust", | ||
302 | "match": "\\b_\\w*\\b[^!(]" | ||
303 | } | ||
304 | ] | ||
305 | }, | ||
306 | "block-comments": { | ||
307 | "patterns": [ | ||
308 | { | ||
298 | "comment": "block comments", | 309 | "comment": "block comments", |
299 | "name": "comment.block.rust", | 310 | "name": "comment.block.rust", |
300 | "begin": "/\\*(?!\\*)", | 311 | "begin": "/\\*(?!\\*)", |
301 | "end": "\\*/", | 312 | "end": "\\*/", |
302 | "patterns": [ | 313 | "patterns": [ |
303 | { | 314 | { |
304 | "include": "#comments" | 315 | "include": "#block-comments" |
305 | } | 316 | } |
306 | ] | 317 | ] |
307 | }, | 318 | }, |
@@ -312,14 +323,9 @@ | |||
312 | "end": "\\*/", | 323 | "end": "\\*/", |
313 | "patterns": [ | 324 | "patterns": [ |
314 | { | 325 | { |
315 | "include": "#comments" | 326 | "include": "#block-comments" |
316 | } | 327 | } |
317 | ] | 328 | ] |
318 | }, | ||
319 | { | ||
320 | "comment": "inferred types, wildcard patterns, ignored params", | ||
321 | "name": "comment.char.underscore.rust", | ||
322 | "match": "\\b_\\w*\\b" | ||
323 | } | 329 | } |
324 | ] | 330 | ] |
325 | }, | 331 | }, |
@@ -451,6 +457,9 @@ | |||
451 | }, | 457 | }, |
452 | "patterns": [ | 458 | "patterns": [ |
453 | { | 459 | { |
460 | "include": "#block-comments" | ||
461 | }, | ||
462 | { | ||
454 | "include": "#comments" | 463 | "include": "#comments" |
455 | }, | 464 | }, |
456 | { | 465 | { |
@@ -517,6 +526,9 @@ | |||
517 | }, | 526 | }, |
518 | "patterns": [ | 527 | "patterns": [ |
519 | { | 528 | { |
529 | "include": "#block-comments" | ||
530 | }, | ||
531 | { | ||
520 | "include": "#comments" | 532 | "include": "#comments" |
521 | }, | 533 | }, |
522 | { | 534 | { |
@@ -798,6 +810,9 @@ | |||
798 | }, | 810 | }, |
799 | "patterns": [ | 811 | "patterns": [ |
800 | { | 812 | { |
813 | "include": "#block-comments" | ||
814 | }, | ||
815 | { | ||
801 | "include": "#comments" | 816 | "include": "#comments" |
802 | }, | 817 | }, |
803 | { | 818 | { |