Subject: bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties

From: Randy Taylor <[email-masked]>
Date: Sat, 18 Feb 2023 23:31:35 +0000

On Saturday, February 18th, 2023 at 16:45, Dmitry Gutov <[email-masked]> wrote:
> On 18/02/2023 22:42, Randy Taylor wrote:
> 
> > Thanks, I think this is actually a lot cleaner than the gazillion queries we had.
> > It looks good barring a few issues I've noticed.
> > 
> > use a::b::{self as ab, A as abc};
> > 
> > A should be highlighted as a type.
> > If abc is Abc, Abc should be highlighted as a type.
> > 
> > use std::Fs as Self_fs;
> > 
> > Self_fs should be highlighted as a type.
> > 
> > I only quickly tested, but re-adding these queries:
> > `((use_as_clause alias: (identifier) @font-lock-type-face) (:match "^[A-Z]" @font-lock-type-face)) ((use_as_clause path: (identifier) @font-lock-type-face) (:match "^[A-Z]" @font-lock-type-face))`
> > 
> > fixes it. Otherwise, I haven't noticed anything else amiss for the types feature.
> 
> 
> Thanks for testing. See the revised patch.

Fix one bug, introduce another ;).

Any use declaration tail (I guess that's the lingo we're using?) should not have a face applied to it if it's lowercase.

For example:
```
use deeply::nested::function as other_function;
```
function should not have any face applied to it.

```
use a::b::{C, d, e::F, g::h::I, g::h::i};
```
i should not have any face applied to it.

Only if they are capitalized should we give them a face: font-lock-type-face.
As it stands now, they are all font-lock-constant-face.

The previous patch was perfect except for the missing use_as_clause queries - if I add those back, I think everything is good unless I'm missing something.

> 
> > The variable feature is highlighting some things incorrectly (it was before too, but I think it's a little worse now).
> > Adding these to rust-ts-mode--variable-p takes care of the issues that I see.
> > `((equal "extern_crate_declaration" parent-type) nil) ((equal "lifetime" parent-type) nil) ((equal "scoped_type_identifier" parent-type) nil) ((equal "use_as_clause" parent-type) nil) ((equal "use_list" parent-type) nil)`
> 
> 
> This should be taken care of by the new approach (enumeration of all
> allowed parent types).

Missing:
     (closure_parameters (identifier) @font-lock-variable-name-face)
     (field_initializer value: (identifier) @font-lock-variable-name-face)

Would it be possible to alphabetize the queries in the variable feature BTW? It makes it easier to see what's there/missing.
And you know I like things alphabetized ;).