mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Query build system of workspaces to determine best workspace to open a file in
This sets the stage for multi-workspace support. Everything should be handled internally, we are just missing the API to actually open multiple workspaces at this point.
This commit is contained in:
@@ -221,6 +221,26 @@ extension BuildServerBuildSystem: BuildSystem {
|
||||
}
|
||||
|
||||
public func filesDidChange(_ events: [FileEvent]) {}
|
||||
|
||||
public func fileHandlingCapability(for uri: DocumentURI) -> FileHandlingCapability {
|
||||
guard let fileUrl = uri.fileURL else {
|
||||
return .unhandled
|
||||
}
|
||||
|
||||
// FIXME: We should not make any assumptions about which files the build server can handle.
|
||||
// Instead we should query the build server which files it can handle (#492).
|
||||
let path = AbsolutePath(fileUrl.path)
|
||||
if projectRoot.isAncestorOfOrEqual(to: path) {
|
||||
return .handled
|
||||
}
|
||||
|
||||
let realpath = resolveSymlinks(path)
|
||||
if realpath != path, projectRoot.isAncestorOfOrEqual(to: realpath) {
|
||||
return .handled
|
||||
}
|
||||
|
||||
return .unhandled
|
||||
}
|
||||
}
|
||||
|
||||
private func loadBuildServerConfig(path: AbsolutePath, fileSystem: FileSystem) throws -> BuildServerConfig {
|
||||
|
||||
Reference in New Issue
Block a user