This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
Respect ruby.pathToBundler for RuboCop executable #407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR:
src/format/RuboCop.ts
should useruby.pathToBundler
configuration when specified.Since I'm new to vscode extension development, I didn't understand how to add / run tests for vscode extensions. Thanks in advance if anyone helps to improve this PR.
Environment
vscode-ruby
version: 0.20.0Expected behavior
Use
bundler
to runAutoCorrect.test()
byRubyDocumentFormattingEditProvider
fromruby.pathToBundler
whenruby.useBundler
is true andruby.pathToBundler
is specified.Actual behavior
It uses
bundle
from the default path.Steps to find the problem
I'm using rvm for ruby version control, and my default version and worksapce version is different.
After installed rubocop, I configured my settings as following, to enable lint and auto formatting:
But both lint and formatting didn't work. It said
rubocop failed with code=7
which I couldn't understand.After a few searchs, I added custom rubocop path in workspace settings and the lint started working.
However, auto formatting never worked, and I found these messages from developer console.
So I added another configuration to specify bundler path. but no luck.
I finally looked through the source code, and realized that although
src/format/RuboCop.ts
sees theruby.useBundler
option, it doesn't utilizeruby.pathToBundler
to executebundle
. (24cb72f)