lspsaga.nvim icon indicating copy to clipboard operation
lspsaga.nvim copied to clipboard

`Lspsaga hover_doc` displays weird `\`s

Open wizard-28 opened this issue 2 years ago • 6 comments

Description

Lspsaga's hover doc command doesn't escape some characters properly.

Expected Behavior

It escapes the characters properly.

Actual Behavior

As you can see lot of \ are present in the hover doc. This is a screenshot of :Lspsaga hover_doc

Neovim Built in Behavior

This is vim.lsp.buf.hover(), it escapes the characters properly.

Details

Reproduce
  1. Open a python file with Pyright LSP for example
  2. Compare the doc shown between Lspsaga hover_doc and vim.lsp.buf.hover()
Environment
  • nvim --version output: https://sourceb.in/KnkjM67EKH
  • Operating system: Pop!_OS 20.04
  • lspsaga commit: Latest (https://github.com/tami5/lspsaga.nvim/commit/9f7ee18f79baed76c648f79ee7352b8fe65f2933)

wizard-28 avatar Feb 27 '22 18:02 wizard-28

Yah, I noticed that with one other server I forgot about. I believe it should be an easy fix, hopefully soon, but by all mean a pr is welcomed

kkharji avatar Mar 03 '22 07:03 kkharji

Yah, I noticed that with one other server I forgot about. I believe it should be an easy fix, hopefully soon, but by all mean a pr is welcomed

Thank you, but I would prefer the Lspsaga team to fix it.

wizard-28 avatar Mar 03 '22 15:03 wizard-28

This seems can be fixed by changing the syntax type of the hover window from markdown into lsp_markdown and set conceallevel=2, as shown in the following screenshots.

Before: before_lsp_markdown After: after_lsp_markdown

Or maybe we could just reuse vim.lsp.util.stylize_markdown()? It has lots of similarities to the lspsaga's fancy_floating_markdown(). What's your idea? @tami5

againxx avatar Mar 06 '22 05:03 againxx

It has lots of similarities to the lspsaga's fancy_floating_markdown().

some stuff in lsp core is inspired by Lspsaga .

🤔 lsp_markdown makes sense to use as users may have bunch of autocmd tied with markdown filetype like I do. I'm with making and reusing our own thing, so that in the future we will have the flexibility of adding features.

@againxx with the above mentioned, feel free to choice whatever makes more sense to you

kkharji avatar Mar 06 '22 10:03 kkharji

reuse vim.lsp.util.stylize_markdown()

I'm right now looking into and I guess @glepnir copied it over and made few adjustments, I'm experimenting with new version right now

kkharji avatar Mar 10 '22 04:03 kkharji

@tami5 I have a similar problem, but a little bit different from @againxx. image

  • MacOS 12.3
  • Nvim 0.6.1
  • latest lspsaga

How should I fix this?

AGou-ops avatar Apr 14 '22 03:04 AGou-ops