# Capture \`shorthand_field_initializer\` and modules in Rust highlights \(\#35842\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 896a35f7befce468427a30489adf88c851b9507d

Requested commit: 896a35f7befce468427a30489adf88c851b9507d

Commit: 896a35f7befce468427a30489adf88c851b9507d

Tree: c3e22735eacfd8a8fc9d486af93a3a5d741d315d

Author: Jonathan Andersson

Committer: GitHub

## Message

```
Capture `shorthand_field_initializer` and modules in Rust highlights (#35842)

Currently shorthand field initializers are not captured the same way as
the full initializers, leading to awkward and mismatching highlighting.
This PR addresses this fact, in addition to capturing new highlights:
- Tags the `!` as part of a macro invocation.
- Tags the identifier part of a lifetime as `@lifetime`.
- Tag module definitions as a new capture group, `@module`.
- Shorthand initializers are now properly tagged as `@property`.

Here's what the current version of Zed looks like:

<img width="596" height="683" alt="image"
src="https://github.com/user-attachments/assets/c9e52d8e-03dc-426b-8545-4fe872b803e0"
/>

With the new highlighting applied:

<img width="596" height="683" alt="image"
src="https://github.com/user-attachments/assets/b7bd9391-9910-456b-8198-6871174d0f4f"
/>

Release Notes:

- Improved highlighting of Rust files, including new highlight groups
for modules and shorthand initializers.
```

## Parents

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

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