Something went wrong. Try again.
a few hacks on top of zed
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364; Variables
(identifier) @variable
(call_expression function: (member_expression object: (identifier) @type (#any-of? @type "Promise" "Array" "Object" "Map" "Set" "WeakMap" "WeakSet" "Date" "Error" "TypeError" "RangeError" "SyntaxError" "ReferenceError" "EvalError" "URIError" "RegExp" "Function" "Number" "String" "Boolean" "Symbol" "BigInt" "Proxy" "ArrayBuffer" "DataView" ) ))
; Properties
(property_identifier) @property(shorthand_property_identifier) @property(shorthand_property_identifier_pattern) @property(private_property_identifier) @property
; Function and method calls
(call_expression function: (identifier) @function)
(call_expression function: (member_expression property: [(property_identifier) (private_property_identifier)] @function.method))
(new_expression constructor: (identifier) @type)
(nested_type_identifier module: (identifier) @type)
; Function and method definitions
(function_expression name: (identifier) @function)(function_declaration name: (identifier) @function)(method_definition name: [(property_identifier) (private_property_identifier)] @function.method)(method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor"))
(pair key: [(property_identifier) (private_property_identifier)] @function.method value: [(function_expression) (arrow_function)])
(assignment_expression left: (member_expression property: [(property_identifier) (private_property_identifier)] @function.method) right: [(function_expression) (arrow_function)])
(variable_declarator name: (identifier) @function value: [(function_expression) (arrow_function)])
(assignment_expression left: (identifier) @function right: [(function_expression) (arrow_function)])
; Parameters
(required_parameter (identifier) @variable.parameter)
(required_parameter (_ ([ (identifier) (shorthand_property_identifier_pattern) ]) @variable.parameter))
(optional_parameter (identifier) @variable.parameter)
(optional_parameter (_ ([ (identifier) (shorthand_property_identifier_pattern) ]) @variable.parameter))
(catch_clause parameter: (identifier) @variable.parameter)
(index_signature name: (identifier) @variable.parameter)
(arrow_function parameter: (identifier) @variable.parameter)
; Special identifiers;(class_declaration (type_identifier) @type.class)
(extends_clause value: (identifier) @type.class)
(type_identifier) @type(predefined_type) @type.builtin
([ (identifier) (shorthand_property_identifier) (shorthand_property_identifier_pattern) ] @constant (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
(this) @variable.special(super) @variable.special
[ (null) (undefined)] @constant.builtin
[ (true) (false)] @boolean
(comment) @comment
(hash_bang_line) @comment
[ (string) (template_string)] @string
(escape_sequence) @string.escape
(regex) @string.regex(regex_flags) @keyword.operator.regex(number) @number
; Tokens
[ ";" "?." "." "," ":"] @punctuation.delimiter
[ "-" "--" "-=" "+" "++" "+=" "*" "*=" "**" "**=" "/" "/=" "%" "%=" "<" "<=" "<<" "<<=" "=" "==" "===" "!" "!=" "!==" "=>" ">" ">=" ">>" ">>=" ">>>" ">>>=" "~" "^" "&" "|" "^=" "&=" "|=" "&&" "||" "??" "&&=" "||=" "??=" "..."] @operator
(regex "/" @string.regex)
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
(ternary_expression [ "?" ":" ] @operator)
[ "abstract" "as" "async" "await" "debugger" "declare" "default" "delete" "extends" "get" "implements" "in" "instanceof" "keyof" "module" "namespace" "new" "of" "override" "private" "protected" "public" "readonly" "set" "static" "target" "typeof" "using" "void" "with"] @keyword
[ "const" "let" "var" "function" "class" "enum" "interface" "type"] @keyword.declaration
[ "export" "from" "import"] @keyword.import
[ "break" "case" "catch" "continue" "do" "else" "finally" "for" "if" "return" "switch" "throw" "try" "while" "yield"] @keyword.control
(switch_default "default" @keyword.control)
(template_substitution "${" @punctuation.special "}" @punctuation.special) @embedded
(type_arguments "<" @punctuation.bracket ">" @punctuation.bracket)
(decorator "@" @punctuation.special)
; JSX elements(jsx_opening_element [ (identifier) @type (member_expression object: (identifier) @type property: (property_identifier) @type ) ])(jsx_closing_element [ (identifier) @type (member_expression object: (identifier) @type property: (property_identifier) @type ) ])(jsx_self_closing_element [ (identifier) @type (member_expression object: (identifier) @type property: (property_identifier) @type ) ])
(jsx_opening_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))(jsx_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))(jsx_self_closing_element (identifier) @tag.jsx (#match? @tag.jsx "^[a-z][^.]*$"))(jsx_attribute (property_identifier) @attribute.jsx)(jsx_opening_element (["<" ">"]) @punctuation.bracket.jsx)(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)(jsx_attribute "=" @punctuation.delimiter.jsx)(jsx_text) @text.jsx(html_character_reference) @string.special