Skip to content

Commit

Permalink
Fix single param arrow functions in function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jcberquist committed Oct 28, 2020
1 parent 7af50f4 commit 2289ca4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
22 changes: 11 additions & 11 deletions syntaxes/cfscript-in-tags.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -927,18 +927,18 @@ contexts:
scope: punctuation.definition.string.begin.cfml
set:
- - meta_scope: meta.string.quoted.single.cfml string.quoted.single.cfml
- match: "'"
- pop: true
match: "'"
scope: punctuation.definition.string.end.cfml
pop: true
- - include: storage-types
- include: else-pop
- match: '"'
scope: punctuation.definition.string.begin.cfml
set:
- - meta_scope: meta.string.quoted.double.cfml string.quoted.double.cfml
- match: '"'
- pop: true
match: '"'
scope: punctuation.definition.string.end.cfml
pop: true
- - include: storage-types
- include: else-pop
- include: else-pop
Expand Down Expand Up @@ -1018,7 +1018,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.function-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -1072,7 +1072,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand All @@ -1097,7 +1097,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -1139,7 +1139,6 @@ contexts:
- match: '{{identifier}}'
scope: variable.other.readwrite.cfml
pop: true

struct-property:
- match: '{{constant_identifier}}'
scope: meta.property.constant.cfml
Expand Down Expand Up @@ -1449,14 +1448,15 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.support.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.function-parameter.cfml
2: keyword.operator.assignment.binary.cfml
3: punctuation.separator.key-value.cfml
push: expression-no-comma
- include: expression-no-comma-push
- include: else-pop

support-method-call:
- match: |-
(?x)(?i)\b(add|addautofilter|addborder|addcolumn|addfreezepane|addimage|addinfo|addpagebreaks
Expand Down Expand Up @@ -1501,7 +1501,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.support.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down
20 changes: 10 additions & 10 deletions syntaxes/cfscript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -931,18 +931,18 @@ contexts:
scope: punctuation.definition.string.begin.cfml
set:
- - meta_scope: meta.string.quoted.single.cfml string.quoted.single.cfml
- match: "'"
- pop: true
match: "'"
scope: punctuation.definition.string.end.cfml
pop: true
- - include: storage-types
- include: else-pop
- match: '"'
scope: punctuation.definition.string.begin.cfml
set:
- - meta_scope: meta.string.quoted.double.cfml string.quoted.double.cfml
- match: '"'
- pop: true
match: '"'
scope: punctuation.definition.string.end.cfml
pop: true
- - include: storage-types
- include: else-pop
- include: else-pop
Expand Down Expand Up @@ -1022,7 +1022,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.function-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -1076,7 +1076,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand All @@ -1101,7 +1101,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -1453,7 +1453,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.support.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.function-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down Expand Up @@ -1506,7 +1506,7 @@ contexts:
pop: true
- match: ','
scope: punctuation.separator.function-call.method.support.cfml
- match: \b({{identifier}})\s*(?:(=)(?!=)|(:))
- match: \b({{identifier}})\s*(?:(=)(?![=>])|(:))
captures:
1: entity.other.method-parameter.cfml
2: keyword.operator.assignment.binary.cfml
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/macros/cfml_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def function_call_params(meta_scope, named_param_scope, delimiter_scope):
},
{"match": ",", "scope": delimiter_scope},
{
"match": r"\b({{identifier}})\s*(?:(=)(?!=)|(:))",
"match": r"\b({{identifier}})\s*(?:(=)(?![=>])|(:))",
"captures": {
1: named_param_scope,
2: "keyword.operator.assignment.binary.cfml",
Expand Down
7 changes: 7 additions & 0 deletions syntaxes/tests/syntax_test_arrow_functions.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,11 @@ var test = (a) =>
// ^ punctuation.terminator.statement.cfml -meta.function.body.cfml -punctuation.section.block.end.cfml
// ^ -punctuation.terminator.statement.cfml

test((a) => 1);
// ^ variable.parameter.function.cfml
// ^^ storage.type.function.arrow.cfml

test(a => 1);
// ^ variable.parameter.function.cfml
// ^^ storage.type.function.arrow.cfml
}

0 comments on commit 2289ca4

Please sign in to comment.