Skip to content

Commit

Permalink
Format with stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 committed Feb 14, 2024
1 parent 92789d4 commit 81d83ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 10 additions & 4 deletions lua/luasnip/nodes/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
14 changes: 4 additions & 10 deletions tests/integration/snippet_basics_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 81d83ec

Please sign in to comment.