Incorrect docs formatting in vim.lsp.buf.hover()

I have an issue with Python documentation which is rendered incorrectly:

Interestingly, I do not observe the same in Rust docs which are rendered beautifully:

image

lsp.buf.hover popup shows incorrect markdown syntax highlighting · Issue #13746 · neovim/neovim · GitHub might be tangentially related, but then why Rust is displayed correctly?..

Would appreciate some guidance as to how setup Python docs optimally.

1 Like

Happens for me as well but only with pyright. pylsp renders it correctly without the backslash next ot the underscore in param names

@yohoos, what’s your setup? Here is what I get with the default config:

Note the object.\_\_str\_\_()

@vimr having the same issue using pylsp.