Skip to content

Find/Replace overlay: fix content assist not available in Java files#4201

Open
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-content-assist-fix
Open

Find/Replace overlay: fix content assist not available in Java files#4201
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-content-assist-fix

Conversation

@HeikoKlare

@HeikoKlare HeikoKlare commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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 .java files.

The cause: ContentAssistCommandAdapter (used by the overlay's regex content-assist fields) activates its handler on the workbench-root IHandlerService without an expression. The target editor (e.g. the Java editor) keeps its own handler for the same command permanently active via a part-scoped ActivePartExpression. 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 FindReplaceOverlayAction for the content-assist command, the same way EDIT_FIND_AND_REPLACE (Ctrl+F) is already handled: through registerAction()'s overlayFocusedExpression (an ACTIVE_FOCUS_CONTROL-based expression). That expression alone already outranks the editor's ActivePartExpression-based activation, regardless of which IHandlerService the activation is registered on, so no separate, part-scoped override mechanism is needed for this.

Screenshot

image

🤖 Generated with Claude Code

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
@HeikoKlare

Copy link
Copy Markdown
Contributor Author

@nettozahler fyi since you asked about that fix here: #4164 (comment)

@nettozahler

Copy link
Copy Markdown

This is great so the regex help (which I use quite often) will be usable again in Java files. Many thanks.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   855 files  ±0     855 suites  ±0   59m 40s ⏱️ - 1m 10s
 8 120 tests ±0   7 877 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 262 runs  ±0  19 608 ✅ ±0  654 💤 ±0  0 ❌ ±0 

Results for commit b12ea31. ± Comparison against base commit ce4e10f.

@HeikoKlare
HeikoKlare marked this pull request as ready for review July 24, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find/Replace Overlay: "Content Assist Available" ctrl+space does not work in .java files

2 participants