Hi there, is there a way using any CLI to extract all type symbols of a particular module?
Xcode has a symbol navigator but it is worthless to me because it does not display the outer type for nested types. For instance the following two nested types will be displayed as Data
in the symbols navigator.
struct Foo { struct Data {} }
struct Bar { struct Data {} }
I seek just for a list of types just like this:
Foo
Foo.Data
Bar
Bar.Data
I don't know how best to hook into your workflow, but the swift-api-dump script might give you an idea where to start. It uses Swift's AST printer (which is configurable depending on the task) to dump out the interface for a module. This is similar to Xcode's generated interface.
SourceKit also has access to this information, and you might be able to glean useful info from the interface-generation tests, which also seem to have some sort of filtering.
Finally, if you've built swift locally, the repl there supports :print_module Foo
and :print_decl Bar
.
Perhaps some choice from the above 3 and/or a filtering mechanism would help.
CC @Xi_Ge for advice on using SourceKit.
2 Likes