Skip to content

Commit 0b92d92

Browse files
committed
Merge pull request zargony#63 from miqid/master
Provide additional highlighting within function definitions and type declarations
2 parents bd63b2c + 020fbe2 commit 0b92d92

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

grammars/rust.cson

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@
7676
'name': 'storage.modifier.box.rust'
7777
'match': '\\bbox\\b'
7878
}
79+
'const': {
80+
'comment': 'Const storage modifier'
81+
'name': 'storage.modifier.const.rust'
82+
'match': '\\bconst\\b'
83+
}
84+
'pub': {
85+
'comment': 'Visibility modifier'
86+
'name': 'storage.modifier.visibility.rust'
87+
'match': '\\bpub\\b'
88+
}
7989
'lifetime': {
8090
'comment': 'Named lifetime'
8191
'name': 'storage.modifier.lifetime.rust'
@@ -209,16 +219,6 @@
209219
'name': 'storage.modifier.static.rust'
210220
'match': '\\bstatic\\b'
211221
}
212-
{
213-
'comment': 'Const storage modifier'
214-
'name': 'storage.modifier.const.rust'
215-
'match': '\\bconst\\b'
216-
}
217-
{
218-
'comment': 'Visibility modifier'
219-
'name': 'storage.modifier.visibility.rust'
220-
'match': '\\bpub\\b'
221-
}
222222
{
223223
'comment': 'Boolean constant'
224224
'name': 'constant.language.boolean.rust'
@@ -245,6 +245,8 @@
245245
{ 'include': '#box' }
246246
{ 'include': '#lifetime' }
247247
{ 'include': '#ref_lifetime' }
248+
{ 'include': '#const' }
249+
{ 'include': '#pub' }
248250
# Operators
249251
{
250252
'comment': 'Operator'
@@ -317,6 +319,7 @@
317319
{ 'include': '#std_types' }
318320
{ 'include': '#std_traits' }
319321
{ 'include': '#type_params' }
322+
{ 'include': '#const' }
320323
]
321324
}
322325
# Type declaration
@@ -334,6 +337,8 @@
334337
{ 'include': '#core_traits' }
335338
{ 'include': '#std_traits' }
336339
{ 'include': '#type_params' }
340+
{ 'include': '#core_types' }
341+
{ 'include': '#pub' }
337342
]
338343
}
339344
# Type alias

test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,11 @@ let x: Vec<Vec<u8>> = Vec::new();
207207
// Correct detection of == (#40)
208208
struct Foo { x: i32 }
209209
if x == 1 { }
210+
211+
// const function parameter (#52)
212+
fn foo(bar: *const i32) {
213+
let _ = 1234 as *const u32;
214+
}
215+
216+
// Keywords and known types in wrapper structs (#56)
217+
pub struct Foobar(pub Option<bool>);

0 commit comments

Comments
 (0)