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.