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: Wed, 15 Feb 2023 02:07:19 +0000

On Tuesday, February 14th, 2023 at 17:14, Dmitry Gutov <dgutov@yandex.ru> wrote:
> On 14/02/2023 14:39, Randy Taylor wrote:
> 
> > On Tuesday, February 14th, 2023 at 06:42, Jostein Kjønigsen
> > jostein@secure.kjonigsen.net wrote:
> > 
> > > Haven given the latest patch a try on a less macro-ridden codebase I have 
> > > to
> > > say it looks a lot better. In general I would say for this other
> > > code-base it looks favourable to rust-mode.
> > > 
> > > If there's one thing which still seems to be done better in rust-mode
> > > (not nitpicking the variable highlighting), it would be fully namespaces
> > > function calls within classes.
> > > 
> > > Consider the following code:
> > > 
> > > extern crate claxon;
> > > let result = claxon::FlacReader::open(path);
> > > 
> > > While rust-ts-mode correctly identifies that open() is a function-call,
> > > rust-mode correctly identified FlacReader as a class.
> > 
> > Thanks for testing. I've attached a patch fixing this.
> > 
> > I had deleted a query I thought was now covered :). I look forward to
> > the day we have highlight tests!
> 
> 
> Thank you, looks almost perfect (see below), I've pushed that to emacs-29.

Thanks!

> 
> Highlighting tests are a pain to write, but the initiative is always
> welcome. ;-) In the meantime, at least tree-sitter validates the
> queries, which lowers the odds of typos in font-lock rules.
> 
> Speaking of a problem, the solution with applying the explicit 'default'
> face doesn't seem ideal. Aside from the redundancy in the resulting
> buffer structure (with very little practical downside), it also makes
> the 'vc-diff' buffers look like this on the attached screenshots (the
> 'default' face's background overrides the greens and reds).
> 
> I couldn't find a quick solution to this problem, so I pushed the
> existing code for now.

The following patch fixes it for me, but it's a hack since the face doesn't 
exist (and I don't think the override option matters for the current patch 
either, I only realized these things as I was about the send the email).

I tried using 'default with all the different override options and nothing 
worked. Yuan, any ideas?

Basically what we have here are general scoped_identifier queries that we want 
to apply only to the actual code (i.e. not imports). However, these 
scoped_identifiers also exist in the imports and the same highlighting 
semantics don't apply there, so we have specific queries for the different 
kinds of imports that specify how they want their scoped_identifier stuff 
highlighted. For some of those specific queries, we want to leave the face as 
it and make sure nothing else gets applied to it (i.e. default is what we 
want). Apparently that causes issues with vc-diff buffers, and maybe other 
things we have yet to discover.

Attachment: 0001-Fix-rust-ts-mode-highlights-overriding-vc-diff-buffe.patch
Description: Text Data


reply via email to

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