bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Randy Taylor
Subject: bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties
Date: Sun, 05 Feb 2023 21:30:59 +0000

On Sunday, February 5th, 2023 at 15:15, Jostein Kjønigsen <jostein@secure.kjonigsen.net> wrote:

Steps to reproduce:

- set font-lock level 4 to enable highlighting of function-invocations
- create a new buffer and activate rust-ts-mode

Try writing a function which invokes functions indirectly trough field-properties. Example below:

pub fn should_handle(url: String) -> bool {
if url.ends_with(".css")
|| url.ends_with(".js")
|| url.ends_with(".png")
|| url.ends_with(".jpg")
{
false
} else {
true
}
}

Observe that:

- ends_with() is fontified as a property-access, not as a function-invocation.
- (plain function invocation is highlighted as expected though)

From my preliminary inspection of the rust-ts-mode source-code, this seems to be because of a very general override later in the file:

rust-ts-mode.el, line 248 or so:

:language 'rust
:feature 'property
:override t
'((field_identifier) @font-lock-property-face
(shorthand_field_initializer (identifier) @font-lock-property-face))

Dissabling "override" for this feature fixes the fontification of method invocations, but I haven't done enough testing to see if there are other unexpected side-effects.

That's expected (at least to me) because it's a property. The same applies to c-ts-mode and go-ts-mode as well.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]