-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
"Find References" triggers textDocument/didOpen
but no textDocument/didClose
, even after opening and closing the file
#205790
Comments
The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines. Happy Coding! |
Please use |
Hi @jrieken , can you provide a little more context to how this would be done? This |
I am no LSP expert, but likely "yes" |
There is no such event. I believe you don't want create diagnostics to begin with - only for tabs |
Thank you for your help... I will try that then. FWIW, the Microsoft LSP sample sends diagnostics on It sounds like this implementation is incorrect then, at the very least misleading. |
yes, looks like it didn't get updated when we added the tabsGroups-api. fyi @dbaeumer |
Hi @jrieken , I finished my investigation and this tab group events do not seem to be the correct way: window.tabGroups.onDidChangeTabs(e => {
const toLabels = (tabs: readonly Tab[]) => tabs.map(tab => tab.label);
console.log(`onDidChangeTabs. Changed: ${toLabels(e.changed)} Opened: ${toLabels(e.opened)} Closed: ${toLabels(e.closed)}`);
});
And another thing. You mentioned:
Can you tell me when the editor would decide to close a document that's been opened from the references pane (without the tab being opened, as shown in the original post's video above)? Maybe I'm missing something, but I can't really understand why the editor would consider the document open if there is no tab and the reference has been cleared from the Reference Pane. It seems the editor considers the document opened indefinitely, as opening a corresponding tab and closing the tab + clearing the references does not trigger Again, thank you for your assistance and quick response times. I greatly appreciate it! |
Use
No, just accept that editor decides but note that document != editor != tab |
Thanks for the insight with
I think this covers all my use-cases. Thanks for all your assistance today 🙇 |
@KevinEady just see the issue now. Was out on vacation. Actually LSP has full support for diagnostics only for files that are open in tabs. Instead of letting the server push the diagnostics you can let the LSP client pull for diagnostics. The client will then do all the tab handling, editor focus switching, ... for you. For the documentation see: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics One of the reasons to introduce the pull model was to avoid syncing the tab model to the server since it is nothing the server should be concern about. |
Thanks for the insight @dbaeumer ! I was able to successfully change my implementation, removing this "send open tabs" workaround and relying solely on the |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
textDocument/didOpen
.Sample repository with a minimal reproduction and additional steps: https://github.com/KevinEady/vscode-bug-no-didClose
The extension clears published diagnostics in the
textDocument/didClose
handler (as seen whenfile1.txt
closes), see here. Since the diagnostics for the files in the References pane never clears, I can only assume there is notextDocument/didClose
event triggered for these files. Enabling the LSP debug logs via"escript.trace.server": "verbose"
confirms this assumption.It seems impossible to remove these diagnostics, as the
textDocument/didClose
never triggers, even after opening the file.The text was updated successfully, but these errors were encountered: