mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Don’t cause any file system file effects when trying to find an implicit workspace for a file
When looking for a workspace that can handle a file, we were creating full-fledged workspaces along the way, which we would then discard if they couldn’t handle the file being opened. This had multiple problems: 1. When background indexing is enabled, it caused semantic indexing of the workspace, which wrote files to a `.index-build` directory and was a waste of work 2. When background indexing is enabled, it caused package resolution, which also created a `.index-build` folder to be created 3. It caused a syntactic test index of the workspace, which was a waste of work. To fix this, do multiple things: 1. When creating a workspace, add a check right after build system creation. This allows us to early exit if the build system can’t handle the file and prevents us from generating the `Workspace`, fixing (1) and (3) 2. Don’t call `reloadPackage` when creating a `SwiftPMWorkspace`. Instead, explicitly call `generateBuildGraph` once we committed to creating the workspace.
This commit is contained in:
@@ -279,7 +279,7 @@ extension BuildServerBuildSystem: BuildSystem {
|
||||
return [ConfiguredTarget(targetID: "dummy", runDestinationID: "dummy")]
|
||||
}
|
||||
|
||||
public func generateBuildGraph() {}
|
||||
public func generateBuildGraph(allowFileSystemWrites: Bool) {}
|
||||
|
||||
public func topologicalSort(of targets: [ConfiguredTarget]) async -> [ConfiguredTarget]? {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user