mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
terraform: Add outline queries (#16945)
Closes #16944 Added outline schema for terraform/HCL Release Notes: - N/A ![SCR-20240827-omjs](https://github.com/user-attachments/assets/48a31863-e848-4a86-97b7-67440d62c93f)
This commit is contained in:
parent
8bd803942d
commit
a4893ab561
76
extensions/terraform/languages/hcl/outline.scm
Normal file
76
extensions/terraform/languages/hcl/outline.scm
Normal file
@ -0,0 +1,76 @@
|
||||
; HCL Outline Scheme
|
||||
; Comments
|
||||
(comment) @annotation
|
||||
|
||||
; Block with and without string_lit
|
||||
; Example:
|
||||
; terraform { ... }
|
||||
; module "vpc" { ... }
|
||||
; resource "resource" "name" { ... }
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier) @context
|
||||
(string_lit)? @name
|
||||
(string_lit)? @name
|
||||
) @item
|
||||
)
|
||||
)
|
||||
|
||||
; Inside block with identifier
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(body
|
||||
(attribute
|
||||
(identifier) @context
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Inside block with identifier and string_lit
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(body
|
||||
(block
|
||||
(identifier) @context
|
||||
(string_lit)? @name
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Root Attribute block
|
||||
; Example:
|
||||
; inputs = { ... }
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier) @context
|
||||
) @item
|
||||
)
|
||||
)
|
||||
|
||||
; Inside Root Attribute block
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(collection_value
|
||||
(object
|
||||
(object_elem
|
||||
key: (expression (variable_expr (identifier) @context))
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
76
extensions/terraform/languages/terraform/outline.scm
Normal file
76
extensions/terraform/languages/terraform/outline.scm
Normal file
@ -0,0 +1,76 @@
|
||||
; HCL Outline Scheme
|
||||
; Comments
|
||||
(comment) @annotation
|
||||
|
||||
; Block with and without string_lit
|
||||
; Example:
|
||||
; terraform { ... }
|
||||
; module "vpc" { ... }
|
||||
; resource "resource" "name" { ... }
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier) @context
|
||||
(string_lit)? @name
|
||||
(string_lit)? @name
|
||||
) @item
|
||||
)
|
||||
)
|
||||
|
||||
; Inside block with identifier
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(body
|
||||
(attribute
|
||||
(identifier) @context
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Inside block with identifier and string_lit
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(body
|
||||
(block
|
||||
(identifier) @context
|
||||
(string_lit)? @name
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Root Attribute block
|
||||
; Example:
|
||||
; inputs = { ... }
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier) @context
|
||||
) @item
|
||||
)
|
||||
)
|
||||
|
||||
; Inside Root Attribute block
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(collection_value
|
||||
(object
|
||||
(object_elem
|
||||
key: (expression (variable_expr (identifier) @context))
|
||||
) @item
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user