-
Notifications
You must be signed in to change notification settings - Fork 13
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 extension wants to set Shopify.ruby-lsp as default formatter, but then complains it can't format Ruby #443
Comments
Hi @unikitty37, which version of the (either in |
Also can you try disabling the |
Thanks — the installed version is I've disabled |
Can you try adding this your settings, if not already present:
|
Is |
@andyw8 Thanks — that was already present in the settings. @vinistock It also comes up with "Ruby LSP formatter is set to I'm using rbenv, if that matters. |
The Ruby LSP doesn't support running RuboCop from a global installation. It must be a part of your The reason for this is consistency. If multiple developers are working on the same codebase and they're all running global installations of RuboCop, there's no guarantee that the developers aren't running different versions, which may lead to different formatting results. Additionally, if there's a version mismatch between the global installation and CI, then linting will fail on CI despite formatting being enabled in the editor. |
Thanks — that explains it! I've added a skeleton Gemfile (containing just the rubocop gem) to the folder and now it works 👍 |
@vinistock can we add a documentation somewhere with this instruction. I read many docs and only this comment made it clear why formatting wasn't working despite all the trials and errors. |
When I open a Ruby file, I get the error 'No configuration found for editor.defaultFormatter. Would you like to apply the suggested default ("Shopify.ruby-lsp")?'
If I click Apply, then open the command palette and run
Developer: Reload Window
I get the formatter error icon in the status bar. Clicking on it shows a message saying "Formatting — Extension 'Ruby-LSP' is configured as formatter but it cannot format 'Ruby'-files'. Clicking theConfigure…
link only offers meruby-rubocop-revived
as a formatter.Why would the extension offer to set Ruby-LSP as the default formatter if it can't format Ruby? (I'm not sure if the problem is that it's offering when it shouldn't, or if VSCode thinks Ruby-LSP can't format when it can :)
The text was updated successfully, but these errors were encountered: