Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] No longer get window.onDidChangeActiveTextEditor events when there is no window.activeEditor #24507

Closed
eamodio opened this issue Apr 11, 2017 · 4 comments
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded

Comments

@eamodio
Copy link
Contributor

eamodio commented Apr 11, 2017

  • VSCode Version: Code 1.11.1 (d9484d1, 2017-04-06T14:00:34.044Z)
  • OS Version: Darwin x64 16.5.0

I'm not exactly sure when this changed, but I used to get the window.onDidChangeActiveTextEditor event when there is no active editor -- i.e. closing all documents/tabs, switching to say an extension page (where there is no text editor). The event would just have an undefined editor parameter, but now I no longer seems to fire at all.

Steps to Reproduce:

  1. Open an extension that listens for window.onDidChangeActiveTextEditor
  2. Observe that no event will be raised when you close the last editor, nor when you switch to an extension page

This is causing issues in GitLens (gitkraken/vscode-gitlens#65 is one) since I am not getting the event anymore to properly update my tracking. This has also broken https://github.com/eamodio/vscode-restore-editors for the same reason.

/cc @jrieken

@eamodio eamodio changed the title No longer get window.onDidChangeActiveTextEditor events when there is no window.activeEditor [Regression] No longer get window.onDidChangeActiveTextEditor events when there is no window.activeEditor Apr 11, 2017
@jrieken jrieken self-assigned this Apr 11, 2017
@jrieken
Copy link
Member

jrieken commented Apr 11, 2017

Yes, I can reproduce. Will investigate...

@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority candidate Issue identified as probable candidate for fixing in the next release labels Apr 11, 2017
@jrieken jrieken added this to the March Recovery 2017 (2) milestone Apr 11, 2017
@jrieken
Copy link
Member

jrieken commented Apr 11, 2017

Problem is that this if-statement if (delta.newActiveEditor) { ... should be checking for undefined, not falsy if (delta.newActiveEditor !== undefined) { ...

jrieken added a commit that referenced this issue Apr 11, 2017
@jrieken jrieken closed this as completed Apr 11, 2017
@jrieken
Copy link
Member

jrieken commented Apr 11, 2017

to verify have an extension with code like below and make sure it prints <NONE> when the last editor closes

   vscode.window.onDidChangeActiveTextEditor(editor => {
        console.log(`onDidChangeActiveTextEditor=${editor ? editor.document.fileName : '<NONE>'}`)
    })

@jrieken jrieken added the api label Apr 11, 2017
jrieken added a commit that referenced this issue Apr 11, 2017
@alexdima
Copy link
Member

Verified on

image

@alexdima alexdima added the verified Verification succeeded label Apr 12, 2017
@egamma egamma removed the candidate Issue identified as probable candidate for fixing in the next release label Apr 12, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants