mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 03:56:52 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
c13e28f894
commit
2c8f2f2fad
829 changed files with 4905 additions and 8010 deletions
8
runtime/queries/typescript/folds.scm
Normal file
8
runtime/queries/typescript/folds.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
; inherits: ecma
|
||||
|
||||
[
|
||||
(interface_declaration)
|
||||
(internal_module)
|
||||
(type_alias_declaration)
|
||||
(enum_declaration)
|
||||
] @fold
|
||||
157
runtime/queries/typescript/highlights.scm
Normal file
157
runtime/queries/typescript/highlights.scm
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
; inherits: ecma
|
||||
|
||||
"require" @include
|
||||
|
||||
(import_require_clause source: (string) @text.uri)
|
||||
|
||||
[
|
||||
"declare"
|
||||
"enum"
|
||||
"export"
|
||||
"implements"
|
||||
"interface"
|
||||
"type"
|
||||
"namespace"
|
||||
"override"
|
||||
"module"
|
||||
"asserts"
|
||||
"infer"
|
||||
"is"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"keyof"
|
||||
"satisfies"
|
||||
] @keyword.operator
|
||||
|
||||
(as_expression "as" @keyword.operator)
|
||||
(export_statement "as" @keyword.operator)
|
||||
(mapped_type_clause "as" @keyword.operator)
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"readonly"
|
||||
] @type.qualifier
|
||||
|
||||
; types
|
||||
|
||||
(type_identifier) @type
|
||||
(predefined_type) @type.builtin
|
||||
|
||||
(import_statement "type"
|
||||
(import_clause
|
||||
(named_imports
|
||||
((import_specifier
|
||||
name: (identifier) @type)))))
|
||||
|
||||
(template_literal_type) @string
|
||||
|
||||
(non_null_expression "!" @operator)
|
||||
|
||||
;; punctuation
|
||||
|
||||
(type_arguments
|
||||
["<" ">"] @punctuation.bracket)
|
||||
|
||||
(type_parameters
|
||||
["<" ">"] @punctuation.bracket)
|
||||
|
||||
(object_type
|
||||
["{|" "|}"] @punctuation.bracket)
|
||||
|
||||
(union_type
|
||||
"|" @punctuation.delimiter)
|
||||
|
||||
(intersection_type
|
||||
"&" @punctuation.delimiter)
|
||||
|
||||
(type_annotation
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
(type_predicate_annotation
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
(index_signature
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
(omitting_type_annotation
|
||||
"-?:" @punctuation.delimiter)
|
||||
|
||||
(opting_type_annotation
|
||||
"?:" @punctuation.delimiter)
|
||||
|
||||
"?." @punctuation.delimiter
|
||||
|
||||
(abstract_method_signature "?" @punctuation.special)
|
||||
(method_signature "?" @punctuation.special)
|
||||
(method_definition "?" @punctuation.special)
|
||||
(property_signature "?" @punctuation.special)
|
||||
(optional_parameter "?" @punctuation.special)
|
||||
(optional_type "?" @punctuation.special)
|
||||
(public_field_definition [ "?" "!" ] @punctuation.special)
|
||||
(flow_maybe_type "?" @punctuation.special)
|
||||
|
||||
(template_type ["${" "}"] @punctuation.special)
|
||||
|
||||
(conditional_type ["?" ":"] @conditional.ternary)
|
||||
|
||||
; Variables
|
||||
|
||||
(undefined) @variable.builtin
|
||||
|
||||
;;; Parameters
|
||||
(required_parameter (identifier) @parameter)
|
||||
(optional_parameter (identifier) @parameter)
|
||||
|
||||
(required_parameter
|
||||
(rest_pattern
|
||||
(identifier) @parameter))
|
||||
|
||||
;; ({ a }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(shorthand_property_identifier_pattern) @parameter))
|
||||
|
||||
;; ({ a = b }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(object_assignment_pattern
|
||||
(shorthand_property_identifier_pattern) @parameter)))
|
||||
|
||||
;; ({ a: b }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(pair_pattern
|
||||
value: (identifier) @parameter)))
|
||||
|
||||
;; ([ a ]) => null
|
||||
(required_parameter
|
||||
(array_pattern
|
||||
(identifier) @parameter))
|
||||
|
||||
;; a => null
|
||||
(arrow_function
|
||||
parameter: (identifier) @parameter)
|
||||
|
||||
;; global declaration
|
||||
(ambient_declaration "global" @namespace)
|
||||
|
||||
;; function signatures
|
||||
(ambient_declaration
|
||||
(function_signature
|
||||
name: (identifier) @function))
|
||||
|
||||
;; method signatures
|
||||
(method_signature name: (_) @method)
|
||||
|
||||
;; property signatures
|
||||
(property_signature
|
||||
name: (property_identifier) @method
|
||||
type: (type_annotation
|
||||
[
|
||||
(union_type (parenthesized_type (function_type)))
|
||||
(function_type)
|
||||
]))
|
||||
7
runtime/queries/typescript/indents.scm
Normal file
7
runtime/queries/typescript/indents.scm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
; inherits: ecma
|
||||
|
||||
[
|
||||
(enum_declaration)
|
||||
(interface_declaration)
|
||||
(object_type)
|
||||
] @indent.begin
|
||||
1
runtime/queries/typescript/injections.scm
Normal file
1
runtime/queries/typescript/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: ecma
|
||||
27
runtime/queries/typescript/locals.scm
Normal file
27
runtime/queries/typescript/locals.scm
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
; inherits: ecma
|
||||
(required_parameter (identifier) @definition)
|
||||
(optional_parameter (identifier) @definition)
|
||||
|
||||
; x => x
|
||||
(arrow_function
|
||||
parameter: (identifier) @definition.parameter)
|
||||
|
||||
;; ({ a }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(shorthand_property_identifier_pattern) @definition.parameter))
|
||||
|
||||
;; ({ a: b }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(pair_pattern
|
||||
value: (identifier) @definition.parameter)))
|
||||
|
||||
;; ([ a ]) => null
|
||||
(required_parameter
|
||||
(array_pattern
|
||||
(identifier) @definition.parameter))
|
||||
|
||||
(required_parameter
|
||||
(rest_pattern
|
||||
(identifier) @definition.parameter))
|
||||
Loading…
Add table
Add a link
Reference in a new issue