lukas-reineke / lsp-format.nvim

A wrapper around Neovims native LSP formatting.
564 stars 27 forks source link

Support for lsp.buf.formatting_seq_sync() behavior? #19

Closed jsec closed 2 years ago

jsec commented 2 years ago

Hey there, great plugin!

I was wondering if there was a way, or if a way may be planned in the future, to support formatting on save when using multiple formatting-enabled LSPs.

For example, I'm currently using the eslint LSP server in conjunction with null-ls for prettier formatting. Right now my format-on-save is calling vim.lsp.buf.formatting_seq_sync() to ensure that both servers have a chance to format according to their configs.

Would there be a way to do that with this plugin? Or is it built with only one attached LSP server at a time in mind?

"Either add eslint to your null-ls config or add an eslint plugin to run prettier and stop running 2 servers at once, you dummy" is also a valid response. 😛

Thanks!

lukas-reineke commented 2 years ago

This is a really good idea, thank you. I released a new version that implements this. The plugin should work the same as formatting_seq_sync now

jsec commented 2 years ago

Just wanted to drop a comment that I tried it out this weekend, and it works great. Thanks, I really appreciate it!