File tree Expand file tree Collapse file tree 1 file changed +2
-21
lines changed
lua/luasnip-latex-snippets/util Expand file tree Collapse file tree 1 file changed +2
-21
lines changed Original file line number Diff line number Diff line change @@ -12,27 +12,8 @@ local TEXT_NODES = {
1212 label_reference = true ,
1313}
1414
15- local function get_node_at_cursor ()
16- local pos = vim .api .nvim_win_get_cursor (0 )
17- -- Subtract one to account for 1-based row indexing in nvim_win_get_cursor
18- local row , col = pos [1 ] - 1 , pos [2 ]
19-
20- local parser = vim .treesitter .get_parser (0 , " latex" )
21- if not parser then
22- return
23- end
24-
25- local root_tree = parser :parse ({ row , col , row , col })[1 ]
26- local root = root_tree and root_tree :root ()
27- if not root then
28- return
29- end
30-
31- return root :named_descendant_for_range (row , col , row , col )
32- end
33-
3415function M .in_text (check_parent )
35- local node = get_node_at_cursor ( )
16+ local node = vim . treesitter . get_node ({ ignore_injections = false } )
3617 while node do
3718 if node :type () == " text_mode" then
3819 if check_parent then
@@ -53,7 +34,7 @@ function M.in_text(check_parent)
5334end
5435
5536function M .in_mathzone ()
56- local node = get_node_at_cursor ( )
37+ local node = vim . treesitter . get_node ({ ignore_injections = false } )
5738 while node do
5839 if TEXT_NODES [node :type ()] then
5940 return false
You can’t perform that action at this time.
0 commit comments