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

Jonathan Andersson created

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.

Change summary

crates/languages/src/rust/highlights.scm | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

Detailed changes

crates/languages/src/rust/highlights.scm 🔗

@@ -6,6 +6,9 @@
 (self) @variable.special
 (field_identifier) @property
 
+(shorthand_field_initializer
+  (identifier) @property)
+
 (trait_item name: (type_identifier) @type.interface)
 (impl_item trait: (type_identifier) @type.interface)
 (abstract_type trait: (type_identifier) @type.interface)
@@ -38,11 +41,20 @@
     (identifier) @function.special
     (scoped_identifier
       name: (identifier) @function.special)
-  ])
+  ]
+  "!" @function.special)
 
 (macro_definition
   name: (identifier) @function.special.definition)
 
+(mod_item
+  name: (identifier) @module)
+
+(visibility_modifier [
+  (crate) @keyword
+  (super) @keyword
+])
+
 ; Identifier conventions
 
 ; Assume uppercase names are types/enum-constructors
@@ -115,9 +127,7 @@
   "where"
   "while"
   "yield"
-  (crate)
   (mutable_specifier)
-  (super)
 ] @keyword
 
 [
@@ -189,6 +199,7 @@
 operator: "/" @operator
 
 (lifetime) @lifetime
+(lifetime (identifier) @lifetime)
 
 (parameter (identifier) @variable.parameter)