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

Commit

Permalink
Improve Documentation on Rubocop
Browse files Browse the repository at this point in the history
- Outline directions in steps
- Group all settings changes into one example config
- Add config setting `"editor.formatOnSave": true`
  • Loading branch information
alex-tan authored and Alex Tan committed Oct 19, 2018
1 parent e09c375 commit 7f828ea
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ The VS Code Ruby extension can automatically format your Ruby files whenever you

### Rubocop

Set `ruby.format` to `rubocop` to enable rubocop formatting on save.
Steps to enable rubocop formatting.

Formatting requires the rubocop gem to be installed. Note that you may have to turn on some of the AutoCorrect functions in your `.rubocop.yml` file. See the [rubocop documentation](http://rubocop.readthedocs.io/en/latest/configuration/).
1. Install rubocop with `gem install rubocop`. Note that you may have to turn on some of the AutoCorrect functions in your `.rubocop.yml` file. See the [rubocop documentation](http://rubocop.readthedocs.io/en/latest/configuration/).
2. Add the following to your settings.json:

Important note: VS Code has a timeout that limits file formatters to 750ms. This is often not enough time for rubocop to complete. In the near future VS Code will allow customizing this timeout via the `editor.formatOnSaveTimeout` setting. See [#43702](https://github.com/Microsoft/vscode/pull/43702) for more details.
```
"[ruby]": {
"editor.formatOnSave": true
},
"ruby.format": "rubocop",
"editor.formatOnSaveTimeout": 1500
```

Note: VS Code has a timeout that limits file formatters to 750ms which is often not enough time for rubocop to complete, which is why the setting is adjusted above. You may want to tweak this setting to meet your needs. See [#43702](https://github.com/Microsoft/vscode/pull/43702) for more details.

### Rufo

Expand Down

0 comments on commit 7f828ea

Please sign in to comment.