aboutsummaryrefslogtreecommitdiffstats
path: root/queries/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'queries/javascript')
-rw-r--r--queries/javascript/folds.scm21
-rw-r--r--queries/javascript/highlights.scm273
-rw-r--r--queries/javascript/indents.scm33
-rw-r--r--queries/javascript/injections.scm21
-rw-r--r--queries/javascript/locals.scm64
5 files changed, 5 insertions, 407 deletions
diff --git a/queries/javascript/folds.scm b/queries/javascript/folds.scm
index ad10a00e5..b6d9b28bf 100644
--- a/queries/javascript/folds.scm
+++ b/queries/javascript/folds.scm
@@ -1,20 +1 @@
-; inherits: (jsx)
-[
- (for_in_statement)
- (for_statement)
- (while_statement)
- (arrow_function)
- (function)
- (function_declaration)
- (class_declaration)
- (method_definition)
- (do_statement)
- (with_statement)
- (switch_statement)
- (switch_case)
- (import_statement)
- (if_statement)
- (try_statement)
- (catch_clause)
- (object)
-] @fold
+; inherits: ecma,jsx
diff --git a/queries/javascript/highlights.scm b/queries/javascript/highlights.scm
index 57cabd93e..b6d9b28bf 100644
--- a/queries/javascript/highlights.scm
+++ b/queries/javascript/highlights.scm
@@ -1,272 +1 @@
-; inherits: (jsx)
-; Types
-
-; Javascript
-
-; Variables
-;-----------
-(identifier) @variable
-
-; Properties
-;-----------
-
-(property_identifier) @property
-(shorthand_property_identifier) @property
-
-; Special identifiers
-;--------------------
-
-((identifier) @constructor
- (#match? @constructor "^[A-Z]"))
-
-((identifier) @constant
- (#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
-
-((shorthand_property_identifier) @constant
- (#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
-
-((identifier) @variable.builtin
- (#vim-match? @variable.builtin "^(arguments|module|console|window|document)$"))
-
-((identifier) @function.builtin
- (#eq? @function.builtin "require"))
-
-; Function and method definitions
-;--------------------------------
-
-(function
- name: (identifier) @function)
-(function_declaration
- name: (identifier) @function)
-(method_definition
- name: (property_identifier) @method)
-
-(pair
- key: (property_identifier) @method
- value: (function))
-(pair
- key: (property_identifier) @method
- value: (arrow_function))
-
-(assignment_expression
- left: (member_expression
- property: (property_identifier) @method)
- right: (arrow_function))
-(assignment_expression
- left: (member_expression
- property: (property_identifier) @method)
- right: (function))
-
-(variable_declarator
- name: (identifier) @function
- value: (arrow_function))
-(variable_declarator
- name: (identifier) @function
- value: (function))
-
-(assignment_expression
- left: (identifier) @function
- right: (arrow_function))
-(assignment_expression
- left: (identifier) @function
- right: (function))
-
-; Function and method calls
-;--------------------------
-
-(call_expression
- function: (identifier) @function)
-
-(call_expression
- function: (member_expression
- property: (property_identifier) @method))
-
-; Variables
-;----------
-
-(formal_parameters (identifier) @parameter)
-
-(formal_parameters
- (rest_parameter
- (identifier) @parameter))
-
-; ({ a }) => null
-(formal_parameters
- (object_pattern
- (shorthand_property_identifier) @parameter))
-
-; ({ a: b }) => null
-(formal_parameters
- (object_pattern
- (pair
- value: (identifier) @parameter)))
-
-; ([ a ]) => null
-(formal_parameters
- (array_pattern
- (identifier) @parameter))
-
-; a => null
-(variable_declarator
- value: (arrow_function
- parameter: (identifier) @parameter))
-
-; optional parameters
-(formal_parameters
- (assignment_pattern
- (shorthand_property_identifier) @parameter))
-
-; Variables
-;----------
-(namespace_import
- (identifier) @namespace)
-
-; Literals
-;---------
-
-(this) @variable.builtin
-(super) @variable.builtin
-
-(true) @boolean
-(false) @boolean
-(null) @constant.builtin
-(comment) @comment
-(string) @string
-(regex) @punctuation.delimiter
-(regex_pattern) @string.regex
-(template_string) @string
-(number) @number
-
-; Punctuation
-;------------
-
-(template_substitution
- "${" @punctuation.special
- "}" @punctuation.special) @none
-
-"..." @punctuation.special
-
-";" @punctuation.delimiter
-"." @punctuation.delimiter
-"," @punctuation.delimiter
-"?." @punctuation.delimiter
-
-(pair ":" @punctuation.delimiter)
-
-[
- "--"
- "-"
- "-="
- "&&"
- "+"
- "++"
- "+="
- "&="
- "/="
- "**="
- "<<="
- "<"
- "<="
- "<<"
- "="
- "=="
- "==="
- "!="
- "!=="
- "=>"
- ">"
- ">="
- ">>"
- "||"
- "%"
- "%="
- "*"
- "**"
- ">>>"
- "&"
- "|"
- "^"
- "??"
- "*="
- ">>="
- ">>>="
- "^="
- "|="
- "&&="
- "||="
- "??="
-] @operator
-
-(binary_expression "/" @operator)
-(ternary_expression ["?" ":"] @operator)
-(unary_expression ["!" "~" "-" "+" "delete" "void" "typeof"] @operator)
-
-"(" @punctuation.bracket
-")" @punctuation.bracket
-"[" @punctuation.bracket
-"]" @punctuation.bracket
-"{" @punctuation.bracket
-"}" @punctuation.bracket
-
-; Keywords
-;----------
-
-[
-"if"
-"else"
-"switch"
-"case"
-"default"
-] @conditional
-
-[
-"import"
-"from"
-"as"
-] @include
-
-[
-"for"
-"of"
-"do"
-"while"
-"continue"
-] @repeat
-
-[
-"async"
-"await"
-"break"
-"class"
-"const"
-"debugger"
-"export"
-"extends"
-"function"
-"get"
-"in"
-"instanceof"
-"let"
-"return"
-"set"
-"static"
-"switch"
-"target"
-"typeof"
-"var"
-"void"
-"with"
-"yield"
-] @keyword
-
-[
- "new"
- "delete"
-] @keyword.operator
-
-[
- "throw"
- "try"
- "catch"
- "finally"
-] @exception
+; inherits: ecma,jsx
diff --git a/queries/javascript/indents.scm b/queries/javascript/indents.scm
index f3796dbaf..b6d9b28bf 100644
--- a/queries/javascript/indents.scm
+++ b/queries/javascript/indents.scm
@@ -1,32 +1 @@
-; inherits: (jsx)
-
-[
- (object)
- (array)
- (arguments)
- (statement_block)
- (object_pattern)
- (class_body)
- (method_definition)
- (named_imports)
- (binary_expression)
- (return_statement)
- (template_substitution)
- (expression_statement (call_expression))
- (export_clause)
-] @indent
-
-[
- (arguments (object))
- "("
- ")"
- "{"
- "}"
- "["
- "]"
-] @branch
-
-[
- (comment)
- (template_string)
-] @ignore
+; inherits: ecma,jsx
diff --git a/queries/javascript/injections.scm b/queries/javascript/injections.scm
index bec0f315e..b6d9b28bf 100644
--- a/queries/javascript/injections.scm
+++ b/queries/javascript/injections.scm
@@ -1,20 +1 @@
-((comment) @jsdoc)
-
-((regex_pattern) @regex)
-
-(call_expression
- function: ((identifier) @language)
- arguments: ((template_string) @content
- (#offset! @content 0 1 0 -1)))
-
-(call_expression
- function: ((identifier) @_name
- (#eq? @_name "gql"))
- arguments: ((template_string) @graphql
- (#offset! @graphql 0 1 0 -1)))
-
-(call_expression
- function: ((identifier) @_name
- (#eq? @_name "hbs"))
- arguments: ((template_string) @glimmer
- (#offset! @glimmer 0 1 0 -1)))
+; inherits: ecma,jsx
diff --git a/queries/javascript/locals.scm b/queries/javascript/locals.scm
index 99a40a6be..b6d9b28bf 100644
--- a/queries/javascript/locals.scm
+++ b/queries/javascript/locals.scm
@@ -1,63 +1 @@
-; inherits: (jsx)
-
-; Scopes
-;-------
-
-(statement_block) @scope
-(function) @scope
-(arrow_function) @scope
-(function_declaration) @scope
-(method_definition) @scope
-(for_statement) @scope
-(for_in_statement) @scope
-(catch_clause) @scope
-
-; Definitions
-;------------
-
-(formal_parameters
- (identifier) @definition.parameter)
-
-(formal_parameters
- (object_pattern
- (identifier) @definition.parameter))
-
-; function(arg = []) {
-(formal_parameters
- (assignment_pattern
- (shorthand_property_identifier) @definition.parameter))
-
-; x => x
-(arrow_function
- parameter: (identifier) @definition.parameter)
-
-(formal_parameters
- (object_pattern
- (shorthand_property_identifier) @definition.parameter))
-
-(formal_parameters
- (array_pattern
- (identifier) @definition.parameter))
-
-(formal_parameters
- (rest_parameter
- (identifier) @definition.parameter))
-
-(variable_declarator
- name: (identifier) @definition.var)
-
-(import_specifier
- (identifier) @definition.import)
-
-(namespace_import
- (identifier) @definition.import)
-
-(function_declaration
- ((identifier) @definition.var)
- (#set! definition.var.scope parent))
-
-; References
-;------------
-
-(identifier) @reference
-(shorthand_property_identifier) @reference
+; inherits: ecma,jsx