Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Support for ${workspaceRoot} in ruby.lint.rubocop.path #187

Closed
scottohara opened this issue Aug 3, 2017 · 2 comments
Closed

Support for ${workspaceRoot} in ruby.lint.rubocop.path #187

scottohara opened this issue Aug 3, 2017 · 2 comments
Labels
feature-request Adds currently unsupported functionality

Comments

@scottohara
Copy link

Your environment

  • vscode-ruby version: 0.12.1
  • Ruby version: 2.4.1
  • VS Code version: 1.14.2
  • Operating System: macOS Sierra 10.12.6
  • Hardware (optional): MacBook Pro

Expected behavior

A common practice is to have a project's gems vendored, i.e. installed using bundle install --path vendor/bundle --binstubs.

This enables each project to specify their own (potentially different) version of rubocop, rather than a single globally installed version.

I'm trying to configure vscode-ruby to always lint my project's *.rb files using the executable found in ${workspaceRoot}/bin/rubocop.

Actual behavior

Attempt 1

vscode settings.json file:

"ruby.lint": {
  "rubocop": {
    "path": "${workspaceRoot}/bin"
  }
}

In the Developer Tools, the following messages are shown when vscode launches:

[Extension Host] Rubocop not installed
[Extension Host] Linter error: rubocop Error: spawn ${workspaceRoot}/bin/rubocop ENOENT

Linting fails because vscode-ruby is unable to find the rubocop executable, as the ${workspaceRoot} variable is not expanded/resolved.

Attempt 2

vscode settings.json file:

"ruby.lint": {
  "rubocop": {
    "path": "./bin"
  }
}

In the Developer Tools, the following messages are shown when vscode launches:

[Extension Host] Rubocop not installed

Despite this, linting does sometimes work, but not always.

I suspect that it is executing the command relative to cwd, so when cwd == workspaceRoot it works, and when cwd !== workspaceRoot it doesn't.

There is an open issue regarding expanding/resolving variables in settings.json (microsoft/vscode#2809), but it has been discussed for over a year and doesn't seem to be nearing resolution any time soon.

In lieu of this, some extensions such as the pythonVSCode implement their own support for expanding environment variables in their config.

Any chance of implementing something similar in vscode-ruby?

@rebornix rebornix added the feature-request Adds currently unsupported functionality label Aug 11, 2017
@rebornix
Copy link
Member

@scottohara thanks, this is a valid feature request. I'll keep an eye on the Code issue there as that's the best way to accomplish it. If that takes too long, I'll see how to support relative path at least.

@wingrunr21
Copy link
Collaborator

This is currently supported

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Adds currently unsupported functionality
Projects
None yet
Development

No branches or pull requests

3 participants