I am using pyright LSP with the neovim (0.10.0-dev), and am seeing any leading spaces in docstrings replaced by  . For example, see the attached image:

enter image description here

As far as I can tell it seems very similar to this issue: https://github.com/neovim/nvim-lspconfig/issues/936 . Unfortunately, from that issue I can't determine how the problem was rectified. I'm already using nvim-cmp (the successor to nvim-compe), so am assuming that this isn't the problem.

I am using mason, and mason-lspconfig, and am initialising pyright as follows. (And calling setup with purely default arguments gives the same result.)

        require("lspconfig").pyright.setup {
            settings = {
                pyright = {
                    -- Use Ruff for import organisation
                    disableOrganizeImports = true,

So far I've tried, without success, to

  • find a way to tell pyright LSP to return plaintext rather than HTML format
  • find a way to intercept the string that neovim receives from the LSP, and use a lua function to replace " " with " " before it gets rendered (which would be VERY hacky but better than nothing!)

Does someone know any likely causes of this issue?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.