elisp-tree-sitter icon indicating copy to clipboard operation
elisp-tree-sitter copied to clipboard

Friendlier printed representation

Open mickeynp opened this issue 3 years ago • 2 comments

Is it possible to replace the printed hash notation of nodes (or trees, I guess) with something more user friendly? I'm thinking #<some_node_type (1 . 5) ptr=...> or something to that effect: basically the node type and position range. That would make debugging and inspecting queries far easier.

Thanks.

mickeynp avatar Apr 11 '21 12:04 mickeynp

Dynamic modules cannot currently customize the printed representation of user_ptr objects. Some changes to Emacs's core is necessary to support that.

As a workaround, you can advise the printing and formatting functions: print, prin1, princ, format, format-message, message. I think adding functionalities to tsc to enable/disable such advices should be ok, for debugging purposes.

ubolonton avatar Apr 13 '21 16:04 ubolonton

Ah! Advising the printing functions: that's a good idea I had not considered. Thanks for your help.

mickeynp avatar Apr 13 '21 20:04 mickeynp