aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjohn muhl2024-05-03 15:51:01 -0500
committerYuan Fu2024-05-08 20:36:37 -0700
commit73d2b829f06124fec8b65eebc68e87da48808086 (patch)
treeff90d3d6472c1b4f8627e688ae20d87540ed5021 /test
parent4eb363acc825ef3aaa5468ab5e206ecab5883acb (diff)
downloademacs-73d2b829f06124fec8b65eebc68e87da48808086.tar.gz
emacs-73d2b829f06124fec8b65eebc68e87da48808086.zip
Improve indentation in 'lua-ts-mode' (bug#70785)
* lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules): - Ignore comments when aligning arguments, parameters and fields. - Apply simpler rules to simpler usage of anonymous functions. - Better handling of table as a function argument. (lua-ts--comment-first-sibling-matcher): (lua-ts--first-real-sibling-anchor): (lua-ts--last-arg-function-call-matcher): (lua-ts--top-level-function-call-matcher): New function. (lua-ts--g-parent): (lua-ts--g-g-parent): New function. (lua-ts--g-g-g-parent): Use it. * test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/lua-ts-mode-resources/indent.erts40
1 files changed, 40 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 48184160b4d..ba7bad1b452 100644
--- a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts
@@ -66,6 +66,10 @@ end
66return f 66return f
67end 67end
68 68
69f6(function()
70print'ok'
71end)
72
69;(function () 73;(function ()
70 return true 74 return true
71 end)() 75 end)()
@@ -118,6 +122,10 @@ function f6(...)
118 return f 122 return f
119end 123end
120 124
125f6(function()
126 print'ok'
127end)
128
121;(function () 129;(function ()
122 return true 130 return true
123end)() 131end)()
@@ -406,6 +414,15 @@ a = 1,
406b = 2, 414b = 2,
407}, 415},
408nil) 416nil)
417
418Test(nil, {
419 a = 1,
420 b = 2,
421 })
422
423fn( -- comment
424 1,
425 2)
409=-= 426=-=
410h( 427h(
411 "string", 428 "string",
@@ -443,6 +460,15 @@ Test({
443 b = 2, 460 b = 2,
444 }, 461 },
445 nil) 462 nil)
463
464Test(nil, {
465 a = 1,
466 b = 2,
467})
468
469fn( -- comment
470 1,
471 2)
446=-=-= 472=-=-=
447 473
448Name: Parameter Indent 474Name: Parameter Indent
@@ -464,6 +490,9 @@ local f3 = function( a, b,
464 c, d ) 490 c, d )
465print(a,b,c,d) 491print(a,b,c,d)
466end 492end
493
494local f4 = function(-- comment
495a, b, c)
467=-= 496=-=
468function f1( 497function f1(
469 a, 498 a,
@@ -481,6 +510,9 @@ local f3 = function( a, b,
481 c, d ) 510 c, d )
482 print(a,b,c,d) 511 print(a,b,c,d)
483end 512end
513
514local f4 = function(-- comment
515 a, b, c)
484=-=-= 516=-=-=
485 517
486Name: Table Indent 518Name: Table Indent
@@ -506,6 +538,10 @@ a = 1,
506 b = 2, 538 b = 2,
507 c = 3, 539 c = 3,
508} 540}
541
542local a = { -- hello world!
543 b = 10
544}
509=-= 545=-=
510local Other = { 546local Other = {
511 First={up={Step=true,Jump=true}, 547 First={up={Step=true,Jump=true},
@@ -527,6 +563,10 @@ local Other = {
527 b = 2, 563 b = 2,
528 c = 3, 564 c = 3,
529} 565}
566
567local a = { -- hello world!
568 b = 10
569}
530=-=-= 570=-=-=
531 571
532Name: Continuation Indent 572Name: Continuation Indent