# rust: Restore and update attribute highlighting \(\#25501\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/113c471bb0aef8ecdb5f748359134c31545f0bb4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 113c471bb0aef8ecdb5f748359134c31545f0bb4

Requested commit: 113c471bb0aef8ecdb5f748359134c31545f0bb4

Commit: 113c471bb0aef8ecdb5f748359134c31545f0bb4

Tree: e49fcd8e30e83dba79ee23644f0a5ff75c57c8a4

Author: Finn Evers

Committer: GitHub

## Message

```
rust: Restore and update attribute highlighting (#25501)

#25333 added broader highlighting for identifiers, which broke the
generic query for attribute queries, resulting in these being
highlighted the same as identifiers.

To accomodate for this change, this PR updates the attribute matches to
be more specific.

Additionally, path matches in scoped identifiers are no longer
highlighted as attributes, as seen in the comparison screenshot. Can
revert this if requested.

| Zed Preview | <img width="750" alt="preview"
src="https://github.com/user-attachments/assets/2cd2e830-f510-4adf-8ce9-c41ed6fb157c"
/> |
| --- | --- | 
| `main` | <img width="750" alt="main"
src="https://github.com/user-attachments/assets/cbe93186-9afd-4515-bc06-e519fd4ee6af"
/> |
| This PR | <img width="750" alt="pr"
src="https://github.com/user-attachments/assets/68270de8-e083-4fc6-a45e-25d3151acd87"
/> |

The generic match for `token_tree` is needed to recursively match
patterns like `#[cfg(any(test, feature = "test-support"))]` (or at least
I was unable to find a better query here). I tried to validate that this
does not break any other highlights and I believe it does not. However,
I might have still missed something.

Release Notes:

- N/A
```

## Parents

- [10fef92eeaa75ac538237380c401269c98974ecb](https://git.cafe/gitcafe/zed/commit/10fef92eeaa75ac538237380c401269c98974ecb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/113c471bb0aef8ecdb5f748359134c31545f0bb4?format=markdown)
