fix: underscores, raw IDs
remove comment scope from ignored params
underscores will automatically receive variable/param scope
add raw ID syntax to modules, functions, and variables
},
{
"comment": "modules",
- "match": "(mod)\\s+([a-z][A-Za-z0-9_]*)",
+ "match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)",
"captures": {
"1": {
"name": "keyword.control.rust"
"comment": "line comments",
"name": "comment.line.double-slash.rust",
"match": "\\s*//.*"
- },
- {
- "comment": "inferred types, wildcard patterns, ignored params",
- "name": "comment.char.underscore.rust",
- "match": "\\b_\\w*\\b[^!(]"
}
]
},
},
"functions": {
"patterns": [
+ {
+ "comment": "pub as a function",
+ "match": "\\b(pub)(\\()",
+ "captures": {
+ "1": {
+ "name": "keyword.other.rust"
+ },
+ "2": {
+ "name": "punctuation.brackets.round.rust"
+ }
+ }
+ },
{
"comment": "function definition",
"name": "meta.function.definition.rust",
- "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))",
+ "begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))",
"beginCaptures": {
"1": {
"name": "keyword.control.fn.rust"
{
"comment": "function/method calls, chaining",
"name": "meta.function.call.rust",
- "begin": "(?:(pub)|(?:(\\.)?([A-Za-z0-9_]+)))(\\()",
+ "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()",
"beginCaptures": {
"1": {
- "name": "keyword.other.rust"
- },
- "2": {
- "name": "keyword.operator.access.dot.rust"
- },
- "3": {
"name": "entity.name.function.rust"
},
- "4": {
+ "2": {
"name": "punctuation.brackets.round.rust"
}
},
{
"comment": "variables",
"name": "variable.other.rust",
- "match": "\\b(?<!\\.)[a-z0-9_]+\\b"
+ "match": "\\b(?<!\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b"
}
]
}
