No release in over 3 years
A Ruby LSP add-on for formatting with `rubyfmt`.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.17.0
 Project Readme

ruby-lsp-rubyfmt-formatter

A Ruby LSP add-on that provides formatting support using rubyfmt.

Installation

Add this gem to your application's Gemfile:

bundle add ruby-lsp-rubyfmt-formatter

Or install it directly:

gem install ruby-lsp-rubyfmt-formatter

Usage

Once installed, configure your VSCode settings to use rubyfmt as the formatter:

{
  "[ruby]": {
    "editor.defaultFormatter": "Shopify.ruby-lsp",
    "editor.formatOnSave": true
  },
  "rubyLsp.formatter": "rubyfmt"
}

By default, the extension uses the rubyfmt in your PATH, or see the configuration options below for passing a specific path.

For instructions on installing rubyfmt itself, see the docs.

Configuration Options

You can customize the rubyfmt behavior via rubyLsp.addonSettings in your VSCode settings:

{
  "rubyLsp.formatter": "rubyfmt",
  "rubyLsp.addonSettings": {
    "rubyfmt": {
      "rubyfmtPath": "/custom/path/to/rubyfmt",
      "rubyfmtArgs": "--include-gitignored"
    }
  }
}

Available Options

Option Type Default Description
rubyfmtPath String "rubyfmt" Path to the rubyfmt executable. Uses PATH by default.
rubyfmtArgs String "" Additional arguments to pass to rubyfmt.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/reese/ruby-lsp-rubyfmt-formatter.