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

Support for formatting/beautifying Ruby files #56

@HusseinElMotayam

Description

@HusseinElMotayam

Your environment

  • vscode-ruby version: 0.5.6
  • Ruby version: 2.3.0
  • VS Code version: 1.5.1
  • Operating System: Ubuntu 16.04

Expected behavior

It'd be great to have some formatting/beautifying functionality in the vscode-ruby plugin.

Actual behavior

As for now, there is no way to format/beautify .rb and .erb files inside vscode in a proper way.

Workaround

I worked around this by:

  • Installing htmlbeautifier and rbeautify gems.
  • Editing my Tasks file as follows:
{
    "version": "0.1.0",
    "command": "sh",
    "args": ["-c"],
    "isShellCommand": false,    
    "showOutput": "never",
    "suppressTaskName": true,
    "tasks": [        
        {
            "taskName": "Ruby format",
            "args": ["rbeautify ${file}"]
        },
        {
            "taskName": "ERB format",
            "args": ["htmlbeautifier ${file}"]
        }
    ]   
}
  • Now, selecting the "Ruby format" task for .rb files or the "ERB format" task for .erb files formats the files in place.
  • Hotkeys can also be assigned to quickly invoke both tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestAdds currently unsupported functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions