[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cc-mode fontification feels random
From: |
Stefan Monnier |
Subject: |
Re: cc-mode fontification feels random |
Date: |
Sat, 05 Jun 2021 13:31:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> I think that's where tree-sitter shines, because AFAIK it does not rely
>> on access to other files.
>
> I took a look at tree-sitter and, IIUC, it suffers from the same
> limitations as CC mode: it gets the information provided by a parser.
To a large extent that's unavoidable. AFAIU it should be able to do
a slightly better job in some cases by just trying out all possible
interpretations and only keeping those that make sense (from a purely
syntactic point of view).
> But most fundamentally, it is unable to determine what
> Foo<whatever>::bar is even when it is defined on the current file.
Indeed it's quite possible that there are also cases where tree-sitter
does a worse job than CC-mode, e.g. by not taking into account semantic
information that can be extracted from the current file.
> If we are going to really modernize Emacs' programming language
> support we need to provide more than parser-based syntax highlighting
> and indentation. [...] That means we need something like LSP.
I believe/hope this is obvious to everyone, yes.
> Tree-sitter migth be useful for the languages not yet supported by
> LSP, though
My impression is that tree-sitter might be useful for
syntax-highlighting and indentation. I'm not sure how well those two
features are supported/handled by LSP servers and clients currently.
> (but, if I got it right, tree-sitter is implemented on Javascript,
AFAIK only the source grammars and the grammar-compiler is written in
Javascript: the parsing engine is written in C and exposed as
a C library.
>> I think you'd expect a good LSP server to "degrade gracefully" and still
>> provide good info for indentation and syntax highlighting even if you
>> only have the one file and all the other files in the project
>> are missing.
> As already mentioned elsewhere on this thread, an LSP server with access
> to just the current file is severely handicapped.
Of course. The question is whether it can still provide a good enough
behavior in that case compared to tree-sitter. If not, it might be
an argument in favor of using both LSP and tree-sitter.
Stefan
- Re: cc-mode fontification feels random, (continued)
- Message not available
- Re: cc-mode fontification feels random, Jim Porter, 2021/06/04
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/04
- Re: cc-mode fontification feels random, Jim Porter, 2021/06/04
- Re: cc-mode fontification feels random, Joost Kremers, 2021/06/04
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, Joost Kremers, 2021/06/05
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, Joost Kremers, 2021/06/05
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/05
- Re: cc-mode fontification feels random, Óscar Fuentes, 2021/06/05
- Re: cc-mode fontification feels random,
Stefan Monnier <=
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, João Távora, 2021/06/05
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, João Távora, 2021/06/05
- Re: cc-mode fontification feels random, Ergus, 2021/06/05
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, Daniel Colascione, 2021/06/05
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/05
- Re: cc-mode fontification feels random, Jim Porter, 2021/06/05
- Re: cc-mode fontification feels random, Daniel Martín, 2021/06/05