Solargraph: HTML encoding bug?

Created on 4 Aug 2019  路  6Comments  路  Source: castwide/solargraph

Hello Mr. Snyder,

thank you very much for your work with this project. I use it on a daily basis and it is so helpful and works great.

I am using Solargraph in combination with Neovim and the LSP client coc.nvim. There is one bug when using this tool combination, which can be cumbersome. When Solargraph returns code documentation to the client, it HTML encodes the documentation first. Coc.nvim doesn't account for HTML encoded documentation, which leads to wrong formatted/displayed documentation. I attached an example screenshot for you (left side shows how it currently looks, right side is the expected representation).

I tried to dig into the Language Server Protocol specification to find out whether the client or server is at fault. My interpretation of the specification is that the language server shouldn't do any special formatting (except for markdown), but I may be wrong here. I also tried some other language servers, where the documentation was displayed correctly, strengthening my above assumption.

Is it possible to remove the HTML encoding within Solargraph?

Kind Regards
Wolfgang

solargraph_html_encoding

All 6 comments

The encoding fixes an issue with the display in VS Code. If the server itself shouldn't do the encoding, I might be able to move that feature to the VS Code extension instead. I'll look into it.

Thank you very much, your work is highly appreciated!

It turns out that the HTML encoding is redundant even in VS Code. There's one VSC-specific feature that requires it, but everything in the standard LSP works without it.

The master branch removes encoding from completion items, hovers, etc. I'll publish the change in version 0.37.0.

This is a little hairier than I expected. There also doesn't seem to be a reliable standard. Depending on the implementation, Markdown renderers might treat <Foo> as plain text, an HTML tag, or a hyperlink. Some decode HTML entities, others do not.

The solution that seems closest to universal is backslash escaping, e.g., \<Foo\>.

Another semi-related change: the language server will no longer encode links to document pages (the solargraph:/document link in your screenshots) unless the client explicitly enables them.

This should be fixed in 0.37.1 (released today).

Apparently the people of the LSP project are also not quite sure how to handle this:
https://github.com/microsoft/language-server-protocol/issues/791

I downloaded the newest Solargraph version and I can verify that the issue is fixed.
Again, thank you very much for your work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bry-guy picture bry-guy  路  3Comments

castwide picture castwide  路  3Comments

patilarpith picture patilarpith  路  5Comments

Sam-Killgallon picture Sam-Killgallon  路  5Comments

tylerlu94 picture tylerlu94  路  5Comments