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
{{ message }}
Repository navigation
onDidOpenTextDocument+onDidCloseTextDocument both fire together when holding Cmd while hovering #109908
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:
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?
Activity
DanTup commentedon Nov 3, 2020
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?
dbaeumer commentedon Nov 3, 2020
A proper fix for this would require addressing #15178. Otherwise even batching is only a band aid
jrieken commentedon Nov 4, 2020
What Dirk Bäumer (@dbaeumer) says