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

Improve Documentation on Rubocop #384

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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