REditorSupport / languageserver

An implementation of the Language Server Protocol for R
Other
564 stars 91 forks source link

Over does not display help correctly #670

Open PMassicotte opened 1 week ago

PMassicotte commented 1 week ago

I am using lspsaga to enhance LSP in neovim (https://github.com/nvimdev/lspsaga.nvim).

One interesting feature is the over (https://nvimdev.github.io/lspsaga/hover/) function (shift+k) that provides function help. When I use this function in other language, the display looks like this:

In Rust:

image

In Python:

image

However, while this kinda works with R, the information is displayed as Markdown/HTML:

image

Anyone know if this could be easily fixed?

rumichaska commented 6 days ago

Hi @PMassicotte, you can solve this setting r.lsp.rich_documentation to false in your lspsaga config. I use mason so I don't know how to configure this setting in lspsaga.

PMassicotte commented 6 days ago

cool let me try!

PMassicotte commented 6 days ago

I was able to get it working (I think) by adding languageserver.rich_documentation = FALSE, in my .Rprofile.

image

cc @jalvesaq for future reference (adding information in R.nvim).

jalvesaq commented 6 days ago

While setting r.lsp.rich_documentation to false avoids formatting problems, it downgrades the user experience by removing the syntax highlighting. It could be better if https://github.com/REditorSupport/languageserver/blob/master/inst/lua/html-to-markdown.lua could be improved to remove the remaining <div> tags and format the Arguments in a different way (not in table format).

PMassicotte commented 6 days ago

I think this is a good suggestion. Would that require a lot of work? Happy to help if needed.