Instead of having FileHandlingCapability for a source file, check if it belongs to any targets

This commit is contained in:
Alex Hoppen
2024-08-24 13:18:48 -07:00
parent bf8ff8b3d1
commit 236f566977
12 changed files with 34 additions and 116 deletions

View File

@@ -331,29 +331,6 @@ extension BuildServerBuildSystem: BuiltInBuildSystem {
package func didChangeWatchedFiles(notification: BuildServerProtocol.DidChangeWatchedFilesNotification) {}
package func fileHandlingCapability(for uri: DocumentURI) -> FileHandlingCapability {
guard
let fileUrl = uri.fileURL,
let path = try? AbsolutePath(validating: fileUrl.path)
else {
return .unhandled
}
// TODO: 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
// (https://github.com/swiftlang/sourcekit-lsp/issues/492).
if projectRoot.isAncestorOfOrEqual(to: path) {
return .handled
}
if let realpath = try? resolveSymlinks(path), realpath != path, projectRoot.isAncestorOfOrEqual(to: realpath) {
return .handled
}
return .unhandled
}
package func sourceFiles() async -> [SourceFileInfo] {
// BuildServerBuildSystem does not support syntactic test discovery or background indexing.
// (https://github.com/swiftlang/sourcekit-lsp/issues/1173).