-
Notifications
You must be signed in to change notification settings - Fork 314
Dummy PR to review BSP migration changes #1679
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
Conversation
…n `BuildSystem` to a type that implements BSP
…anges to the build system
…orkspace creation This allows us to create the build system from a `BuiltInBuildSystemAdapter` when it receives an `InitializeRequest`, which will be done in a follow-up commit.
This way we create the `BuiltInBuildSystem` at the same time that we create the `BuildSystemManager`, which gets us one step closer to creating the `BuiltInBuildSystem` from the `BuiltInBuildSystemAdapter`.
This moves the creation another step closer to creating the `BuiltInBuildSystem` inside `BuiltInBuildSystemAdapter`.
This finalizes the move of `BuiltInBuildSystem` creation into `BuiltInBuildSystemAdapter` and means that we can set the message handler of the `BuiltInBuildSystem` during initialization instead of using a setter method.
Start migration of the communication between SourceKit-LSP and build systems to happen via the Build Server Protocol (BSP)
Create `BuiltInBuildSystem` in `BuildSystemAdapter`
…dSystemAdapterDelegate` This was causing memory leaks.
Fix retain cycle between `BuiltInBuildSystemAdapter` and `BuiltInBuildSystemAdapterDelegate`
…s to LSP requests" This reverts commit b2c17c7. The workaround isn’t needed anymore because we have a proper fix in the VS Code extension: swiftlang/vscode-swift#1026
`Workspace` is responsible for creating the `BuildSystemManager` and responds to most of the delegate calls. It should thus also be the delegate of `BuildSystemManager`.
Use BSP requests to get build settings of a source file
Make `Workspace` the delegate of a `BuildSystemManager`
Allow overriding the timeout duration for tests
…f it belongs to any targets
This was only really used for the legacy BSP integration, which we are phasing out in favor of the new `SourceKitOptions` request.
Migrate `fileHandlingCapability` and `prepare` to BSP and remove `registerForChangeNotifications`
Revert "Add an extra percent encoding layer when encoding DocumentURIs to LSP requests"
Migrate getting the list of all source files to BSP
…the build system The implementation of which file’s dependencies have been updated is common across all build systems and thus build systems shouldn’t need to implement this logic. This also allows us to remove `BuildSystemDelegate`.
…ns between the build system and `BuildSystemManager`
`buildTarget/inverseSources` is not required to be implemented by BSP servers and we have almost all information needed for it in `BuildSystemManager`. This also makes sure that `buildTarget/sources` and `buildTarget/inverseSources` actually match each other. Before this change, we had source files like `Package.swift` for which we returned a target from `buildTarget/inverseSources` but that weren’t part of that target’s sources retrieved using `buildTarget/sources`.
This was equivalent to `buildTargetsDidChange`
…mManager` and `FileBuildSettings.patching`
Clean-up of the build system integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor nits
let workspace = try await self.createWorkspace( | ||
workspaceFolder: workspaceFolder.uri, | ||
buildSystemKind: determineBuildSystem(forWorkspaceFolder: workspaceFolder.uri, options: self.options) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern is repeated a few times, would it be worth factoring out a createWorkspace
overload that looks like the old one where it just takes the workspace path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Created a function for it.
Addressing the review comments here: #1817 |
I merged a bunch of changes to the interaction of SourceKit-LSP with the build systems over the last week without code review and would like to use this PR to consolidate feedback
This PR shows all changes made to main between 765c2c0 and 6e99e34.
The way I would suggest to review these changes would be to review the
BuildServerProtocol
andBuildSystemIntegration
modules in their current state onmain
because they have changed too much for it to make sense to look at diffs. Afterwards, use this PR to review all changes to files that are not in theBuildServerProtocol
orBuildSystemIntegration
module, which should be mostly (but not exclusively) mechanical. I would suggest reading the files in the following logical ordering.BuildServerProtocol
BuildServerProtocol
folderContributor Documentation/BSP Extensions.md
BuildTargetIdentifierExtensions.swift
FileBuildSettings.swift
Language+InferredFromFileExtension.swift
MainFilesProvider.swift
(didn’t change, so no real review necessary)PathPrefixMapping.swift
(didn’t change, so no real review necessary)BuildSystemTestHooks.swift
FallbackBuildSettings.swift
BuildSystemManagerDelegate.swift
BuildSystemMessageDependencyTracker.swift
BuildSettingsLogger.swift
(didn’t change, so no real review necessary)BuildSystemManager.swift
BuiltInBuildSystemAdapter.swift
BuiltInBuildSystem.swift
QueueBasedMessageHandler.swift
CompilationDatabase.swift
SplitShellCommand.swift
(didn’t change, so no real review necessary)CompilationDatabaseBuildSystem.swift
BuildServerBuildSystem.swift
PrefixMessageWithTaskEmoji.swift
SwiftPMBuildSystem.swift
TestBuildSystem.swift
BuildServerProtocol
orBuildSystemIntegration
modules