[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on fi
From: |
Dmitry Gutov |
Subject: |
bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties |
Date: |
Sat, 18 Feb 2023 22:59:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
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
Description: Text Data
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, (continued)
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/14
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/14
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/15
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/17
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/18
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/18
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/18
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/18
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/18
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/19
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties,
Dmitry Gutov <=
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Jostein Kjønigsen, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Jostein Kjønigsen, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Randy Taylor, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/13
- bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/13
bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties, Dmitry Gutov, 2023/02/05