aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjohn muhl2024-01-06 09:36:33 -0600
committerStefan Kangas2024-01-11 21:51:23 +0100
commita66069c50c8eaf4a3ee253e7b7e47af48e721585 (patch)
tree60778b5160bc4038e5389f0cb63b886f20f9c3dd /test
parent07bb8dc0afaef5ec7a7e194df42cc019ce8604d4 (diff)
downloademacs-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.erts106
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
532Name: Continuation Indent
533
534=-=
535local very_long_variable_name =
536"ok"..
537 "ok"
538local n = a +
539b *
540c /
5411
542local x = "A"..
543"B"
544.."C"
545if a
546 and b
547 and c then
548 if x
549 and y then
550 local x = 1 +
5512 *
552 3
553 end
554elseif a
555 or b
556 or c then
557end
558=-=
559local very_long_variable_name =
560 "ok"..
561 "ok"
562local n = a +
563 b *
564 c /
565 1
566local x = "A"..
567 "B"
568 .."C"
569if 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
578elseif a
579 or b
580 or c then
581end
582=-=-=
583
532Code: 584Code:
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(...))
678end end end 730end end end
679=-=-= 731=-=-=
732
733Code:
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
741Name: Unaligned Continuation Indent
742
743=-=
744local n = a +
745 b *
746 c /
747 1
748if a
749 and b
750and c then
751 if x
752 and y then
753 local x = 1 +
754 2 *
755 3
756 end
757elseif a
758 or b
759 or c then
760 if x
761 or y
762 end
763end
764=-=
765local n = a +
766 b *
767 c /
768 1
769if a
770and b
771and c then
772 if x
773 and y then
774 local x = 1 +
775 2 *
776 3
777 end
778elseif a
779or b
780or c then
781 if x
782 or y
783 end
784end
785=-=-=