{ "scopeName": "source.js", "fileTypes": [ "js", "_js", "es", "es6", "gs", "htc", "jscad", "jslib", "jsm", "json5", "jspre", "pac", "pjs", "xsjs", "xsjslib" ], "firstLineMatch": "(?x)\n# Hashbang\n^\\#!.*(?:\\s|\\/|(?<=!)\\b)\n (?:node|iojs|JavaScript)\n(?:$|\\s)\n|\n# Modeline\n(?i:\n # Emacs\n -\\*-(?:(?:(?!mode\\s*:)[^:;]+:[^:;]+;)*\\s*mode\\s*:)?\\s*\n (?:js|javascript)\n \\s*(?:;[^:;]+:[^:;]+?)*;?\\s*-\\*-\n |\n # Vim\n (?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n javascript\n (?=\\s|:|$)\n)", "name": "JavaScript", "patterns": [ { "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$]+\\s*:|\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.other.inherited-class.js" }, "4": { "name": "entity.name.type.class.js" }, "5": { "name": "storage.modifier.js" }, "6": { "name": "entity.other.inherited-class.js" } }, "name": "meta.class.js" }, { "match": "(new)\\s+([\\w$]+[\\w.$]*)", "name": "meta.class.instance.constructor.js", "captures": { "1": { "name": "keyword.operator.new.js" }, "2": { "name": "entity.name.type.instance.js", "patterns": [ { "match": "\\.", "name": "meta.delimiter.property.period.js" } ] } } }, { "begin": "(?)", "captures": { "0": { "name": "punctuation.definition.comment.html.js" }, "2": { "name": "punctuation.definition.comment.html.js" } }, "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" } ] }, { "begin": "\\?", "beginCaptures": { "0": { "name": "keyword.operator.ternary.js" } }, "end": ":", "endCaptures": { "0": { "name": "keyword.operator.ternary.js" } }, "patterns": [ { "include": "#prevent_object_keys_matching" }, { "include": "$self" } ] }, { "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.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": [ { "include": "#string_escapes" }, { "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": [ { "include": "#string_escapes" }, { "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": [ { "include": "#string_escapes" }, { "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": [ { "include": "#string_escapes" }, { "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": [ { "include": "#string_escapes" }, { "include": "#interpolated_js" } ] } ] }, "string_escapes": { "patterns": [ { "match": "\\\\u(?![A-Fa-f0-9]{4}|{[A-Fa-f0-9]+})[^'\"]*", "name": "invalid.illegal.unicode-escape.js" }, { "match": "\\\\u(?:[A-Fa-f0-9]{4}|({)([A-Fa-f0-9]+)(}))", "name": "constant.character.escape.js", "captures": { "1": { "name": "punctuation.definition.unicode-escape.begin.bracket.curly.js" }, "2": { "patterns": [ { "match": "[A-Fa-f\\d]{7,}|(?!10)[A-Fa-f\\d]{6}", "name": "invalid.illegal.unicode-escape.js" } ] }, "3": { "name": "punctuation.definition.unicode-escape.end.bracket.curly.js" } } }, { "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" } ] }, "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|exec|execScript|valueOf|UTC|find|file|\nfileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|\nforward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert|\nabort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|\nreleaseCapture|releaseEvents|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(acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append|\nappendChild|appendData|before|blur|canPlayType|captureStream|\ncaretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click|\ncloneContents|cloneNode|cloneRange|close|closest|collapse|\ncompareBoundaryPoints|compareDocumentPosition|comparePoint|contains|\nconvertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute|\ncreateAttributeNS|createCaption|createCDATASection|createComment|\ncreateContextualFragment|createDocument|createDocumentFragment|\ncreateDocumentType|createElement|createElementNS|createEntityReference|\ncreateEvent|createExpression|createHTMLDocument|createNodeIterator|\ncreateNSResolver|createProcessingInstruction|createRange|createShadowRoot|\ncreateTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete|\ndeleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot|\ndeleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint|\nenableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen|\nexitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get|\ngetAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode|\ngetAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads|\ngetClientRects|getContext|getDestinationInsertionPoints|getElementById|\ngetElementsByClassName|getElementsByName|getElementsByTagName|\ngetElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate|\ngetVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes|\nhasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement|\ninsertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData|\ninsertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode|\nisPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI|\nlookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild|\nmoveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open|\nparentNode|pause|play|postMessage|prepend|preventDefault|previousNode|\npreviousSibling|probablySupportsContext|queryCommandEnabled|\nqueryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue|\nquerySelector|querySelectorAll|registerContentHandler|registerElement|\nregisterProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute|\nremoveAttributeNode|removeAttributeNS|removeChild|removeEventListener|\nremoveItem|replace|replaceChild|replaceData|replaceWith|reportValidity|\nrequestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView|\nscrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute|\nsetAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture|\nsetCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem|\nsetRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore|\nslice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|\nsubmit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|\ntoDataURL|toggle|toString|values|write|writeln)\\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": "(?x) (? # {Array} or {Object} type application\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {(string|number[])} type application, a string or an array of numbers\n ) |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {string[]|number} type application, an array of strings or a number\n ) |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n(\n \\[ # [foo] optional parameter\n \\s*\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n (?:\n \\s*\n = # [foo=bar] Default parameter value\n \\s*\n [\\w$\\s]*\n )?\n )\n \\s*\n \\] |\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n )?\n)\n\\s+\n((?:(?!\\*\\/).)*) # The type description", "captures": { "0": { "name": "other.meta.jsdoc" }, "1": { "name": "entity.name.type.instance.jsdoc" }, "2": { "name": "variable.other.jsdoc" }, "3": { "name": "other.description.jsdoc" } } }, { "match": "(?x)\n({(?:\n \\* | # {*} any type\n \\? | # {?} unknown type\n\n (?: # Check for a prefix\n \\? | # {?string} nullable type\n ! | # {!string} non-nullable type\n \\.{3} # {...string} variable number of parameters\n )?\n\n (?:\n \\( # Opening bracket of multiple types with parenthesis {(string|number)}\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n <[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n((?:(?!\\*\\/).)*) # The type description", "captures": { "0": { "name": "other.meta.jsdoc" }, "1": { "name": "entity.name.type.instance.jsdoc" }, "2": { "name": "other.description.jsdoc" } } } ] }, "comments": { "patterns": [ { "begin": "/\\*\\*(?!/)", "beginCaptures": { "0": { "name": "punctuation.definition.comment.js" } }, "end": "\\*/", "endCaptures": { "0": { "name": "punctuation.definition.comment.js" } }, "name": "comment.block.documentation.js", "patterns": [ { "include": "#docblock" } ] }, { "begin": "/\\*", "beginCaptures": { "0": { "name": "punctuation.definition.comment.js" } }, "end": "\\*/", "endCaptures": { "0": { "name": "punctuation.definition.comment.js" } }, "name": "comment.block.js" }, { "begin": "(^[ \\t]+)?(?=//)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.js" } }, "end": "(?!\\G)", "patterns": [ { "begin": "//", "beginCaptures": { "0": { "name": "punctuation.definition.comment.js" } }, "end": "\\n", "name": "comment.line.double-slash.js" } ] } ] }, "switch_statement": { "patterns": [ { "begin": "\\bswitch\\b", "beginCaptures": { "0": { "name": "keyword.control.switch.js" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.definition.section.switch-block.end.bracket.curly.js" } }, "name": "meta.switch-statement.js", "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.switch-expression.begin.bracket.round.js" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.switch-expression.end.bracket.round.js" } }, "patterns": [ { "include": "$self" } ] }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.definition.section.switch-block.begin.bracket.curly.js" } }, "end": "(?=})", "patterns": [ { "begin": "\\bcase\\b", "beginCaptures": { "0": { "name": "keyword.control.case.js" } }, "end": ":", "endCaptures": { "0": { "name": "punctuation.definition.section.case-statement.js" } }, "patterns": [ { "include": "#prevent_object_keys_matching" }, { "include": "$self" } ] }, { "match": "(?:^\\s*)?\\b(default)\\b\\s*(:)", "captures": { "1": { "name": "keyword.control.default.js" }, "2": { "name": "punctuation.definition.section.case-statement.js" } } }, { "include": "$self" } ] } ] } ] }, "prevent_object_keys_matching": { "patterns": [ { "match": "(\\w+)(?=\\s*:)", "captures": { "1": { "patterns": [ { "include": "$self" } ] } } } ] } } }