fix: prevent window focus ping-pong between IDEs on Windows - #18
Open
tangcent wants to merge 2 commits into
Open
fix: prevent window focus ping-pong between IDEs on Windows#18tangcent wants to merge 2 commits into
tangcent wants to merge 2 commits into
Conversation
When two IDE windows mirror each other, the follower should not steal OS window focus. Introduces windowFocusedProvider/isWindowFocused checks so openFile/showTextDocument preserves focus when the receiving window is not active. Also fixes build.gradle.kts: disable self-update, set Java 17 target, skip buildSearchableOptions.
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.
Summary
When two IDE windows (e.g. JetBrains IDEA and VS Code) are actively mirroring each other on Windows, opening the mirrored active file in the unfocused window was stealing OS focus back. This caused an infinite "focus ping-pong" between the two IDE windows.
This PR adds window focus checking before activating the mirrored active file:
openFile(virtualFile, focus)to use the computedwindowFocusedvalue instead of always forcing focus. ExposewindowFocusedProviderfor testability. Add unit tests for both focused/unfocused scenarios.preserveFocusinshowTextDocumentto invert based onwindowFocused(preserveFocus = !windowFocused). Add unit tests.Also improves
jetbrains-plugin/build.gradle.ktsbuild configuration:initializeIntelliJPluginself-update check (fails frequently due to GitHub network issues on Windows)buildSearchableOptionstask (often OOMs on Windows, not needed for a small plugin)Follows project rules: cross-plugin feature parity applied to both JetBrains and VS Code, tests added in both plugins.