Ask Your Question
1

What is the process to automatically format Ruby or .erb files in VS Code?

asked 2023-01-07 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2021-09-04 04:00:00 +0000

djk gravatar image

To automatically format Ruby or .erb files in VS Code, you can follow these steps:

  1. Install the ‘Ruby’ extension (if not already installed).
  2. Press Ctrl + Shift + P (Windows/Linux) or Command + Shift + P (Mac) to open the Command Palette.
  3. Type ‘Preferences: Open Settings (JSON)’ in the Command Palette and press Enter.
  4. In the ‘settings.json’ file, add the following line:

    "ruby.format": "rubocop"

  5. Save the file and close it.

  6. Open a Ruby or .erb file and press Ctrl + Shift + I (Windows/Linux) or Command + Shift + I (Mac) to format the file.

Alternatively, you can also click on the ‘Format Document’ option in the context menu (right-click) of the editor.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-01-07 11:00:00 +0000

Seen: 9 times

Last updated: Sep 04 '21