GNU bug report logs -
#61302
29.0.60; rust-ts-mode does not show function-invocation on field-properties
Previous Next
Reported by: jostein <at> kjonigsen.net
Date: Sun, 5 Feb 2023 20:16:01 UTC
Severity: normal
Found in version 29.0.60
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 18/02/2023 05:27, Dmitry Gutov 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).
It seems the check could be further simplified (no variable can be part
of a scoping expression, I believe):
(defun rust-ts-mode--variable-p (node)
(let* ((parent (treesit-node-parent node))
(parent-type (treesit-node-type parent)))
;; Everything in a token_tree is an identifier.
(not (string-match-p "token_tree\\|scoped_identifier"
parent-type))))
But that does not improve performance.
I also tried to create a query with negation, but it seems you can't do
that for parent type.
What works, and removes the performance drop, is enumerating all
possible parent types which can contain an identifier to be highlighted
as a variable. It's a moderately large list, see if I maybe missed some.
Randy, Jostein, feedback welcome.
[rust-ts-fontify-scope-v2.diff (text/x-patch, attachment)]
This bug report was last modified 2 years and 91 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.