Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] Add configuration files for SourceKit-LSP #1537

Merged
merged 8 commits into from
Jul 2, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 28, 2024

ahoppen added 7 commits June 28, 2024 22:20
This extension was added for VS Code but never used. Let’s remove it in favor of workspace-specific configuration files.

# Conflicts:
#	Sources/SourceKitLSP/SourceKitLSPServer.swift
…onfiguration files

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.

# Conflicts:
#	Sources/SourceKitLSP/SourceKitLSPServer+Options.swift
#	Sources/SourceKitLSP/Swift/SwiftLanguageService.swift
#	Sources/sourcekit-lsp/SourceKitLSP.swift
#	Tests/SourceKitLSPTests/BackgroundIndexingTests.swift
#	Tests/SourceKitLSPTests/ExecuteCommandTests.swift
We previously always assumed that the project was being built for the host.

Fixes swiftlang#786
Fixes swiftlang#1475
rdar://129662080
rdar://113099964
This allows us to flip the default in the future more easily. It also allows users to disable background indexing when it’s enabled by default.

rdar://130280855

# Conflicts:
#	Tests/SourceKitLSPTests/BackgroundIndexingTests.swift
This allows editors to provide UI elements to toggle SourceKit-LSP options.

# Conflicts:
#	Sources/SourceKitLSP/Swift/SwiftLanguageService.swift
The reverse-DNS notation is macOS style and doesn’t feel at home on Linux.
@ahoppen ahoppen requested a review from bnbarham June 28, 2024 21:01
@ahoppen
Copy link
Member Author

ahoppen commented Jun 28, 2024

@swift-ci Please test

@ahoppen ahoppen changed the title Add configuration files for SourceKit-LSP [6.0] Add configuration files for SourceKit-LSP Jun 29, 2024
This fixes a test failure when running tests using Xcode 15.4.
@ahoppen
Copy link
Member Author

ahoppen commented Jun 29, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jun 29, 2024

@swift-ci Please test Windows

@ahoppen
Copy link
Member Author

ahoppen commented Jul 2, 2024

@swift-ci Please test Linux

@ahoppen ahoppen merged commit 22ec953 into swiftlang:release/6.0 Jul 2, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants