Find/Replace overlay: fix content assist not available in Java files#4201
Open
HeikoKlare wants to merge 1 commit into
Open
Find/Replace overlay: fix content assist not available in Java files#4201HeikoKlare wants to merge 1 commit into
HeikoKlare wants to merge 1 commit into
Conversation
Ctrl+Space in the overlay's search/replace fields never opened content assist in Java files because ContentAssistCommandAdapter activates its handler on the workbench-root IHandlerService without an expression, while the target editor keeps a part-scoped handler for the same command permanently active via ActivePartExpression. Since handler conflicts are resolved by evaluated source priority regardless of context nesting, the editor's higher-priority activation always wins, independent of where focus actually is. Fix this by registering an ordinary FindReplaceOverlayAction for the content-assist command, the same way EDIT_FIND_AND_REPLACE is already handled: activated through registerAction()'s overlayFocusedExpression, which alone already outranks the editor's ActivePartExpression-based activation regardless of which IHandlerService the activation lives on, so no separate, part-scoped override mechanism is needed for this. Fixes eclipse-platform#2651
Contributor
Author
|
@nettozahler fyi since you asked about that fix here: #4164 (comment) |
|
This is great so the regex help (which I use quite often) will be usable again in Java files. Many thanks. |
Contributor
HeikoKlare
marked this pull request as ready for review
July 24, 2026 07:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #2651. Pressing Ctrl+Space in the overlay's search/replace fields while regex mode is active shows the "content assist available" hint, but never actually opens content assist — most noticeably in
.javafiles.The cause:
ContentAssistCommandAdapter(used by the overlay's regex content-assist fields) activates its handler on the workbench-rootIHandlerServicewithout an expression. The target editor (e.g. the Java editor) keeps its own handler for the same command permanently active via a part-scopedActivePartExpression. Since Eclipse resolves conflicting handler activations for the same command purely by evaluated source priority — independent of context nesting — the editor's higher-priority activation always wins, regardless of where focus actually is.What changed
Register an ordinary
FindReplaceOverlayActionfor the content-assist command, the same wayEDIT_FIND_AND_REPLACE(Ctrl+F) is already handled: throughregisterAction()'soverlayFocusedExpression(anACTIVE_FOCUS_CONTROL-based expression). That expression alone already outranks the editor'sActivePartExpression-based activation, regardless of whichIHandlerServicethe activation is registered on, so no separate, part-scoped override mechanism is needed for this.Screenshot
🤖 Generated with Claude Code