-
My bet would be that the LSP is returning the entire buffer via formatting. I've got a thing that takes the returned buffer, diffs it to the current state, and constructs linewise edits for LSP to use. You can check that here: https://github.com/CKolkey/config/blob/master/nvim/lua/plugins/lsp/formatting.lua
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
This might have something to do with extmarks being clobbered when the new text is written. For example, here is a GitHub issue describing the problem: https://github.com/mhartington/formatter.nvim/issues/22 This is for formatter.nvim, but this would likely apply to any process that rewrites the whole buffer.
-
As far as I know, the only solution (other than getting formatting directly from a LSP server) is to use EFM (https://github.com/mattn/efm-langserver), which implements the tricky logic of figuring out how to only update the changed text.