[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree sitter support for C-like languages
From: |
Eli Zaretskii |
Subject: |
Re: Tree sitter support for C-like languages |
Date: |
Sun, 13 Nov 2022 11:56:13 +0200 |
> From: Theodor Thornhill <theo@thornhill.no>
> Cc: casouri@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca
> Date: Sun, 13 Nov 2022 10:40:26 +0100
>
> > But if I add an empty line at BOB, the fontification becomes as
> > expected, and doesn't go back to font-lock-warning-face even if I then
> > remove that empty line.
> >
>
> This is likely due to either treesit or tree-sitter or tree-sitter-c not
> dealing properly with the root node. Maybe Yuan has some insight here?
This sounds like we don't update tree-sitter under some conditions,
IOW a bug of sorts.
> I think the best solution is just to remove the
>
> ```
> :language mode
> :override t
> :feature 'error
> '((ERROR) @font-lock-warning-face)
> ```
What are the downsides of removing this? what will we lose?
> > Next, if I type M-;, I get a C++-style comment delimiter "//". It
> > sounds like this is the only style of comments supported? More
> > generally, if I compare c-basic-common-init and c-common-init from CC
> > Mode with c-ts-mode, I see that the former has much more
> > initializations than the latter. So I think we should audit what CC
> > Mode does here and see what else is relevant. Alternatively, we could
> > consider c-ts-mode be a minor mode of CC Mode, which only changes the
> > fontification, the indentation, and the navigation parts.
> >
>
> I can take a look at that this evening - and see what else I can come up
> with. I agree with the comment style
Thanks.
> Your issues are two-fold. The warning face is super easy, but the
> indenting of error nodes may need a change of perspective. Tree-sitter
> works best when syntax is correct, even though it handles errors pretty
> well.
The mode must do something sensible when code is incomplete, and thus
"incorrect". At the very least the fontification and indentation
should become fixed once the code becomes complete/correct, and that
is not what happens as things are now.
- Re: Tree sitter support for C-like languages, (continued)
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/12
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/12
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/12
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/12
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/13
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/13
- Re: Tree sitter support for C-like languages,
Eli Zaretskii <=
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/13
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/13
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/13
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/13
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/13
- Re: Tree sitter support for C-like languages, Dmitry Gutov, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/13
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/14
- Re: Tree sitter support for C-like languages, Stefan Monnier, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/14