[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cc-mode fontification feels random
From: |
Dmitry Gutov |
Subject: |
Re: cc-mode fontification feels random |
Date: |
Sun, 6 Jun 2021 20:08:55 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Hi Alan,
On 06.06.2021 14:53, Alan Mackenzie wrote:
Would it work much worse if you took the approach of not applying the
highlighting when you frequently cannot be sure of what the type of the
term is?
Cases of "not being sure" are common indeed. The whole of CC Mode is
based on heuristics.
I would differentiate between approaches like
need to parse around the callsite/usage site [of identifier]
and
need to parse the identifier's definition itself
and, as far as Emacs major modes go, only used the first approach, plus
perhaps some predefined/customizable list of built-ins.
Because it's pretty much a given that in a big enough project a lot of
functions/classes/etc will be defined in files that the user will never
visit in the current session.
That would mean none of the types in brackets would be highlighted in
the original example, but perhaps that is still better than the current
result?
That would mean adding complicated decision functions for "not being
sure". If the fontification of types where they are used (as opposed to
being declared) were to become less common, people would notice and
complain too.
Some might be relieved, too, seeing more stability of what is highlighed
and what is not (and when).
There's the idea I proposed in my post to Daniel C of today - when a
type is newly recognised, then go through the buffer fontifying
occurrences of it. That would probably help a lot, possibly at the cost
of slowing the mode down a bit.
What about the types that are defined in files you never visited?
- Re: cc-mode fontification feels random, (continued)
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/14
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/14
- Re: cc-mode fontification feels random, Ergus, 2021/06/15
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/07
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/08
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/08
Re: cc-mode fontification feels random, Dmitry Gutov, 2021/06/05
Re: Re: cc-mode fontification feels random, Pedro Andres Aranda Gutierrez, 2021/06/06