Community
Participate
Working Groups
We are developing an IDE for a custom language that was based on the C++. This language allows developing applications that run on heterogeneous hardware (CPU or GPGPU). One of the features we wanted to introduce was custom semantic highlight. We wanted to create rules like: 1. Use different face color for variables that reside in different memory spaces. 2. Use different background color for the code that can run on different targets. 3. Color function calls that are made across targets. We gathered following requirements: 1. Provide an extensibility mechanism that would let the users to extend semantic highlight without subclassing CDT source editor - we believe the utility of this framework is beyond custom language dialects (i.e. provider with some custom C++ SDK may want to provide a plugin with custom highlight). 2. User should be able to use "Syntax Coloring" preference page to configure custom highlightings - this is essential for streamlined and consistent UI. 3. Rules should be language-dependent but a way to contribute rules for all languages may also be desired. We have developed extensibility support that fits our requirements and are willing to contribute it to CDT. We would like to refine the requirements and refine our implementation before attaching the patch here. P.S. One of the side-effects of our refactoring was that "Inactive code background highlight" was moved to "Syntax Coloring" preference page as it was changed to use the new framework.
I have had a quick look at your github repo (https://github.com/eugeneo/cdt/commits/customcdt8) when you sent your initial proposal to cdt-dev. Looks definitely promising.
*** Bug 399422 has been marked as a duplicate of this bug. ***
The github repo in comment 1 is no longer active, any idea where that code went? I have a nearly complete implementation of this feature, I should be ready to push it to gerrit later today. However, if there is already a partial solution then it would be good to compare first.
I took some guesses at the URL by walking up the parents. I eventually found: https://github.com/eugeneo/cdt/commit/f7300d380054e237b5c2d0d15cfd6afa8f698313 I'll look at this in more detail before pushing my own changes. The changeset is a bit old, I'll bring it up to date to better compare functionality.
All our changes for CDT 8.1.1 are published here - https://github.com/NVIDIA/cdt-nsight
My patch is ready for review, but I still have to figure out how to push it to Gerrit. I'll do that tomorrow. In terms of functionality, I found two things in your changes that weren't in my patch. 1) Application based on ILanguage.getId 2) Background highlighting changes. Otherwise, both changes follow the same general approach; a new extension point allows new highlighters to be contributed. One difference in my changes is that the contributing plugin is only loaded after it has been decided that the highlighter should have a chance to consume the token. I based this part of the patch on the existing quickFixProcessors extension point. An enablement expression (from oe.core.expressions) is used to decide whether the highlighter should have a chance to consume the token. Originally, the only variable in the execution context was a list of the project's natures. However, I've updated my patch to include the language id. I think this should provide similar functionality to that part of the NVidia changes. Another difference in my patch is that the extension point provides a way to specify the order in which the highlighters are evaluated. This is important in my case, since I need the contributing highlighter to have a chance to consume the token before some of the built in ones. I don't have any functionality similar to the background highlighting changes. I also don't really have a way to test those changes. ---- I'll post this patch for review tomorrow.
Please also note that in our product (and our Git repository), our custom semantic highlight settings are shown on the CDT editing preference page. You can contribute that through another extension point.
I've looked in both the nvidia/master and nvidia/nsight_8_1_x branches, but I don't see any changes in the preferences dialog. I'll try looking at the code to see where the new node should show up, but if you see this first, could you tell me how to find the changes described in comment 7? Right now my patch just adds a section to 'C/C++ - Editor - Syntax Coloring - Element - Code', which I don't think is very nice. For one thing, extensions might provide highlightings that aren't for 'Code'. It would be nice to move the contributed highlightings to their own area.
I've posted my patch to gerrit for review https://git.eclipse.org/r/#/c/10074/ I wasn't able to find the UI changes (in the nvidia repo) for the contributed semantic highlightings. That could be added as a second change.
Created attachment 226427 [details] Nsight EE semantic highlight use cases I attached a PDF with screenshots explaining how we use our implementation of the extendible semantic highlight. I'm quite sure the requirements are not unique for our product (e.g. other adopters may want to use custom backgrounds for some critical sections, introduce rules to highlight some custom SDK usage, etc)
Marking fixed. Doug has already committed the patch. BTW, ISemanticToken misses a Copyright header. Eugene, if you would like to contribute the background highlighting extension, please file a new bug. Thanks for the contribution, Andrew.
I was leaving this to see if I wanted to back port it to 8.1. But I think we'll do that locally. Thanks everyone.