[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method wh
From: |
Yuan Fu |
Subject: |
bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument. |
Date: |
Fri, 9 Dec 2022 13:05:04 -0800 |
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> On 08.12.2022 11:12, Theodor Thornhill wrote:
>> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>>
>>> When I use the new csharp-ts-mode, method fontification is usually accurate
>>> with only 1 exception which I have
>>> encountered so far:
>>>
>>> When calling methods on objects, and that method accepts a generic
>>> type-argument. You typically see this in
>>> Startup.cs-like files in ASP.Net Core projects:
>>>
>>> services.AddSomeExtensionWithoutTypeArguments();
>>> services.AddSomeExtensionWithTypeArguments<MyType>();
>>>
>>> In the above cases we see that fontification of "services" differs.
>>>
>>> For the first line, services is fontified using
>>> font-lock-variable-name-face (correct), but in the latter case services
>>> is fontified using font-lock-function-name-face (incorrect).
>>>
>>> In both cases I expected services to be fontified using
>>> font-lock-variable-name-face.
>>>
>> Can you test this patch, Jostein, and if you're happy, please install,
>> Yuan :-)
>
> I beat you by 3 minutes, but I'll be a gentleman and test none the less :D
>
> You test mine, and we can see which one we prefer?
>> BTW, I think the ruleset is getting pretty gnarly in csharp-mode, so
>> maybe we should consider slimming it down a little (without losing
>> granularity) for perf reasons down the line!
>>
>> Theo
>
> It's getting somewhat intricate, agreed. It's IMO not entirely obvious
> what the different rules are for or what cases they are meant to
> support.
We had a discussion on emacs-devel that aims to standardize and define
feature names, here is the list so far:
Basic tokens:
delimiter ,.; (delimit things)
operator == != || (produces a value)
bracket []{}()
misc-punctuation
constant true, false, null
number
keyword
comment (includes doc-comments)
string (includes chars and docstrings)
string-interpolation f"text {variable}"
escape-sequence "\n\t\\"
function every function identifier
variable every variable identifier
type every type identifier
property a.b <--- highlight b
key { a: b, c: d } <--- highlight a, c
error highlight parse error
Abstract features:
assignment: the LHS of an assignment (thing being assigned to), eg:
a = b <--- highlight a
a.b = c <--- highlight b
a[1] = d <--- highlight a
definition: the thing being defined, eg:
int a(int b) { <--- highlight a
return 0
}
int a; <-- highlight a
struct a { <--- highlight a
int b; <--- highlight b
}
>
> In that regard, I miss our old test-suite from github's csharp-mode.
> It was a nice safety-net when making changes like this.
A test suite is most welcome. I think we can even come up with a general
framework for testing fontification, indent, defun movement, imenu, etc.
To generate a test you would just need to open a file, verify everything
is expected, and run a command which records the current fontification
and indentation, etc, to a file. Then a test suite will just use that
file. I wonder if csharp-mode had something like this?
Yuan
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., (continued)
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Theodor Thornhill, 2022/12/08
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Jostein Kjønigsen, 2022/12/08
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Jostein Kjønigsen, 2022/12/09
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Theodor Thornhill, 2022/12/09
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Jostein Kjønigsen, 2022/12/12
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Yuan Fu, 2022/12/12
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Jostein Kjønigsen, 2022/12/14
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Yuan Fu, 2022/12/14
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Jostein Kjønigsen, 2022/12/14
- bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Yuan Fu, 2022/12/14
bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument.,
Yuan Fu <=
bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument., Yuan Fu, 2022/12/09