Community
Participate
Working Groups
At the moment, there are two issues with template full variable keywords highlighting: (1) Keywords that can also be java identifiers ("field", "var", "localVar", "argType", "elemType","newName", "newType", "importStatic", "link", "array") are not highlighted at all. e.g.: the "newName" < in ${s:newName(String)} > will not be highlighted. This is because this keywords can be java identifiers. e.g.: "newName" in < String newName = "Name"; > must not be highlighted. (2) The "import" keyword is also a java keyword, and is highlighted as a java keyword instead of a template keyword. e.g.: -> in the case of < ${:import(java.util.List, java.util.Collection)} > the template keyword "import" should be highlighted as a template keyword -> in the case of < import java.util.List; > the java keyword "import" should be highlighted as a java keyword. Both this issues can be fixed if we create separate grammar rules for each of the template keywords that would return a common type. e.g. NewNameTemplateKeyword returns TemplateKeyword: 'newName'; ImportTemplateKeyword returns TemplateKeyword: 'import'; Afterwards we can use the semantic highlight calculator to highlight the above template keywords appropriately
Is there a way to test that the highlighter applied the right highlighting to a selected portion of the input document? As highlighting depends very much on the underlying grammar, it's easy to accidentally break it again in the future -- unless there are tests guarding against this.
Solved by change-set <https://git.eclipse.org/r/#/c/29324/>