Skip to content

Commit 6d80dfa

Browse files
6361: Textmate grammar: angle bracket fix (closes rust-lang#6323) r=dustypomerleau a=dustypomerleau Fixes rust-lang#6323 After tinkering, it became clear that `<` and `>` should really default to the punctuation interpretation in the vast majority of cases. In addition, the breakage is greater when an angle bracket is missed. So, rather than optimizing for a type parameter `meta` scope and considering every possible parent scope and child scope, the easier fix was to narrow the case where `<` and `>` are treated as comparison operators. Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2 parents eae54b5 + efdcfcf commit 6d80dfa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

editors/code/rust.tmGrammar.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,28 @@
641641
},
642642
{
643643
"comment": "less than, greater than (special case)",
644-
"match": "(^|\\s)(?<!=)([<>])\\s",
644+
"match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",
645645
"captures": {
646+
"1": {
647+
"name": "punctuation.brackets.round.rust"
648+
},
646649
"2": {
650+
"name": "punctuation.brackets.square.rust"
651+
},
652+
"3": {
653+
"name": "punctuation.brackets.curly.rust"
654+
},
655+
"4": {
647656
"name": "keyword.operator.comparison.rust"
657+
},
658+
"5": {
659+
"name": "punctuation.brackets.round.rust"
660+
},
661+
"6": {
662+
"name": "punctuation.brackets.square.rust"
663+
},
664+
"7": {
665+
"name": "punctuation.brackets.curly.rust"
648666
}
649667
}
650668
},

0 commit comments

Comments
 (0)