From c574208de4b69c3f259df17c2d760535cd8fede2 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 4 Jan 2025 21:53:53 -0800 Subject: [PATCH] fix: Fix luasnip helpers.fill --- nvim/lua/snippets/helpers.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nvim/lua/snippets/helpers.lua b/nvim/lua/snippets/helpers.lua index 03ca79f..0ae8842 100644 --- a/nvim/lua/snippets/helpers.lua +++ b/nvim/lua/snippets/helpers.lua @@ -1,24 +1,24 @@ -local ls = require("luasnip") +local ls = require('luasnip') local sn = ls.snippet_node local i = ls.insert_node local M = {} M.fill = function(_, parent, args) - local title = "" + local title = '' local chars = {} - if #parent.snippet.env.LS_SELECT_RAW > 0 then + if type(parent.snippet.env.LS_SELECT_RAW) == 'table' then for _, ele in ipairs(parent.snippet.env.LS_SELECT_RAW) do - title = title .. ele .. " " + title = title .. ele .. ' ' end end - for str in string.gmatch(args, "([^%%]+)") do + for str in string.gmatch(args, '([^%%]+)') do table.insert(chars, str) end - local snip = chars[1] .. " " .. title + local snip = chars[1] .. ' ' .. title local _, c = unpack(vim.api.nvim_win_get_cursor(0))