aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/bicep
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/bicep
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/bicep')
-rw-r--r--runtime/queries/bicep/folds.scm19
-rw-r--r--runtime/queries/bicep/highlights.scm234
-rw-r--r--runtime/queries/bicep/indents.scm27
-rw-r--r--runtime/queries/bicep/injections.scm5
-rw-r--r--runtime/queries/bicep/locals.scm73
5 files changed, 358 insertions, 0 deletions
diff --git a/runtime/queries/bicep/folds.scm b/runtime/queries/bicep/folds.scm
new file mode 100644
index 000000000..217a86d6a
--- /dev/null
+++ b/runtime/queries/bicep/folds.scm
@@ -0,0 +1,19 @@
+[
+ (module_declaration)
+ (metadata_declaration)
+ (output_declaration)
+ (parameter_declaration)
+ (resource_declaration)
+ (type_declaration)
+ (variable_declaration)
+ (parenthesized_expression)
+ (decorators)
+ (array)
+ (object)
+ (if_statement)
+ (for_statement)
+ (subscript_expression)
+ (ternary_expression)
+ (string)
+ (comment)
+] @fold
diff --git a/runtime/queries/bicep/highlights.scm b/runtime/queries/bicep/highlights.scm
new file mode 100644
index 000000000..35c9d6c17
--- /dev/null
+++ b/runtime/queries/bicep/highlights.scm
@@ -0,0 +1,234 @@
+; Includes
+[
+ "import"
+ "provider"
+ "with"
+ "as"
+ "from"
+] @keyword.import
+
+; Namespaces
+(module_declaration
+ (identifier) @module)
+
+; Builtins
+(primitive_type) @type.builtin
+
+((member_expression
+ object: (identifier) @type.builtin)
+ (#eq? @type.builtin "sys"))
+
+; Functions
+(call_expression
+ function: (identifier) @function.call)
+
+(user_defined_function
+ name: (identifier) @function)
+
+; Properties
+(object_property
+ (identifier) @property
+ ":" @punctuation.delimiter
+ (_))
+
+(object_property
+ (compatible_identifier) @property
+ ":" @punctuation.delimiter
+ (_))
+
+(property_identifier) @property
+
+; Attributes
+(decorator
+ "@" @attribute)
+
+(decorator
+ (call_expression
+ (identifier) @attribute))
+
+(decorator
+ (call_expression
+ (member_expression
+ object: (identifier) @attribute
+ property: (property_identifier) @attribute)))
+
+; Types
+(type_declaration
+ (identifier) @type)
+
+(type_declaration
+ (identifier)
+ "="
+ (identifier) @type)
+
+(type
+ (identifier) @type)
+
+(resource_declaration
+ (identifier) @type)
+
+(resource_expression
+ (identifier) @type)
+
+; Parameters
+(parameter_declaration
+ (identifier) @variable.parameter
+ (_))
+
+(call_expression
+ function: (_)
+ (arguments
+ (identifier) @variable.parameter))
+
+(call_expression
+ function: (_)
+ (arguments
+ (member_expression
+ object: (identifier) @variable.parameter)))
+
+(parameter
+ .
+ (identifier) @variable.parameter)
+
+; Variables
+(variable_declaration
+ (identifier) @variable
+ (_))
+
+(metadata_declaration
+ (identifier) @variable
+ (_))
+
+(output_declaration
+ (identifier) @variable
+ (_))
+
+(object_property
+ (_)
+ ":"
+ (identifier) @variable)
+
+(for_statement
+ "for"
+ (for_loop_parameters
+ (loop_variable) @variable
+ (loop_enumerator) @variable))
+
+; Conditionals
+"if" @keyword.conditional
+
+(ternary_expression
+ "?" @keyword.conditional.ternary
+ ":" @keyword.conditional.ternary)
+
+; Loops
+(for_statement
+ "for" @keyword.repeat
+ "in"
+ ":" @punctuation.delimiter)
+
+; Keywords
+[
+ "module"
+ "metadata"
+ "output"
+ "param"
+ "resource"
+ "existing"
+ "targetScope"
+ "type"
+ "var"
+ "using"
+ "test"
+] @keyword
+
+"func" @keyword.function
+
+"assert" @keyword.exception
+
+; Operators
+[
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "||"
+ "&&"
+ "|"
+ "=="
+ "!="
+ "=~"
+ "!~"
+ ">"
+ ">="
+ "<="
+ "<"
+ "??"
+ "="
+ "!"
+ ".?"
+] @operator
+
+(subscript_expression
+ "?" @operator)
+
+(nullable_type
+ "?" @operator)
+
+"in" @keyword.operator
+
+; Literals
+(string) @string
+
+(escape_sequence) @string.escape
+
+(number) @number
+
+(boolean) @boolean
+
+(null) @constant.builtin
+
+; Misc
+(compatible_identifier
+ "?" @punctuation.special)
+
+(nullable_return_type) @punctuation.special
+
+[
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "["
+ "]"
+] @punctuation.bracket
+
+[
+ "("
+ ")"
+] @punctuation.bracket
+
+[
+ "."
+ ":"
+ "::"
+ "=>"
+] @punctuation.delimiter
+
+; Interpolation
+(interpolation) @none
+
+(interpolation
+ "${" @punctuation.special
+ "}" @punctuation.special)
+
+(interpolation
+ (identifier) @variable)
+
+; Comments
+[
+ (comment)
+ (diagnostic_comment)
+] @comment @spell
diff --git a/runtime/queries/bicep/indents.scm b/runtime/queries/bicep/indents.scm
new file mode 100644
index 000000000..055e51b23
--- /dev/null
+++ b/runtime/queries/bicep/indents.scm
@@ -0,0 +1,27 @@
+[
+ (array)
+ (object)
+] @indent.begin
+
+"}" @indent.end
+
+[
+ "{"
+ "}"
+] @indent.branch
+
+[
+ "["
+ "]"
+] @indent.branch
+
+[
+ "("
+ ")"
+] @indent.branch
+
+[
+ (ERROR)
+ (comment)
+ (diagnostic_comment)
+] @indent.auto
diff --git a/runtime/queries/bicep/injections.scm b/runtime/queries/bicep/injections.scm
new file mode 100644
index 000000000..5c2d4a57b
--- /dev/null
+++ b/runtime/queries/bicep/injections.scm
@@ -0,0 +1,5 @@
+([
+ (comment)
+ (diagnostic_comment)
+] @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/bicep/locals.scm b/runtime/queries/bicep/locals.scm
new file mode 100644
index 000000000..cc9c3c2cf
--- /dev/null
+++ b/runtime/queries/bicep/locals.scm
@@ -0,0 +1,73 @@
+; Scopes
+[
+ (infrastructure)
+ (call_expression)
+ (lambda_expression)
+ (subscript_expression)
+ (if_statement)
+ (for_statement)
+ (array)
+ (object)
+ (interpolation)
+] @local.scope
+
+; References
+(property_identifier) @local.reference
+
+(call_expression
+ (identifier) @local.reference)
+
+(object_property
+ (_)
+ ":"
+ (identifier) @local.reference)
+
+(resource_expression
+ (identifier) @local.reference)
+
+; Definitions
+(type) @local.definition.associated
+
+(object_property
+ (identifier) @local.definition.field
+ (_))
+
+(object_property
+ (compatible_identifier) @local.definition.field
+ (_))
+
+(user_defined_function
+ name: (identifier) @local.definition.function)
+
+(module_declaration
+ (identifier) @local.definition.namespace)
+
+(parameter_declaration
+ (identifier) @local.definition.parameter
+ (_))
+
+(parameter
+ .
+ (identifier) @local.definition.parameter)
+
+(type_declaration
+ (identifier) @local.definition.type
+ (_))
+
+(variable_declaration
+ (identifier) @local.definition.var
+ (_))
+
+(metadata_declaration
+ (identifier) @local.definition.var
+ (_))
+
+(output_declaration
+ (identifier) @local.definition.var
+ (_))
+
+(for_statement
+ "for"
+ (for_loop_parameters
+ (loop_variable) @local.definition.var
+ (loop_enumerator) @local.definition.var))