doomemacs/modules/lang/ruby
Henrik Lissner 6acf163cf7
refactor!: replace smartparens with electric
BREAKING CHANGE: This moves smartparens out of core and formally
deprecates it. The package has been a performance liability and is only
being used for pair management, so the rest of its functionality was
overkill for what we needed it for.

Instead, I'm waiting for electric.el's support for N-character pairs in
Emacs 31. In the meantime, I delegate to yasnippet (later, tempel)
snippets to handle more complex pairs like /* ... */ or <?php ... ?>.

- To restore auto-pairing functionality (which is all Doom was using
  smartparens for, really), enable :emacs (electric +pair). This is not
  a perfect replacement for all of smartparens' capabilities. More
  complex pairing is being relegated to snippets (for example, /* ... */
  and <?php ... ?> comment blocks will soon have snippets for them).

- To restore the old smartparens functionality, enable :config (default
  +smartparens). Keep in mind that this is temporary! In v3, smartparens
  will be removed entirely OR moved to its own module; this hasn't been
  decided yet.

Fix: #5759
Fix: #5894
Fix: #6223
Fix: #8093
Fix: #8620
2026-02-21 17:00:48 -05:00
..
.doommodule feat: add .doommodule files 2024-09-14 20:47:39 -04:00
config.el refactor!: replace smartparens with electric 2026-02-21 17:00:48 -05:00
doctor.el feat(ruby): add treesit support 2025-05-15 13:01:40 +02:00
packages.el bump: :lang 2026-01-18 03:13:00 -05:00
README.org refactor!(ruby): remove rubocop 2025-06-29 17:36:18 +02:00

:lang ruby

Description   unfold

This module add Ruby and optional Ruby on Rails support to Emacs. IDE features (like code completion, jump-to-definition, etc) are provided by a supported LSP client (recommended: ruby-lsp or solargraph).

Module flags

+chruby
Enable chruby integration.
+lsp
Enable LSP support for ruby-mode. Requires doom-module::tools lsp and a langserver (recommended: ruby-lsp or solargraph).
+rails
Enable rails navigational commands, plus server+console integration.
+rbenv
Enable rbenv integration.
+rvm
Enable RVM (Ruby Version Manager) integration.
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Hacks

No hacks documented for this module.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires Ruby. It is recommended you install it with some version manager (e.g. RVM or Rbenv).

These guides will help you install Ruby:

Formatter

Formatting is handled using the doom-module::editor format module via prettier.

TODO Usage

󱌣 This module's usage documentation is incomplete. Complete it?

Commands

projectile-rails

The projectile-rails prefix is <localleader> r:

command key / ex command description
projectile-rails-console <localleader> r r Open Rails console
projectile-rails-server <localleader> r R Open Rails server
projectile-rails-find-model <localleader> r m Find any model of the project
projectile-rails-find-model <localleader> r M Find the model related of currently open resource

bundler

The bundler prefix is <localleader> b:

command key / ex command description
bundle-install <localleader> b i Runs bundle install
bundle-update <localleader> b u Runs bundle update

rspec-mode

The rspec-mode prefix is <localleader> t:

command key / ex command description
rspec-verify SPC m t v Runs rspec on current file
rspec-verify-method SPC m t s Runs rspec for the item on cursor

TODO Configuration

󱌣 This module has no configuration documentation yet. Write some?

Troubleshooting

There are no known problems with this module. Report one?

Known imenu issues

These are recorded issues with ruby-mode's imenu integration that need to be addressed upstream. PRs to fix them locally are welcome.

  • Incorrectly parses methods/items after an array accessor endless method definition (Ruby 3+):

    class Foo
      def bar; end
      def baz; end
      def [](key) = x + x
      def wop; end
      def gop; end
    end

    Imenu will list Foo#bar, Foo#baz, and Foo#[] but stops there, sometimes listing the rest as if there were top-level.

  • Does not recognize inline Struct definitions as classes:

    Foo = Struct.new(:a, :b, :c) do
      def test; end
    end

    Imenu should recognize this method as Foo#test, not test. class Foo < Struct.new(...) is not an acceptable workaround because it creates an intermediary class (i.e. has side-effects).

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?