Subject: Re: 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 20:42:56 +0000

On Friday, February 17th, 2023 at 22:27, Dmitry Gutov <[email-masked]> wrote:
>On 16/02/2023 03:53, Dmitry Gutov wrote:
>> But the new one will need to check that the parent is
>> 'scoped_identifier', and the grandparent is not a 'call_expression'
>> node, or 'use_as_clause', or 'use_declaration', etc, and the name itself
>> is lowercase -- when so, skip highlighting. And highlight with one of
>> the two faces when otherwise.
>>
>> Shouldn't be too hard to do, but I'm wary about the additional cost at
>> runtime.
>
>So, this seems to work.
>
>At the cost of some performance overhead due to :pred in the 'variable'
>query (the rest of the changes don't seem to affect the runtime -- guess
>the Lisp calls were balanced out by fewer queries).

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.

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)
```