swiftlang / sourcekit-lsp

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

Allow configuring of SourceKit-LSP’s options using configuration files #1524

Closed ahoppen closed 5 days ago

ahoppen commented 1 week ago

The idea here is to unify the different ways in which we can currently set options on SourceKit-LSP in a scalable way: Environment variables, command line arguments to sourcekit-lsp and initialization options.

The idea is that a user can define a ~/.sourcekit-lsp/.sourcekit-lsp file (we store logs in ~/.sourcekit-lsp/logs on non-Darwin platforms), which will be used as the default configuration for all SourceKit-LSP instances. They can also place a .sourcekit-lsp file in the root of a workspace to configure SourceKit-LSP for that project specifically, eg. setting arguments that need to be passed to swift build for that project and which thus also need to be set on SourceKit-LSP.

For compatibility reasons, I’m mapping the existing command line options into the new options structure for now. I hope to delete the command line arguments in the future and solely rely on .sourcekit-lsp configuration files.

Environment variable will be migrated to .sourcekit-lsp in a follow-up commit.

ahoppen commented 1 week ago

@swift-ci Please test

ahoppen commented 6 days ago

@swift-ci Please test

ahoppen commented 6 days ago

@swift-ci Please test Windows

ahoppen commented 6 days ago

@swift-ci Please test

ahoppen commented 6 days ago

@swift-ci Please test Windows

ahoppen commented 6 days ago

@swift-ci Please test

ahoppen commented 6 days ago

@swift-ci Please test Windows

ahoppen commented 6 days ago

@swift-ci Please test Windows

ahoppen commented 6 days ago

@swift-ci Please test Windows