stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.15k stars 161 forks source link

feat(formatters): defined a 'execute' option so a custom function can be used as a formatter #301

Closed brunotvs closed 8 months ago

brunotvs commented 8 months ago

An attempt to solve issues #36 and #61.

stevearc commented 8 months ago

While I appreciate the effort that went into this, it does not solve any of the fundamental problems that are mentioned in the attached issues. LSP formatting operates on the current state of a buffer, so if you try to run this in a sequence with other formatters, it won't work properly.

Also, there is already support for formatters that are defined via a function. That's what is used for the injected formatter https://github.com/stevearc/conform.nvim/blob/61cff430c9f15770d0c5e68c1b08067223bd94ab/lua/conform/formatters/injected.lua#L125