mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
parent
939556333f
commit
fee71c102c
6 changed files with 171 additions and 20 deletions
|
|
@ -63,20 +63,20 @@ body: (_
|
|||
; directive labels in wildcard context
|
||||
((wildcard
|
||||
(identifier) @label)
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
(#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards"))
|
||||
|
||||
((wildcard
|
||||
(attribute
|
||||
object: (identifier) @label))
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
(#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards"))
|
||||
|
||||
((wildcard
|
||||
(subscript
|
||||
value: (identifier) @label))
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
(#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards"))
|
||||
|
||||
; directive labels in block context (eg. within 'run:')
|
||||
((identifier) @label
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")
|
||||
(#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards")
|
||||
(#has-ancestor? @label "directive")
|
||||
(#has-ancestor? @label "block"))
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
; inherits: python
|
||||
|
||||
((rule_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((checkpoint_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((rule_inheritance) @indent.begin
|
||||
([
|
||||
(rule_definition)
|
||||
(checkpoint_definition)
|
||||
(rule_inheritance)
|
||||
(module_definition)
|
||||
(directive)
|
||||
] @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((rule_import
|
||||
|
|
@ -14,12 +14,20 @@
|
|||
":") @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((module_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((directive) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
; end indentation after last parameter node (no following ',')
|
||||
(directive_parameters
|
||||
(_) @indent.end .)
|
||||
; ; end indentation after last parameter node (no following ',')
|
||||
; ; accommodate different levels of nesting
|
||||
; ; see also queries/python/indents.scm: return_statement
|
||||
(directive
|
||||
(directive_parameters
|
||||
[
|
||||
(_) @indent.dedent
|
||||
(_
|
||||
[
|
||||
(_)
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] .) @indent.dedent
|
||||
]
|
||||
. ; anchor at end: no subsequent ','
|
||||
))
|
||||
|
|
|
|||
|
|
@ -2,3 +2,39 @@
|
|||
|
||||
(rule_definition
|
||||
name: (identifier) @local.definition.type) @local.scope
|
||||
|
||||
(rule_inheritance
|
||||
alias: (as_pattern_target) @local.definition.type) @local.scope
|
||||
|
||||
(checkpoint_definition
|
||||
name: (identifier) @local.definition.type) @local.scope
|
||||
|
||||
(module_definition
|
||||
name: (identifier) @local.definition.type) @local.scope
|
||||
|
||||
; use rule A from X
|
||||
(rule_import
|
||||
(rule_import_list
|
||||
(identifier) @local.definition.import)
|
||||
.
|
||||
module_name: (identifier) .) @local.scope
|
||||
|
||||
; use rule A from X as A_fromX
|
||||
; use rule A from X as *_fromX
|
||||
; use rule * from X as *_fromX
|
||||
(rule_import
|
||||
alias: (as_pattern_target) @local.definition.import .) @local.scope
|
||||
|
||||
; use rule A from X with:
|
||||
(rule_import
|
||||
(rule_import_list
|
||||
(identifier) @local.definition.type)
|
||||
.
|
||||
module_name: (identifier)
|
||||
.
|
||||
"with") @local.scope
|
||||
|
||||
; use rule A from X as Y with:
|
||||
(rule_import
|
||||
alias: (as_pattern_target) @local.definition.type
|
||||
"with") @local.scope
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue