Skip to content

fix(intellij): don't surface blank inline completion suggestions so End works - #13462

Open
xh123637 wants to merge 1 commit into
continuedev:mainfrom
xh123637:fix/12302-end-key-hijack
Open

xh123637 wants to merge 1 commit into
continuedev:mainfrom
xh123637:fix/12302-end-key-hijack

Conversation

@xh123637

@xh123637 xh123637 commented Nov 5, 2026

Copy link
Copy Markdown

Fixes #12302

What was wrong

In the IntelliJ plugin, pressing End did nothing when Continue's autocomplete had returned a blank suggestion. Repro from the issue:

  1. Open any .toml file
  2. Type a heading [some_heading<caret>]
  3. Press End

Expected: the caret moves to the end of the line. Actual: nothing happens — Continue swallows the keypress even though no suggestion is visible.

Root cause

Two places could produce a blank suggestion, and the platform treats any returned suggestion — even one with an empty gray-text element — as an active suggestion, so its inline-completion handler intercepts End (accept-to-end-of-line) instead of letting the editor handle it:

  • ContinueCompletionService.getAutocomplete returned "" (not null) when the core response carried no content, and the provider only checked for null, so it built InlineCompletionSingleSuggestion with an empty InlineCompletionGrayTextElement.
  • In the NextEdit path, checkFim can yield an empty fimText when the suggested edit is identical to the existing text, and the provider rendered that as a gray-text suggestion too.

No End-key handling exists in the plugin's own code (verified by searching the whole extensions/intellij tree) — the interception comes from the platform once a suggestion object exists, so the fix is to never surface a blank suggestion.

Changes

  • ContinueInlineCompletionProvider.kt: return InlineCompletionSuggestion.Empty when the traditional autocomplete variant is null or blank, and when the NextEdit FIM text is blank.
  • ContinueCompletionService.kt: return null instead of "" when the core response has no completion content, so "no completion" is signalled the way the CompletionService contract intends.
  • ContinueInlineCompletionProviderTest.kt: two new tests using the issue's exact repro ([some_heading<caret>] + EditorLineEnd): a blank suggestion and a whitespace-only suggestion must both let End move the caret to the end of the line.

Verification

Honest note: I could not run the plugin test suite here — this environment has no JDK at all (and apt-get could not install one), and the IntelliJ tests need the Gradle + IDE sandbox, so the new tests have not been executed and fail-before has not been observed in this environment. The tests follow the existing testInlineCompletion patterns in the same file and exercise the exact repro from the issue; please let CI run them. The fix itself was verified by code inspection: the only two paths that build a gray-text suggestion are now guarded, and getAutocomplete has no other caller besides the provider.

@xh123637
xh123637 requested a review from a team as a code owner November 5, 2026 19:55
@xh123637
xh123637 requested review from sestinj and removed request for a team November 5, 2026 19:55
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@xh123637

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

This branch has not been deployed

No deployments
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.

IntelliJ plugin hijacks End key

1 participant