Repository navigation
fix(jetbrains): keep chat input focus while the agent works - #12
Merged
Merged
Conversation
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.
Problem
While the user types in the chat box, the chat input loses focus on every agent turn. The user cannot type until they click the box again.
Cause
The plugin took focus when it created a terminal, opened an editor or a diff, and mounted a webview. The plugin also ignored
preserveFocusfor editors, diffs and terminals.Fix
FocusRequestEpoch. A late focus request cannot override a newer one.ManualFocusGuard. If the user moves focus, a queued deliberate show is cancelled. The guard never restores focus.TerminalCreationFocusGuard. It restores chat focus once after a terminal is created.preserveFocusfrom the wire arguments for editors, diffs and terminals. A diff sends[column, options]. A plain options map also works.RPC method names are unchanged.
Scope
This PR covers the plugin-side focus fixes for terminal creation, deliberate shows, editors and diffs.
Not covered: an intermittent loss of one draft character when the first editor opens. Two live runs showed it. One later full run kept all 35 sampled characters. The cause is not known. It is recorded in
docs/KNOWN_ISSUES.md.Not tested: other operating systems, and live click races.
Tests
pr.ymltest list.docs/validation/chat-focus-preservation.md.Manual harness
jetbrains_plugin/scripts/ui-harness/holds a dev-only harness. It runs the IDE under Xvfb and types into the real chat box.Size
This PR is large. The repository sets no line limit. If you prefer, it can split into focus intent, focus restoration, webview mount and retire, and docs with harness.