IDE Language Tools โ
Problem โ
Hover, go-to-definition, and symbol lists need precise, fast answers about the code under the cursor.
Why tree-sitter.zig helps โ
gotoDescendant(offset) answers "what is under the cursor" in one dive; compiled queries answer "every X in this file" in one walk.
API โ
TreeCursor.gotoDescendant, Node.parent, Query + QueryCursor.
Architecture โ
text
Cursor event โ gotoDescendant โ parent chain โ definition lookup
File open โ execute (identifier) @id โ document symbolsExample โ
zig
var cursor = tree.cursor();
defer cursor.deinit();
cursor.gotoDescendant(click_byte);
const def_node = cursor.currentNode().parent();