JAVA syntax highlighting breaks for type names ending with 'class'
Closed this issue · 4 comments
alexr00 commented
From @Zenoo on October 24, 2018 14:11
class ZoneSuperclass {
}
public static void main(String[] args) {
Zonesuperclass zone = null;
}
Issue Type: Bug
- Have a Java class with a name ending with 'class'
- Try to reference this class elsewhere like
ZoneSuperclass zone = null;
Copied from original issue: microsoft/vscode#61727
Example code to copy and paste:
class ZoneSuperclass {
}
public static void main(String[] args) {
ZoneSuperclass testVal = null;
}
alexr00 commented
@Zenoo, I can't reproduce this. I tried with:
VS Code version: Code 1.28.2 (7f3ce96, 2018-10-17T00:23:51.859Z)
VS Code version: 1.29.0-insider (4a29bd373)
And built out of master from 3dd2b19b2ab73
Does this reproduce if you disable all extensions? Can you provide more details for me to reproduce with?
alexr00 commented
alexr00 commented
@Zenoo, I see it now, thank you for catching. This also repros in Atom, which is where we're getting the language grammar from.
sadikovi commented
Thanks for reporting!
This should do it:
C02W6HZLHTD5:language-java ivansadikov$ git diff
diff --git a/grammars/java.cson b/grammars/java.cson
index df32209..5045385 100644
--- a/grammars/java.cson
+++ b/grammars/java.cson
@@ -243,7 +243,7 @@
}
]
'class':
- 'begin': '(?=\\w?[\\w\\s]*(?:class|(?<!@)interface|enum)\\s+\\w+)'
+ 'begin': '(?=\\w?[\\w\\s]*\\b(?:class|(?<!@)interface|enum)\\s+\\w+)'
'end': '}'
'endCaptures':
'0':
I will open a PR to fix it.