Skip to content

Prevent handling onDidChangeActiveTextEditor twice - #162

Merged
Discookie merged 1 commit into
Ericsson:mainfrom
Magyarimiki:feature/fix-did-change-active-editor
Feb 20, 2026
Merged

Prevent handling onDidChangeActiveTextEditor twice#162
Discookie merged 1 commit into
Ericsson:mainfrom
Magyarimiki:feature/fix-did-change-active-editor

Conversation

@Magyarimiki

Copy link
Copy Markdown
Collaborator

The window.onDidChangeActiveTextEditor event is called twice in vscode by design:

  • old editor deactivated (event parameter: undefined)
  • new editor activated (event parameter: the editor object)

Simply reacting to this event calls the event handler function twice when switching editors.

This PR adds a wrapper to the event handler function to ignore the event for the deactivation and only handle it when the new editor is activated.

Signed-off-by: Magyarimiki <249292183+Magyarimiki@users.noreply.github.com>
@Discookie
Discookie self-requested a review February 5, 2026 09:34
@dkrupp
dkrupp requested a review from vodorok February 5, 2026 12:03
@Discookie
Discookie merged commit 134cf5e into Ericsson:main Feb 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet