[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plug treesit.el into other emacs constructs
From: |
Kévin Le Gouguec |
Subject: |
Re: Plug treesit.el into other emacs constructs |
Date: |
Fri, 16 Dec 2022 11:02:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Stephen Leake <stephen_leake@stephe-leake.org> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> Cool, thanks, a few comments (based on my experience with adding
>> similar things based on `smie`):
>>
>>> ** Forward-sexp:
>>> Executing C-M-f repeatedly will go from:
>>> ```
>>> public void foo(|String bar, String baz) {}
>>> ```
>>> to
>>> ```
>>> public void foo(String bar|, String baz) {}
>>> ```
>>
>> That looks wrong. `String` is a valid AST node. Whether it gets a node
>> in tree-sitter or not, I don't know, but here there are several "sexps"
>> that start at point and I think `forward-sexp` should be conservative
>> and keep advancing by the smallest option.
>
> ada-mode has something similar; forward-sexp goes to the next labeled
> keyword. That's more useful than stopping at every little AST node. It
> relies on markup in the grammar to label the keywords; tree-sitter would
> need another markup similar to the current indent markup.
Chiming in since I got bitten by this in ada-mode right now: as someone
used to mark long_identifiers_with_underscores with C-M-SPC in other
modes, it's tripping me up that mark-sexp (and sexp movement in general)
"overshoots" and goes over much bigger expressions in ada-mode.
Identifiers are a unit I manipulate much more often than other kinds of
expressions, so it's useful for me to have C-M-* recognize them. I find
it tolerable to "spam" C-M-* when needed to move over bigger units; YMMV
🤷
- Re: Plug treesit.el into other emacs constructs, (continued)
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/14
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/15
- Re: Plug treesit.el into other emacs constructs, Yuan Fu, 2022/12/15
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/15
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/13
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/13
Re: Plug treesit.el into other emacs constructs, Stephen Leake, 2022/12/14