swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 273 forks source link

Add a maximum duration for sourcekitd requests #1543

Closed ahoppen closed 3 months ago

ahoppen commented 3 months ago

VS Code does not cancel semantic tokens requests. If a source file gets into a state where an AST build takes very long, this can cause us to wait for the semantic tokens from sourcekitd for a few minutes, effectively blocking all other semantic functionality in that file.

To circumvent this problem (or any other problem where an editor might not be cancelling requests they are no longer interested in) add a maximum request duration for SourceKitD requests, defaulting to 2 minutes.

rdar://130948453

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test Windows