Format with stylua

This commit is contained in:
L3MON4D3 2024-02-14 17:00:05 +00:00 committed by github-actions[bot]
parent 1a6043b704
commit 9bd796b4d5
2 changed files with 14 additions and 14 deletions

View file

@ -519,8 +519,11 @@ local function refocus(from, to)
-- here.
-- snippet does not have input_leave_children, so only input_leave
-- needs to be called.
ok2 =
pcall(from.parent.snippet.input_leave, from.parent.snippet, true)
ok2 = pcall(
from.parent.snippet.input_leave,
from.parent.snippet,
true
)
end
if not ok1 or not ok2 then
from.parent.snippet:remove_from_jumplist()
@ -536,8 +539,11 @@ local function refocus(from, to)
ok3 = true
else
ok2 = pcall(leave_nodes_between, node.parent.snippet, node, true)
ok3 =
pcall(node.parent.snippet.input_leave, node.parent.snippet, true)
ok3 = pcall(
node.parent.snippet.input_leave,
node.parent.snippet,
true
)
end
if not ok1 or not ok2 or not ok3 then

View file

@ -1433,23 +1433,17 @@ describe("snippets_basic", function()
end)
it("node-event is not triggered twice for exitNode.", function()
exec_lua[[
exec_lua([[
counter = 0
snip = s("mk", t"asdf", {callbacks = {[-1] = {[events.leave] = function()
counter = counter + 1
end}}})
]]
]])
exec_lua([[ls.snip_expand(snip)]])
assert.are.same(
1,
exec_lua("return counter")
)
assert.are.same(1, exec_lua("return counter"))
-- +1 for entering the exit-node of the second expansion.
exec_lua([[ls.snip_expand(snip)]])
assert.are.same(
2,
exec_lua("return counter")
)
assert.are.same(2, exec_lua("return counter"))
end)
end)