@@ -32,42 +32,12 @@ function M.out(node)
3232 return markdown_targets .out ()
3333 end
3434
35- -- Special handling for comments - try direct approach first
36- local cursor_pos = vim .api .nvim_win_get_cursor (0 )
37- local cursor_row , cursor_col = cursor_pos [1 ] - 1 , cursor_pos [2 ] -- Convert to 0-indexed
38-
39- -- Special handling for comments - direct approach to find containing declarations
40- local actual_node = vim .treesitter .get_node ({ pos = { cursor_row , cursor_col } })
41- if actual_node and actual_node :type ():match (" comment" ) then
42- -- Walk up the tree to find a class_declaration or function_declaration
43- local parent = actual_node :parent ()
44- while parent do
45- if parent :type () == " class_declaration" and nodes .is_jump_target (parent ) then
46- local target_row = nodes .get_srow (parent )
47- return parent , target_row
48- elseif parent :type () == " function_declaration" and nodes .is_jump_target (parent ) then
49- local target_row = nodes .get_srow (parent )
50- return parent , target_row
51- end
52- parent = parent :parent ()
53- end
54- end
55-
5635 local candidate = strategies .get_first_ancestor_with_diff_scol (node )
5736 -- If no ancestor with different column found, try to find the first valid ancestor
5837 if not candidate then
5938 candidate = strategies .get_first_ancestor_jump_target (node )
6039 end
6140
62- -- Handle comments: if we're in a comment and the candidate is a body node,
63- -- go to the declaration instead
64- if node :type ():match (" comment" ) and candidate and candidate :type ():match (" body" ) then
65- local declaration = candidate :parent ()
66- if declaration and nodes .is_jump_target (declaration ) then
67- candidate = declaration
68- end
69- end
70-
7141 candidate = coincident (candidate )
7242 if not candidate then return end
7343 local row = nodes .get_srow (candidate )
0 commit comments