Skip to content

Commit

Permalink
[Rust] Fix type names in generics
Browse files Browse the repository at this point in the history
This commit ...
1. includes `all-generic-type-names` in generics
   to properly highlight all types
2. scopes static type access (e.g.: nir::) `variable.other`
   as this is the scope used everywhere else.
  • Loading branch information
deathaxe committed Feb 26, 2025
1 parent 45485e3 commit 4ab5696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Rust/Rust.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ contexts:
scope: punctuation.accessor.rust
set: [type-path-second, path-after-accessor]
- include: type-names
- include: generic-identifier-names
- include: else-pop

type-path-second:
Expand Down Expand Up @@ -813,7 +814,7 @@ contexts:
scope: punctuation.separator.rust
- match: \b(Self)\b
scope: keyword.other.rust
- match: '{{identifier}}'
- include: all-generic-type-names
- match: '(?=\S)'
pop: true
- include: types
Expand Down
4 changes: 4 additions & 0 deletions Rust/tests/syntax_test_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,11 @@ fn impl_trait_with_plus() -> impl Iterator<Item = hir::GenericParam<'hir>> + Cap
// ^^^^ storage.type.impl
// ^^^^^^^^ support.type
// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic - meta.generic meta.generic
// ^^^^ storage.type.rust
// ^ keyword.operator
// ^^^ variable.other.rust
// ^^ punctuation.accessor.rust
// ^^^^^^^^^^^^ storage.type.rust
// ^^^^^^ meta.generic meta.generic
// ^^^^ storage.modifier.lifetime
// ^ meta.generic - meta.generic meta.generic
Expand Down

0 comments on commit 4ab5696

Please sign in to comment.