mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 05:24:24 -05:00
fix(snip): use wordtrig for short triggers
This commit is contained in:
@@ -44,14 +44,15 @@ function M.ri(insert_node_id)
|
|||||||
return luasnip.function_node(function(args) return args[1][1] end, insert_node_id)
|
return luasnip.function_node(function(args) return args[1][1] end, insert_node_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.snip(trigger, expand, insert, condition, priority)
|
function M.snip(trigger, expand, insert, condition, priority, wordTrig)
|
||||||
priority = priority or 1000
|
priority = priority or 1000
|
||||||
|
if wordTrig == nil then wordTrig = #trigger <= 2 end
|
||||||
return luasnip.snippet(
|
return luasnip.snippet(
|
||||||
{
|
{
|
||||||
trig = trigger,
|
trig = trigger,
|
||||||
trigEngine = M.engine,
|
trigEngine = M.engine,
|
||||||
trigEngineOpts = { condition = condition },
|
trigEngineOpts = { condition = condition },
|
||||||
wordTrig = false,
|
wordTrig = wordTrig,
|
||||||
priority = priority,
|
priority = priority,
|
||||||
snippetType = 'autosnippet',
|
snippetType = 'autosnippet',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ local smart_wrap = function(args, parent, old_state, expand)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, val in pairs(operations) do
|
for _, val in pairs(operations) do
|
||||||
table.insert(snippets, snip(val[1], '<>', { d(1, smart_wrap, {}, { user_args = { val } }) }, math))
|
table.insert(snippets, snip(val[1], '<>', { d(1, smart_wrap, {}, { user_args = { val } }) }, math, 1500, false))
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user