Use tree-sitter to extract the context near the cursor

A first iteration for #237 (closed).

Algorithm:

  1. Find the coordinate point of the cursor (row,col). The cursor is always at the end of the prefix.
  2. Traverse the tree and collect only nodes that have their end point equal to the cursor's point.

image

  1. Traverse the list of collected nodes in reverse (going up the tree) and choose the most relevant node type. The most relevant node type is language-specific

image

Edited by Bruno Cardoso

Merge request reports

Loading