emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

Weird Sideline Hover Symbol Line Wrap #661

Open llcc opened 2 years ago

llcc commented 2 years ago

As the following image (red underline) shows, some sideline hover symbols' info has been wrapped to the new line. It seems that the weird behavior is not related with the length of the info, since in some cases even some short info got wrapped.

Screen Shot 2021-10-14 at 7 45 32 AM
bodnarlajos commented 2 years ago

Hi, I tried to set the height to 0.7 but there is no affect ... I did it because the font-size seems higher then the normal font. image

wolfwood commented 2 years ago

I'm also having this issue, using the standalone config from rksm/emacs-rust-config which configures lsp-ui with the sideline

2022-01-20-135115_1278x706_scrot

bmathieu33 commented 2 years ago

Isn't this issue like #184?

sam-masaki commented 2 years ago

I had this problem and it was caused by the sideline text using markdown-code-face which inherits from fixed-pitch, which uses the generic Monospace placeholder font family. Looking closer at the two screenshots, it looks like most of the sideline text besides the variable names in boxes are a different font from everything else, so this is probably what's causing it for you here too. If you just set the font family for fixed-pitch to the same as your default font, this issue should go away.

As for how to fix this in general, I'm not sure. lsp-ui-sideline--format-info fontifies the sideline text with lsp--render-element, and that is supposed to render the string with the correct major-mode or as markdown otherwise. Looking at the text that get sent there, its kind is set as markdown and the actual content of the text is a markdown codeblock annotated with the correct language.

I've seen this happen in both rust in python (the only languages I use lsp-mode with) so I don't know if the strings are formatted differently in other language modes.