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
A document that no editor shows stays connected after the request that connected it #2341
Postponed: nothing is wrong with these documents, and no one has reported their cost. Found while fixing #2335 (#2340).
What happens
A request for a file that no editor shows connects the file for good: LanguageServiceAccessor.getLanguageServers(file, …) sends textDocument/didOpen, and only these disconnect it:
The exception is formatting. It connects through getLanguageServersForScope with a DocumentConnectionScope (#1707), which sends didClose once the scope ends, unless an editor has the file.
One way in is the inline values of a stopped debug session (LSPDebugVariablePositionProvider.getVariableLookups). It connects a file whose editor was closed while the session was stopped, at each stop and at each workspace/inlineValue/refresh.
Effects
The text stays right, since LSP4IJ keeps sending the changes of the document. But while the file exists:
the language server keeps the file open, and may analyze it as an open file;
LSP4IJ keeps pulling its diagnostics;
a language server whose only documents are such files never stops when idle, since keepAlive() counts every connected document.
Options
Connect per request through a DocumentConnectionScope, as formatting does, feature by feature. For the inline values, that's a change in getVariableLookups.
A general policy: a document connected without an editor is closed after its request, or after a delay.
Either sends didOpen and didClose for each request for such a file, and a language server may analyze the file again at each didOpen. VS Code asks for inline values only for a document that an editor shows.
Activity