Skip to content

Workspace.documentServices is never cleared up #2209

@ahoppen

Description

@ahoppen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions