Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 436902 - Context dependent syntax highlighting for template keywords
Summary: Context dependent syntax highlighting for template keywords
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders.incubator (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Prisca CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-07 06:02 EDT by Stefan Prisca CLA
Modified: 2019-07-24 14:36 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Prisca CLA 2014-06-07 06:02:37 EDT
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
Comment 1 Andreas Sewe CLA 2014-07-02 07:10:46 EDT
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.
Comment 2 Stefan Prisca CLA 2014-07-05 03:41:27 EDT
Solved by change-set <https://git.eclipse.org/r/#/c/29324/>