elisp-tree-sitter
elisp-tree-sitter copied to clipboard
Friendlier printed representation
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.
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.
Ah! Advising the printing functions: that's a good idea I had not considered. Thanks for your help.