Skip to content

Commit

Permalink
Format with stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 committed Oct 28, 2024
1 parent 0b91570 commit 2c08f32
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
4 changes: 3 additions & 1 deletion lua/luasnip/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ c = {
end)
if session.config.enable_autosnippets then
ls_autocmd("InsertCharPre", function()
require("luasnip.util.feedkeys").feedkeys_insert("<cmd>lua require('luasnip').expand_auto()<cr>")
require("luasnip.util.feedkeys").feedkeys_insert(
"<cmd>lua require('luasnip').expand_auto()<cr>"
)
end)
end

Expand Down
16 changes: 12 additions & 4 deletions lua/luasnip/util/feedkeys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ local enqueued_actions = {}
local function _feedkeys_insert(id, keys)
executing_id = id
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes(keys .. "<cmd>lua require('luasnip.util.feedkeys').confirm(" .. id .. ")<cr>", true, false, true),
vim.api.nvim_replace_termcodes(
keys
.. "<cmd>lua require('luasnip.util.feedkeys').confirm("
.. id
.. ")<cr>",
true,
false,
true
),
-- folds are opened manually now, no need to pass t.
-- n prevents langmap from interfering.
"ni",
Expand Down Expand Up @@ -132,9 +140,9 @@ end
function M.confirm(id)
executing_id = nil

if enqueued_actions[id+1] then
enqueued_actions[id+1](id+1)
enqueued_actions[id+1] = nil
if enqueued_actions[id + 1] then
enqueued_actions[id + 1](id + 1)
enqueued_actions[id + 1] = nil
end
end

Expand Down
12 changes: 8 additions & 4 deletions tests/integration/session_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,8 @@ describe("session", function()
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --recording @a} |]] })
{2:-- INSERT --recording @a} |]],
})
change()
jump()
screen:expect({
Expand Down Expand Up @@ -2190,7 +2191,8 @@ describe("session", function()
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --recording @a} |]] })
{2:-- INSERT --recording @a} |]],
})
change()
feed("aa")
jump()
Expand Down Expand Up @@ -2229,7 +2231,8 @@ describe("session", function()
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --recording @a} |]] })
{2:-- INSERT --recording @a} |]],
})
feed("cc<Esc>Gqo<Esc>@a")
screen:expect({
grid = [[
Expand Down Expand Up @@ -2262,6 +2265,7 @@ describe("session", function()
{0:~ }|
{0:~ }|
{0:~ }|
|]] })
|]],
})
end)
end)
3 changes: 2 additions & 1 deletion tests/integration/snippet_basics_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,7 @@ describe("snippets_basic", function()
grid = [[
qwer |
qwe^r |
|]]})
|]],
})
end)
end)

0 comments on commit 2c08f32

Please sign in to comment.