racket-langserver
racket-langserver copied to clipboard
fix textDocument/documentSymbol
I made symbol lookup/document outline working.
Previously it would list all words in the document and the server would crash for big documents,
Now it only looks for function definitions (define) and type definitions (define-type)
(also resolves #12 )
I don't think this is a good change, because it is brittle in the face of macros that perform binding. The existing approach is to give all symbols and allow the lsp to basically be like emacs' M-/ where it just helps you complete symbols that already there. A more robust change would be to do what DrRacket does and look at the expansion for binding positions.
Do we have any way to find out which expressions are binding, without resorting to some sort of string pattern match?
DrRacket has a library implement for this, as part of Check Syntax, that fully-expands the program and then inspects the source code for binding information in the syntax objects.