Skip to content

Commit

Permalink
Restore fully qualified function definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Aug 29, 2024
1 parent 229a5dd commit 5d6bce5
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 5 deletions.
37 changes: 33 additions & 4 deletions CoffeeScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ contexts:
- match: '[:=](?!>)'
scope: keyword.operator.assignment.coffee
pop: 1
- match: (?=\S)
fail: function
- include: else-pop

function-parameter-list:
- match: \(
Expand Down Expand Up @@ -778,9 +777,39 @@ contexts:
- match: '{{identifier}}(?=\()'
scope: meta.function-call.identifier.coffee variable.function.coffee
set: function-call-argument-list
# member variable
# member function definition or variable
- match: (?=(?:(?!and=|or=)|@){{identifier}})
branch_point: member
branch:
- member-function
- member-variable
pop: 1

member-function:
- meta_include_prototype: false
- meta_scope: meta.function.identifier.coffee meta.path.coffee
- match: (@?){{identifier}}
scope: entity.name.function.coffee
captures:
1: punctuation.definition.variable.coffee
set:
- member-function-body
- function-parameter-list
- function-assignment
- match: ''
fail: member

member-function-body:
- meta_content_scope: meta.function.coffee
- match: '[=-]>'
scope: meta.function.coffee keyword.declaration.function.coffee
pop: 1
- match: (?=\S)
fail: member

member-variable:
- match: '{{identifier}}'
scope: variable.other.member.coffee
scope: meta.path.coffee variable.other.member.coffee
pop: 1
- include: immediately-pop

Expand Down
44 changes: 43 additions & 1 deletion tests/syntax_test_scope.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,52 @@ class App.Router extends Snakeskin.Router
# ^ keyword.operator.assignment.coffee
# ^^ keyword.declaration.function.coffee

name = =>
namespace.name: ->
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
# ^ meta.path.coffee punctuation.accessor.dot.coffee
# ^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
# ^ meta.function.coffee keyword.operator.assignment.coffee
# ^ meta.function.coffee - keyword
# ^^ meta.function.coffee keyword.declaration.function.coffee
# ^ - meta.function

name = ->
# ^^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
# ^ meta.function.coffee - entity
# ^^^^ meta.function.coffee
# ^ keyword.operator.assignment.coffee
# ^^ keyword.declaration.function.coffee

namespace.name = ->
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
# ^ meta.path.coffee punctuation.accessor.dot.coffee
# ^^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
# ^ meta.function.coffee - keyword
# ^ meta.function.coffee keyword.operator.assignment.coffee
# ^ meta.function.coffee - keyword
# ^^ meta.function.coffee keyword.declaration.function.coffee
# ^ - meta.function

name: =>
# ^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
# ^^^^ meta.function.coffee
# ^ keyword.operator.assignment.coffee
# ^^ keyword.declaration.function.coffee

namespace.name: =>
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
# ^ meta.path.coffee punctuation.accessor.dot.coffee
# ^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
# ^ meta.function.coffee keyword.operator.assignment.coffee
# ^ meta.function.coffee - keyword
# ^^ meta.function.coffee keyword.declaration.function.coffee
# ^ - meta.function

name = =>
# ^^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
Expand All @@ -101,6 +132,17 @@ class App.Router extends Snakeskin.Router
# ^ keyword.operator.assignment.coffee
# ^^ keyword.declaration.function.coffee

namespace.name = =>
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
# ^ meta.path.coffee punctuation.accessor.dot.coffee
# ^^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
# ^ meta.function.coffee - keyword
# ^ meta.function.coffee keyword.operator.assignment.coffee
# ^ meta.function.coffee - keyword
# ^^ meta.function.coffee keyword.declaration.function.coffee
# ^ - meta.function

name: () ->
# ^^^^^^^^^^^ - meta.function meta.function
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
Expand Down

0 comments on commit 5d6bce5

Please sign in to comment.