Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
fix: rules for methods
Browse files Browse the repository at this point in the history
feat: add support for multiline arguments
feat: add double splat operator
test: add tests
  • Loading branch information
graceful-potato committed Oct 12, 2020
1 parent 2449c01 commit 2d66c5e
Show file tree
Hide file tree
Showing 2 changed files with 632 additions and 41 deletions.
176 changes: 135 additions & 41 deletions packages/vscode-ruby/syntaxes/ruby.cson.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,30 +268,16 @@
"name": "meta.function.method.with-arguments.ruby",
"patterns": [
{
"begin": "(?![\\s,)])",
"end": "(?=,|\\)\\s*$)",
"begin": "(?=[&*_a-zA-Z])",
"end": "(?=[,)])",
"patterns": [
{
"captures": {
"1": {
"name": "storage.type.variable.ruby"
},
"2": {
"name": "constant.language.symbol.hashkey.parameter.function.ruby"
},
"3": {
"name": "punctuation.definition.constant.hashkey.ruby"
},
"4": {
"name": "variable.parameter.function.ruby"
}
},
"match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))"
},
{
"include": "$self"
"include": "#method_parameters"
}
]
},
{
"include": "#method_parameters"
}
]
},
Expand All @@ -306,34 +292,20 @@
}
},
"comment": "same as the previous rule, but without parentheses around the arguments",
"end": "$",
"end": "(?=;)|(?<=[\\w\\])}`'\"!?])(?=\\s*#|\\s*$)",
"name": "meta.function.method.with-arguments.ruby",
"patterns": [
{
"begin": "(?![\\s,])",
"end": "(?=,|$)",
"begin": "(?=[&*_a-zA-Z])",
"end": "(?=,|;|\\s*#|\\s*$)",
"patterns": [
{
"captures": {
"1": {
"name": "storage.type.variable.ruby"
},
"2": {
"name": "constant.language.symbol.hashkey.parameter.function.ruby"
},
"3": {
"name": "punctuation.definition.constant.hashkey.ruby"
},
"4": {
"name": "variable.parameter.function.ruby"
}
},
"match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))"
},
{
"include": "$self"
"include": "#method_parameters"
}
]
},
{
"include": "#method_parameters"
}
]
},
Expand Down Expand Up @@ -2269,6 +2241,128 @@
}
],
"repository": {
"method_parameters": {
"patterns": [
{
"include": "#parens"
},
{
"include": "#braces"
},
{
"include": "#brackets"
},
{
"include": "#params"
},
{
"include": "$self"
}
],
"repository": {
"params": {
"captures": {
"1": {
"name": "storage.type.variable.ruby"
},
"2": {
"name": "constant.other.symbol.hashkey.parameter.function.ruby"
},
"3": {
"name": "punctuation.definition.constant.ruby"
},
"4": {
"name": "variable.parameter.function.ruby"
}
},
"match": "\\G(&|\\*\\*?)?(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))"
},
"braces": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.ruby"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.ruby"
}
},
"patterns": [
{
"include": "#parens"
},
{
"include": "#braces"
},
{
"include": "#brackets"
},
{
"include": "$self"
}
]
},
"brackets": {
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.array.begin.ruby"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.array.end.ruby"
}
},
"patterns": [
{
"include": "#parens"
},
{
"include": "#braces"
},
{
"include": "#brackets"
},
{
"include": "$self"
}
]
},
"parens": {
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.function.begin.ruby"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.function.end.ruby"
}
},
"patterns": [
{
"include": "#parens"
},
{
"include": "#braces"
},
{
"include": "#brackets"
},
{
"include": "$self"
}
]
}
}
},
"escaped_char": {
"match": "\\\\(?:[0-7]{1,3}|x[\\da-fA-F]{1,2}|.)",
"name": "constant.character.escape.ruby"
Expand Down
Loading

0 comments on commit 2d66c5e

Please sign in to comment.