-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
(let* ((parser (tsc-make-parser))
(parsed (progn
(tsc-set-language parser (tree-sitter-require 'python))
(tsc-root-node (tsc-parse-string parser "def dupa(foo):")))))
(message "parsed is %s" parsed)
(tsc-traverse-mapc (lambda (node)
(let ((parent (tsc-get-parent node)))
(when (and parent
(zerop (tsc-count-children parent)))
(error "Our parent has zero children!? %s" (tsc-node-to-sexp node)))))
parsed))This results in:
tsc-traverse-mapc: Our parent has zero children!? ("_newline")
For some reason, the node returns the trailing ":" as its parent, but it is actually its sibling in the traversal order (ie. (tsc-node-eq node (tsc-get-next-sibling parent)) => t).
Metadata
Metadata
Assignees
Labels
No labels