From 450d4bb15f6f0b1981c26d811182e1edbc2e03e3 Mon Sep 17 00:00:00 2001 From: Aqil Contractor Date: Mon, 19 Dec 2022 05:52:17 -0500 Subject: Fix bug with rainbowparen.lua messing with the ability to comment out lines. (#170) --- plugins/rainbowparen.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins/rainbowparen.lua') diff --git a/plugins/rainbowparen.lua b/plugins/rainbowparen.lua index 6ca4cb4..075667e 100644 --- a/plugins/rainbowparen.lua +++ b/plugins/rainbowparen.lua @@ -20,6 +20,7 @@ style.syntax.paren4 = style.syntax.paren4 or { common.color "#52dab2"} style.syntax.paren5 = style.syntax.paren5 or { common.color "#5a98cf"} local tokenize = tokenizer.tokenize +local extract_subsyntaxes = tokenizer.extract_subsyntaxes local closers = { ["("] = ")", ["["] = "]", @@ -30,6 +31,13 @@ local function parenstyle(parenstack) return "paren" .. ((#parenstack % config.plugins.rainbowparen.parens) + 1) end +function tokenizer.extract_subsyntaxes(base_syntax, state) + if not config.plugins.rainbowparen.enabled then + return extract_subsyntaxes(base_syntax, state) + end + return extract_subsyntaxes(base_syntax, state.istate) +end + function tokenizer.tokenize(syntax, text, state) if not config.plugins.rainbowparen.enabled then return tokenize(syntax, text, state) -- cgit v1.2.3