summaryrefslogtreecommitdiff
path: root/vrsite/assets/javascript.scm
diff options
context:
space:
mode:
Diffstat (limited to 'vrsite/assets/javascript.scm')
-rw-r--r--vrsite/assets/javascript.scm52
1 files changed, 52 insertions, 0 deletions
diff --git a/vrsite/assets/javascript.scm b/vrsite/assets/javascript.scm
new file mode 100644
index 0000000..a5c8f01
--- /dev/null
+++ b/vrsite/assets/javascript.scm
@@ -0,0 +1,52 @@
+; JavaScript highlights, from tree-sitter/tree-sitter-javascript v0.25.0
+; queries/highlights.scm (MIT). Reordered for later-patterns-win and capture
+; names mapped onto zed syntax keys. Upstream's @variable.builtin and require()
+; patterns are gone: they lean on (#is-not? local), which no query engine
+; outside nvim evaluates. Also loaded ahead of typescript.scm, the way upstream
+; composes the TypeScript highlights.
+
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+[";" (optional_chain) "." ","] @punctuation.delimiter
+["-" "--" "-=" "+" "++" "+=" "*" "*=" "**" "**=" "/" "/=" "%" "%=" "<" "<="
+ "<<" "<<=" "=" "==" "===" "!" "!=" "!==" "=>" ">" ">=" ">>" ">>=" ">>>"
+ ">>>=" "~" "^" "&" "|" "^=" "&=" "|=" "&&" "||" "??" "&&=" "||="
+ "??="] @operator
+
+["as" "async" "await" "break" "case" "catch" "class" "const" "continue"
+ "debugger" "default" "delete" "do" "else" "export" "extends" "finally" "for"
+ "from" "function" "get" "if" "import" "in" "instanceof" "let" "new" "of"
+ "return" "set" "static" "switch" "target" "throw" "try" "typeof" "var"
+ "void" "while" "with" "yield"] @keyword
+
+[(property_identifier) (shorthand_property_identifier)] @property
+
+((identifier) @constructor
+ (#match? @constructor "^[A-Z]"))
+([(identifier) (shorthand_property_identifier)
+ (shorthand_property_identifier_pattern)] @constant
+ (#match? @constant "^[A-Z_][A-Z0-9_]+$"))
+
+(function_expression name: (identifier) @function)
+(function_declaration name: (identifier) @function)
+(method_definition name: (property_identifier) @function.method)
+(pair key: (property_identifier) @function.method
+ value: [(function_expression) (arrow_function)])
+(assignment_expression
+ left: (member_expression property: (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)])
+(call_expression function: (identifier) @function)
+(call_expression function: (member_expression
+ property: (property_identifier) @function.method))
+
+[(this) (super)] @variable.special
+(number) @number
+[(true) (false) (null) (undefined)] @constant
+[(string) (template_string)] @string
+(escape_sequence) @string.escape
+(regex) @string.regex
+(template_substitution "${" @punctuation.special "}" @punctuation.special)
+(comment) @comment