mirror of
https://github.com/L3MON4D3/LuaSnip
synced 2024-09-16 21:54:03 +02:00
Format with stylua
This commit is contained in:
parent
dd3244f41c
commit
21efce7023
2 changed files with 58 additions and 42 deletions
|
@ -70,19 +70,8 @@ function M.pre_cut()
|
|||
-- store registers so we don't change any of them.
|
||||
-- "" is affected since we perform a cut (s), 1-9 also (although :h
|
||||
-- quote_number seems to state otherwise for cuts to specific registers..?).
|
||||
saved_registers = store_registers(
|
||||
"",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"z"
|
||||
)
|
||||
saved_registers =
|
||||
store_registers("", "1", "2", "3", "4", "5", "6", "7", "8", "9", "z")
|
||||
|
||||
-- store data needed for de-indenting lines.
|
||||
start_line = vim.fn.line("'<") - 1
|
||||
|
|
|
@ -29,148 +29,175 @@ describe("Selection", function()
|
|||
|
||||
feed("iasdf qwer<Esc>v^<Tab>")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
.asdf qwer.^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
|
||||
assert.is_true(exec_lua("return vim.deep_equal(vim.api.nvim_get_context({}).regs, regs_pre)"))
|
||||
assert.is_true(
|
||||
exec_lua(
|
||||
"return vim.deep_equal(vim.api.nvim_get_context({}).regs, regs_pre)"
|
||||
)
|
||||
)
|
||||
end)
|
||||
|
||||
it("works via manual keybinding.", function()
|
||||
exec_lua[[
|
||||
exec_lua([[
|
||||
vim.keymap.set({"x"}, "p", ls.select_keys, {silent = true})
|
||||
]]
|
||||
]])
|
||||
feed("iasdf qwer<Esc>v^p")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
.asdf qwer.^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("works with linewise-selection.", function()
|
||||
feed("iasdf qwer<Cr>asdf qwer<Cr>asdf qwer<Esc>Vkk<Tab>")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
.asdf qwer |
|
||||
asdf qwer |
|
||||
asdf qwer.^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("works with block-select.", function()
|
||||
feed("iasdf qwer<Cr>asdf qwer<Cr>asdf qwer")
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
asdf qwer |
|
||||
asdf qwer |
|
||||
asdf qwer^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
feed("<Esc><C-V>^kkllohh")
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
as{3:df qw}er |
|
||||
as{3:df qw}er |
|
||||
as{3:df q}^wer |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- VISUAL BLOCK --} |]]}
|
||||
{2:-- VISUAL BLOCK --} |]],
|
||||
})
|
||||
feed("<Tab>")
|
||||
feed("<Esc>Go")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
aser |
|
||||
aser |
|
||||
aser |
|
||||
.df qw |
|
||||
df qw |
|
||||
df qw.^ |
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("works with virtualedit.", function()
|
||||
feed(":set virtualedit=block<Cr>")
|
||||
feed("iasdf qwer<Cr>asdf qwer<Cr>asdf qwer")
|
||||
feed("<Esc><C-V>kkllll")
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
asdf qwe{3:r }^ |
|
||||
asdf qwe{3:r } |
|
||||
asdf qwe{3:r } |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- VISUAL BLOCK --} |]]}
|
||||
{2:-- VISUAL BLOCK --} |]],
|
||||
})
|
||||
feed("<Tab>")
|
||||
feed("<Esc>Go")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
asdf qwe |
|
||||
asdf qwe |
|
||||
asdf qwe |
|
||||
.r |
|
||||
r |
|
||||
r .^ |
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("works for multibyte characters.", function()
|
||||
feed("i 𝔼f-𝔼abc<Esc>vbb")
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
𝔼f^-{3:𝔼abc} |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- VISUAL --} |]]}
|
||||
{2:-- VISUAL --} |]],
|
||||
})
|
||||
feed("<Tab>")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
𝔼f.-𝔼abc.^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("works for combined characters.", function()
|
||||
feed("i ‖͚asdf‖͚qwer<Esc>vbbh")
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
‖͚asd^f{3:‖͚qwer} |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- VISUAL --} |]]}
|
||||
{2:-- VISUAL --} |]],
|
||||
})
|
||||
feed("<Tab>")
|
||||
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
|
||||
screen:expect{grid=[[
|
||||
screen:expect({
|
||||
grid = [[
|
||||
‖͚asd.f‖͚qwer.^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{2:-- INSERT --} |]]}
|
||||
{2:-- INSERT --} |]],
|
||||
})
|
||||
end)
|
||||
|
||||
it("does not destroy any registers.", function()
|
||||
end)
|
||||
it("does not destroy any registers.", function() end)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue