-
Notifications
You must be signed in to change notification settings - Fork 319
Description
Reading through code, I noticed that Workspace.documentServices
only ever has elements added to it and we never remove elements from it, even when documents are closed.
What’s more is that setDocumentServices
is called from places other than openDocument
, so documentServices
might contain more documents than the ones that have been opened by the client.
I think the correct thing to do here is to make SourceKitLSPServer.languageService
just return an existing or newly started language service and only call setLanguageServices
from openDocument
. That way we don’t need to deal with race conditions for multiple calls to setLanguageServices
anymore (openDocument
is a blocker request for requests affecting that document URI) and we can remove documents from documentServices
when a document is closed.