How to tell when the user has switched tabs/documents?

I have a feeling I’ve missed something, but is there an API that will let me see when the user changes tab or document?

I want to reload/refresh my sidebar when the current document changes.

Currently my sidebar will refresh after the next typing, but that means there’s a period where the contents refer to the previous document and are therefore stale.

This is for:

No, there isn’t. I use TextEditor.onDidChangeSelection(). It fires as soon as the user clicks inside a document.

1 Like

I think that’ll do! Thank you.

Worked a treat. Thank you