1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335 |
- # "?." means "?." or "."
- # Even though sometimes it doesn't seem like using the chaining operator would make any sense, it's still supported.
- # Example: Math?.PI
- # Negative look-behinds for "." should cover "?."
- 'scopeName': 'source.js'
- 'fileTypes': [
- 'js'
- '_js'
- 'cjs'
- 'es'
- 'es6'
- 'gs'
- 'htc'
- 'jscad'
- 'jscript'
- 'jse'
- 'jslib'
- 'jsm'
- 'json5'
- 'jspre'
- 'mjs'
- 'pac'
- 'pjs'
- 'sjs'
- 'snap'
- 'xsjs'
- 'xsjslib'
- ]
- 'firstLineMatch': '''(?x)
- # Hashbang
- ^\\#!.*(?:\\s|\\/|(?<=!)\\b)
- (?:node|iojs|JavaScript)
- (?:$|\\s)
- |
- # Modeline
- (?i:
- # Emacs
- -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
- (?:js|javascript)
- (?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
- |
- # Vim
- (?:(?:\\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*=
- javascript
- (?=\\s|:|$)
- )
- '''
- 'name': 'JavaScript'
- 'patterns': [
- {
- # ES6 import
- 'begin': '(?<!\\.)\\b(import)(?!\\s*[:(])\\b'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.js'
- 'end': '(?=;|$)'
- 'name': 'meta.import.js'
- 'patterns': [
- {
- # { member1 , member2 as alias2 , [...] }
- 'begin': '{'
- 'beginCaptures':
- 0:
- 'name': 'punctuation.definition.modules.begin.js'
- 'end': '}'
- 'endCaptures':
- 0:
- 'name': 'punctuation.definition.modules.end.js'
- 'patterns': [
- {
- # (default|name) as alias
- 'match': '''(?x)
- (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b)
- \\s*
- (\\b as \\b)
- \\s*
- (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b)
- '''
- 'captures':
- '1':
- 'name': 'variable.language.default.js'
- '2':
- 'name': 'variable.other.module.js'
- '3':
- 'name': 'keyword.control.js'
- '4':
- 'name': 'invalid.illegal.js'
- '5':
- 'name': 'variable.other.module-alias.js'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- {
- 'include': '#comments'
- }
- {
- 'match': '\\b([a-zA-Z_$][\\w$]*)\\b'
- 'name': 'variable.other.module.js'
- }
- ]
- }
- {
- # (default|*|name) as alias
- 'match': '''(?x)
- (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b)
- \\s*
- (\\b as \\b)
- \\s*
- (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b)
- '''
- 'captures':
- '1':
- 'name': 'variable.language.default.js'
- '2':
- 'name': 'variable.language.import-all.js'
- '3':
- 'name': 'variable.other.module.js'
- '4':
- 'name': 'keyword.control.js'
- '5':
- 'name': 'invalid.illegal.js'
- '6':
- 'name': 'variable.other.module-alias.js'
- }
- {
- 'match': '\\*'
- 'name': 'variable.language.import-all.js'
- }
- {
- 'match': '\\b(default)\\b'
- 'name': 'variable.language.default.js'
- }
- {
- 'include': '#strings'
- }
- {
- 'include': '#comments'
- }
- {
- 'match': '\\b(from)\\b'
- 'name': 'keyword.control.js'
- }
- {
- 'match': '\\b([a-zA-Z_$][\\w$]*)\\b(?=.*\\bfrom\\b)'
- 'name': 'variable.other.module.js'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- ]
- }
- {
- # ES6 export: export default (variable|class|function, etc.)
- 'match': '''(?x)
- \\b(export)\\b\\s*
- \\b(default)\\b\\s*
- \\b((?!\\b(?:function|class|let|var|const)\\b)[a-zA-Z_$][\\w$]*)?\\b
- '''
- 'captures':
- '0':
- 'name': 'meta.export.js'
- '1':
- 'name': 'keyword.control.js'
- '2':
- 'name': 'variable.language.default.js'
- '3':
- 'name': 'variable.other.module.js'
- }
- {
- # ES6 export, re-export: export {member as alias, [...]} [from ...]
- 'begin': '(?<!\\.)\\b(export)(?!\\s*[:(])\\b'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.js'
- 'end': '(?=;|\\bfunction\\b|\\bclass\\b|\\blet\\b|\\bvar\\b|\\bconst\\b|$)'
- 'name': 'meta.export.js'
- 'patterns': [
- {
- 'include': '#numbers'
- }
- {
- # { member1 , member2 as alias2 , [...] }
- 'begin': '(?![a-zA-Z_$0-9]){'
- 'beginCaptures':
- 0:
- 'name': 'punctuation.definition.modules.begin.js'
- 'end': '}'
- 'endCaptures':
- 0:
- 'name': 'punctuation.definition.modules.end.js'
- 'patterns': [
- {
- # name as (default|alias)
- 'captures':
- '1':
- 'name': 'variable.language.default.js'
- '2':
- 'name': 'variable.other.module.js'
- '3':
- 'name': 'keyword.control.js'
- '4':
- 'name': 'variable.language.default.js'
- '5':
- 'name': 'invalid.illegal.js'
- '6':
- 'name': 'variable.other.module-alias.js'
- 'match': '''(?x)
- (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b)
- \\s*
- (\\b as \\b)
- \\s*
- (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b)
- '''
- }
- {
- 'include': '#comments'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- {
- 'match': '\\b([a-zA-Z_$][\\w$]*)\\b'
- 'name': 'variable.other.module.js'
- }
- ]
- }
- {
- 'match': '\\*(?=.*\\bfrom\\b)'
- 'name': 'variable.language.import-all.js'
- }
- {
- 'match': '\\b(default)\\b'
- 'name': 'variable.language.default.js'
- }
- {
- 'include': '#strings'
- }
- {
- 'include': '#comments'
- }
- {
- 'match': '\\b(from)\\b'
- 'name': 'keyword.control.js'
- }
- {
- 'match': '\\b([a-zA-Z_$][\\w$]*)\\b'
- 'name': 'variable.other.module.js'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- {
- 'include': '#operators'
- }
- ]
- }
- {
- 'match': '(?:(?<=\\.{3})|(?<!\\.)\\b)(?<!\\$)(super|this|arguments)(?!\\s*:|\\$)\\b'
- 'name': 'variable.language.js'
- }
- {
- # [async] function [name](params)
- # function* name(params) – generator function declaration
- 'begin': '(?=(\\basync\\b\\s*)?\\bfunction\\b(?!\\s*:))'
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=\\))'
- 'name': 'meta.function.js'
- 'patterns': [
- {
- 'include': '#function_innards'
- }
- ]
- }
- ]
- }
- {
- # [?.]foo = function...
- 'begin': '(?=(\\?\\.|\\.)?[a-zA-Z_$][\\w$]*\\s*=\\s*(\\basync\\b\\s*)?\\bfunction\\b)'
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?!\\G)(?<=\\))'
- 'name': 'meta.function.js'
- 'patterns': [
- {
- 'match': '(\\?\\.|\\.)?([a-zA-Z_$][\\w$]*)\\s*(=)\\s*'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_illegal_optional_method'
- }
- ]
- '2':
- 'name': 'entity.name.function.js'
- '3':
- 'name': 'keyword.operator.assignment.js'
- }
- {
- 'include': '#function_innards'
- }
- ]
- }
- ]
- }
- {
- # foo: function...
- 'begin': '(?=\\b[a-zA-Z_$][\\w$]*\\s*:\\s*(\\basync\\b\\s*)?\\bfunction\\b)'
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=\\))'
- 'name': 'meta.function.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': '#function_innards'
- }
- ]
- }
- ]
- }
- {
- # "foo": function...
- 'begin': '(?=((\'[^\']*?\')|("[^"]*?"))\\s*:\\s*(\\basync\\b\\s*)?\\bfunction\\b)'
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=\\))'
- 'name': 'meta.function.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': '#function_innards'
- }
- ]
- }
- ]
- }
- {
- 'begin': '(?=\\bconstructor\\b\\s*)'
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=\\))'
- 'name': 'meta.function.js'
- 'patterns': [
- {
- 'match': '\\b(constructor)\\s*'
- 'name': 'entity.name.function.constructor.js'
- }
- {
- 'include': '#function_innards'
- }
- ]
- }
- ]
- }
- {
- # ES6 method definitions: foo() {}
- 'begin': '''(?x)
- (?=
- (?!
- (break|case|catch|continue|do|else|finally|for|function|if|
- return|switch|throw|try|while|with)
- [\\s\\(]
- )
- (
- \\b(get|set) # Property getter/setter: get foo(){}
- (?:\\s+|(?=\\[)) # Followed by whitespace or square bracket
- )?+
- ( # Method name
- \\b[a-zA-Z_$][\\w$]* # Fixed name
- |
- \\[ # Computed property key
- [^\\[\\]]++ # Contains at least one non-brace character
- \\]
- )
- \\s*\\(\\s* # Start of arguments list
- (
- "[^"]*" | # Double-quoted string
- '[^']*' | # Single-quoted string
- [^"()'] # Any non-bracket or non-quote
- )*
- \\)\\s* # End of arguments
- { # Beginning of body
- )
- '''
- 'end': '(?<=})'
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=\\))'
- 'name': 'meta.function.method.definition.js'
- 'patterns': [
- {
- 'match': '(\\[)(.+)(\\])(?=\\s*\\()'
- 'captures':
- '1':
- 'name': 'punctuation.definition.computed-key.begin.bracket.square.js'
- '2':
- 'patterns': [
- {
- 'include': '$self'
- }
- {
- 'match': '[a-zA-Z_$][\\w$]*'
- 'name': 'variable.parameter.property.js'
- }
- ]
- '3':
- 'name': 'punctuation.definition.computed-key.end.bracket.square.js'
- 'name': 'meta.computed-key.js'
- }
- {
- 'match': '\\b(get|set)(?=\\s*\\[.+\\]\\s*\\(|\\s+[^\\s\\[(]+\\s*\\()'
- 'name': 'keyword.operator.$1ter.js'
- }
- {
- 'match': '\\b([a-zA-Z_$][\\w$]*)'
- 'name': 'entity.name.function.js'
- }
- {
- 'include': '#function_params'
- }
- ]
- }
- ]
- }
- {
- # [param|(params)] => [expression|{statements}]
- 'begin': '''(?x)
- (?=
- (?<![A-Za-z0-9])
- ((\\(([^\\(\\)]*)?\\))|[\\w$]+)
- \\s*=>
- )
- '''
- 'end': '''(?x)
- (?<=})|
- ((?!
- \\s*{|
- \\G\\(|
- \\G[\\w$]+|
- \\s*/\\*|\\s*//
- )(?=\\s*\\S))
- '''
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'include': '#function_body'
- }
- {
- 'begin': '\\G'
- 'end': '(?<=(=>))'
- 'name': 'meta.function.arrow.js'
- 'patterns': [
- {
- 'include': '#arrow_function_innards'
- }
- ]
- }
- ]
- }
- {
- # [?.]foo = ... => ...
- 'begin': '''(?x)
- (?=
- (\\?\\.|\\.)?[a-zA-Z_$][\\w$]*
- \\s*(=)\\s*
- ((\\(([^\\(\\)]*)?\\))|[\\w$]+)
- \\s*=>
- )
- '''
- 'end': '''(?x)
- (?<=})|
- ((?!
- \\s*{|
- \\G(\\?\\.|\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*\\(|
- \\G(\\?\\.|\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*[\\w$]+|
- \\s*/\\*|\\s*//
- )(?=\\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':
- 'patterns': [
- {
- 'include': '#period_or_illegal_optional_method'
- }
- ]
- '2':
- 'name': 'entity.name.function.js'
- '3':
- 'name': 'keyword.operator.assignment.js'
- }
- {
- 'include': '#arrow_function_innards'
- }
- ]
- }
- ]
- }
- {
- # foo: ... => ...
- 'begin': '''(?x)
- (?=
- \\b[a-zA-Z_$][\\w$]*
- \\s*:\\s*
- ((\\(([^\\(\\)]*)?\\))|[\\w$]+)
- \\s*=>
- )
- '''
- 'end': '''(?x)
- (?<=})|
- ((?!
- \\s*{|
- \\G[\\w$]+\\s*:|
- \\s*/\\*|\\s*//
- )(?=\\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'
- }
- ]
- }
- ]
- }
- {
- # "foo": ... => ...
- 'begin': '''(?x)
- (?=
- ((\'[^\']*?\')|("[^"]*?"))
- \\s*:\\s*
- ((\\(([^\\(\\)]*)?\\))|[\\w$]+)
- \\s*=>
- )
- '''
- 'end': '''(?x)
- (?<=})|
- ((?!
- \\G((\'[^\']*?\')|("[^"]*?"))|
- \\s*{|
- \\s*/\\*|\\s*//
- )(?=\\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)
- \\b(class)
- (?:
- (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))
- |
- (?:
- (?:\\s+([a-zA-Z_$][\\w$]*))
- (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))?
- )
- )
- '''
- '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': [
- {
- 'include': '#period_or_illegal_optional_property'
- }
- ]
- }
- {
- # console
- # console.log(arg1, "arg2", [...])
- 'begin': '(?<![\\w$])console(?![\\w$]|\\s*:)'
- 'beginCaptures':
- '0':
- 'name': 'entity.name.type.object.console.js'
- 'end': '''(?x)
- (?<=\\)) | (?=
- (?! (\\s*//)|(\\s*/\\*)|(\\s*(\\?\\.|\\.)\\s*
- (assert|clear|count|countReset|debug|dir|dirxml|error|group|groupCollapsed|
- groupEnd|info|log|profile|profileEnd|table|time|timeEnd|timeLog|trace|
- timeStamp|warn)
- \\s*\\(
- )) \\s*\\S
- )
- '''
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'begin': '\\s*(\\?\\.|\\.)\\s*(\\w+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'name': 'support.function.console.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- ]
- }
- {
- # JSON
- 'begin': '(?<![\\w$])JSON(?![\\w$]|\\s*:)'
- 'beginCaptures':
- '0':
- 'name': 'support.class.json.js'
- 'end': '''(?x)
- (?<=\\)) | (?=
- (?! (\\s*//)|(\\s*/\\*)|(\\s*(\\?\\.|\\.)\\s*
- (parse|stringify)
- \\s*\\(
- )) \\s*\\S
- )
- '''
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- 'begin': '\\s*(\\?\\.|\\.)\\s*(\\w+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'name': 'support.function.json.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- ]
- }
- {
- # Math
- 'begin': '(?<![\\w$])Math(?![\\w$]|\\s*:)'
- 'beginCaptures':
- '0':
- 'name': 'support.class.math.js'
- 'end': '''(?x)
- (?<=E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2|\\)
- ) | (?=
- (?! (\\s*//)|(\\s*/\\*)|(\\s*(\\?\\.|\\.)\\s* (
- ((abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp|
- expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random|
- round|sign|sin|sinh|sqrt|tan|tanh|trunc)\\s*\\(
- ) | (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)(?!\\s*[\\w$(]))
- )) \\s*\\S
- )
- '''
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- # Math.random()
- 'begin': '\\s*(\\?\\.|\\.)\\s*(\\w+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'name': 'support.function.math.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- {
- # Math.PI
- 'match': '\\s*(\\?\\.|\\.)\\s*(\\w+)\\b'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'support.constant.property.math.js'
- }
- ]
- }
- {
- # Promise
- 'begin': '(?<![\\w$])Promise(?![\\w$]|\\s*:)'
- 'beginCaptures':
- '0':
- 'name': 'support.class.promise.js'
- 'end': '''(?x)
- (?<=\\)) | (?=
- (?! (\\s*//)|(\\s*/\\*)|(\\s*(\\?\\.|\\.)\\s*(all|allSettled|any|race|reject|resolve)\\s*\\() )\\s*\\S
- )
- '''
- 'patterns': [
- {
- 'include': '#comments'
- }
- {
- # Promise.all()
- 'begin': '\\s*(\\?\\.|\\.)\\s*(\\w+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'name': 'support.function.promise.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- ]
- }
- {
- 'include': '#strings'
- }
- {
- 'include': '#comments'
- }
- {
- 'match': '(<!--|-->)'
- 'captures':
- '0':
- 'name': 'punctuation.definition.comment.html.js'
- '2':
- 'name': 'punctuation.definition.comment.html.js'
- 'name': 'comment.block.html.js'
- }
- {
- 'match': '(?<!\\.)\\b(class|enum|function|interface)(?!\\s*:)\\b'
- 'name': 'storage.type.js'
- }
- {
- 'match': '(?<!\\.)\\b(async|export|extends|implements|private|protected|public|static)(?!\\s*:)\\b'
- 'name': 'storage.modifier.js'
- }
- {
- 'match': '(?<!\\.)\\b(let|var)(?!\\s*:)\\b'
- 'name': 'storage.type.var.js'
- }
- {
- 'begin': '(?<!\\.)\\b(const)(?!\\s*:)\\b'
- 'beginCaptures':
- '1':
- 'name': 'storage.type.const.js'
- 'end': '(\\bof\\b|\\bin\\b)|(;)|(=)|(?<![,{])\\n'
- 'endCaptures':
- '1':
- 'name': 'keyword.operator.$1.js'
- '2':
- 'name': 'punctuation.terminator.statement.js'
- '3':
- 'name': 'keyword.operator.assignment.js'
- 'patterns': [
- {
- 'match': '([$_a-zA-Z][$_a-zA-Z0-9]*)\\s*(:)\\s*([$_a-zA-Z][$_a-zA-Z0-9]*)?'
- 'captures':
- '2':
- 'name': 'keyword.operator.assignment.js'
- '3':
- 'name': 'constant.other.js'
- }
- {
- 'match': '([$_a-zA-Z][$_a-zA-Z0-9]*)'
- 'captures':
- '1':
- 'name': 'constant.other.js'
- }
- {
- 'match': '\\.\\.\\.'
- 'name': 'keyword.operator.spread.js'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- {
- 'match': '\\(|\\)'
- 'name': 'meta.brace.round.js'
- }
- {
- 'match': '{|}'
- 'name': 'meta.brace.curly.js'
- }
- {
- 'match': '\\[|\\]'
- 'name': 'meta.brace.square.js'
- }
- {
- 'include': '#comments'
- }
- ]
- }
- {
- 'match': '(?<!\\.)\\b(yield)(?!\\s*:)\\b(?:\\s*(\\*))?',
- 'captures':
- '1':
- 'name': 'keyword.control.js'
- '2':
- 'name': 'storage.modifier.js'
- 'name': 'meta.control.yield.js'
- }
- {
- # This is "..." so don't need to check "?."
- 'match': '(?:(?<=\\.{3})|(?<!\\.))\\b(await)(?!\\s*:)\\b'
- 'name': 'keyword.control.js'
- }
- {
- 'match': '(?<!\\.)\\b(break|catch|continue|do|else|finally|for|if|import|package|return|throw|try|while|with)(?!\\s*:)\\b'
- 'name': 'keyword.control.js'
- }
- {
- 'include': '#switch_statement'
- }
- {
- 'match': '(?<!\\.)\\b(delete|in|of|instanceof|new|typeof|void)(?!\\s*:)\\b'
- 'name': 'keyword.operator.$1.js'
- }
- # By default, three dots = spread
- # `keyword.operator.rest.js` is only done in specific cases in functions
- {
- 'match': '\\.\\.\\.'
- 'name': 'keyword.operator.spread.js'
- }
- {
- 'match': '(?<!\\.)\\b(true|false)(?!\\s*:)\\b'
- 'name': 'constant.language.boolean.$1.js'
- }
- {
- 'match': '(?<!\\.)\\b(null)(?!\\s*:)\\b'
- 'name': 'constant.language.null.js'
- }
- {
- 'match': '(?<!\\.)\\b(debugger)(?!\\s*:)\\b'
- 'name': 'keyword.other.debugger.js'
- }
- {
- 'match': '''(?x) (?<!\\$) \\b
- (AggregateError|Array|ArrayBuffer|AsyncFunction|AsyncGeneratorFunction|Atomics|BigInt|BigInt64Array
- |BigUInt64Array|Boolean|DataView|Date|Error|EvalError|FinalizationRegistry|Float32Array|Float64Array
- |Function|Generator|GeneratorFunction|Int16Array|Int32Array|Int8Array|InternalError|Intl|Map|Number
- |Object|Proxy|RangeError|ReferenceError|Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|SyntaxError
- |TypedArray|TypeError|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|URIError|WeakMap|WeakRef|WeakSet)
- \\b
- '''
- 'name': 'support.class.js'
- }
- {
- 'match': '''(?x) (\\?\\.|\\.) \\s* (?:
- (constructor|length|prototype) |
- (EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)
- )\\b
- '''
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'support.variable.property.js'
- '3':
- 'name': 'support.constant.js'
- }
- {
- 'match': '''(?x) (?<!\\$) \\b (?:
- (document|event|navigator|performance|screen|window|self|frames)
- |
- (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener
- |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
- |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration
- |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern
- |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent
- |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException
- |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer
- |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry
- |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent
- |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential
- |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync
- |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement
- |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement
- |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement
- |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement
- |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement
- |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement
- |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement
- |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement
- |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement
- |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement
- |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement
- |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase
- |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction
- |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities
- |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess
- |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent
- |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream
- |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent
- |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID
- |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification
- |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential
- |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark
- |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList
- |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent
- |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList
- |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager
- |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource
- |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement
- |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength
- |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio
- |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement
- |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement
- |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement
- |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength
- |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement
- |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio
- |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList
- |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement
- |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement
- |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState
- |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet
- |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable
- |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer
- |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat
- |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES
- |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope
- |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult
- |XSLTProcessor)
- )\\b
- '''
- 'captures':
- '1':
- 'name': 'support.variable.dom.js'
- '2':
- 'name': 'support.class.dom.js'
- }
- {
- 'match': '''(?x) (\\?\\.|\\.) \\s*
- (?:
- (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE
- |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR
- |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR
- |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR)
- |
- (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName
- |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop
- |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor
- |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption
- |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear
- |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete
- |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset
- |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight
- |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds
- |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize
- |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host
- |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth
- |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext
- |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom
- |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple
- |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName
- |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight
- |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer
- |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling
- |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText
- |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts
- |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove
- |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
- |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
- |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
- |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex)
- )
- \\b
- '''
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'support.constant.dom.js'
- '3':
- 'name': 'support.variable.property.dom.js'
- }
- {
- 'match': '(?<!\\.)\\b(module|exports|__filename|__dirname|global|globalThis|process)(?!\\s*:)\\b'
- 'name': 'support.variable.js'
- }
- {
- 'match': '\\b(Infinity|NaN|undefined)\\b'
- 'name': 'constant.language.js'
- }
- {
- 'begin': '(?<=[\\[{=(?:+*,!~-]|^|return|=>|&&|\\|\\|)\\s*(/)(?![/*+?])(?=.*/)'
- 'beginCaptures':
- '1':
- 'name': 'punctuation.definition.string.begin.js'
- 'end': '(/)([gimsuy]*)'
- 'endCaptures':
- '1':
- 'name': 'punctuation.definition.string.end.js'
- '2':
- 'name': 'meta.flag.regexp'
- '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': '((?<!\\.|[\\w$])(?![_\\$]+[^A-Z0-9_$])\\$*\\b(?:[A-Z_$][A-Z0-9_$]*)\\b\\$*)'
- 'name': 'constant.other.js'
- }
- {
- 'match': '(?<!\\$)\\b[0-9]+[\\w$]*'
- 'name': 'invalid.illegal.identifier.js'
- }
- {
- 'match': '\\;'
- 'name': 'punctuation.terminator.statement.js'
- }
- {
- 'match': ','
- 'name': 'meta.delimiter.object.comma.js'
- }
- {
- # Allows the special return snippet to fire.
- 'match': '({)(})'
- 'captures':
- '1':
- 'name': 'punctuation.section.scope.begin.js'
- '2':
- 'name': 'punctuation.section.scope.end.js'
- }
- {
- 'begin': '{'
- 'beginCaptures':
- '0':
- 'name': 'meta.brace.curly.js'
- 'end': '}'
- 'endCaptures':
- '0':
- 'name': 'meta.brace.curly.js'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '\\('
- 'beginCaptures':
- '0':
- 'name': 'meta.brace.round.js'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'meta.brace.round.js'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- # This is inconsistent with the () and {}, however the current tests *rely* on this
- '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-9a-fA-F]+)*n?\\b(?!\\$)'
- 'name': 'constant.numeric.hex.js'
- 'captures':
- '0':
- 'patterns': [
- {
- 'include': '#numeric_separators'
- }
- ]
- }
- {
- 'match': '\\b(?<!\\$)0(b|B)[01]+(?:_[01]+)*n?\\b(?!\\$)'
- 'name': 'constant.numeric.binary.js'
- 'captures':
- '0':
- 'patterns': [
- {
- 'include': '#numeric_separators'
- }
- ]
- }
- {
- 'match': '\\b(?<!\\$)0(o|O)?[0-7]+(?:_[0-7]+)*n?\\b(?!\\$)'
- 'name': 'constant.numeric.octal.js'
- 'captures':
- '0':
- 'patterns': [
- {
- 'include': '#numeric_separators'
- }
- ]
- }
- {
- 'match': '''(?x)
- (?<!\\$)(?:
- (?:\\b[0-9]+(?:_[0-9]+)*\\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1.1E+3
- (?:\\b[0-9]+(?:_[0-9]+)*\\.[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1.E+3
- (?:\\B\\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # .1E+3
- (?:\\b[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1E+3
- (?:\\b[0-9]+(?:_[0-9]+)*\\.[0-9]+(?:_[0-9]+)*\\b)| # 1.1
- (?:\\b[0-9]+(?:_[0-9]+)*\\.\\B)| # 1.
- (?:\\B\\.[0-9]+(?:_[0-9]+)*\\b)| # .1
- (?:\\b[0-9]+(?:_[0-9]+)*n?\\b(?!\\.)) # 1n
- )(?!\\$)
- '''
- 'name': 'constant.numeric.decimal.js'
- 'captures':
- '0':
- 'patterns': [
- {
- 'include': '#numeric_separators'
- }
- ]
- }
- ]
- 'numeric_separators':
- 'patterns': [
- {
- 'match': '(_)|(\\.)'
- 'captures':
- '1':
- 'name': 'meta.delimiter.numeric.separator.js'
- '2':
- 'name': 'meta.delimiter.decimal.period.js'
- }
- ]
- 'operators':
- 'patterns': [
- {
- # %= **= *= /= += -=
- 'match': '%=|\\*\\*=|\\*=|(?<!\\()/=|\\+=|-='
- 'name': 'keyword.operator.assignment.compound.js'
- }
- {
- # &&= ||= ??=
- 'match': '&&=|\\|\\|=|\\?\\?='
- 'name': 'keyword.operator.assignment.compound.logical.js'
- }
- {
- 'match': '&=|\\^=|\\|='
- 'name': 'keyword.operator.assignment.compound.bitwise.js'
- }
- {
- 'match': '<<=|>>=|>>>='
- 'name': 'keyword.operator.assignment.compound.bitwise.shift.js'
- }
- # Bitwise shift to match >> instead of >
- # Then comparison to match != instead of !
- {
- 'match': '<<|>>>|>>'
- 'name': 'keyword.operator.bitwise.shift.js'
- }
- {
- 'match': '!==|!=|<=|>=|===|==|<|>'
- 'name': 'keyword.operator.comparison.js'
- }
- {
- # One of: && !! ! || ??
- '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'
- }
- ]
- }
- {
- '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'
- }
- ]
- }
- {
- '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': '(?<=innerHTML)\\s*(\\+?=)\\s*(?=`)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.assignment.js'
- 'end': '(?<=`)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.js'
- 'contentName': 'string.quoted.template.html.js'
- 'patterns': [
- {
- 'begin': '`'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.js'
- 'end': '`'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.js'
- 'patterns': [
- {
- 'include': '#string_escapes'
- }
- {
- 'include': '#interpolated_js'
- }
- {
- 'include': 'text.html.basic'
- }
- ]
- }
- ]
- }
- {
- 'begin': '(Relay(\\?\\.|\\.)QL|gql)\\s*(`)'
- 'beginCaptures':
- '1':
- 'name': 'entity.name.function.js'
- '2':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '3':
- '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': '(sql|SQL|Sql)\\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.sql.js'
- 'patterns': [
- {
- 'include': '#string_escapes'
- }
- {
- 'include': '#interpolated_js'
- }
- {
- 'include': 'source.sql'
- }
- ]
- }
- {
- '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': [
- {
- # Max codepoint: \u{10FFFF}
- '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[0-9A-Fa-f]{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.rest.js'
- '2':
- 'name': 'variable.parameter.rest.function.js'
- }
- {
- 'include': '$self'
- }
- {
- 'match': '[a-zA-Z_$][\\w$]*'
- 'name': 'variable.parameter.function.js'
- }
- ]
- }
- {
- # Or starting with optional chaining
- 'begin': '(\\?\\.)(\\()'
- 'beginCaptures':
- '1':
- 'name': 'meta.delimiter.method.optional.js'
- '2':
- '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.rest.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': [
- {
- # [?].methodCall(arg1, "arg2", [...])
- 'begin': '(\\?\\.|\\.)\\s*([\\w$]+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'patterns': [
- {
- 'include': '#method_names'
- }
- ]
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- {
- # [?].methodCall?.(arg1, "arg2", [...])
- 'begin': '(\\?\\.|\\.)\\s*([\\w$]+)\\s*(\\?\\.)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_method'
- }
- ]
- '2':
- 'patterns': [
- {
- 'include': '#method_names'
- }
- ]
- '3':
- 'name': 'meta.delimiter.method.optional.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- {
- # [array]?.(arg1, "arg2", [...])
- # The array itself is not in the method-call scope, maybe later
- 'begin': '(?<=\\])\\s*(\\?\\.)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'name': 'meta.delimiter.method.optional.js'
- 'end': '(?<=\\))'
- 'name': 'meta.method-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- ]
- 'method_names':
- 'patterns': [
- {
- 'match': '''(?x)
- \\bon(Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset|
- Readystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove|
- Before(cut|deactivate|unload|update|paste|print|editfocus|activate)|
- Blur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help|
- Change|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate|
- Datasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover|
- Dragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error|
- Errorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort)\\b
- '''
- 'name': 'support.function.event-handler.js'
- }
- {
- 'match': '''(?x)
- \\b(catch|finally|then|shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|
- scrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort|
- sup|sub|substr|substring|splice|split|send|set(Milliseconds|Seconds|Minutes|Hours|
- Month|Year|FullYear|Date|UTC(Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|
- Time|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice|
- savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat|
- contextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup|
- createEventObject|to(GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|
- test|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|
- untaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse|stringify|
- print|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file|
- fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|
- forward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert|
- abort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|
- releaseCapture|releaseEvents|go|get(Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|
- Time|Date|TimezoneOffset|UTC(Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|
- Attention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo|
- moveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back)\\b
- '''
- 'name': 'support.function.js'
- }
- {
- 'match': '''(?x)
- \\b(acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append|
- appendChild|appendData|before|blur|canPlayType|captureStream|
- caretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click|
- cloneContents|cloneNode|cloneRange|close|closest|collapse|
- compareBoundaryPoints|compareDocumentPosition|comparePoint|contains|
- convertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute|
- createAttributeNS|createCaption|createCDATASection|createComment|
- createContextualFragment|createDocument|createDocumentFragment|
- createDocumentType|createElement|createElementNS|createEntityReference|
- createEvent|createExpression|createHTMLDocument|createNodeIterator|
- createNSResolver|createProcessingInstruction|createRange|createShadowRoot|
- createTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete|
- deleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot|
- deleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint|
- enableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen|
- exitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get|
- getAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode|
- getAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads|
- getClientRects|getContext|getDestinationInsertionPoints|getElementById|
- getElementsByClassName|getElementsByName|getElementsByTagName|
- getElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate|
- getVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes|
- hasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement|
- insertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData|
- insertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode|
- isPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI|
- lookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild|
- moveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open|
- parentNode|pause|play|postMessage|prepend|preventDefault|previousNode|
- previousSibling|probablySupportsContext|queryCommandEnabled|
- queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue|
- querySelector|querySelectorAll|registerContentHandler|registerElement|
- registerProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute|
- removeAttributeNode|removeAttributeNS|removeChild|removeEventListener|
- removeItem|replace|replaceChild|replaceData|replaceWith|reportValidity|
- requestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView|
- scrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute|
- setAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture|
- setCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem|
- setRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore|
- slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|
- submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|
- toDataURL|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'
- }
- ]
- 'function_calls':
- 'patterns': [
- {
- # functionCall(arg1, "arg2", [...])
- 'begin': '([\\w$]+)\\s*(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'match': '''(?x)
- \\b(isNaN|isFinite|eval|uneval|parseInt|parseFloat|decodeURI|
- decodeURIComponent|encodeURI|encodeURIComponent|escape|unescape|
- require|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'
- }
- ]
- }
- {
- # functionCall?.(arg1, "arg2", [...])
- 'begin': '([\\w$]+)\\s*(\\?\\.)(?=\\()'
- 'beginCaptures':
- '1':
- 'patterns': [
- {
- 'match': '''(?x)
- \\b(isNaN|isFinite|eval|uneval|parseInt|parseFloat|decodeURI|
- decodeURIComponent|encodeURI|encodeURIComponent|escape|unescape|
- require|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'
- }
- ]
- '2':
- 'name': 'meta.delimiter.method.optional.js'
- 'end': '(?<=\\))'
- 'name': 'meta.function-call.js'
- 'patterns': [
- {
- 'include': '#arguments'
- }
- ]
- }
- ]
- 'objects':
- 'patterns': [
- # "Obj." is already enough to prove objectness,
- # however "Obj.[8]" is impossible, and
- # "Obj?.()" is a function
- {
- # OBJ in OBJ.prop, OBJ.methodCall()
- 'match': '[A-Z][A-Z0-9_$]*(?=\\s*\\??\\.\\s*[a-zA-Z_$]\\w*)'
- 'name': 'constant.other.object.js'
- }
- {
- # obj in obj.prop, obj.methodCall()
- 'match': '[a-zA-Z_$][\\w$]*(?=\\s*\\??\\.\\s*[a-zA-Z_$]\\w*)'
- 'name': 'variable.other.object.js'
- }
- {
- # OBJ in OBJ[8], OBJ?.[8]
- 'match': '[A-Z][A-Z0-9_$]*(?=\\s*(\\?\\.)?\\s*\\[)'
- 'name': 'constant.other.object.js'
- }
- {
- # obj in obj[8], obj?.[8]
- 'match': '[a-zA-Z_$][\\w$]*(?=\\s*(\\?\\.)?\\s*\\[)'
- 'name': 'variable.other.object.js'
- }
- ]
- 'properties':
- 'patterns': [
- # object.prop includes object?.prop
- {
- # Specifically ?.[], for example divArray?.[8]
- 'begin': '(\\?\\.)\\s*(\\[)'
- 'beginCaptures':
- '1':
- 'name': 'meta.delimiter.property.optional.js'
- '2':
- 'name': 'meta.brace.square.js'
- 'end': '\\]'
- 'endCaptures':
- '0':
- 'name': 'meta.brace.square.js'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- # PROP1 in obj.PROP1.prop2, func().PROP1.prop2
- 'match': '(\\?\\.|\\.)\\s*([A-Z][A-Z0-9_$]*\\b\\$*)(?=\\s*(\\?\\.|\\.)\\s*[a-zA-Z_$]\\w*)'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'constant.other.object.property.js'
- }
- {
- # prop1 in obj.prop1.prop2, func().prop1.prop2
- 'match': '(\\?\\.|\\.)\\s*(\\$*[a-zA-Z_$][\\w$]*)(?=\\s*(\\?\\.|\\.)\\s*[a-zA-Z_$]\\w*)'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'variable.other.object.property.js'
- }
- {
- # PROP in obj.PROP, func().PROP
- 'match': '(\\?\\.|\\.)\\s*([A-Z][A-Z0-9_$]*\\b\\$*)'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'constant.other.property.js'
- }
- {
- # prop in obj.prop, func().prop
- 'match': '(\\?\\.|\\.)\\s*(\\$*[a-zA-Z_$][\\w$]*)'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '2':
- 'name': 'variable.other.property.js'
- }
- {
- # 123illegal in obj.123illegal, func().123illegal
- 'match': '(\\?\\.|\\.)\\s*([0-9][\\w$]*)'
- 'captures':
- '1':
- 'patterns': [
- {
- 'include': '#period_or_optional_property'
- }
- ]
- '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'
- }
- ]
- }
- ]
- 'comments':
- 'patterns': [
- {
- 'captures':
- '1':
- 'name': 'punctuation.definition.comment.begin.js'
- '2':
- 'name': 'punctuation.definition.comment.end.js'
- 'match': '(/\\*)(\\*/)'
- 'name': 'comment.block.empty.js'
- }
- {
- 'begin': '/\\*\\*'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.begin.js'
- 'end': '\\*/'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.comment.end.js'
- 'name': 'comment.block.documentation.js'
- 'patterns': [
- {
- 'include': 'source.jsdoc'
- }
- ]
- }
- {
- 'begin': '/\\*'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.begin.js'
- 'end': '\\*/'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.comment.end.js'
- 'name': 'comment.block.js'
- }
- {
- 'begin': '//'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.js'
- 'end': '$'
- 'name': 'comment.line.double-slash.js'
- }
- ]
- 'switch_statement':
- 'patterns': [
- {
- # switch(expression) {...}
- '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': [
- {
- # e.g. don't treat null as an object key in
- # ? null :
- # case null:
- 'match': '(\\w+)(?=\\s*:)'
- 'captures':
- '1':
- 'patterns': [
- 'include': '$self'
- ]
- }
- ]
- 'period_or_illegal_optional_property':
- 'patterns': [
- {
- 'match': '\\.'
- 'name': 'meta.delimiter.property.period.js'
- }
- {
- 'match': '\\?\\.'
- 'name': 'invalid.illegal.meta.delimiter.property.optional.js'
- }
- ]
- 'period_or_illegal_optional_method':
- 'patterns': [
- {
- 'match': '\\.'
- 'name': 'meta.delimiter.method.period.js'
- }
- {
- 'match': '\\?\\.'
- 'name': 'invalid.illegal.meta.delimiter.method.optional.js'
- }
- ]
- 'period_or_optional_property':
- 'patterns': [
- {
- 'match': '\\.'
- 'name': 'meta.delimiter.property.period.js'
- }
- {
- 'match': '\\?\\.'
- 'name': 'meta.delimiter.property.optional.js'
- }
- ]
- 'period_or_optional_method':
- 'patterns': [
- {
- 'match': '\\.'
- 'name': 'meta.delimiter.method.period.js'
- }
- {
- 'match': '\\?\\.'
- 'name': 'meta.delimiter.method.optional.js'
- }
- ]
|