eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
81 stars 188 forks source link

Missing line numbers in Quick Search viewer #2010

Open RedeemerSK opened 4 months ago

RedeemerSK commented 4 months ago

Suggestion

From a fresh installation and clean workspace: no setup steps are necessary

I reach state showing found occurrence in Quick Search dialog with

And would like to be able to see line numbers and selected result/occurrence highlighted amongst other nearby occurrences in the viewer.

Concern

If searched text/pattern occurs multiple times near each other in a file, it's hard to tell which occurrence the viewer is currently showing / "focused on". Example:

image It's hard to tell that viewer is showing last occurrence on line 106.

RedeemerSK commented 4 months ago

I would be willing to implement this enhancement if it would be accepted.

I currently have prototype working: image

It's inspired by

therefore it uses SourceViewer for result viewer and shows line numbers vertical ruller + highlights current line (both if enabled by preferences) and for now it does not support any semantic highlighting for content. For comparison, current implementation of quick search dialog is using simple StyledText widget for viewer.

humphreygao commented 4 months ago

any possibility to have syntax color?

RedeemerSK commented 4 months ago

any possibility to have syntax color?

I definitely plan to look into that and I'm quite sure it's doable.

But I can imagine it's much harder to implement since even without investigating I'm quite sure it would require plugins/features (eg. Java development tools or Wild Web Developer) to be able to plug in custom viewer implementations doing their specific syntax coloring / semantic highlighting for specific content type (eg. java, xml, json ...).

So I think it makes sense to have 1st implementation delivered without syntax coloring asap and then build on that in later releases.

EDIT: but yeah, having syntax coloring is my end goal.

merks commented 4 months ago

I recall @iloveeclipse doing some fairly recent cool stuff to make syntax highlighting work in the compare editor. Maybe he has some pointers/suggestions.

iloveeclipse commented 4 months ago

It just happened to me to play with textmate & generic editor, but I'm not much of the help here. See https://github.com/eclipse-platform/eclipse.platform.ui/pull/1786 and linked tickets / related code for further pointers.

Just an idea that if one would use generic editor contribution here (similar the one used in compare editor) and combine it with the content type / file name known, it should be possible to have full syntax support for many file types.