GNU bug report logs - #61302
29.0.60; rust-ts-mode does not show function-invocation on field-properties

Previous Next

Package: emacs;

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


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: jostein <at> kjonigsen.net
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Re: 29.0.60;
 rust-ts-mode does not show function-invocation on field-properties
Date: Sun, 05 Feb 2023 21:30:59 +0000
[Message part 1 (text/plain, inline)]
On Sunday, February 5th, 2023 at 15:15, Jostein Kjønigsen <jostein <at> 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.
[Message part 2 (text/html, inline)]

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.