Skip to content

Commit 5d6bce5

Browse files
committed
Restore fully qualified function definitions
1 parent 229a5dd commit 5d6bce5

File tree

2 files changed

+76
-5
lines changed

2 files changed

+76
-5
lines changed

CoffeeScript.sublime-syntax

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ contexts:
169169
- match: '[:=](?!>)'
170170
scope: keyword.operator.assignment.coffee
171171
pop: 1
172-
- match: (?=\S)
173-
fail: function
172+
- include: else-pop
174173

175174
function-parameter-list:
176175
- match: \(
@@ -778,9 +777,39 @@ contexts:
778777
- match: '{{identifier}}(?=\()'
779778
scope: meta.function-call.identifier.coffee variable.function.coffee
780779
set: function-call-argument-list
781-
# member variable
780+
# member function definition or variable
781+
- match: (?=(?:(?!and=|or=)|@){{identifier}})
782+
branch_point: member
783+
branch:
784+
- member-function
785+
- member-variable
786+
pop: 1
787+
788+
member-function:
789+
- meta_include_prototype: false
790+
- meta_scope: meta.function.identifier.coffee meta.path.coffee
791+
- match: (@?){{identifier}}
792+
scope: entity.name.function.coffee
793+
captures:
794+
1: punctuation.definition.variable.coffee
795+
set:
796+
- member-function-body
797+
- function-parameter-list
798+
- function-assignment
799+
- match: ''
800+
fail: member
801+
802+
member-function-body:
803+
- meta_content_scope: meta.function.coffee
804+
- match: '[=-]>'
805+
scope: meta.function.coffee keyword.declaration.function.coffee
806+
pop: 1
807+
- match: (?=\S)
808+
fail: member
809+
810+
member-variable:
782811
- match: '{{identifier}}'
783-
scope: variable.other.member.coffee
812+
scope: meta.path.coffee variable.other.member.coffee
784813
pop: 1
785814
- include: immediately-pop
786815

tests/syntax_test_scope.coffee

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,52 @@ class App.Router extends Snakeskin.Router
7878
# ^ keyword.operator.assignment.coffee
7979
# ^^ keyword.declaration.function.coffee
8080

81-
name = =>
81+
namespace.name: ->
82+
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
83+
# ^ meta.path.coffee punctuation.accessor.dot.coffee
84+
# ^^^^^^^^ - meta.function meta.function
85+
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
86+
# ^ meta.function.coffee keyword.operator.assignment.coffee
87+
# ^ meta.function.coffee - keyword
88+
# ^^ meta.function.coffee keyword.declaration.function.coffee
89+
# ^ - meta.function
90+
91+
name = ->
8292
# ^^^^^^^^^ - meta.function meta.function
8393
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
8494
# ^ meta.function.coffee - entity
8595
# ^^^^ meta.function.coffee
8696
# ^ keyword.operator.assignment.coffee
8797
# ^^ keyword.declaration.function.coffee
8898

99+
namespace.name = ->
100+
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
101+
# ^ meta.path.coffee punctuation.accessor.dot.coffee
102+
# ^^^^^^^^^ - meta.function meta.function
103+
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
104+
# ^ meta.function.coffee - keyword
105+
# ^ meta.function.coffee keyword.operator.assignment.coffee
106+
# ^ meta.function.coffee - keyword
107+
# ^^ meta.function.coffee keyword.declaration.function.coffee
108+
# ^ - meta.function
109+
89110
name: =>
90111
# ^^^^^^^^ - meta.function meta.function
91112
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
92113
# ^^^^ meta.function.coffee
93114
# ^ keyword.operator.assignment.coffee
94115
# ^^ keyword.declaration.function.coffee
95116

117+
namespace.name: =>
118+
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
119+
# ^ meta.path.coffee punctuation.accessor.dot.coffee
120+
# ^^^^^^^^ - meta.function meta.function
121+
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
122+
# ^ meta.function.coffee keyword.operator.assignment.coffee
123+
# ^ meta.function.coffee - keyword
124+
# ^^ meta.function.coffee keyword.declaration.function.coffee
125+
# ^ - meta.function
126+
96127
name = =>
97128
# ^^^^^^^^^ - meta.function meta.function
98129
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee
@@ -101,6 +132,17 @@ class App.Router extends Snakeskin.Router
101132
# ^ keyword.operator.assignment.coffee
102133
# ^^ keyword.declaration.function.coffee
103134

135+
namespace.name = =>
136+
# ^^^^^^^^^ meta.path.coffee variable.other.object.coffee
137+
# ^ meta.path.coffee punctuation.accessor.dot.coffee
138+
# ^^^^^^^^^ - meta.function meta.function
139+
# ^^^^ meta.function.identifier.coffee meta.path.coffee entity.name.function.coffee
140+
# ^ meta.function.coffee - keyword
141+
# ^ meta.function.coffee keyword.operator.assignment.coffee
142+
# ^ meta.function.coffee - keyword
143+
# ^^ meta.function.coffee keyword.declaration.function.coffee
144+
# ^ - meta.function
145+
104146
name: () ->
105147
# ^^^^^^^^^^^ - meta.function meta.function
106148
# ^^^^ meta.function.identifier.coffee entity.name.function.coffee

0 commit comments

Comments
 (0)