Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: Support SymbolInformation[] response type #41

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

lambdahands
Copy link

Some language servers (like cssls) don't respond to "textDocument/documentSymbol" with the type DocumentSymbol[], but instead SymbolInformation[].

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 a detail field, as well the range living in location.range instead of range. 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!

@lambdahands lambdahands marked this pull request as draft February 1, 2022 23:49
@GustavoKatel
Copy link
Member

hi @lambdahands

I committed your sanitized code here: a562af1

it is now on the dev branch. thanks a lot!

regarding the LSP issue I think it all looks fine. So to merge this PR:

1- can you rebase from dev and use the sanitize code I pushed there?
2- make the PR as "ready for review" when done so I can giver another look :)

thanks!

@GustavoKatel GustavoKatel changed the base branch from main to dev February 13, 2022 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants