diff options
author | john muhl <jm@pub.pink> | 2024-05-03 15:51:01 -0500 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2024-05-08 20:36:37 -0700 |
commit | 73d2b829f06124fec8b65eebc68e87da48808086 (patch) | |
tree | ff90d3d6472c1b4f8627e688ae20d87540ed5021 /test/lisp | |
parent | 4eb363acc825ef3aaa5468ab5e206ecab5883acb (diff) | |
download | emacs-73d2b829f06124fec8b65eebc68e87da48808086.tar.gz |
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/lisp')
-rw-r--r-- | test/lisp/progmodes/lua-ts-mode-resources/indent.erts | 40 |
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 return f end +f6(function() +print'ok' +end) + ;(function () return true end)() @@ -118,6 +122,10 @@ function f6(...) return f end +f6(function() + print'ok' +end) + ;(function () return true end)() @@ -406,6 +414,15 @@ a = 1, b = 2, }, nil) + +Test(nil, { + a = 1, + b = 2, + }) + +fn( -- comment + 1, + 2) =-= h( "string", @@ -443,6 +460,15 @@ Test({ b = 2, }, nil) + +Test(nil, { + a = 1, + b = 2, +}) + +fn( -- comment + 1, + 2) =-=-= Name: Parameter Indent @@ -464,6 +490,9 @@ local f3 = function( a, b, c, d ) print(a,b,c,d) end + +local f4 = function(-- comment +a, b, c) =-= function f1( a, @@ -481,6 +510,9 @@ local f3 = function( a, b, c, d ) print(a,b,c,d) end + +local f4 = function(-- comment + a, b, c) =-=-= Name: Table Indent @@ -506,6 +538,10 @@ a = 1, b = 2, c = 3, } + +local a = { -- hello world! + b = 10 +} =-= local Other = { First={up={Step=true,Jump=true}, @@ -527,6 +563,10 @@ local Other = { b = 2, c = 3, } + +local a = { -- hello world! + b = 10 +} =-=-= Name: Continuation Indent |