Function: combobulate-proxy-node-to-real-node

combobulate-proxy-node-to-real-node is a natively compiled function defined in combobulate-interface.el.

Signature

(combobulate-proxy-node-to-real-node PROXY-NODE)

Documentation

Attempt to find the real tree-sitter node PROXY-NODE points to.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-interface.el
(defun combobulate-proxy-node-to-real-node (proxy-node)
  "Attempt to find the real tree-sitter node PROXY-NODE points to."
  (when proxy-node
    ;; if we are holding on to a valid treesit node then just pass
    ;; that on provided it's still useful.
    (cond
     ;; todo: disabled until it is possible to detect if a node belongs to a deleted parser
     ;; (or (treesit-node-check (combobulate-proxy-node-node proxy-node) 'outdated)
     ;;     (treesit-node-check (combobulate-proxy-node-node proxy-node) 'missing))
     ;; check if proxy-node is even a proxy node
     ((not (combobulate-proxy-node-p proxy-node)) proxy-node)
     (t (save-excursion
          (combobulate--goto-node proxy-node)
          (car-safe (seq-filter (lambda (pt-node)
                                  (and
                                   (equal (cons (marker-position (car (combobulate-node-range proxy-node)))
                                                (marker-position (cdr (combobulate-node-range proxy-node))))
                                          (combobulate-node-range pt-node))
                                   (equal (combobulate-node-type pt-node)
                                          (combobulate-node-type proxy-node))
                                   (or (equal (combobulate-node-field-name pt-node)
                                              (combobulate-node-field-name proxy-node))
                                       t)))
                                (combobulate-filter-nodes
                                 (combobulate-all-nodes-at-point)
                                 :keep-types (list (combobulate-node-type proxy-node))))))))))