mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 05:24:24 -05:00
fix(snip): ignore conflicts in markup indices
This commit is contained in:
@@ -73,10 +73,10 @@ trigger_index_post = table.concat(common_indices, '|')
|
|||||||
|
|
||||||
local get_greek = function(_, snippet) return s(nil, t(greek_letters_map[snippet.captures[1]])) end
|
local get_greek = function(_, snippet) return s(nil, t(greek_letters_map[snippet.captures[1]])) end
|
||||||
|
|
||||||
local get_index = function(_, snippet, _, idx1, idx2)
|
local get_index = function(_, snippet, _, idx1, idx2, check_conflict)
|
||||||
local letter, index = snippet.captures[idx1], snippet.captures[idx2]
|
local letter, index = snippet.captures[idx1], snippet.captures[idx2]
|
||||||
local trigger = letter .. index
|
local trigger = letter .. index
|
||||||
if index_conflicts_set[trigger] then return s(nil, t(trigger)) end
|
if check_conflict and index_conflicts_set[trigger] then return s(nil, t(trigger)) end
|
||||||
return s(nil, t(letter .. '_' .. index))
|
return s(nil, t(letter .. '_' .. index))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ return {
|
|||||||
snip(
|
snip(
|
||||||
'\\$(' .. trigger_index_pre .. ')\\$' .. ' (' .. trigger_index_post .. ')([^\\w])',
|
'\\$(' .. trigger_index_pre .. ')\\$' .. ' (' .. trigger_index_post .. ')([^\\w])',
|
||||||
'$<>$<>',
|
'$<>$<>',
|
||||||
{ d(1, get_index, {}, { user_args = { 1, 2 } }), d(2, prepend_space, {}, { user_args = { 3 } }) },
|
{ d(1, get_index, {}, { user_args = { 1, 2, false } }), d(2, prepend_space, {}, { user_args = { 3 } }) },
|
||||||
markup,
|
markup,
|
||||||
500,
|
500,
|
||||||
true,
|
true,
|
||||||
@@ -122,7 +122,7 @@ return {
|
|||||||
snip(
|
snip(
|
||||||
'(' .. trigger_index_pre .. ')' .. '(' .. trigger_index_post .. ')([^\\w])',
|
'(' .. trigger_index_pre .. ')' .. '(' .. trigger_index_post .. ')([^\\w])',
|
||||||
'<><>',
|
'<><>',
|
||||||
{ d(1, get_index, {}, { user_args = { 1, 2 } }), d(2, prepend_space, {}, { user_args = { 3 } }) },
|
{ d(1, get_index, {}, { user_args = { 1, 2, true } }), d(2, prepend_space, {}, { user_args = { 3 } }) },
|
||||||
math,
|
math,
|
||||||
200,
|
200,
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in New Issue
Block a user