perf(snip): don't rely on luasnip wordtrig

This commit is contained in:
arne314
2025-01-14 19:31:00 +01:00
parent 5ccdf56f6f
commit fc7d5b5101
3 changed files with 16 additions and 16 deletions

View File

@@ -44,14 +44,14 @@ 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, wordTrig) function M.snip(trigger, expand, insert, condition, priority)
priority = priority or 1000 priority = priority or 1000
return luasnip.snippet( return luasnip.snippet(
{ {
trig = trigger, trig = trigger,
trigEngine = M.engine, trigEngine = M.engine,
trigEngineOpts = { condition = condition }, trigEngineOpts = { condition = condition },
wordTrig = wordTrig, wordTrig = false,
priority = priority, priority = priority,
snippetType = 'autosnippet', snippetType = 'autosnippet',
}, },

View File

@@ -34,28 +34,28 @@ return {
snip('ge', '>>= ', {}, math), snip('ge', '>>= ', {}, math),
-- operators -- operators
snip('ak([^k ])', '+ <>', { cap(1) }, math, 100, false), snip('ak([^k ])', '+ <>', { cap(1) }, math, 100),
snip('sk([^k ])', '- <>', { cap(1) }, math, 100, false), snip('sk([^k ])', '- <>', { cap(1) }, math, 100),
snip('oak', 'plus.circle ', {}, math, 1100), snip('oak', 'plus.circle ', {}, math),
snip('bak', 'plus.square ', {}, math, 1100), snip('bak', 'plus.square ', {}, math),
snip('mak', 'plus.minus ', {}, math, 1100), snip('mak', 'plus.minus ', {}, math),
snip('xx', 'times ', {}, math), snip('xx', 'times ', {}, math, 900),
snip('oxx', 'times.circle ', {}, math), snip('oxx', 'times.circle ', {}, math),
snip('bxx', 'times.square ', {}, math), snip('bxx', 'times.square ', {}, math),
-- sets -- sets
-- 'st' to '{<>} in ./visual.lua -- 'st' to '{<>} in ./visual.lua
snip('set', '{<> | <>}', { i(1), i(2) }, math), snip('set', '{<> | <>}', { i(1), i(2) }, math),
snip('es', 'emptyset ', {}, math), snip('es', 'emptyset ', {}, math, 900),
snip('ses', '{emptyset} ', {}, math), snip('ses', '{emptyset} ', {}, math),
snip('sp', 'supset ', {}, math), snip('sp', 'supset ', {}, math),
snip('sb', 'subset ', {}, math), snip('sb', 'subset ', {}, math),
snip('sep', 'supset.eq ', {}, math), snip('sep', 'supset.eq ', {}, math),
snip('seb', 'subset.eq ', {}, math), snip('seb', 'subset.eq ', {}, math),
snip('nn', 'sect ', {}, math), snip('nn', 'sect ', {}, math, 900),
snip('uu', 'union ', {}, math), snip('uu', 'union ', {}, math, 900),
snip('bnn', 'sect.big ', {}, math, 1100), snip('bnn', 'sect.big ', {}, math),
snip('buu', 'union.big ', {}, math, 1100), snip('buu', 'union.big ', {}, math),
snip('swo', 'without ', {}, math), snip('swo', 'without ', {}, math),
-- misc -- misc
@@ -73,12 +73,12 @@ return {
snip('(.*)kk', '<>^(<>)', { cap(1), i(1, 'n') }, math), snip('(.*)kk', '<>^(<>)', { cap(1), i(1, 'n') }, math),
snip('ddx', '(d <>)(d <>)', { i(1, 'f'), i(2, 'x') }, math), snip('ddx', '(d <>)(d <>)', { i(1, 'f'), i(2, 'x') }, math),
snip('it', 'integral', {}, math),
snip('int', 'integral_(<>)^(<>)', { i(1, 'a'), i(2, 'b') }, math), snip('int', 'integral_(<>)^(<>)', { i(1, 'a'), i(2, 'b') }, math),
snip('oit', 'integral_Omega', {}, math), snip('oit', 'integral_Omega', {}, math),
snip('dit', 'integral_(<>)', { i(1, 'Omega') }, math), snip('dit', 'integral_(<>)', { i(1, 'Omega') }, math),
snip('it', 'integral ', {}, math, 900),
snip('sm', 'sum ', {}, math), snip('sm', 'sum ', {}, math, 900),
snip('sum', 'sum_(<>)^(<>)', { i(1, 'i=0'), i(2, 'oo') }, math), snip('sum', 'sum_(<>)^(<>)', { i(1, 'i=0'), i(2, 'oo') }, math),
snip('osm', 'sum_Omega', {}, math), snip('osm', 'sum_Omega', {}, math),
snip('dsm', 'sum_(<>)', { i(1, 'I') }, math), snip('dsm', 'sum_(<>)', { i(1, 'I') }, math),

View File

@@ -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, 1000, false)) table.insert(snippets, snip(val[1], '<>', { d(1, smart_wrap, {}, { user_args = { val } }) }, math))
end end
return { return {