summaryrefslogtreecommitdiff
path: root/lua/lvim
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-11-25 14:36:01 +0100
committeropalmay <[email protected]>2023-02-06 21:40:05 +0200
commit070565d5735432b6c5c380e87cdfaaf4a98dc12b (patch)
tree88941f7d6d59d9cf00765fe31c473cb85c8a1a35 /lua/lvim
parent449a19874c5fa8096f61192d00e3df6d665e6fe3 (diff)
chore: formatting
Diffstat (limited to 'lua/lvim')
-rw-r--r--lua/lvim/core/luasnip.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lua/lvim/core/luasnip.lua b/lua/lvim/core/luasnip.lua
index dde61e5b..8dd704f6 100644
--- a/lua/lvim/core/luasnip.lua
+++ b/lua/lvim/core/luasnip.lua
@@ -64,7 +64,7 @@ end
---when inside a snippet, seeks to the nearest luasnip field if possible, and checks if it is jumpable
---@param dir number 1 for forward, -1 for backward; defaults to 1
----@return boolean true if a jumpable luasnip field is found while inside a snippet
+---@return boolean|nil true if a jumpable luasnip field is found while inside a snippet
local function jumpable(dir)
local luasnip_ok, luasnip = pcall(require, "luasnip")
if not luasnip_ok then
@@ -110,7 +110,7 @@ local function jumpable(dir)
local n_next = node.next
local next_pos = n_next and n_next.mark:pos_begin()
local candidate = n_next ~= snippet and next_pos and (pos[1] < next_pos[1])
- or (pos[1] == next_pos[1] and pos[2] < next_pos[2])
+ or (pos[1] == next_pos[1] and pos[2] < next_pos[2])
-- Past unmarked exit node, exit early
if n_next == nil or n_next == snippet.next then
@@ -149,7 +149,8 @@ local function jumpable(dir)
end
if dir == -1 then
- return luasnip.in_snippet() and luasnip.jumpable(-1) else
+ return luasnip.in_snippet() and luasnip.jumpable(-1)
+ else
return luasnip.in_snippet() and seek_luasnip_cursor_node() and luasnip.jumpable(1)
end
end