[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68993: treesitter support for forward-sexp-default-function
From: |
Yuan Fu |
Subject: |
bug#68993: treesitter support for forward-sexp-default-function |
Date: |
Sun, 11 Feb 2024 17:28:03 -0800 |
> On Feb 10, 2024, at 9:46 AM, Juri Linkov <juri@linkov.net> wrote:
>
> Hi Yuan,
>
> Do you think 'comment' is a suitable name for 'treesit-forward-sexp'?
> I'm unsure even if 'text' is a good name for 'treesit-forward-sentence'.
> But at least these two should be consistent with each another.
>
> Maybe better to add the prefix 'default-' to both?
> This will hint that the default function is used.
>
> Then 'treesit-forward-sentence' will support types
> 'sentence' and 'default-sentence'.
> And 'treesit-forward-sexp' will support types
> 'sexp' and 'default-sexp'.
First there’s the “text” definition, then treesit-forward-sentence uses it as a
heuristic to get better results in comments and strings, rather than the other
way around. So for me it doesn’t make much sense to say if “text” is good or
bad name for treesit-forward-sentence—it’s not for treesit-forward-sentence to
start with.
My suggestion would be for both treesit-forward-sentence and -sexp to use
“text” for their heuristic. If someone wants more customized behavior, they can
always write a custom forward-sentence/sexp function.
Yuan