I was recently looking for a way to surface protocol conformance on the terminal the way Xcode makes available through the search menu, and had sourcekit-lsp suggested to me as a possible avenue to take. So I went about my experiment, finding some helpful articles folks have written along the way.
It seemed to me that the textDocument/typeHierarchy family of requests was the way to go, but after a decent amount of debugging, I was left wondering whether I was doing something wrong. I came up with a very rough macOS executable prototype and a barebones Swift Package as sample input to try to tease out the behavior I was looking for, but I kept coming up short.
I’ve been able to successfully execute textDocument/didOpen as well as textDocument/hover requests, but attempting to execute textDocument/prepareTypeHierarchy and/or typeHierarchy/supertypes / typeHierarchy/subtypes comes back with nil and empty array responses.
And so my question is: is this user error? Is there something I’m overlooking about how I’m making these requests?
For reference, I’m using macOS 14.7.1 and Xcode 15.2.
As an aside, was the --log-level option removed from recent versions of sourcekit-lsp?
Thanks so much for all this information @ahoppen !
On this topic, is there any place where custom requests like this are documented? This is absolutely not accusatory in the slightest, I'm just very curious to see what other features the language server is hiding!
Oh, interesting! Unfortunately I'm confined to the Xcode 15.2/Swift 5.9.2 toolchain for the time being, but I'll keep the background indexing feature in mind for future projects. Thanks for the insights, @ahoppen! I was able to see results from those type hierarchy requests like I was expecting after running a build on the command line.