-
Notifications
You must be signed in to change notification settings - Fork 286
Linter not working #338
Comments
Unfortunately getting the linter to run in VS code can be a bit tricky due to issues with path/bundler/rvm/rbenv shell. I would like to complete a full test pass of these various config options, at least on Mac OS. :) But I haven't gotten around to that yet. @wingrunr21 I was hoping to address problems like this in my branch. At a minimum we should log the full path / args when linting to give everyone a chance to debug. We might even want to log this stuff as a diagnostic (on failure) to increase visibility. |
I have a similar issue. Running ruby through RVM. Not getting any output from the linter. Tried |
Same issue here. If I jump into a terminal I get
So not sure why it's not working |
Any idea how I could debug "where this is breaking"? I can lint from the terminal in VS code but I can't make anything work (code completion, go to, linting, etc) |
You might want to check #317 , my impression is that linting and formatting isn't working at all in this extension. I'm not sure why they've included documentation for it honestly, it seems completely missing. |
It used to work. I'm not sure when it stopped working but it appears to have been during one of the PRs being merged. As I've said repeatedly: if someone wants to dive in and fix things for the current master branch then please do so and submit a PR to fix things. Bonus points if I can reuse it with the language server work I'm doing. I've not heard about issues with code completion and go to. There're a few people that have had issues with rubyLocate that I think have been figured out. Solargraph is a much newer extension that probably works a bit better here. I don't use either one of those in my professional life so I can't comment on the configuration. As for debugging, you'd need to pull down the extension and run it in debug mode. It will spawn a new instance of VSCode with your local version of the extension running. That will allow you to take a look at the various paths in node. |
The linter is not completely broken - only for RVM installations of ruby. I was able to get it to work by installing ruby and rubocop from the terminal inside VSCode (which - assuming you haven't switched the shell parameters to be a login shell - can't access the rvm environment by default, and is therefore running in the same parent system environment that VSCode runs in). This is what I did:
This is not a great solution, obviously, as I do want to setup the VSCode terminal as a login shell that runs RVM, etc. but that prevents access to the system environment, making it difficult to keep the system ruby and rubocop up-to-date. But this does show that it's simply a compatibility issue with VSCode and RVM. I haven't been able to find a way to make vscode-ruby use the rvm ruby/rubocop, or to allow VSCode to access the rvm environment. I think that's what needs to be solved, ideally. |
Interestingly: after posting this, I realized one way to do what I was looking for might be to run vscode from a login shell. So I opened a terminal (which is configured as a login shell), typed |
I had the same issue and fixed it by fixing all rubocop warnings about config. When I run rubocop manually I saw a lot of warning in a console like some rule has a wrong scope. This warning appears after rubocop update. One time I've fixed all warnings but rubocop still doesn't work. And then I run rubocop for specified file, I see more warnings (for rule which was wrong only in this file) and after fixing this warning rubocop finally started to work. I hope this will help someone. I think this extension should be updated to handle warning from rubocop. |
I spent some time debugging this. What seems to be happening is that the spawned linter process is failing silently when calling rubocop through the bin folder. It's printing out this in the stderr log:
After some google fu (literally pasting the error into google). I came across this stack overflow post recommeding the use of the wrappers directory instead of the bin directory, which allowed linting to work again. Some takeaways here are that we need better error logging for the process and that a better way has to be figured out for finding the rubocop executable. If there are no objections I'll try my hand putting together a PR to add in better error logging. tldr; try this:
|
@mjhenkes That worked, thanks! version for rbenv (mac): |
I'm trying to make ti show undefined methods in a project. |
I wanted formatting on save to work as well; after @mjhenkes suggestion + a few tweaks finally got it to work. For some reason it was looking for rubocop in ruby-2.4.1 which i also have installed in rvm. I ran
|
This should be working correctly on |
All you actually need now is
|
Your environment
vscode-ruby
version: 0.18.0Make sure you have
ruby
,ruby-debug-ide
andruby-debug-basex19
installed before submitting your issue -- thank you !Expected behavior
Linter should highlights erros.
Actual behavior
Nothing is highlighten.
Steps to reproduce the problem
I saw similar problem on your closed issue, but they didn't help me.
#226
#229
Rubocop is installed and works in console but not in vs code.
I have tried many configurations, for example:
but then i have error that
As i said before in console everything is ok.
I have changed configuration(#187) to
There is no error in log, but stil not working
The text was updated successfully, but these errors were encountered: