Skip to content

Commit 20730df

Browse files
authored
Merge pull request #38 from icedrocket/fix-attributes-in-call
Fix attributes highlighting in function call
2 parents 3a24cf5 + 3bbbb0a commit 20730df

File tree

2 files changed

+79
-72
lines changed

2 files changed

+79
-72
lines changed

syntaxes/rust.tmLanguage.json

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -117,54 +117,6 @@
117117
}
118118
}
119119
},
120-
{
121-
"comment": "attributes",
122-
"name": "meta.attribute.rust",
123-
"begin": "(#)(\\!?)(\\[)",
124-
"beginCaptures": {
125-
"1": {
126-
"name": "punctuation.definition.attribute.rust"
127-
},
128-
"2": {
129-
"name": "keyword.operator.attribute.inner.rust"
130-
},
131-
"3": {
132-
"name": "punctuation.brackets.attribute.rust"
133-
}
134-
},
135-
"end": "\\]",
136-
"endCaptures": {
137-
"0": {
138-
"name": "punctuation.brackets.attribute.rust"
139-
}
140-
},
141-
"patterns": [
142-
{
143-
"include": "#block-comments"
144-
},
145-
{
146-
"include": "#comments"
147-
},
148-
{
149-
"include": "#keywords"
150-
},
151-
{
152-
"include": "#lifetimes"
153-
},
154-
{
155-
"include": "#punctuation"
156-
},
157-
{
158-
"include": "#strings"
159-
},
160-
{
161-
"include": "#gtypes"
162-
},
163-
{
164-
"include": "#types"
165-
}
166-
]
167-
},
168120
{
169121
"comment": "modules",
170122
"match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)",
@@ -255,6 +207,9 @@
255207
{
256208
"include": "#comments"
257209
},
210+
{
211+
"include": "#attributes"
212+
},
258213
{
259214
"include": "#lvariables"
260215
},
@@ -438,6 +393,51 @@
438393
}
439394
}
440395
},
396+
"attributes": {
397+
"comment": "attributes",
398+
"name": "meta.attribute.rust",
399+
"begin": "(#)(\\!?)(\\[)",
400+
"beginCaptures": {
401+
"1": {
402+
"name": "punctuation.definition.attribute.rust"
403+
},
404+
"3": {
405+
"name": "punctuation.brackets.attribute.rust"
406+
}
407+
},
408+
"end": "\\]",
409+
"endCaptures": {
410+
"0": {
411+
"name": "punctuation.brackets.attribute.rust"
412+
}
413+
},
414+
"patterns": [
415+
{
416+
"include": "#block-comments"
417+
},
418+
{
419+
"include": "#comments"
420+
},
421+
{
422+
"include": "#keywords"
423+
},
424+
{
425+
"include": "#lifetimes"
426+
},
427+
{
428+
"include": "#punctuation"
429+
},
430+
{
431+
"include": "#strings"
432+
},
433+
{
434+
"include": "#gtypes"
435+
},
436+
{
437+
"include": "#types"
438+
}
439+
]
440+
},
441441
"functions": {
442442
"patterns": [
443443
{
@@ -546,6 +546,9 @@
546546
{
547547
"include": "#comments"
548548
},
549+
{
550+
"include": "#attributes"
551+
},
549552
{
550553
"include": "#keywords"
551554
},
@@ -606,6 +609,9 @@
606609
{
607610
"include": "#comments"
608611
},
612+
{
613+
"include": "#attributes"
614+
},
609615
{
610616
"include": "#keywords"
611617
},

syntaxes/rust.tmLanguage.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,6 @@ patterns:
7171
name: entity.name.type.macro.rust
7272
5:
7373
name: punctuation.brackets.curly.rust
74-
-
75-
comment: attributes
76-
name: meta.attribute.rust
77-
begin: '(#)(\!?)(\[)'
78-
beginCaptures:
79-
1:
80-
name: punctuation.definition.attribute.rust
81-
2:
82-
name: keyword.operator.attribute.inner.rust
83-
3:
84-
name: punctuation.brackets.attribute.rust
85-
end: '\]'
86-
endCaptures:
87-
0:
88-
name: punctuation.brackets.attribute.rust
89-
patterns:
90-
- include: '#block-comments'
91-
- include: '#comments'
92-
- include: '#keywords'
93-
- include: '#lifetimes'
94-
- include: '#punctuation'
95-
- include: '#strings'
96-
- include: '#gtypes'
97-
- include: '#types'
9874
-
9975
comment: modules
10076
match: (mod)\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)
@@ -142,6 +118,7 @@ patterns:
142118
- include: '#lvariables'
143119
- include: '#block-comments'
144120
- include: '#comments'
121+
- include: '#attributes'
145122
- include: '#lvariables'
146123
- include: '#constants'
147124
- include: '#gtypes'
@@ -254,6 +231,28 @@ repository:
254231
name: constant.character.escape.unicode.punctuation.rust
255232
5:
256233
name: constant.character.escape.unicode.punctuation.rust
234+
attributes:
235+
comment: attributes
236+
name: meta.attribute.rust
237+
begin: '(#)(\!?)(\[)'
238+
beginCaptures:
239+
1:
240+
name: punctuation.definition.attribute.rust
241+
3:
242+
name: punctuation.brackets.attribute.rust
243+
end: '\]'
244+
endCaptures:
245+
0:
246+
name: punctuation.brackets.attribute.rust
247+
patterns:
248+
- include: '#block-comments'
249+
- include: '#comments'
250+
- include: '#keywords'
251+
- include: '#lifetimes'
252+
- include: '#punctuation'
253+
- include: '#strings'
254+
- include: '#gtypes'
255+
- include: '#types'
257256
functions:
258257
patterns:
259258
-
@@ -317,6 +316,7 @@ repository:
317316
patterns:
318317
- include: '#block-comments'
319318
- include: '#comments'
319+
- include: "#attributes"
320320
- include: '#keywords'
321321
- include: '#lvariables'
322322
- include: '#constants'
@@ -343,6 +343,7 @@ repository:
343343
patterns:
344344
- include: '#block-comments'
345345
- include: '#comments'
346+
- include: "#attributes"
346347
- include: '#keywords'
347348
- include: '#lvariables'
348349
- include: '#constants'

0 commit comments

Comments
 (0)