Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs: Attributes highlighting fixes #14818

Closed

Conversation

tomjakubowski
Copy link
Contributor

This addresses two problems noted in #14347: the highlight of #foo] as an attribute, and the non-highlight of #[foo = "bar"].

Setting `OVERRIDE` to `t` overrides the conflicting highlight Emacs
places on string literals.

Fix rust-lang#14347
@tomjakubowski
Copy link
Contributor Author

Here's an example screenshot:

screen shot 2014-06-11 at 5 17 08 am

@emberian
Copy link
Member

cc @brson @nikomatsakis @pnkfelix, surely there is an emacser who can review this.

@pnkfelix
Copy link
Member

@tomjakubowski I tried to find documentation on what the trailing ... t) that you added signifies in a font-lock-defaults list. But alas I was not able to find a description of it. Would you mind pointing me at some docs for it?

(Having said that, I will r+ this now, since I trust that it is an improvement on what we had before, especially with the bug fix to the regexp.)

bors added a commit that referenced this pull request Jun 17, 2014
… r=pnkfelix

This addresses two problems noted in #14347: the highlight of `#foo]` as an attribute, and the non-highlight of `#[foo = "bar"]`.
@tomjakubowski
Copy link
Contributor Author

@pnkfelix the relevant documentation is in M-x describe-variable font-lock-keywords.

MATCH-HIGHLIGHT should be of the form:

 (SUBEXP FACENAME [OVERRIDE [LAXMATCH]])

...

OVERRIDE and LAXMATCH are flags.  If OVERRIDE is t, existing fontification can
be overwritten.  If `keep', only parts not already fontified are highlighted.
If `prepend' or `append', existing fontification is merged with the new, in
which the new or existing fontification, respectively, takes precedence.

The problem is that Emacs's highlighting for matched delimiters in the syntax table take precedence over keywords. Thinking it over some more we should be using append; t makes Emacs over-eagerly highlight attributes inside comments and string literals:

screen shot 2014-06-17 at 2 40 24 am

I'll submit another PR with that fix.

@bors bors closed this Jun 17, 2014
tomjakubowski added a commit to tomjakubowski/rust that referenced this pull request Jun 17, 2014
This addresses the font lock regression introduced by the earlier pull
request rust-lang#14818 - attributes are no longer be highligted inside of comments
and strings.

Also add some font lock test infrastructure and some tests for attribute
font locking.
bors added a commit that referenced this pull request Jun 18, 2014
…ht, r=pnkfelix

This addresses the font lock regression introduced by the earlier pull
request #14818 - attributes are no longer be highligted inside of comments
and strings.

Also add some font lock test infrastructure and some tests for attribute
font locking and fix some minor nits.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…=Veykril

fix: place type inlay hints after the item and without left-padding

**Before**:

![Type hints were placed before the item and there was left-padding that accentuaded the issue](https://github.com/rust-lang/rust-analyzer/assets/7951708/006a28e9-ed7b-4d49-a7e7-3c6da8efca79)

**After**:

![Type hints are now placed after the item and without padding since there already is `: ` in front of the type](https://github.com/rust-lang/rust-analyzer/assets/7951708/330a847f-8c59-40c7-877f-bf1aaced30e2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants