[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree sitter support for C-like languages
From: |
Yuan Fu |
Subject: |
Re: Tree sitter support for C-like languages |
Date: |
Mon, 14 Nov 2022 00:23:20 -0800 |
> On Nov 13, 2022, at 7:48 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>> The parse tree has errors and it fontifies int in warning face.
>>
>> Then when you insert the closing bracket, the parse tree is complete
>>
>> int
>> foo (void)
>> {
>> int bar = 0;
>> }
>>
>> Int is still in warning face because jit-lock doesn’t know it needs to be
>> refontified.
>
> Doesn't tree-sitter tell us that the node for `int` has changed?
Yes and no, but mostly no. Tree-sitter can tell if a node “has changes”. But
you need to keep the node updated as the buffer changes, which we currently
don’t do. Even if we add this feature, I don’t know if “has changes” includes
“previously inside an ERROR node but not anymore”. IIUC “has changes” means
“corresponding text edited”. I need to add this feature and experiment with it
to figure out what does “has changes” mean exactly.
Keeping some nodes updated (ie, “watch” those nodes) isn’t too hard to
implement, but it wouldn’t be a trivial change. I don’t know if we want to
introduce non-trivial changes now.
Yuan
- Re: Tree sitter support for C-like languages, (continued)
- 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, 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 <=
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/14
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/14
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/14
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/14
- Re: Tree sitter support for C-like languages, Yuan Fu, 2022/11/15
- Re: Tree sitter support for C-like languages, Theodor Thornhill, 2022/11/15
- Re: Tree sitter support for C-like languages, Eli Zaretskii, 2022/11/15