Open adam-fowler opened 2 years ago
rdar://102473561
This issue is not specific to SourceKit-LSP. The cursor info request that underlies hover does not provide results if the result builder body has an error. The solution here is to convert cursor info to the solver-based implementation as well but that might take a while.
The following reduced test case fails.
@resultBuilder
struct MyBuilder {
static func buildBlock<Content>(_ components: Content...) -> Content {
fatalError()
}
public static func buildExpression<Content>(_ content: Content) -> Content { return content }
}
struct ContentView {
/// Some documentation
var someInt: Int = 2
@MyBuilder
var body: Int {
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):5 %s -- %s | %FileCheck %s
someInt
someInvalidRef
}
}
// CHECK: source.lang.swift.ref.var.instance (11:7-11:14)
Reported in swift-vscode repo https://github.com/swift-server/vscode-swift/issues/446
In the code below hover fails for
Text
,image
andHStack
inside theView
resultBuilder while it works for everything outside of the resultBuilder.