swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
734 stars 50 forks source link

Add setting to enable experimental background indexing in SourceKit-LSP #987

Closed ahoppen closed 2 weeks ago

ahoppen commented 1 month ago

Could you add a setting that allows background indexing to be enabled? Something like


Experimental: Background Indexing

Enable SourceKit-LSP’s experimental background indexing for SwiftPM projects, providing cross-file functionality without needing to build. This requires SourceKit-LSP bundled with Swift 6.


When enabled, send the following in the initializationOptions of the initialize request.

{
  "backgroundIndexing": true,
  "backgroundPreparationMode": "enabled"
}
plemarquand commented 1 month ago

@ahoppen is this functionally equivalent to passing --experimental-feature background-indexing as arguments to the LSP?

ahoppen commented 1 month ago

Passing --experimental-feature background-indexing as the command line argument to sourcekit-lsp has the same behavior as "backgroundIndexing": true. We prefer to use the initialization options now because it allows us to remove options. Removing a command line option would cause SourceKit-jLPS to fail to launch.

plemarquand commented 1 month ago

Fixed in #992

award999 commented 2 weeks ago

Verified with d6c91dd379abd6a402dddb3503e35fd328c6ce21