Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby-lsp integration for rubyfmt #446

Open
pjg opened this issue Oct 28, 2023 · 2 comments
Open

ruby-lsp integration for rubyfmt #446

pjg opened this issue Oct 28, 2023 · 2 comments

Comments

@pjg
Copy link

pjg commented Oct 28, 2023

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

@pjg pjg changed the title ruby-lsp integration for ruby-fmt ruby-lsp integration for rubyfmt Oct 28, 2023
@pjg
Copy link
Author

pjg commented Dec 26, 2023

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

@jscharf
Copy link

jscharf commented Jan 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants