perf: jsregexp instead of lua pattern matching

This commit is contained in:
arne314
2024-12-04 00:24:09 +01:00
parent fe0da6738d
commit 39a73ca8cb
5 changed files with 18 additions and 13 deletions

View File

@@ -32,7 +32,14 @@ end
function M.snip(trigger, expand, insert, condition, priority)
priority = priority or 1000
return luasnip.snippet(
{ trig = trigger, regTrig = true, wordtrig = false, priority = priority, snippetType = 'autosnippet' },
{
trig = trigger,
trigEngine = 'ecma',
regTrig = true,
wordtrig = false,
priority = priority,
snippetType = 'autosnippet'
},
fmta(expand, { unpack(insert) }),
{
condition = function()
@@ -46,7 +53,7 @@ function M.snip(trigger, expand, insert, condition, priority)
end
function M.start_snip(trigger, expand, insert, condition, priority)
return M.snip('^%s*' .. trigger, expand, insert, condition, priority)
return M.snip('^\\s*' .. trigger, expand, insert, condition, priority)
end
function M.toggle_autosnippets()