swift-index-store
swift-index-store copied to clipboard
Add support for adding missing imports
This works by collecting all definition USRs from all units, and cross referencing all reference USRs from each file, until there are no unhandled USRs remaining.
there are a few cases this adds imports for that might be surprising:
- In this case module c gets an import for module a
// module a
class A {
let property: String
}
// module b
class B: A {}
// module c
self.b.property
- typealiases + extensions are a bit weird, this case gets an import to A because the extension is technically on
A(AFAIUI):
// module a
struct A {}
// module b
typealias B = A
extension B {
func foo() {}
}
// module c
B().foo()
maybe some more, but most were pretty understandable and more surprising that they could be missing (mostly the usual suspects like extensions on system types, operators, uses of callAsFunction etc)