aboutsummaryrefslogtreecommitdiffstats
path: root/queries/puppet
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/puppet
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/puppet')
-rw-r--r--queries/puppet/highlights.scm117
-rw-r--r--queries/puppet/locals.scm42
2 files changed, 109 insertions, 50 deletions
diff --git a/queries/puppet/highlights.scm b/queries/puppet/highlights.scm
index aaf5dac39..8e99f1268 100644
--- a/queries/puppet/highlights.scm
+++ b/queries/puppet/highlights.scm
@@ -1,17 +1,17 @@
; Variables
-
(identifier) @variable
; Includes
-
"include" @keyword.import
-(include_statement (identifier) @type)
+(include_statement
+ (identifier) @type)
-(include_statement (class_identifier (identifier) @type . ))
+(include_statement
+ (class_identifier
+ (identifier) @type .))
; Keywords
-
[
"class"
"inherits"
@@ -33,68 +33,99 @@
"case"
] @keyword.conditional
-(default_case "default" @keyword.conditional)
+(default_case
+ "default" @keyword.conditional)
; Properties
+(attribute
+ name: (identifier) @property)
-(attribute name: (identifier) @property)
-(attribute name: (variable (identifier) @property))
+(attribute
+ name:
+ (variable
+ (identifier) @property))
; Parameters
+(lambda
+ (variable
+ (identifier) @variable.parameter))
-(lambda (variable (identifier) @variable.parameter))
+(parameter
+ (variable
+ (identifier) @variable.parameter))
-(parameter (variable (identifier) @variable.parameter))
-
-(function_call (identifier) @variable.parameter)
+(function_call
+ (identifier) @variable.parameter)
-(method_call (identifier) @variable.parameter)
+(method_call
+ (identifier) @variable.parameter)
; Functions
-
(function_declaration
- "function" . (identifier) @function)
+ "function"
+ .
+ (identifier) @function)
(function_call
- (identifier) @function.call "(")
+ (identifier) @function.call
+ "(")
(defined_resource_type
- "define" . (identifier) @function)
+ "define"
+ .
+ (identifier) @function)
; Methods
-
(function_declaration
- "function" . (class_identifier (identifier) @function.method . ))
+ "function"
+ .
+ (class_identifier
+ (identifier) @function.method .))
(function_call
- (class_identifier (identifier) @function.method.call . ))
+ (class_identifier
+ (identifier) @function.method.call .))
(defined_resource_type
- "define" . (class_identifier (identifier) @function.method . ))
+ "define"
+ .
+ (class_identifier
+ (identifier) @function.method .))
(method_call
- "." . (identifier) @function.method.call)
+ "."
+ .
+ (identifier) @function.method.call)
; Types
-
(type) @type
(builtin_type) @type.builtin
(class_definition
(identifier) @type)
+
(class_definition
- (class_identifier (identifier) @type . ))
+ (class_identifier
+ (identifier) @type .))
+
+(class_inherits
+ (identifier) @type)
-(class_inherits (identifier) @type)
-(class_inherits (class_identifier (identifier) @type . ))
+(class_inherits
+ (class_identifier
+ (identifier) @type .))
(resource_declaration
(identifier) @type)
+
(resource_declaration
- (class_identifier (identifier) @type . ))
+ (class_identifier
+ (identifier) @type .))
-(node_definition (node_name (identifier) @type))
+(node_definition
+ (node_name
+ (identifier) @type))
((identifier) @type
(#lua-match? @type "^[A-Z]"))
@@ -103,11 +134,11 @@
(#any-of? @type.builtin "Boolean" "Integer" "Float" "String" "Array" "Hash" "Regexp" "Variant" "Data" "Undef" "Default" "File"))
; "Namespaces"
-
-(class_identifier . (identifier) @module)
+(class_identifier
+ .
+ (identifier) @module)
; Operators
-
[
"or"
"and"
@@ -142,7 +173,6 @@
] @operator
; Punctuation
-
[
"|"
"."
@@ -153,13 +183,26 @@
"=>"
] @punctuation.delimiter
-[ "{" "}" ] @punctuation.bracket
+[
+ "{"
+ "}"
+] @punctuation.bracket
-[ "[" "]" ] @punctuation.bracket
+[
+ "["
+ "]"
+] @punctuation.bracket
-[ "(" ")" ] @punctuation.bracket
+[
+ "("
+ ")"
+] @punctuation.bracket
-(interpolation [ "${" "}" ] @punctuation.special)
+(interpolation
+ [
+ "${"
+ "}"
+ ] @punctuation.special)
[
"$"
@@ -168,7 +211,6 @@
] @punctuation.special
; Literals
-
(number) @number
(float) @number.float
@@ -187,5 +229,4 @@
] @variable.builtin
; Comments
-
(comment) @comment @spell
diff --git a/queries/puppet/locals.scm b/queries/puppet/locals.scm
index cc13bc77b..37ac2d851 100644
--- a/queries/puppet/locals.scm
+++ b/queries/puppet/locals.scm
@@ -1,5 +1,4 @@
; Scopes
-
[
(block)
(defined_resource_type)
@@ -16,31 +15,50 @@
] @local.scope
; References
-
[
(identifier)
(class_identifier)
- (variable)
+ (variable)
] @local.reference
; Definitions
-
-(attribute [(identifier) (variable)] @local.definition.field)
+(attribute
+ [
+ (identifier)
+ (variable)
+ ] @local.definition.field)
(function_declaration
- [(identifier) (class_identifier)] @local.definition.function)
+ [
+ (identifier)
+ (class_identifier)
+ ] @local.definition.function)
-(include_statement [(identifier) (class_identifier)] @local.definition.import)
+(include_statement
+ [
+ (identifier)
+ (class_identifier)
+ ] @local.definition.import)
-(parameter (variable) @local.definition.parameter)
+(parameter
+ (variable) @local.definition.parameter)
(class_definition
- [(identifier) (class_identifier)] @local.definition.type)
+ [
+ (identifier)
+ (class_identifier)
+ ] @local.definition.type)
(node_definition
- (node_name (identifier) @local.definition.type))
+ (node_name
+ (identifier) @local.definition.type))
(resource_declaration
- [(identifier) (class_identifier)] @local.definition.type)
+ [
+ (identifier)
+ (class_identifier)
+ ] @local.definition.type)
-(assignment . (variable) @local.definition.var)
+(assignment
+ .
+ (variable) @local.definition.var)