diff options
| author | Dmitry Gutov | 2022-12-30 23:58:26 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2022-12-31 00:00:21 +0200 |
| commit | 8675f4136c7da7356e5578cf1eabda2f37a597e5 (patch) | |
| tree | f37bbb61f80912e30f2428c20b16c30c8e7ab2bc /test/lisp/progmodes/ruby-mode-resources/ruby.rb | |
| parent | 4922de626f05f0c26bc732b082c30c5c18a88416 (diff) | |
| download | emacs-8675f4136c7da7356e5578cf1eabda2f37a597e5.tar.gz emacs-8675f4136c7da7356e5578cf1eabda2f37a597e5.zip | |
Add new options for Ruby code indentation
* lisp/progmodes/ruby-mode.el (ruby-block-indent)
(ruby-after-operator-indent, ruby-method-call-indent)
(ruby-parenless-call-arguments-indent): New options (bug#60186).
(ruby-smie-grammar): Specify associativity for "?".
(ruby-smie--indent-to-stmt): Add optional argument.
* test/lisp/progmodes/ruby-mode-resources/ruby.rb: New cases.
* test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb:
* test/lisp/progmodes/ruby-mode-resources/ruby-block-indent.rb:
* test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb:
* test/lisp/progmodes/ruby-mode-resources/
ruby-parenless-call-arguments-indent.rb: New files.
* test/lisp/progmodes/ruby-mode-tests.el: Add indentation tests for new files.
Diffstat (limited to 'test/lisp/progmodes/ruby-mode-resources/ruby.rb')
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb index 6a69d9db78a..bfae948b259 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb | |||
| @@ -226,6 +226,7 @@ desc "foo foo" \ | |||
| 226 | 226 | ||
| 227 | foo. | 227 | foo. |
| 228 | bar | 228 | bar |
| 229 | .baz | ||
| 229 | 230 | ||
| 230 | # https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 | 231 | # https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 |
| 231 | foo # comment intended to confuse the tokenizer | 232 | foo # comment intended to confuse the tokenizer |
| @@ -380,6 +381,18 @@ foo = [1, 2, 3].map do |i| | |||
| 380 | i + 1 | 381 | i + 1 |
| 381 | end | 382 | end |
| 382 | 383 | ||
| 384 | m1 = foo | ||
| 385 | .asdasd | ||
| 386 | .proc do |**args| | ||
| 387 | p(**args) | ||
| 388 | end | ||
| 389 | |||
| 390 | m2 = foo | ||
| 391 | .asdasd | ||
| 392 | .proc { |**args| | ||
| 393 | p(**args) | ||
| 394 | } | ||
| 395 | |||
| 383 | bar.foo do | 396 | bar.foo do |
| 384 | bar | 397 | bar |
| 385 | end | 398 | end |
| @@ -398,6 +411,12 @@ bar 1 do | |||
| 398 | end | 411 | end |
| 399 | end | 412 | end |
| 400 | 413 | ||
| 414 | x.foo do | ||
| 415 | foo | ||
| 416 | end.bar do | ||
| 417 | bar | ||
| 418 | end | ||
| 419 | |||
| 401 | foo | | 420 | foo | |
| 402 | bar | 421 | bar |
| 403 | 422 | ||
| @@ -540,5 +559,9 @@ class Bar | |||
| 540 | end | 559 | end |
| 541 | 560 | ||
| 542 | # Local Variables: | 561 | # Local Variables: |
| 562 | # ruby-after-operator-indent: t | ||
| 563 | # ruby-block-indent: t | ||
| 564 | # ruby-method-call-indent: t | ||
| 543 | # ruby-method-params-indent: t | 565 | # ruby-method-params-indent: t |
| 566 | # ruby-parenless-call-arguments-indent: t | ||
| 544 | # End: | 567 | # End: |