smithy-lang / smithy-language-server

A Language Server Protocol implementation for the Smithy IDL
https://smithy.io
Apache License 2.0
33 stars 19 forks source link

[feature-request] become a `documentSymbolProvider` #87

Closed ckipp01 closed 1 year ago

ckipp01 commented 1 year ago

I'm really loving having a language server for Smithy so far. Thanks for making the effort and having one! One missing feature that I've found myself reaching for is textDocument/documentSymbol. You can read more about it here, but especially when I'm working with large smithy files it'd be great to use this to get a nice overview of everything in the file or quickly search for something intelligently in the current document.

kubukoz commented 1 year ago

I'm a huge fan of this idea - e.g. in vscode, this powers at least 3 features:

so it would be a pretty big win.

kubukoz commented 1 year ago

FYI I've started some work on this :)

mtdowling commented 1 year ago

Btw, I’m also working on a fault tolerant parse tree that I think will be the basis of rewriting lots of this repo. Basically it would be a parse tree that can be used with the LSP to implement features like this and remove some of the adhoc parsing, and would be used in an IntelliJ plugin to convert it to a PSI. Eventually we’d add support for directly loading the parse tree into the ModelAssembler to make updating files more efficient and only parsed once. I’m hoping to expose a similar kind of tree for Smithy JSON AST files too.

kubukoz commented 1 year ago

That sounds very useful! However, I'm still going to submit this PR as it's almost ready and it's standing on existing shoulders of existing giants (the location map in SmithyProject is of HUGE help!) :)

mtdowling commented 1 year ago

Awesome, thanks! I didn’t realize it was already done. Should be easy enough to refactor stuff in the future as needed when the parser stuff is done 😊