-
Notifications
You must be signed in to change notification settings - Fork 286
Cannot make Linting work with Rubocop #229
Comments
I found the logs and I have 2 errors. They seem to come from the extension but I cannot find how to solve them.
|
Was this ever resolved? I'm experiencing the exact same issues myself, but on VS Code 1.19.2 and Ruby 2.5.0 |
It is actually working on 0.15 for me but does not on 0.17 |
How do you all have rubocop installed? |
rubocop is in my Gemfile.
I reverted back to 0.15 for now |
Any updates on this? I'm affected too. |
I've been out of town for the past week or so and haven't been able to look. I'm also seeing the same issue. |
I am having the same issue with ruby v2.3.5 with RVM and the same setting. Tried to toggle "Developer Tools", showing
But the gem is actually installed. I open VSCode from the shell that switched to ruby 2.3.5 with RVM. |
I think this is another part of the docs that could use a refresh. This kind of error is very common. It turns out that getting VS Code and rvm/rbenv/chruby to play nicely together is a non-trivial task. Can you try investigating/installing rubocop from within VS Code's Integrated Terminal? (View > Integrated Terminal). Try I have a theory that this might be the easiest way to diagnose and fix gem dependency issues. Personally I have a simple rbenv setup and I'm curious how things look with rvm + VS Code. |
Many thanks. Below are the outputs from Integrated Terminal
From Visual Studio Code Developer Tools
|
Thanks for taking the time to put that together. Hm, that's strange. I would expect it to work if VS Code can run rubocop in the terminal. I added a new set of error messages to the rubocop activation code, but we haven't released that version of vscode-ruby yet. With 0.17.0 all you get is These kinds of errors are common. That's why I want to add more error messages and improve the docs. We appreciate your patience. You can wait for the next release to get more debug info (which could take a few days), or if you are feeling ambitious you can try debugging the extension locally. See https://github.com/rubyide/vscode-ruby#contributing. Beware, though - it's easy to get bogged down with install/config issues if you're just dipping your toe into development. Especially if you don't know npm/js/etc. :) |
Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience. |
I'm not sure if this is directly related, but I was (and still are) having trouble getting the new In my case, I use
Additionally, I have the Outside of vscode, to lint my project I run
In vscode, I get the same First, I noticed the following in the console:
So, I opened up the
...and added a console.log(data); as the first line.
Turns out that the
Hmmm, that's odd. I know that all my gems are installed correctly, because I can run Next, I wanted to see what vscode-ruby/src/lint/lib/linter.js Line 99 in 72ae6af
...I added the following: console.log(cp.execSync("bundle show rubocop", {cmd: cmdOpts.dir})); This gives even more clues:
Again, it looks like the gem(s) aren't properly installed. Finally, I opened up the Integrated Terminal in VSCode and ran
So it looks like the problem (in my case) is that VSCode hasn't loaded Hope this helps. |
Had the same issue as you @scottohara. It's a normal behavior. When you open up a new terminal, the environment variable |
Yep. There's a bit of code here in the extension that attempts to rectify this problem but I'm not sure how well it works. For instance, I'm a Proper support for |
|
@wingrunr21 any fix for this? |
I am sorry but I wouldn't call this normal behavior. While I understand that Other languages (node, python, etc) could solve this problem somehow, so I suspect this is not inherently unsolvable. |
Please open a new issue or comment on the applicable open issue. This issue is out of date given version manager support shipped in the language server support. There is an outstanding bug related to environment detection (#470) which I haven’t been able to nail down yet. Also, as you seem rather confident that this is an easy problem to solve across four different version managers plus bundler plus global installs independent of how VSCode is launched, please open a PR with a fix. |
@wingrunr21 is right - this is hard, unfortunately. Too many configurations and too few people to painstakingly recreate and debug the myriad problems with PATH and ENV. I do have a brute force workaround to suggest - replace the rubocop executable with a bash script of your own devising. Then you can configure your PATH and ENV in a way that works on your system before launching rubocop. This technique is used to great effect by https://github.com/fohte/rubocop-daemon. If you decide to go this route, feel free to swing back and share your findings. Ideally with a link to your replacement script! |
Your environment
vscode-ruby
version: 0.15.0Make sure you have
ruby
,ruby-debug-ide
andruby-debug-basex19
installed before submitting your issue -- thank you !Expected behavior
Rubocop linting shows the errors in my files (same errors than when running with the command line)
Actual behavior
There is not linting at all in my VSCode editor
Steps to reproduce the problem
Add the following config to your settings (I tried others but nothing works):
Trigger a Rubocop error (for example: wrong order of gems in gemfile). Nothing happens in VSCode but
rubocop
in the command line find the error.I do not seem to have any error so I do not know how I can give more info. Please let me know if I can be more useful.
Thank you
The text was updated successfully, but these errors were encountered: