feat: inherit typescript schema from javascript instead

This commit is contained in:
ajit
2022-02-14 09:04:09 +05:30
parent 71739b5422
commit fb730d5c6b
3 changed files with 26 additions and 39 deletions

View File

@@ -1 +1,23 @@
; inherits: jsx
; functions
(function_declaration "function" @open.function) @scope.function
(return_statement "return" @mid.function.1)
; switch case
(switch_statement "switch" @open.switch) @scope.switch
(switch_case "case" @mid.switch.1)
(switch_default "default" @mid.switch.2)
; 'else' and 'else if'
(else_clause
"else" @_start (if_statement "if" @_end)?
(#make-range! "mid.if.1" @_start @_end))
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
; template strings
(template_string
"`" @open.tmpl_str
"`" @close.tmpl_str) @scope.tmpl_str

View File

@@ -1,3 +1,5 @@
; inherits: javascript
(jsx_element) @scope.tag
(jsx_opening_element (identifier) @open.tag)
(jsx_closing_element (identifier) @close.tag)
@@ -7,27 +9,3 @@
"/" @_start ">" @_end
(#make-range! "close.selftag" @_start @_end)
) @scope.selftag
; functions
(function_declaration "function" @open.function) @scope.function
(return_statement "return" @mid.function.1)
; switch case
(switch_statement "switch" @open.switch) @scope.switch
(switch_case "case" @mid.switch.1)
(switch_default "default" @mid.switch.2)
; 'else' and 'else if'
(else_clause
"else" @_start (if_statement "if" @_end)?
(#make-range! "mid.if.1" @_start @_end))
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
; template strings
(template_string
"`" @open.tmpl_str
"`" @close.tmpl_str) @scope.tmpl_str

View File

@@ -1,14 +1 @@
; switch case
(switch_statement "switch" @open.switch) @scope.switch
(switch_case "case" @mid.switch.1)
(switch_default "default" @mid.switch.2)
; 'else' and 'else if'
(else_clause
"else" @_start (if_statement "if" @_end)?
(#make-range! "mid.if.1" @_start @_end))
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
; inherits: javascript