diff options
| author | john muhl | 2024-01-06 09:36:33 -0600 |
|---|---|---|
| committer | Stefan Kangas | 2024-01-11 21:51:23 +0100 |
| commit | a66069c50c8eaf4a3ee253e7b7e47af48e721585 (patch) | |
| tree | 60778b5160bc4038e5389f0cb63b886f20f9c3dd /test | |
| parent | 07bb8dc0afaef5ec7a7e194df42cc019ce8604d4 (diff) | |
| download | emacs-a66069c50c8eaf4a3ee253e7b7e47af48e721585.tar.gz emacs-a66069c50c8eaf4a3ee253e7b7e47af48e721585.zip | |
Support indented continuation lines in lua-ts-mode
* lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules):
Add a rule to indent multi-line assignments and if statements.
(lua-ts-indent-continuation-lines): New user option.
* test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add
tests. (Bug#68279)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/lua-ts-mode-resources/indent.erts | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts index 9797467bbe5..48184160b4d 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts | |||
| @@ -529,6 +529,58 @@ local Other = { | |||
| 529 | } | 529 | } |
| 530 | =-=-= | 530 | =-=-= |
| 531 | 531 | ||
| 532 | Name: Continuation Indent | ||
| 533 | |||
| 534 | =-= | ||
| 535 | local very_long_variable_name = | ||
| 536 | "ok".. | ||
| 537 | "ok" | ||
| 538 | local n = a + | ||
| 539 | b * | ||
| 540 | c / | ||
| 541 | 1 | ||
| 542 | local x = "A".. | ||
| 543 | "B" | ||
| 544 | .."C" | ||
| 545 | if a | ||
| 546 | and b | ||
| 547 | and c then | ||
| 548 | if x | ||
| 549 | and y then | ||
| 550 | local x = 1 + | ||
| 551 | 2 * | ||
| 552 | 3 | ||
| 553 | end | ||
| 554 | elseif a | ||
| 555 | or b | ||
| 556 | or c then | ||
| 557 | end | ||
| 558 | =-= | ||
| 559 | local very_long_variable_name = | ||
| 560 | "ok".. | ||
| 561 | "ok" | ||
| 562 | local n = a + | ||
| 563 | b * | ||
| 564 | c / | ||
| 565 | 1 | ||
| 566 | local x = "A".. | ||
| 567 | "B" | ||
| 568 | .."C" | ||
| 569 | if a | ||
| 570 | and b | ||
| 571 | and c then | ||
| 572 | if x | ||
| 573 | and y then | ||
| 574 | local x = 1 + | ||
| 575 | 2 * | ||
| 576 | 3 | ||
| 577 | end | ||
| 578 | elseif a | ||
| 579 | or b | ||
| 580 | or c then | ||
| 581 | end | ||
| 582 | =-=-= | ||
| 583 | |||
| 532 | Code: | 584 | Code: |
| 533 | (lambda () | 585 | (lambda () |
| 534 | (setq indent-tabs-mode nil) | 586 | (setq indent-tabs-mode nil) |
| @@ -677,3 +729,57 @@ function e (n, t) | |||
| 677 | end)(i(...)) | 729 | end)(i(...)) |
| 678 | end end end | 730 | end end end |
| 679 | =-=-= | 731 | =-=-= |
| 732 | |||
| 733 | Code: | ||
| 734 | (lambda () | ||
| 735 | (setq indent-tabs-mode nil) | ||
| 736 | (setq lua-ts-indent-continuation-lines nil) | ||
| 737 | (setq lua-ts-indent-offset 2) | ||
| 738 | (lua-ts-mode) | ||
| 739 | (indent-region (point-min) (point-max))) | ||
| 740 | |||
| 741 | Name: Unaligned Continuation Indent | ||
| 742 | |||
| 743 | =-= | ||
| 744 | local n = a + | ||
| 745 | b * | ||
| 746 | c / | ||
| 747 | 1 | ||
| 748 | if a | ||
| 749 | and b | ||
| 750 | and c then | ||
| 751 | if x | ||
| 752 | and y then | ||
| 753 | local x = 1 + | ||
| 754 | 2 * | ||
| 755 | 3 | ||
| 756 | end | ||
| 757 | elseif a | ||
| 758 | or b | ||
| 759 | or c then | ||
| 760 | if x | ||
| 761 | or y | ||
| 762 | end | ||
| 763 | end | ||
| 764 | =-= | ||
| 765 | local n = a + | ||
| 766 | b * | ||
| 767 | c / | ||
| 768 | 1 | ||
| 769 | if a | ||
| 770 | and b | ||
| 771 | and c then | ||
| 772 | if x | ||
| 773 | and y then | ||
| 774 | local x = 1 + | ||
| 775 | 2 * | ||
| 776 | 3 | ||
| 777 | end | ||
| 778 | elseif a | ||
| 779 | or b | ||
| 780 | or c then | ||
| 781 | if x | ||
| 782 | or y | ||
| 783 | end | ||
| 784 | end | ||
| 785 | =-=-= | ||