Skip to content

Commit 5fdf7e1

Browse files
committed
Performance Boost.
1 parent 8fe303e commit 5fdf7e1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lua/luasnip-latex-snippets/util/ts_utils.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function M.in_text(check_parent)
4949
return true
5050
end
5151

52-
function M.in_mathzone()
52+
local in_mathzone = false
53+
54+
local function check_in_mathzone()
5355
local node = get_node_at_cursor()
5456
while node do
5557
if node:type() == "text_mode" then
@@ -62,4 +64,14 @@ function M.in_mathzone()
6264
return false
6365
end
6466

67+
vim.api.nvim_buf_attach(0, false, {
68+
on_lines = function(...)
69+
in_mathzone = check_in_mathzone()
70+
end,
71+
})
72+
73+
function M.in_mathzone()
74+
return in_mathzone
75+
end
76+
6577
return M

0 commit comments

Comments
 (0)