Skip to content

some hints on the "Mismatch between server and client text" error #1371

@goulf-3m

Description

@goulf-3m

I often see this error (in neovim), but still did not find a way to predicatively reproduce.

However, I find that, it can often occur when lsp is restarted (LspStart after some other error) and I write the file.
When this case occur, and I restart lsp again, it will surely throw this error again (and again if I restart lsp again)!
With the same workspace/setup, and I restart neovim, it will be OK, not throwing errors when I write the file.

Another hint: when this case occur, after I restart lsp, and introduce some change to buffer (no writing to disk) and ask lsp to code-format, it gives me the formatted version from disk!

The typical sequence:

... (some unknown reason causes lsp to abort)
I noticed this and call :LspStart
do edit and save
(now it's quite probable that lsp will abort again, if so)
I call :LspStart
do edit and save
lsp will surely exit with this mismatch error
I call :LspStart
do edit and save
lsp will surely exit with this mismatch error
I call :LspStart
do edit (no save)
call code-format (provided by lsp)
previous edit is lost!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions