lsp-format-modifications.nvim is a plugin for performing LSP code formatting on modified text regions (as defined by the version control system).
Rationale: many projects suggest contributors use an autoformatter to keep code style consistent.
However, in larger projects with legacy code, there can be plenty of places where the style deviates from the autoformatter’s preference.
In that case, you don’t want to format entire files — you’ll be left with very noisy diffs!
You also don’t want to comb through all of the changes you’ve made, manually applying the autoformatter before you commit. We are too lazy for that!
One reasonable solution is to run the autoformatter over the changed lines as defined by the revision control system. VSCode can do this — and this is something that I didn’t find an analog for in Neovim. Hence, this plugin!
Feedback appreciated.