You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you hover over a symbol and hold Ctrl/Cmd, VS Code sends a definition request to include a preview in the tooltip. However it also onDidOpenTextDocument followed immediately by onDidCloseTextDocument for the document that contains the definition for apparently no reason.
This results in the language server being told a file has been opened (that has not) and may kick off expensive analysis work, only to immediately be told the file is closed. The open/close events occur immediately together, so it appears VS Code is getting no benefit or information from this at all, it's only potentially triggering unnecessary work on the server.
This simply provides a basic definition provider and los when open/close is called. When you run it, it'll open the sample_project folder that has two text files. Open one.txt and hover over the text then press/hold Cmd/Ctrl. Each time you press Cmd/Ctrl you'll see in the debug console the Open/Close events fired.
In some cases (I haven't fully debugged yet), VS code actually seems to trigger a bunch of requests and cancel them. The original log where I noticed the behaviour above shows a number of requests all being sent to the LSP server at exactly the same time (before any are responded to), many of which are cancelled:
The text was updated successfully, but these errors were encountered:
Apparently this has come up before in #84875 and was just fixed in the TS extension. If this isn't going to be fixed by VS Code, it seems like the LSP language client is going to need the same workaround?
When you hover over a symbol and hold Ctrl/Cmd, VS Code sends a
definition
request to include a preview in the tooltip. However it alsoonDidOpenTextDocument
followed immediately byonDidCloseTextDocument
for the document that contains the definition for apparently no reason.This results in the language server being told a file has been opened (that has not) and may kick off expensive analysis work, only to immediately be told the file is closed. The open/close events occur immediately together, so it appears VS Code is getting no benefit or information from this at all, it's only potentially triggering unnecessary work on the server.
Here's a repro:
https://github.com/DanTup/vscode-repro-ctrl-hover
This simply provides a basic definition provider and los when open/close is called. When you run it, it'll open the
sample_project
folder that has two text files. Openone.txt
and hover over the text then press/hold Cmd/Ctrl. Each time you press Cmd/Ctrl you'll see in the debug console the Open/Close events fired.In some cases (I haven't fully debugged yet), VS code actually seems to trigger a bunch of requests and cancel them. The original log where I noticed the behaviour above shows a number of requests all being sent to the LSP server at exactly the same time (before any are responded to), many of which are cancelled:
The text was updated successfully, but these errors were encountered: