Skip to content

IDE: vscode

Jennifer Konikowski edited this page May 6, 2021 · 8 revisions
  1. Install the Ruby extension

  2. Enable the Ruby language server in your settings:

    ruby language server

  3. The Ruby:Lint option will direct you to the settings.json file:

    ruby linting

    Enable standard linting by adding the following:

    "ruby.lint": {
      "standard": true
    }
  4. Reload your window to enable the language server and linting. You can confirm that linting is happening by selecting the "Ruby Language Server" in the Output tab.

You can view the ruby extension docs for more configuration options, like defaulting to the bundler-installed version of standard:

"ruby.lint": {
  "standard": {
    "useBundler": true,
  }
}
  1. To enable Standard to fix your code on save, you can use the Run on Save extension, configured in your settings.json:
"emeraldwalk.runonsave": {
    "commands": [
        {
            "match": "\\.rb$",
            "cmd": "standardrb --fix"
        }
    ]
}

NOTE: This will fix every file. To fix only the current file, change the above to:

"cmd": "standardrb --fix ${file}"
Clone this wiki locally