-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
grammars/rust.cson
Outdated
@@ -404,14 +404,16 @@ | |||
] | |||
} | |||
# Implementation | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you shouldn't have removed the line.
Why did you do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was accidental! 😱 Apologies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maccoda,
Okay. Revert it and the brace at the end which you have deleted.
Hello @maccoda, impl A {} impl A for B {} impl<A> B for C {} impl<A> B<A> for C<A> {} impl<'a> B for C {} impl<'a> B<'a> for C<'a> {} impl<'a, A> B<'a> for C<'a> {} impl<'a, A> B<'a, A> for C<'a, A> {} |
Hi, |
grammars/rust.cson
Outdated
@@ -429,5 +432,5 @@ | |||
'match': '\\bfor\\b' | |||
} | |||
] | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot about the brace.
I hope you find the regex. |
Alright so it turns out those missing braces are what helped actually because I believe there is an order in which Atom checks and because this is a complex one grabbing the entire line it should be up the top. Hence the move you will see in the next commit. I have also attached a few screenshots of the tests you provided. |
Please attach a screenshot for the code: 'a;
&'a i; I want |
Also I want |
OK I will have a look into that and see what I can get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is cool.
grammars/rust.cson
Outdated
@@ -159,11 +159,46 @@ | |||
{ 'include': '#std_types' } | |||
{ 'include': '#std_traits' } | |||
{ 'include': '#type_params' } | |||
{ | |||
'name': 'entity.name.type.rust' | |||
'match': '\\b[A-Za-z]+\\b' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A type's name may contain digits and underscore:
https://is.gd/5NukLU
grammars/rust.cson
Outdated
{ | ||
'name': 'entity.name.type.rust' | ||
'match': '\\b[A-Za-z]+\\b' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract the block from here and place it after 144 line:
'std_traits': {
'comment': 'Standard library trait'
'name': 'support.type.std.rust'
'match': '\\b(ToOwned|ToString)\\b'
}
'Type': {
'comment': 'A type'
'name': 'entity.name.type.rust'
'match': '\\b[A-Za-z]+\\b'
}
And add after 161 line:
{ 'include': '#type' }
grammars/rust.cson
Outdated
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the empty lines.
grammars/rust.cson
Outdated
{ | ||
'name': 'entity.name.type.rust' | ||
'match': '\\b[A-Za-z]+\\b' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the "#Type" from the previous comment.
Addressed your comments. Hope this is closer to what we are wanting. |
@maccoda, Thank you |
@maccoda, |
@maccoda, |
@maccoda, |
grammars/rust.cson
Outdated
'type': { | ||
'comment': 'A type' | ||
'name': 'entity.name.type.rust' | ||
'match': '\\b[A-Za-z0-9_]+\\b' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is wrong regex because it matches for _
, 0
and etc.
The correct is \\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z][A-Za-z0-9_]*)\\b
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct is \\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b
grammars/rust.cson
Outdated
# Implementation | ||
{ | ||
'comment': 'Implementation' | ||
'begin': '\\b(impl)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be \\b(impl)\\b
because otherwise it would match implementation
.
@maccoda, |
Sorry I forgot about you. I will look tomorrow. |
Oups. I did it again. I will look at it now. |
I have prepared tests for your changes. impl<'a, T> A {} It tokenizes |
@aeschli, |
@KalitaAlexey thanks for that, sorry didn't get as you were wanting but hopefully it is a step in the right direction |
Hopefully able to fix issues on incorrect
impl
highlighting like #7 and maybe #86