{ "scopeName": "source.js", "fileTypes": [ "js", "_js", "es", "es6", "gs", "htc", "jscad", "jslib", "jsm", "json5", "jspre", "pac", "pjs", "xsjs", "xsjslib" ], "firstLineMatch": "^#!.*\\b(node|iojs|JavaScript)", "name": "JavaScript", "patterns": [ { "comment": "ES6 import", "begin": "(?\n)", "end": "(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G\\(|\n \\G[\\w$]+|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))", "patterns": [ { "include": "#comments" }, { "include": "#function_body" }, { "begin": "\\G", "end": "(?<=(=>))", "name": "meta.function.arrow.js", "patterns": [ { "include": "#arrow_function_innards" } ] } ] }, { "begin": "(?x)\n(?=\n (\\.)?[a-zA-Z_$][\\w$]*\n \\s*(=)\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)", "end": "(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G(\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*\\(|\n \\G(\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*[\\w$]+|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))", "patterns": [ { "include": "#comments" }, { "include": "#function_body" }, { "begin": "\\G", "end": "(?<=(=>))", "name": "meta.function.arrow.js", "patterns": [ { "match": "\\G(\\.)?([a-zA-Z_$][\\w$]*)\\s*(=)", "captures": { "1": { "name": "meta.delimiter.method.period.js" }, "2": { "name": "entity.name.function.js" }, "3": { "name": "keyword.operator.assignment.js" } } }, { "include": "#arrow_function_innards" } ] } ] }, { "begin": "(?x)\n(?=\n \\b[a-zA-Z_$][\\w$]*\n \\s*:\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)", "end": "(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G[\\w$]+:|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))", "patterns": [ { "include": "#comments" }, { "include": "#function_body" }, { "begin": "\\G", "end": "(?<=(=>))", "name": "meta.function.arrow.json.js", "patterns": [ { "match": "\\b([a-zA-Z_$][\\w$]*)\\s*(:)\\s*", "captures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "keyword.operator.assignment.js" } } }, { "include": "#arrow_function_innards" } ] } ] }, { "begin": "(?x)\n(?=\n (('[^']*?')|(\"[^\"]*?\"))\n \\s*:\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)", "end": "(?x)\n(?<=})|\n((?!\n \\G(('[^']*?')|(\"[^\"]*?\"))|\n \\s*{|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))", "patterns": [ { "include": "#comments" }, { "include": "#function_body" }, { "begin": "\\G", "end": "(?<=(=>))", "name": "meta.function.arrow.json.js", "patterns": [ { "match": "(?:((')([^']*?)('))|((\")([^\"]*?)(\")))\\s*(:)", "captures": { "1": { "name": "string.quoted.single.js" }, "2": { "name": "punctuation.definition.string.begin.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "punctuation.definition.string.end.js" }, "5": { "name": "string.quoted.double.js" }, "6": { "name": "punctuation.definition.string.begin.js" }, "7": { "name": "entity.name.function.js" }, "8": { "name": "punctuation.definition.string.end.js" }, "9": { "name": "keyword.operator.assignment.js" } } }, { "include": "#arrow_function_innards" } ] } ] }, { "match": "(=>)", "captures": { "0": { "name": "meta.function.arrow.js" }, "1": { "name": "storage.type.function.arrow.js" } } }, { "match": "(?x)\n\\b(class)\n(?:\n (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))\n |\n (?:\n (?:\\s+([a-zA-Z_$][\\w$]*))\n (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))?\n )\n)", "captures": { "1": { "name": "storage.type.class.js" }, "2": { "name": "storage.modifier.js" }, "3": { "name": "entity.name.type.class.js" }, "4": { "name": "entity.name.type.class.js" }, "5": { "name": "storage.modifier.js" }, "6": { "name": "entity.name.type.class.js" } }, "name": "meta.class.js" }, { "captures": { "1": { "name": "keyword.operator.new.js" }, "2": { "name": "entity.name.type.instance.js" } }, "match": "(new)\\s+(\\$?\\w+(?:\\.\\w*)?)", "name": "meta.class.instance.constructor" }, { "begin": "(?)", "name": "comment.block.html.js" }, { "match": "(?|&&|\\|\\|)\\s*(/)(?![/*+{}?])(?=.*/)", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.js" } }, "end": "(/)[gimuy]*", "endCaptures": { "1": { "name": "punctuation.definition.string.end.js" } }, "name": "string.regexp.js", "patterns": [ { "include": "source.js.regexp" } ] }, { "include": "#operators" }, { "include": "#method_calls" }, { "include": "#function_calls" }, { "include": "#numbers" }, { "include": "#objects" }, { "include": "#properties" }, { "match": "(?>=|>>>=|\\|=", "name": "keyword.operator.assignment.compound.bitwise.js" }, { "match": "!==|!=|<=|>=|===|==|<|>", "name": "keyword.operator.comparison.js" }, { "match": "&&|!|\\|\\|", "name": "keyword.operator.logical.js" }, { "match": "&|\\||\\^|~", "name": "keyword.operator.bitwise.js" }, { "match": "\\?|:", "name": "keyword.operator.js" }, { "match": "=", "name": "keyword.operator.assignment.js" }, { "match": "--", "name": "keyword.operator.decrement.js" }, { "match": "\\+\\+", "name": "keyword.operator.increment.js" }, { "match": "%|\\*|/|-|\\+", "name": "keyword.operator.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": "((\\w+)?(html|HTML|Html))\\s*(`)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "4": { "name": "punctuation.definition.string.begin.js" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.js" } }, "name": "string.quoted.template.html.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" }, { "include": "text.html.basic" } ] }, { "begin": "(Relay\\.QL)\\s*(`)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "punctuation.definition.string.begin.js" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.js" } }, "name": "string.quoted.template.graphql.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" }, { "include": "source.graphql" } ] }, { "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" } ] } ] }, "function_params": { "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.parameters.begin.bracket.round.js" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.js" } }, "name": "meta.parameters.js", "patterns": [ { "match": "(\\.\\.\\.)([a-zA-Z_$][\\w$]*)", "captures": { "1": { "name": "keyword.operator.spread.js" }, "2": { "name": "variable.parameter.rest.function.js" } } }, { "include": "$self" }, { "match": "[a-zA-Z_$][\\w$]*", "name": "variable.parameter.function.js" } ] } ] }, "function_body": { "patterns": [ { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.definition.function.body.begin.bracket.curly.js" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.definition.function.body.end.bracket.curly.js" } }, "patterns": [ { "include": "$self" } ] } ] }, "function_innards": { "patterns": [ { "match": "(?:\\b(async)\\b\\s*)?\\b(function)\\b(?:\\s*(\\*))?", "captures": { "1": { "name": "storage.modifier.async.js" }, "2": { "name": "storage.type.function.js" }, "3": { "name": "storage.modifier.generator.js" } } }, { "match": "[a-zA-Z_$][\\w$]*(?=\\s*\\()", "name": "entity.name.function.js" }, { "include": "#function_params" }, { "include": "#comments" } ] }, "arrow_function_innards": { "patterns": [ { "match": "=>", "name": "storage.type.function.arrow.js" }, { "include": "#function_params" }, { "match": "([a-zA-Z_$][\\w$]*)(?=\\s*=>)", "captures": { "0": { "name": "meta.parameters.js" }, "1": { "name": "variable.parameter.function.js" } } }, { "match": "(\\d[\\w$]*)", "captures": { "0": { "name": "meta.parameters.js" }, "1": { "name": "invalid.illegal.identifier.js" } } } ] }, "arguments": { "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.arguments.begin.bracket.round.js" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.arguments.end.bracket.round.js" } }, "name": "meta.arguments.js", "patterns": [ { "include": "$self" } ] } ] }, "method_calls": { "patterns": [ { "begin": "(\\.)\\s*([\\w$]+)\\s*(?=\\()", "beginCaptures": { "1": { "name": "meta.delimiter.method.period.js" }, "2": { "patterns": [ { "match": "(?x)\n\\bon(Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset|\nReadystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove|\nBefore(cut|deactivate|unload|update|paste|print|editfocus|activate)|\nBlur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help|\nChange|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate|\nDatasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover|\nDragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error|\nErrorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort)\\b", "name": "support.function.event-handler.js" }, { "match": "(?x)\n\\b(shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|\nscrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort|\nsup|sub|substr|substring|splice|split|send|set(Milliseconds|Seconds|Minutes|Hours|\nMonth|Year|FullYear|Date|UTC(Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|\nTime|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice|\nsavePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat|\ncontextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup|\ncreateEventObject|to(GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|\ntest|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|\nuntaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse|\nprint|prompt|preference|enableExternalCapture|elementFromPoint|exec|execScript|\nexecCommand|valueOf|UTC|queryCommandState|queryCommandIndeterm|queryCommandEnabled|\nqueryCommandValue|find|file|fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|\nfixed|fontsize|fontcolor|forward|fromCharCode|watch|link|load|lastIndexOf|\nanchor|attachEvent|atob|apply|alert|abort|routeEvents|\nresize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|releaseCapture|\nreleaseEvents|go|get(Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|\nTime|Date|TimezoneOffset|UTC(Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|\nAttention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo|\nmoveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back)\\b", "name": "support.function.js" }, { "match": "(?x)\n\\b(substringData|submit|splitText|setNamedItem|setAttribute|setAttributeNode|select|\nhasChildNodes|hasFeature|namedItem|click|close|cloneNode|createComment|createCDATASection|\ncreateCaption|createTHead|createTextNode|createTFoot|createDocumentFragment|\ncreateProcessingInstruction|createEntityReference|createElement|createAttribute|\ntabIndex|insertRow|insertBefore|insertCell|insertData|item|open|deleteRow|deleteCell|\ndeleteCaption|deleteTHead|deleteTFoot|deleteData|focus|write|writeln|add|appendChild|\nappendData|reset|replaceChild|replaceData|move|moveNamedItem|moveChild|moveAttribute|\nmoveAttributeNode|getNamedItem|getElementsByName|getElementsByTagName|getElementById|\ngetAttribute|getAttributeNode|blur)\\b", "name": "support.function.dom.js" }, { "match": "[a-zA-Z_$][\\w$]*", "name": "entity.name.function.js" }, { "match": "\\d[\\w$]*", "name": "invalid.illegal.identifier.js" } ] } }, "end": "(?<=\\))", "name": "meta.method-call.js", "patterns": [ { "include": "#arguments" } ] } ] }, "function_calls": { "patterns": [ { "begin": "([\\w$]+)\\s*(?=\\()", "beginCaptures": { "1": { "patterns": [ { "match": "(?x)\n\\b(isNaN|isFinite|eval|uneval|parseInt|parseFloat|decodeURI|\ndecodeURIComponent|encodeURI|encodeURIComponent|escape|unescape|\nrequire|set(Interval|Timeout)|clear(Interval|Timeout))\\b", "name": "support.function.js" }, { "match": "[a-zA-Z_$][\\w$]*", "name": "entity.name.function.js" }, { "match": "\\d[\\w$]*", "name": "invalid.illegal.identifier.js" } ] } }, "end": "(?<=\\))", "name": "meta.function-call.js", "patterns": [ { "include": "#arguments" } ] } ] }, "objects": { "patterns": [ { "match": "[A-Z][A-Z0-9_$]*(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)", "name": "constant.other.object.js" }, { "match": "[a-zA-Z_$][\\w$]*(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)", "name": "variable.other.object.js" } ] }, "properties": { "patterns": [ { "match": "(\\.)\\s*([A-Z][A-Z0-9_$]*\\b\\$*)(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)", "captures": { "1": { "name": "meta.delimiter.property.period.js" }, "2": { "name": "constant.other.object.property.js" } } }, { "match": "(\\.)\\s*(\\$*[a-zA-Z_$][\\w$]*)(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)", "captures": { "1": { "name": "meta.delimiter.property.period.js" }, "2": { "name": "variable.other.object.property.js" } } }, { "match": "(\\.)\\s*([A-Z][A-Z0-9_$]*\\b\\$*)", "captures": { "1": { "name": "meta.delimiter.property.period.js" }, "2": { "name": "constant.other.property.js" } } }, { "match": "(\\.)\\s*(\\$*[a-zA-Z_$][\\w$]*)", "captures": { "1": { "name": "meta.delimiter.property.period.js" }, "2": { "name": "variable.other.property.js" } } }, { "match": "(\\.)\\s*([0-9][\\w$]*)", "captures": { "1": { "name": "meta.delimiter.property.period.js" }, "2": { "name": "invalid.illegal.identifier.js" } } } ] }, "interpolated_js": { "patterns": [ { "begin": "\\$\\{", "captures": { "0": { "name": "punctuation.section.embedded.js" } }, "end": "\\}", "name": "source.js.embedded.source", "patterns": [ { "begin": "{", "beginCaptures": { "0": { "name": "meta.brace.curly.js" } }, "end": "}", "endCaptures": { "0": { "name": "meta.brace.curly.js" } }, "patterns": [ { "include": "$self" } ] }, { "include": "$self" } ] } ] }, "docblock": { "patterns": [ { "match": "(?