Closed joshuapinter closed 3 years ago
You're correct, setting executable disables all other settings. Two things can go wrong, at least. 1. Maybe we don't set the correct working dir. We Print that in debug mode. 2. The process environment of Sublime itself is different from your Terminal. You could check that by closing Sublime completely, and starting it again using subl . from the Terminal. It should then inherit the ENV from the Terminal.
@joshuapinter Have you tried overriding the env
for the rubocop linter in your settings file? For example here is mine with asdf. I'm guessing rbenv is similiar in that you can use ~/.rbenv/shims
as the environment override. With this config you should be able to remove your executable config above
"rubocop": {
"use_bundle_exec": true,
"env": {
"PATH": "~/.asdf/shims:$PATH"
}
}
Reference: http://www.sublimelinter.com/en/stable/troubleshooting.html#debugging-path-problems
Mac OSX alternative Alternatively, if you're on OS X and launching Sublime Text via the Finder menu you can try the following (though I'd suggest trying the previous fix first)
Set the path used by launchctl (which launches apps via Finder) to include the path to your Rubocop shim
sudo launchctl config user path /Users/<username>/.asdf/shims:/Users/<username>/.asdf/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Something like the above but for rbenv should work.
Reference: https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications
@joshmfrankel Hey Josh. Not sure why I didn't reply to this originally but just wanted to follow-up and say that the configuration change you suggested worked perfectly. It now finds and uses the rubocop
binary in my ~/.rbenv/shims
directory. My final config looks like this:
{
"linters": {
"rubocop": {
"use_bundle_exec": true,
"env": {
"PATH": "~/.rbenv/shims:$PATH"
}
}
}
}
Belated thank you! 🙏
I think this should be in the README:
"rubocop": {
"use_bundle_exec": true,
"env": {
"PATH": "~/.asdf/shims:$PATH"
}
}
I'm using
rbenv
and I'm trying to use therubocop
that we have in ourbundle
.I have my
executable
set to~/me/.rbenv/shims/rubocop
anduse_bundle_exec
totrue
.Based on the console log it's not finding the right executable.
If I look at the code, it appears that if
executable
is set, it ignoresuse_bundle_exec
. Am I wrong?For reference, if I run
bundle exec rubocop
in my project directory, everything works great. Running justrubocop
it does not.FYI, I'm a contributor to
rubocop
so we use variousgithub
branches in ourGemfile
to pull and test the master branch of the gem.Thanks!