Comments (9)
Hi @unikitty37, which version of the ruby-lsp
gem is in use?
(either in Gemfile.lock
or .ruby-lsp/Gemfile.lock
)
from vscode-shopify-ruby.
Also can you try disabling the ruby-rubocop-revived
extension.
from vscode-shopify-ruby.
Thanks — the installed version is ruby-lsp (0.5.1)
I've disabled ruby-rubocop-revived
and now don't get the error — but I also can't format the Ruby code; I just get "There is no formatter for 'ruby' files installed." when I try.
from vscode-shopify-ruby.
Can you try adding this your settings, if not already present:
"[ruby]": {
"editor.defaultFormatter": "Shopify.ruby-lsp"
}
from vscode-shopify-ruby.
Is rubyLsp.formatter
configured to anything? And in the application you're using, do you have RuboCop or Syntax Tree installed to format files?
from vscode-shopify-ruby.
@andyw8 Thanks — that was already present in the settings.
@vinistock rubyLsp.formatter
is configured to rubocop
. RuboCop is installed globally; if I save a file as /tmp/foo.rb
and run rubocop /tmp/foo.rb
, it runs. But opening that file in VSCode and running the format command still produces "There is no formatter for 'ruby' files installed."
It also comes up with "Ruby LSP formatter is set to rubocop
but RuboCop was not found in the bundle". This is odd, as this is just a .rb file in a folder — Bundler is not being used in this case.
I'm using rbenv, if that matters.
from vscode-shopify-ruby.
The Ruby LSP doesn't support running RuboCop from a global installation. It must be a part of your Gemfile
or else it just gets ignored.
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.
from vscode-shopify-ruby.
Thanks — that explains it!
I've added a skeleton Gemfile (containing just the rubocop gem) to the folder and now it works 👍
from vscode-shopify-ruby.
The Ruby LSP doesn't support running RuboCop from a global installation. It must be a part of your Gemfile or else it just gets ignored.
@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.
from vscode-shopify-ruby.
Related Issues (20)
- Replace GitHub Personal Access Tokens with Org-Rotated Tokens HOT 1
- Can I override the ruler configuration? HOT 3
- Interest in supporting this extension pack in a GitHub Codespace? HOT 3
- Remove ? and ! from editor.wordSeparators HOT 3
- Message about uninstalling reborn.ruby and wingrunr21.vscode-ruby upon Vscode startup HOT 5
- How can I add the semantic token colours to an existing theme that doesn't have them? HOT 4
- Add setting to disable Spinel theme prompt HOT 1
- Stand-alone theme HOT 1
- Is there a way to use this extension without it changing my rulers? HOT 1
- add support for standardrb HOT 6
- Does not work for versions lower than ruby 3 HOT 1
- bricks color theme HOT 6
- Clarify that this extension is not intended for general Ruby development HOT 6
- Feature request: built-in support for syntax_suggest HOT 3
- Syntax highlighting breaks on non-Spinel themes HOT 1
- Why does it bundle koichisasada.vscode-rdbg when Shopify.ruby-lsp supports debugging? HOT 3
- Rename extension
- running
- any plan to add support for erb files? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-shopify-ruby.