diff --git a/.gitmodules b/.gitmodules index 66840c28..cac62a7d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -173,3 +173,6 @@ path = assets/syntaxes/Vue url = https://github.com/vuejs/vue-syntax-highlight.git branch = new +[submodule "assets/syntaxes/CoffeeScript"] + path = assets/syntaxes/CoffeeScript + url = https://github.com/sustained/CoffeeScript-Sublime-Plugin diff --git a/assets/syntaxes/CoffeeScript b/assets/syntaxes/CoffeeScript new file mode 160000 index 00000000..e08f9b8c --- /dev/null +++ b/assets/syntaxes/CoffeeScript @@ -0,0 +1 @@ +Subproject commit e08f9b8cdfc84e0456ae63dca7aaefb94bf06e24 diff --git a/assets/syntaxes/CoffeeScript.sublime-syntax b/assets/syntaxes/CoffeeScript.sublime-syntax new file mode 100644 index 00000000..d9d5c047 --- /dev/null +++ b/assets/syntaxes/CoffeeScript.sublime-syntax @@ -0,0 +1,271 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: CoffeeScript +comment: "CoffeeScript Syntax: version 1" +file_extensions: + - coffee + - Cakefile + - coffee.erb + - cson +first_line_match: ^#!.*\bcoffee +scope: source.coffee +contexts: + main: + - match: '(\([^()]*?\))\s*([=-]>)' + comment: "match stuff like: a -> …" + scope: meta.inline.function.coffee + captures: + 1: variable.parameter.function.coffee + 2: storage.type.function.coffee + - match: (new)\s+(\w+(?:\.\w*)*) + scope: meta.class.instance.constructor + captures: + 1: keyword.operator.new.coffee + 2: support.class.coffee + - match: "'''" + captures: + 0: punctuation.definition.string.begin.coffee + push: + - meta_scope: string.quoted.heredoc.coffee + - match: "'''" + captures: + 0: punctuation.definition.string.end.coffee + pop: true + - match: '"""' + captures: + 0: punctuation.definition.string.begin.coffee + push: + - meta_scope: string.quoted.double.heredoc.coffee + - match: '"""' + captures: + 0: punctuation.definition.string.end.coffee + pop: true + - match: \\. + scope: constant.character.escape.coffee + - include: interpolated_coffee + - match: "`" + captures: + 0: punctuation.definition.string.begin.coffee + push: + - meta_scope: string.quoted.script.coffee + - match: "`" + captures: + 0: punctuation.definition.string.end.coffee + pop: true + - match: '\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)' + scope: constant.character.escape.coffee + - match: (?)|\+\+|\+|~|==|=(?!>)|!=|<=|>=|<<=|>>=| + >>>=|<>|<|>|!|&&|\.\.(\.)?|\?|\||\|\||\:|\*=|(?)))' + scope: variable.assignment.coffee + captures: + 1: variable.assignment.coffee + 4: punctuation.separator.key-value + 5: keyword.operator.coffee + - match: '(?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])' + captures: + 0: keyword.operator.coffee + push: + - meta_scope: meta.variable.assignment.destructured.coffee + - match: '([\]\}]\s*[:=])' + captures: + 0: keyword.operator.coffee + pop: true + - include: variable_name + - include: instance_variable + - include: single_quoted_string + - include: double_quoted_string + - include: numeric + - match: |- + (?x) + (\s*) + (?=[a-zA-Z\$_]) + ( + [a-zA-Z\$_](\w|\$|:|\.)*\s* + (?=[:=](\s*\(.*\))?\s*([=-]>)) + ) + scope: meta.function.coffee + captures: + 2: entity.name.function.coffee + 3: entity.name.function.coffee + 4: variable.parameter.function.coffee + 5: storage.type.function.coffee + - match: ^\s*(describe|it|app\.(get|post|put|all|del|delete)) + comment: Show well-known functions from Express and Mocha in Go To Symbol view + push: + - meta_scope: meta.function.symbols.coffee + - match: $ + pop: true + - include: main + - match: "[=-]>" + scope: storage.type.function.coffee + - match: '\b(?