mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-11 08:30:45 -08:00
* lisp/progmodes/lua-ts-mode.el: * test/lisp/progmodes/lua-ts-mode-resources/indent.erts: * test/lisp/progmodes/lua-ts-mode-tests.el: New files. * etc/NEWS: Mention the new mode. * lisp/progmodes/eglot.el (eglot-server-programs): * lisp/progmodes/hideshow.el (hs-special-modes-alist): Support 'lua-ts-mode'. * admin/notes/tree-sitter/build-module/batch.sh: * admin/notes/tree-sitter/build-module/build.sh: Add Lua. * test/infra/Dockerfile.emba: * test/infra/test-jobs.yml: Include lua-ts-mode tests.
152 lines
1.5 KiB
Text
152 lines
1.5 KiB
Text
Code:
|
|
(lambda ()
|
|
(setq indent-tabs-mode nil)
|
|
(setq lua-ts-indent-offset 2)
|
|
(lua-ts-mode)
|
|
(indent-region (point-min) (point-max)))
|
|
|
|
Name: Basic Indent
|
|
|
|
=-=
|
|
print(
|
|
0,
|
|
1
|
|
)
|
|
|
|
local function f(o)
|
|
if o.x > o.y then
|
|
return o.x
|
|
elseif o.y > o.z then
|
|
return o.y
|
|
else
|
|
return o.z
|
|
end
|
|
end
|
|
|
|
f({
|
|
x = 1,
|
|
y = 2,
|
|
z = 3,
|
|
})
|
|
|
|
;(function()
|
|
return false
|
|
)()
|
|
=-=
|
|
print(
|
|
0,
|
|
1
|
|
)
|
|
|
|
local function f(o)
|
|
if o.x > o.y then
|
|
return o.x
|
|
elseif o.y > o.z then
|
|
return o.y
|
|
else
|
|
return o.z
|
|
end
|
|
end
|
|
|
|
f({
|
|
x = 1,
|
|
y = 2,
|
|
z = 3,
|
|
})
|
|
|
|
;(function()
|
|
return false
|
|
)()
|
|
=-=-=
|
|
|
|
Name: Argument Indent
|
|
|
|
=-=
|
|
function h(
|
|
string,
|
|
number,
|
|
options)
|
|
print(string, number, options)
|
|
end
|
|
|
|
local p = h(
|
|
"sring",
|
|
1000,
|
|
{
|
|
cost = 2,
|
|
length = 8,
|
|
parallelism = 4,
|
|
})
|
|
=-=
|
|
function h(
|
|
string,
|
|
number,
|
|
options)
|
|
print(string, number, options)
|
|
end
|
|
|
|
local p = h(
|
|
"sring",
|
|
1000,
|
|
{
|
|
cost = 2,
|
|
length = 8,
|
|
parallelism = 4,
|
|
})
|
|
=-=-=
|
|
|
|
Name: Continuation Indent
|
|
|
|
=-=
|
|
function f()
|
|
local str = [[
|
|
multi-line
|
|
string
|
|
]]
|
|
--[[
|
|
multi-line
|
|
comment
|
|
]]
|
|
return true
|
|
end
|
|
=-=
|
|
function f()
|
|
local str = [[
|
|
multi-line
|
|
string
|
|
]]
|
|
--[[
|
|
multi-line
|
|
comment
|
|
]]
|
|
return true
|
|
end
|
|
=-=-=
|
|
|
|
Name: Loop Indent
|
|
|
|
=-=
|
|
for k, v in pairs({}) do
|
|
print(k, v)
|
|
end
|
|
|
|
while n < 10 do
|
|
n = n + 1
|
|
end
|
|
|
|
repeat
|
|
z = z * 2
|
|
until z > 12
|
|
=-=
|
|
for k, v in pairs({}) do
|
|
print(k, v)
|
|
end
|
|
|
|
while n < 10 do
|
|
n = n + 1
|
|
end
|
|
|
|
repeat
|
|
z = z * 2
|
|
until z > 12
|
|
=-=-=
|