syntax: add pattern to boost tokenizer performance (#896)

This commit is contained in:
Jefferson González 2022-03-25 11:25:32 -04:00 committed by GitHub
parent a2d5a7a904
commit 951f0913da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,11 @@ local plain_text_syntax = { name = "Plain Text", patterns = {}, symbols = {} }
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)
end