-
Notifications
You must be signed in to change notification settings - Fork 206
Extension for quick search dialog text viewers. Fixes #2010 #2853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Extension for quick search dialog text viewers. Fixes #2010 #2853
Conversation
Also bump versions for 4.36
Also remove key listener from match results table causing duplicate triggering of selection listener.
@RedeemerSK I think it would be good to include some screenshots / Video in the PR description that shows the new feature. Also this is a rather huge contribution, do you think individual smaller parts can maybe merged independently? |
It's not a small change, specifically in the impact on Eclipse platform (new extension point), so I'm creating the PR now even if eg. test are completely missing (will add in parallel), just to kick off the discussion. |
Done
Atm I can't see any reasonable way to split it. |
Update on possibility of splitting: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt another extension point for that is likely to be well adopted. However what you're suggesting here is more or less a clone of the org.eclipse.compare.contentViewers
extension-point which basically covers the exact same story and is already well adopted.
So I strongly recommend consuming the existing extension point (and related APIs) to simplify your code, and ease adoption.
At the beginning I was evaluation the possibility to re-use exactly that extension point (and some others as well) but realized it would do more harm than good. This is my reasoning:
Are the above points enough valid reasons to reconsider the rejection of new extension point idea @mickaelistria ? |
The returned viewer has "get/setSelection", which by API contract of the viewer is expected to work the viewer. If this doesn't work, then I suggest reporting it as an issue to those contributors and fixing it there.
This is IMO not so related and can/should be fixed upstream too then (note that semantic hightlight can be an expensive operation that might not fit in a quick view anyway).
This comes from the "compare" bundle, but if you look at the description of that particular extension point and API, it seems to me like a perfect match for what you intend here. So yes, the extension might have been better located in another bundle, yet it still seems to match this case well.
I disagree about it in general. While it might be sometimes true, for user-facing extensions, such a new extension point with only 1 or 2 extension would give the impression that the feature only works partly. There would be disappointment for users because of the lack of completeness, and it's not likely that all language supports in the wild (CDT, PyDev, and all DSLs created in various RCP) do adopt this extension point. While there are some limitations as you mentioned above about particular extensions not behaving at best; in Platform we have to think about how to unleash as much value as possible to adopters for the least possible development/maintenance effort (ideally, none at all) on their side. New extension points are welcome when there is nothing existing, but here we would create more value to more adopters by just using what's already existing. |
@mickaelistria Would it be possible to start with my original #2644 so that at least that makes it into 4.36 release ? |
After looking at the
Extension point defines that contributions return instance of None of them forwards mentioned Not only that, but 3 of them do not allow easy & reliable way to
one of which is necessary to highlight matches in the content. I assume we don't want to sacrifice matches highlighting. So none of these common plugins can be used for quicksearch use-case without modifications, even if we would resort to some I would say it's reasonable to assume other extensions would also be implemented in a way preventing their use without modifications. @mickaelistria if you're convinced we could achieve re-use of Thanks |
What it does
Introduces new extension point
textViewers
of theorg.eclipse.text.quicksearch
plugin that makes it possible to plug-in different text viewers with different text styles/decorations to present quick search matches.New extension point API is defined by interfaces but to make it easier for implementors to create extensions that provide common & expected text viewer behavior & visuals, easy-to-extend abstract classes that implement the common aspects are also provided.
API interfaces are modeled so that extensions are able to
create new text viewers under parent widget provided by opened quicksearch dialog (supporting multiple dialogs)
focus on the specific match (selected amongst quicksearch results) within content of its containing file, meaning:
highlight all matches in the file *
Abstract classes implement common code that is responsible for:
SourceViewer
implementation to:(* already done by current version of quicksearch plugin)
This PR also contains implementation of new extension provided by
org.eclipse.ui.genericeditor
plugin that is capable of presenting quicksearch matches inside same type of files that GenericEditor supports. Also fallback implementation of new extension capable of presenting any text file.Quicksearch dialog also allows to manually change text viewer (extension) used to display matches inside specific file - selection is remembered until restart of workbench.
Design of the API + implementation of the abstract classes is the result of implementing new extension contributions in
org.eclipse.ui.genericeditor
plugin,org.eclipse.jdt.ui
plugin (will be separate PR) and DBeaver project chosen for unusual/unreasonable approach to re-usable source viewers classes (actually misusing full IEditor implementation for them).How to test
Open Quick Search dialog (default: CTRL + SHIFT + ALT + L) and confirm bottom area presenting parts of files where matches are located displays matches in a text (source) viewer that does text styling & decorations based on the file content + extension used. Focusing on match inside the file content should behave like it used to = displays match vertically centered, keeps it centered on resizing the dialog or area, content limited to same 'context' (lines before & after match within source file).
Known bugs
TBD
Author checklist