;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'tree-sitter) #@56 Buffer used to display the syntax tree of this buffer. (defvar tree-sitter-debug--tree-buffer nil (#$ . 110)) (make-variable-buffer-local 'tree-sitter-debug--tree-buffer) #@80 Source buffer of the syntax tree displayed in this `tree-sitter-debug' buffer. (defvar tree-sitter-debug--source-code-buffer nil (#$ . 287)) (byte-code "\300\301!\210\302\303\304\305\306\307%\210\310\311\312\313\314DD\315\316\317\306\303&\210\310\320\312\313\321DD\322\316\317\306\303&\207" [make-variable-buffer-local tree-sitter-debug--source-code-buffer custom-declare-group tree-sitter-debug nil "Tree sitter debug and display features." :group tree-sitter custom-declare-variable tree-sitter-debug-jump-buttons funcall function #[0 "\300\207" [nil] 1] "Whether to enable jump-to-node buttons in `tree-sitter-debug' views.\nThis can have a performance penalty in large buffers." :type boolean tree-sitter-debug-highlight-jump-region #[0 "\300\207" [nil] 1] "Whether to highlight the node jumped to.\nThis only takes effect if `tree-sitter-debug-jump-buttons' is non-nil."] 8) #@81 The function to call when a `tree-sitter-debug' BUTTON is clicked. (fn BUTTON) (defalias 'tree-sitter-debug--button-node-lookup #[257 "\204\301\302!\210\303!\204\304\305!\210\211\204\304\306!\210\307\310\311\"\"\207" [tree-sitter-debug--source-code-buffer error "No source code buffer set" buffer-live-p user-error "Source code buffer has been killed" "This function must be called on a button" tree-sitter-debug--goto-node button-get points-to] 6 (#$ . 1175)]) #@78 Switch to BUFFER, centering on the region defined by NODE. (fn BUFFER NODE) (defalias 'tree-sitter-debug--goto-node #[514 "\301!\210\302!\211@b\210\303A\304#\207" [tree-sitter-debug-highlight-jump-region switch-to-buffer-other-window tsc-node-position-range push-mark t] 7 (#$ . 1654)]) #@83 Display NODE that appears at the given DEPTH in the syntax tree. (fn NODE DEPTH) (defalias 'tree-sitter-debug--display-node #[514 "\301\302_\303\"c\210\304\305\306!\"\203\"\307\310\311\312\313\314 &\266\202&\211c\266\315\316\317\"\"\207" [tree-sitter-debug-jump-buttons make-string 2 32 format "%s:\n" tsc-node-type insert-button action tree-sitter-debug--button-node-lookup follow-link t points-to tsc-mapc-children make-closure #[257 "\301!\205 \302\300T\"\207" [V0 tsc-node-named-p tree-sitter-debug--display-node] 4 "\n\n(fn C)"]] 11 (#$ . 1952)]) #@56 Display the current `tree-sitter-tree'. (fn OLD-TREE) (defalias 'tree-sitter-debug--display-tree #[257 "\211\205r q\210\302 \210\303\304!\305\")\207" [tree-sitter-tree tree-sitter-debug--tree-buffer erase-buffer tree-sitter-debug--display-node tsc-root-node 0] 5 (#$ . 2526)]) #@53 Set up syntax tree debugging in the current buffer. (defalias 'tree-sitter-debug--setup #[0 "\302!\204\303\304\305\306 \"!prq\210\211)\210\307\310\311\312\313$\210\307\314\315\312\313$\210\316!\210\311\312!\207" [tree-sitter-debug--tree-buffer tree-sitter-debug--source-code-buffer buffer-live-p get-buffer-create format "tree-sitter-tree: %s" buffer-name add-hook tree-sitter-after-change-functions tree-sitter-debug--display-tree nil :local kill-buffer-hook tree-sitter-debug--teardown display-buffer] 5 (#$ . 2814)]) #@56 Tear down syntax tree debugging in the current buffer. (defalias 'tree-sitter-debug--teardown #[0 "\301\302\303\304#\210\305!\205\306!\210\307\211\207" [tree-sitter-debug--tree-buffer remove-hook tree-sitter-after-change-functions tree-sitter-debug--display-tree :local buffer-live-p kill-buffer nil] 4 (#$ . 3347)]) #@113 Non-nil if Tree-Sitter-Debug mode is enabled. Use the command `tree-sitter-debug-mode' to change this variable. (defvar tree-sitter-debug-mode nil (#$ . 3676)) (make-variable-buffer-local 'tree-sitter-debug-mode) #@701 Toggle syntax tree debugging for the current buffer. This mode displays the syntax tree in another buffer, and keeps it up-to-date. This is a minor mode. If called interactively, toggle the `Tree-Sitter-Debug mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `tree-sitter-debug-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'tree-sitter-debug-mode #[256 "\303 \304=\203 ?\202\247\203\305W\203\306\202\307\310\301!\2031\311\300 \"\2031\300 B\203V\307C\312\313\"\216\n\204C\302 \210\314 \210\211\306\240\210)\210\315\316\317\306\320$\210\202Y\321 \210\322\323\203c\324\202d\325\"\210\326\327!\203\206\303 \203x\211\303 \232\203\206\330\331\203\202\332\202\203\333\334#\210\210\335 \210\207" [tree-sitter-debug-mode local-minor-modes tree-sitter-mode current-message toggle 1 nil t boundp delq make-closure #[0 "\300\242\205 \302\303 \207" [V0 tree-sitter-debug-mode nil tree-sitter-debug--teardown] 1] tree-sitter-debug--setup add-hook tree-sitter--before-off-hook (lambda nil (tree-sitter-debug-mode -1)) :local tree-sitter-debug--teardown run-hooks tree-sitter-debug-mode-hook tree-sitter-debug-mode-on-hook tree-sitter-debug-mode-off-hook called-interactively-p any message "Tree-Sitter-Debug mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 7 (#$ . 3896) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar tree-sitter-debug-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\310\313\300!\205#\310\211%\207" [tree-sitter-debug-mode-map tree-sitter-debug-mode-hook variable-documentation put "Hook run after entering or leaving `tree-sitter-debug-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode tree-sitter-debug-mode boundp] 6) #@509 Execute query PATTERNS against the current syntax tree and return captures. If the optional arg MATCHES is non-nil, matches (from `tsc-query-matches') are returned instead of captures (from `tsc-query-captures'). If the optional arg TAG-ASSIGNER is non-nil, it is passed to `tsc-make-query' to assign custom tags to capture names. This function is primarily useful for debugging purpose. Other packages should build queries and cursors once, then reuse them. (fn PATTERNS &optional MATCHES TAG-ASSIGNER) (defalias 'tree-sitter-debug-query #[769 "\302#\303 !\214~\210\203\304\305#\202\306\305#)\207" [tree-sitter-language tree-sitter-tree tsc-make-query tsc-root-node tsc-query-matches tsc--buffer-substring-no-properties tsc-query-captures] 9 (#$ . 6236)]) (provide 'tree-sitter-debug)