syntax: add pattern to boost tokenizer performance (#896)
This commit is contained in:
parent
a2d5a7a904
commit
951f0913da
|
@ -7,6 +7,11 @@ local plain_text_syntax = { name = "Plain Text", patterns = {}, symbols = {} }
|
||||||
|
|
||||||
|
|
||||||
function syntax.add(t)
|
function syntax.add(t)
|
||||||
|
-- this rule gives us a performance gain for the tokenizer in lines with
|
||||||
|
-- long amounts of consecutive spaces without affecting other patterns
|
||||||
|
if t.patterns then
|
||||||
|
table.insert(t.patterns, 1, { pattern = "%s+", type = "normal" })
|
||||||
|
end
|
||||||
table.insert(syntax.items, t)
|
table.insert(syntax.items, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue