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

doc-render issue in 29 #742

Closed seagle0128 closed 1 year ago

seagle0128 commented 1 year ago

lsp-ui-doc is not rendered correctly, as the screenshots below.

clangd

image

pyright

image
ianyepan commented 1 year ago

Same thing in Emacs 28.2. Happens with the clangd server. Those faces inherit markdown-code-face, by the way.

Edit: this happened only very recently. It was working well for the past few years.

jcs090218 commented 1 year ago

Was it working earlier? The recent relevant commit is https://github.com/emacs-lsp/lsp-mode/commit/e2a1b5f682ae00206491a80b4d28e8d932c2960f; not sure if this is the cause. 😕

def-SpaceWar commented 1 year ago

I also have Emacs 28.2 and I get the same error in CSharp.

image

But it also sometimes works.

image

And this error is only recent, not something I was experiencing before.

stonekyx commented 1 year ago

Looks like https://github.com/emacs-lsp/lsp-mode/commit/e2a1b5f682ae00206491a80b4d28e8d932c2960f (https://github.com/emacs-lsp/lsp-mode/pull/3844) is indeed related. Removing the following function call in lsp--fontlock-with-mode fixes it for me:

(when (eq mode 'lsp--render-markdown)
              (lsp--fix-markdown-links))
jcs090218 commented 1 year ago

@vspinu Can you help us here?

vspinu commented 1 year ago

Something is throwing there and you get the plain string instead. To be frank I think that try error logic could be improved. Falling back to plain str is too conservative IMO. I think the buffer string should be returned regardless, in case of errors the buffer string is likely to be better formatted anyhow.