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

[Rust] More small tweaks to type matching #3590

Merged
merged 1 commit into from
Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Rust/Rust.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ contexts:
scope: keyword.operator.arithmetic.rust
- include: integers
- include: block
- match: '{{identifier}}'
- match: ':|,'
scope: punctuation.separator.rust
- match: '\+|='
Expand Down Expand Up @@ -638,7 +637,7 @@ contexts:
pop: true
- match: '!'
scope: keyword.operator.negated-type.rust
- include: type-identifiers
- include: type-any-identifiers

type-any-identifiers:
- match: '!'
Expand All @@ -650,6 +649,7 @@ contexts:
- match: '{{type_identifier}}'
scope: storage.type.rust
- match: '{{identifier}}'
scope: meta.identifier.expected-type.rust

support-type:
- match: '(Vec|Option|Result|BTreeMap|HashMap|Box|Rc|Arc|AsRef|AsMut|Into|From)\s*(?=<)'
Expand All @@ -661,6 +661,7 @@ contexts:
type:
# A low-level type. Typically you want types-any for the full type grammar.
- match: '{{identifier}}(?=<)'
scope: storage.type.rust
push: generic-angles
- match: \b(Self|{{int_suffixes}}|{{float_suffixes}}|bool|char|str)\b
scope: storage.type.rust
Expand Down
16 changes: 15 additions & 1 deletion Rust/tests/syntax_test_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,22 @@ type Snail = Vec<SnailNum>;
// ^ punctuation.definition.generic.end.rust

type ExampleRawPointer = HashMap<*const i32, Option<i32>, BuildHasherDefault<FnvHasher>>;
// ^^^^^^ meta.generic storage.modifier
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.rust
// ^^^^^^ storage.modifier
// ^^^ meta.generic storage.type
// ^ punctuation.separator.rust
// ^^^^^^^^^^^ meta.generic.rust meta.generic.rust
// ^^^^^^ support.type.rust
// ^ punctuation.definition.generic.begin.rust
// ^^^ storage.type.rust
// ^ punctuation.definition.generic.end.rust
// ^ punctuation.separator.rust
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.rust meta.generic.rust
// ^^^^^^^^^^^^^^^^^^ storage.type
// ^ punctuation.definition.generic.begin.rust
// ^^^^^^^^^ storage.type.rust
// ^^ punctuation.definition.generic.end.rust
// ^ punctuation.terminator.rust


// Anonymous lifetimes.
Expand Down