Editing the same file in a split causes vim to jump to the top of the file when saving with autoformatter

This page summarizes the projects mentioned and recommended in the original post on /r/neovim

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. config

    Personal Config - Consume at your own risk. (by CKolkey)

    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

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. formatter.nvim

    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.

  4. efm-langserver

    General purpose Language Server

    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.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Style rules for LSP for coursework

    2 projects | /r/nvim | 21 Nov 2023
  • efm-langserver doesn't work in helix as expected

    1 project | /r/HelixEditor | 8 Sep 2023
  • Error when using efm-langserver

    1 project | /r/neovim | 26 Aug 2023
  • Anyone using efm-langserver with native LSP?

    1 project | /r/neovim | 12 Jul 2023
  • [Neovim] Comment formater une partie du fichier à l'aide de la prise en charge LSP native de Neovim?

    1 project | /r/enfrancais | 28 Apr 2023

Did you know that Lua is
the 18th most popular programming language
based on number of references?