Bug 521382 - [generic editor] Default highlighter for generic editor
Summary: [generic editor] Default highlighter for generic editor
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.8 M4   Edit
Assignee: Lucas Bullen CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation, noteworthy
Depends on:
Blocks:
 
Reported: 2017-08-24 11:47 EDT by Angelo ZERR CLA
Modified: 2017-11-14 10:17 EST (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 Angelo ZERR CLA 2017-08-24 11:47:32 EDT
Generic Editor provides a default autocompletion with tokens. 

I tell me that Generic Editor could provide too a default highlighter which highlights those tokens. It's the strategy used too by VSCode.
Comment 1 Angelo ZERR CLA 2017-09-28 04:56:43 EDT
If GenericEditor could provides this feature, it should be nice to provide a "Toggle Highlight" button like lsp4e provides. In this case I think "Toggle Highlight" from lsp4e should be moved to GenericEditor Platform Text and provides an extension point to override it with lsp4e higlighter language server.
Comment 2 Eclipse Genie CLA 2017-10-04 11:54:33 EDT
New Gerrit change created: https://git.eclipse.org/r/106222
Comment 3 Eclipse Genie CLA 2017-10-04 12:08:18 EDT
New Gerrit change created: https://git.eclipse.org/r/106229
Comment 5 Mickael Istria CLA 2017-11-07 09:21:12 EST
thanks for the patch Lucas. Can you please add a reference to the new extension point in the N&N and in the documentation?
Comment 6 Eclipse Genie CLA 2017-11-07 12:32:56 EST
New Gerrit change created: https://git.eclipse.org/r/111165
Comment 8 Eclipse Genie CLA 2017-11-07 13:05:12 EST
New Gerrit change created: https://git.eclipse.org/r/111167
Comment 10 Mickael Istria CLA 2017-11-07 14:08:18 EST
A (non-blocking) issue with the current patch is that the Toggle Highlight command uses a preference that extenders are supposed to consume. It would be more consistent with the idea of the generic editor to have the preference controlling installation/uninstallation of the highlight reconciliers and removal of the related annotations.
It would be nice if we could improve that as part of this bug.

Note that this is a smell that the highlight reconcilier and annotations in general (in JFace, not in generic editor in particular) would be worth being made an abstract subclass of reconciliers providing more specific actions and settings. But that would be for another iteration.
Comment 11 Lucas Bullen CLA 2017-11-07 14:54:20 EST
To move over from our discussion on the N&N commit:

Yes we could do that, however when disabling the toggle I would like to remove any annotations the user has added. To do this we would have to know what type of annotation has been added, which would require them to use our defined annotation so we can refer to it, which restricts them from having multiple types of annotations or their own style of annotation.
Comment 12 Mickael Istria CLA 2017-11-07 15:47:35 EST
(In reply to Lucas Bullen from comment #11)
> To do this we would have to know
> what type of annotation has been added, which would require them to use our
> defined annotation so we can refer to it, which restricts them from having
> multiple types of annotations or their own style of annotation.

That's the key point. Similarly to common commands or other stuff, we probably need a place in Platform to define a "highlight" annotation type and be able to interact with it.
The purpose of the generic editor is more to provide consistency and simplicity to extend a code editor over giving full freedom to extenders (as most of Platform Text already does), so I think defining an annotation type and asking extenders to use it is closer to the generic editor goals. In any case, people who want to use another annotation could still use one, it would only be a recommendation to consistently use a common one for highlight.
Comment 13 Mickael Istria CLA 2017-11-08 12:09:14 EST
Thanks a lot Lucas for those good patches!
Further improvements regarding definition of the annotation will be covered by bug 527007
Comment 14 Angelo ZERR CLA 2017-11-09 02:38:11 EST
Thanks a lot Lucas for your great wor!

I have just few comments. Compare to VSCode, it should be cool:

 * highlight every time the token even if there is just one token.
 * token should contains '_'  like 'indent_size'. Today the token is 'indent'.

Anyway thanks for this very cool work!
Comment 15 Mickael Istria CLA 2017-11-09 03:10:17 EST
(In reply to Angelo ZERR from comment #14)
> Thanks a lot Lucas for your great wor!
> 
> I have just few comments. Compare to VSCode, it should be cool:
> 
>  * highlight every time the token even if there is just one token.
>  * token should contains '_'  like 'indent_size'. Today the token is
> 'indent'.
> 
> Anyway thanks for this very cool work!

Can you please report new bugs for those items and link them to this one?