Having a protocol
protocol MyTest {
var isCorrect: Bool { get }
}
And a class that implements the protocol
class Super: MyTest {
var isCorrect: Bool = false
}
How can you find the declaration of the isCorrect property when in PSI mode?
I do have a reference to SwiftVariableDeclaration when I'm analyzing the Super class, but I would like to get a reference to the actual declaration of the isCorrect inside the MyTest protocol.
I've tried SwiftVariableDeclaration.swiftSymbol but I'm not sure how to get a reference to the declaration.
Appreciate any hints into how to resolve it.
You already have the declaration of the property. What you're looking for is the declaration of its ancestors.
(Note that a variable declaration can contain multiple variables, so you'll need to pick one.)