diff options
| author | Aaron Jensen | 2025-11-21 21:20:01 -0800 |
|---|---|---|
| committer | Dmitry Gutov | 2025-11-26 01:31:12 +0200 |
| commit | 16a70518880ef8f54bd853020f1606d3abf04d8e (patch) | |
| tree | a184851e9f787b6e4ad2f12f7638cdfc061baca4 /test/lisp/progmodes/ruby-mode-resources | |
| parent | 36f1fde9b9c9db19cfb15eb16ebfc44b3f9c13b9 (diff) | |
| download | emacs-16a70518880ef8f54bd853020f1606d3abf04d8e.tar.gz emacs-16a70518880ef8f54bd853020f1606d3abf04d8e.zip | |
Fix indentation of keyword argument arrays/hashes in ruby-mode
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Check for ':' and
'=>' as previous tokens, and handle symbols ending with ':' to
properly indent keyword argument arrays and hashes when
ruby-bracketed-args-indent is nil.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol):
Handle arrays/hashes that are children of 'pair' nodes (keyword
arguments) to ensure consistent indentation.
* test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb:
Add test cases for keyword argument arrays and hashes with both
symbol-colon and hash-rocket syntax.
When ruby-bracketed-args-indent is nil, arrays and hashes used as
keyword argument values now indent by ruby-indent-level from the
line start, matching the documented behavior and fixing inconsistent
indentation (bug#74517).
(https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00939.html)
Diffstat (limited to 'test/lisp/progmodes/ruby-mode-resources')
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb index c1aaff78ac9..27905f757d5 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb | |||
| @@ -37,6 +37,24 @@ def foo | |||
| 37 | ) | 37 | ) |
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | some_method(arg, include: [ | ||
| 41 | :value1, | ||
| 42 | :value2 | ||
| 43 | ]) | ||
| 44 | |||
| 45 | some_method(arg, options: { | ||
| 46 | key: "value" | ||
| 47 | }) | ||
| 48 | |||
| 49 | some_method(arg, :include => [ | ||
| 50 | :value1, | ||
| 51 | :value2 | ||
| 52 | ]) | ||
| 53 | |||
| 54 | some_method(arg, :options => { | ||
| 55 | :key => "value" | ||
| 56 | }) | ||
| 57 | |||
| 40 | # Local Variables: | 58 | # Local Variables: |
| 41 | # ruby-bracketed-args-indent: nil | 59 | # ruby-bracketed-args-indent: nil |
| 42 | # End: | 60 | # End: |