{ "scopeName": "source.js", "fileTypes": [ "js", "htc", "_js", "es", "es6", "jsm", "pjs", "xsjs", "xsjslib" ], "firstLineMatch": "^#!.*\\b(node|iojs|JavaScript)", "name": "JavaScript", "patterns": [ { "begin": "(?)", "beginCaptures": { "1": { "name": "punctuation.definition.parameters.begin.js" } }, "end": "(\\))(\\s*=>)", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.js" }, "2": { "name": "storage.type.arrow.js" } }, "patterns": [ { "include": "#function-params" } ] }, { "comment": "match stuff like: play = (a,b) => { … }", "name": "meta.function.arrow.js", "begin": "([a-zA-Z_?$][\\w?$]*)\\s*(=)\\s*(\\()(?=(?:[^\\(\\)]*)?\\)\\s*=>)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "keyword.operator.js" }, "3": { "name": "punctuation.definition.parameters.begin.js" } }, "end": "(\\))(\\s*=>)", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.js" }, "2": { "name": "storage.type.arrow.js" } }, "patterns": [ { "include": "#function-params" } ] }, { "comment": "match stuff like: Sound.play = (a,b) => { … }", "name": "meta.function.arrow.js", "begin": "([a-zA-Z_?$]*)\\.([a-zA-Z_?$][\\w?$]*)\\s*(=)\\s*(\\()(?=(?:[^\\(\\)]*)?\\)\\s*=>)", "beginCaptures": { "1": { "name": "support.class.js" }, "2": { "name": "entity.name.function.js" }, "3": { "name": "keyword.operator.js" }, "4": { "name": "punctuation.definition.parameters.begin.js" } }, "end": "(\\))(\\s*=>)", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.js" }, "2": { "name": "storage.type.arrow.js" } }, "patterns": [ { "include": "#function-params" } ] }, { "captures": { "1": { "name": "keyword.operator.new.js" }, "2": { "name": "entity.name.type.instance.js" } }, "match": "(new)\\s+(\\$?\\w+(?:\\.\\w*)?)", "name": "meta.class.instance.constructor" }, { "match": "\\b(console)\\b", "name": "entity.name.type.object.js.console" }, { "match": "\\b(\\.)(assert|clear|debug|error|info|log|profile|profileEnd|time|timeEnd|warn)(?=\\()", "captures": { "1": { "name": "meta.delimiter.method.period.js" }, "2": { "name": "support.function.js.console" } } }, { "include": "#numbers" }, { "include": "#strings" }, { "include": "#comments" }, { "captures": { "0": { "name": "punctuation.definition.comment.html.js" }, "2": { "name": "punctuation.definition.comment.html.js" } }, "match": "()", "name": "comment.block.html.js" }, { "match": "=>", "name": "storage.type.arrow.js" }, { "match": "(?=|<<=|>>=|>>>=|\\*=|(?|<|>|!|&&|\\|\\||\\?|\\:|\\^", "comment": "match 2-character operator first", "name": "keyword.operator.js" }, { "match": "\\;", "name": "punctuation.terminator.statement.js" }, { "match": ",", "name": "meta.delimiter.object.comma.js" }, { "match": "\\.", "name": "meta.delimiter.method.period.js" }, { "captures": { "1": { "name": "punctuation.section.scope.begin.js" }, "2": { "name": "punctuation.section.scope.end.js" } }, "comment": "Allows the special return snippet to fire.", "match": "(\\{)(\\})" }, { "match": "\\{|\\}", "name": "meta.brace.curly.js" }, { "match": "\\(|\\)", "name": "meta.brace.round.js" }, { "match": "\\[|\\]", "name": "meta.brace.square.js" }, { "match": "\\A#!.*$", "name": "comment.line.shebang.js" } ], "repository": { "numbers": { "patterns": [ { "match": "\\b((0(x|X)[0-9a-fA-F]+)|(0(b|B)[01]+)|(0(o|O)[0-7]+)|([0-9]+(\\.[0-9]+)?)((e|E)[+-]?[0-9]+)?)\\b", "name": "constant.numeric.js" } ] }, "strings": { "patterns": [ { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.js" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.js" } }, "name": "string.quoted.single.js", "patterns": [ { "match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)", "name": "constant.character.escape.js" }, { "match": "[^']*[^\\n\\r'\\\\]$", "name": "invalid.illegal.string.js" } ] }, { "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.js" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.js" } }, "name": "string.quoted.double.js", "patterns": [ { "match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)", "name": "constant.character.escape.js" }, { "match": "[^\"]*[^\\n\\r\"\\\\]$", "name": "invalid.illegal.string.js" } ] }, { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.js" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.js" } }, "name": "string.quoted.template.js", "patterns": [ { "match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)", "name": "constant.character.escape.js" }, { "include": "#interpolated_js" } ] } ] }, "methods": { "patterns": [ { "name": "meta.method.js", "comment": "match regular function like: function myFunc(arg) { … }", "begin": "\\b((?!(?:break|case|catch|continue|do|else|finally|for|function|if|export|import|package|return|switch|throw|try|while|with)[\\s\\(])(?:[a-zA-Z_$][a-zA-Z_$0-9]*))\\s*(\\()(?=(?:[^\\(\\)]*)?\\)\\s*\\{)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "punctuation.definition.parameters.begin.js" } }, "patterns": [ { "include": "#function-params" }, { "include": "#strings" } ], "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.js" } } } ] }, "function-params": { "patterns": [ { "include": "#numbers" }, { "include": "#strings" }, { "match": "\\(|\\)", "name": "meta.brace.round.js" }, { "match": "\\[|\\]", "name": "meta.brace.square.js" }, { "match": "\\{|\\}", "name": "meta.brace.curly.js" }, { "match": ",", "name": "meta.object.delimiter.js" }, { "match": "=", "name": "keyword.operator.js" }, { "include": "#comments" }, { "match": "[a-zA-Z_$][a-zA-Z_$0-9]*", "name": "variable.parameter.function.js" } ] }, "interpolated_js": { "patterns": [ { "begin": "\\$\\{", "captures": { "0": { "name": "punctuation.section.embedded.js" } }, "end": "\\}", "name": "source.js.embedded.source", "patterns": [ { "include": "$self" } ] } ] }, "docblock": { "patterns": [ { "match": "(?