Skip to content

Some sourcekitd documents opened in SwiftLanguageServer are never closed #553

Closed
@ianhanken

Description

@ianhanken

In SwiftLanguageServer, there are a few cases where sourcekitd files are opened using source.request.editor.open, but these file names are prepended by an extra string to indicate that they are not directly related to a file URI. Below is a snippet as well as the lines where this occurs:

let skreq = SKDRequestDictionary(sourcekitd: self.sourcekitd)
skreq[keys.request] = self.requests.editor_open
skreq[keys.name] = "FoldingRanges:" + snapshot.document.uri.pseudoPath
skreq[keys.sourcetext] = snapshot.text
skreq[keys.syntactic_only] = 1

https://github.com/apple/sourcekit-lsp/blob/main/Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift#L664
https://github.com/apple/sourcekit-lsp/blob/main/Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift#L761
https://github.com/apple/sourcekit-lsp/blob/main/Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift#L967

These documents don't seem to have a source.request.editor.close, so they are likely never closed and remain open for the duration of the SourceKit-LSP session.

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