A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg00813.html below:

Re: Tree sitter support for C-like languages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] From: Theodor Thornhill Subject: Re: Tree sitter support for C-like languages Date: Sun, 13 Nov 2022 11:13:24 +0100
On 13 November 2022 10:56:13 CET, Eli Zaretskii <eliz@gnu.org> wrote:
>> 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?
>

Absolutely nothing. Only the yellow color.

>> > 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.

Yes. By applying that patch we are 98% there. I'll tweak it tonight without 
auto-closing-brace enabled. I use them, so my choices are based on that.

Just apply the patch in the meantime, and test some more if your time permits 
:-)

Thanks,
Theo



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4