drym-org / symex.el

An intuitive way to edit Lisp symbolic expressions ("symexes") structurally in Emacs
Other
271 stars 22 forks source link

Tree-sitter: Make movements consistent with Lisp #83

Open countvajhula opened 1 year ago

countvajhula commented 1 year ago

In the tree sitter node navigation commands, "named" visits too few nodes, while "all of them" visits too many. I'd say we're looking for the behavior that "all" has, except that it shouldn't visit punctuation like , and closing delimiters like ].

(a) Does tree-sitter provide some metadata on the node that we could use to tell that it's "empty", e.g. punctuation or a closing delimiter? If it does, then we could use the "all" behavior while avoiding such "empty" nodes.

(b) Another (less desirable) possibility is to have an exclusion list that skips over these at the symex level.

(c) A third possibility is to do nothing and leave it as "named" nodes, especially if we agree it would be preferable to option (b) above (e.g. would (b) require maintaining separate exclusion lists for different languages?).

Additional context: see this comment and the responses.