ZIm/extensions/ruby/languages/ruby/indents.scm
Vitaly Slobodin 08123a270a
ruby: Add proper indentation for singleton methods (#12535)
Hi. Currently, Zed uses incorrect indentation for singleton methods:

```ruby
def self.build
| # <= cursor position after hitting Enter
end
```

Handling the `singleton_method` token indentation
changes this behavior to the following:

```ruby
def self.build
  | # <= cursor position after hitting Enter
end
```

## Before


https://github.com/zed-industries/zed/assets/1894248/40fc2b37-692f-469f-9cbe-05cbb1ab4c3c

## After



https://github.com/zed-industries/zed/assets/1894248/d9ba8d27-fd17-4c74-b22c-a4de124739a3



Release Notes:

- N/A
2024-05-31 11:36:42 -04:00

18 lines
339 B
Scheme

(method "end" @end) @indent
(class "end" @end) @indent
(module "end" @end) @indent
(begin "end" @end) @indent
(singleton_method "end" @end) @indent
(do_block "end" @end) @indent
(then) @indent
(call) @indent
(ensure) @outdent
(rescue) @outdent
(else) @outdent
(_ "[" "]" @end) @indent
(_ "{" "}" @end) @indent
(_ "(" ")" @end) @indent