LuaSnip
LuaSnip copied to clipboard
Getting Errors : Invalid 'col': out of range
Similar issue as https://github.com/L3MON4D3/LuaSnip/issues/239
These errors have been happning frequently for me - any recommendation for settings to update?
Does it happen because
....local/share/nvim/lazy/LuaSnip/lua/luasnip/util/mark.lua:136: Invalid 'col': out of range
Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ....local/share/nvim/lazy/LuaSnip/lua/luasnip/util/mark.lua:136: Invalid 'end_col': out of range
stack traceback:
[C]: in function 'nvim_buf_set_extmark'
....local/share/nvim/lazy/LuaSnip/lua/luasnip/util/mark.lua:136: in function 'set_opts'
....local/share/nvim/lazy/LuaSnip/lua/luasnip/util/mark.lua:199: in function 'update_opts'
...local/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/node.lua:178: in function 'input_leave'
...local/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/util.lua:109: in function 'leave_nodes_between'
...local/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/util.lua:565: in function 'refocus'
...kuro/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:675: in function 'exit_out_of_region'
...ro/.local/share/nvim/lazy/LuaSnip/lua/luasnip/config.lua:103: in function <...ro/.local/share/nvim/lazy/LuaSnip/lua/luasnip/config.lua:102>
function Mark:pos_begin_end_raw()
local mark_info = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, self.id, { details = true })
return { mark_info[1], mark_info[2] }, {
mark_info[3].end_row,
mark_info[3].end_col,
}
end
Config
local types = require('luasnip.util.types')
local ls = require('luasnip')
ls.setup({
keep_roots = true,
link_roots = true,
link_children = true,
-- Update more often, :h events for more info.
update_events = 'TextChanged,TextChangedI',
-- Snippets aren't automatically removed if their text is deleted.
-- `delete_check_events` determines on which events (:h events) a check for
-- deleted snippets is performed.
-- This can be especially useful when `history` is enabled.
-- delete_check_events = 'TextChanged,InsertLeave',
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { 'choiceNode', 'Comment' } },
},
},
},
-- Controls highlight priority - set to avoid conflicts
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
--- for now disable autosnippets (expand on their own)
enable_autosnippets = false,
--- @TM_SELECTED_TEXT` not set by default - key to trigger
--- In Visual mode pressing <TAB> will store the text - then when
--- TM_SELECTED_TEXT used - it uses that data
store_selection_keys = '<Tab>',
-- ft func used to get the current active filetype
--ft_func = function()
-- return vim.split(vim.bo.filetype, '.', true) --- @diagnostic disable-line
--end,
})