Sometimes I know the name of the function I'm looking for but it isn't used anywhere in the current buffer. With the various tags utilities I was always able to just search for a definition by name, but lsp-find-definition seems to only operate on whatever symbol the cursor is currently on. Is there a way to get a prompt where I can type in a name to search for? Manually adding a use to the current buffer just so I can find the definition and then deleting it afterwards is very clunky. Would be especially nice to have something that would play well with read-completing-function so helm/ivy would work.
1 Answer
Nope. As best I can tell, the LSP protocol doesn't appear to have any facility for looking up definitions based on name rather than document position. In fact, an LSP client like Emacs doesn't even parse the document to get the identifier at the point. Instead it just sends the current cursor position (file name, line, and column number).
This is documented in the protocol specification.
-
Thanks for digging into this, filed: github.com/microsoft/language-server-protocol/issues/1033 Commented Jun 24, 2020 at 19:58