LSP: Support SymbolInformation[] response type #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some language servers (like cssls) don't respond to
"textDocument/documentSymbol"
with the typeDocumentSymbol[]
, but insteadSymbolInformation[]
.This is a flat list of symbols in contrast to a hierarchy of symbols with
children
properties. There are other subtle differences, like the lack of adetail
field, as well the range living inlocation.range
instead ofrange
. See here in the LSP spec for details about the two types.This code was put together quickly, so I'm not sure how well it holds up. I found vim.lsp.utils.symbols_to_items(), but it seems to lose
name
information that's used to build the resulting lines.Speaking of lines, I ran into a strange issue in which newlines were appearing in the resulting strings, causing
nvim_buf_set_lines
to fail. Let me know if I'm on the right track here, and thank you for your work on such an awesome plugin!