-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I'm working on a way to get TM4E to be able to emulate DevStyle's Darkest Dark theme so I can use it as a base and extend it with additional scopes it does not cover, like invalid and invalid.illegal. And since I can't "export" the dynamic theme from the TM4E Theme's page or find it anywhere else in raw form, I've come up with some creative ways to grab all of it's definitions from a workspace export. Nonetheless, I'm getting pretty close to a tmTheme that replicates its defaults of whatever's setup within Eclipse and that will give me the ability to start with it as a base and add more scopes.
While I was doing that I wated a rapid way to test my tmTheme and adjust it. So, I started using TmLanguage and TmTheme Playground at https://youngspe.dev/textmate-grammar-playground/. I loaded in the java.tmLanguage.json from https://github.com/eclipse-tm4e/tm4e/blob/main/org.eclipse.tm4e.language_pack/syntaxes/java/java.tmLanguage.json, and my theme, and some sample code, and I noticed something. I don't think TM4E is determining the same scopes as a standard TextMate engine does. For example, extends Someclass, the Someclass ends up with scopes:
entity.other.inherited-class.java
meta.definition.class.inherited.classes.java
meta.class.java
source.java
And I have a theme rule:
{
"scope": "entity.other",
"settings": {
"foreground": "#D197D9"
}
},
And the Someclass ends up D197D9 (pinkish) in the Playground, but white in the Generic Code Editor in TM4E. According to TextMate selector semantics, a selector entity.other should match any scope beginning with entity.other.*, including entity.other.inherited-class.java. So, it should show up as pinkish in TM4E but it does not.
I can't find a way to see the scope inside of the Generic Code Editor (is there a way?) so I don't know what scope(s) it decided to apply to the element, and why it's not applying the scope rule from my theme.
I've attached my sample Java code that I'm using to test the grammar (and develop the theme itself), my tmTheme, and a copy of screenshots where you can see the divergence, not just in that scope, but in MANY other scopes too (method names, class names, variables, annotations, etc). Inspecting the screenshots you can see many differences: lots of things that should be the base white are colored aqua (annotations, classes after "new" keyword, method names, etc). Many Java class names that should be red are rendered in that same aqua keyword color. Generic types should be another color but are also the generic aqua color. variables should be a darker blue but are colored differently in TM4E depending on context. Some thigns are correct: comments, keywords, Javadoc and single line comments, quoted strings, etc. But most of the other things are not correct. If I were to guess, it looks like it's not applyting the proper scopes to the elements.
