ruby-lsp integration for rubyfmt
Opened this issue · 2 comments
I've been looking for a way to integrate rubyfmt with my ruby-lsp vim (via coc.nvim), but was unable to do so.
Rubocop integration in coc-settings.json works perfectly as ruby-lsp provides integration with it by default:
"languageserver": {
"ruby-lsp": {
"command": "ruby-lsp",
"initializationOptions": {
"formatter": "auto" // will use rubocop (if installed) or falls back to syntax_tree
},
"filetypes": ["ruby"]
}
},
I think something like ruby-lsp-rubyfmt would be necessary to integrate with ruby-lsp in vim. I don't think such project exists. Also my hope is that I can configure multiple formatters with different priorities, so that I can run rubyfmt first, and then/afterwards rubocop (or standardrb).
Also I'm coming to a realisation that rubyfmt will probably never support/read rubocop's (or standard's) config (#445).
Edit: I've found similar request in vscode-ruby-lsp repo: Shopify/ruby-lsp#1740
FWIW I was able to use conform.nvim to run rubyfmt, and then an AutoCmd to run rubocop via LSP on rubyfmt's results. Reference: pjg/dotfiles@2d6c577
I think something like ruby-lsp-rubyfmt would be necessary to integrate with ruby-lsp in vim.
I don't think such project exists.
Hey @pjg! I stumbled across this issue recently and wanted to let you know that I've created a such a project, for bridging these technologies together. https://github.com/jscharf/ruby-lsp-rubyfmt
If you have any feedback for me or if you have time to test it out to make sure it works for you, I would really appreciate it.
I initially wanted to do this around December 2022 and asked in the Ruby LSP project here Shopify/ruby-lsp#409