Skip to content

himynameisjonas/zed-standardrb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Standard Ruby – A Zed Extension

This extension for the Zed editor adds support for running Standard Ruby as a language server.

Install as a Dev Extension

  1. Install the Rust toolchain via rustup
  2. Clone the repo via git clone https://github.com/himynameisjonas/zed-standardrb.git
  3. Launch Zed and to go to Extensions
  4. Click the "Install Dev Extension" button (top right)
  5. Select the directory you cloned the repo into
  6. Wait a moment while Zed compiles the extension

Configure Zed for Ruby

First, install the standard gem, either via gem install standard or by adding it to your Gemfile:

gem "standard", require: false, group: :development

Next, launch Zed, press Command + , to open Settings, and change the language server for Ruby:

{
  "languages": {
    "Ruby": {
      "language_servers": ["standardrb"]
    }
  }
}

Here's a slightly more elaborate Zed config that uses Shopify's Ruby LSP as the primary language server, with auto-formatting and diagnostics handled by Standard Ruby.

{
  "languages": {
    "Ruby": {
      "language_servers": ["ruby-lsp", "standardrb", "!rubocop", "!solargraph"],
      "formatter": "language_server",
      "format_on_save": "on"
    }
  },
  "lsp": {
    "ruby-lsp": {
      "initialization_options": {
        "enabledFeatures": {
          "diagnostics": false, // Zed currently doesn't support Ruby LSP's pull-based diagnostics
          "formatting": true
        },
        "formatter": "standard"
      }
    },
    "standardrb": {
      "initialization_options": {
        "enabledFeatures": {
          "diagnostics": true,
          "formatting": false // Because we use Standard Ruby's formatting via Ruby LSP
        }
      }
    }
  }
}