GNU bug report logs -
#62238
30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Previous Next
Full log
Message #20 received at 62238 <at> debbugs.gnu.org (full text, mbox):
Daniel Martín <mardani29 <at> yahoo.es> writes:
> Yuan Fu <casouri <at> gmail.com> writes:
>
>>
>> I tested this on my Emacs session and vanilla session, and both marked
>> to the closing bracket. I believe forward-sexp should just work by the
>> syntax table. Perhaps it’s your config or something?
>>
>
> You need to enable c-ts-mode first, which redirects
> forward-sexp-function to treesit-forward-sexp.
I see in treesit.el that we set forward-sexp-function to
treesit-forward-sexp when treesit-sexp-type-regexp is set by the major
mode. For languages with simple grammars, like C, I think that the
current approach that uses the syntax table is simpler and less prone to
errors, because the Tree-sitter function is general and should work for
every language. I'd suggest we don't define treesit-sexp-type-regexp in
c-ts-mode, at least for C.
For languages like TypeScript, whose grammar is more complex, perhaps
forward-sexp does not work very well and using Tree-sitter to implement
it gives better results with code that is simpler to understand.
Thanks.
This bug report was last modified 2 years and 133 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.