mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add bicep
This commit is contained in:
parent
061ee1b98f
commit
028b7dfbdd
8 changed files with 363 additions and 0 deletions
|
|
@ -181,6 +181,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
|
||||
- [x] [beancount](https://github.com/polarmutex/tree-sitter-beancount) (maintained by @polarmutex)
|
||||
- [x] [bibtex](https://github.com/latex-lsp/tree-sitter-bibtex) (maintained by @theHamsta, @clason)
|
||||
- [x] [bicep](https://github.com/amaanq/tree-sitter-bicep) (maintained by @amaanq)
|
||||
- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus)
|
||||
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
|
||||
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @Luxed)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
"bibtex": {
|
||||
"revision": "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34"
|
||||
},
|
||||
"bicep": {
|
||||
"revision": "b94a0983b69ebb75e9129329a188199ad6ebcec0"
|
||||
},
|
||||
"blueprint": {
|
||||
"revision": "6ef91ca8270f0112b9c6d27ecb9966c741a5d103"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -144,6 +144,14 @@ list.bibtex = {
|
|||
maintainers = { "@theHamsta", "@clason" },
|
||||
}
|
||||
|
||||
list.bicep = {
|
||||
install_info = {
|
||||
url = "https://github.com/amaanq/tree-sitter-bicep",
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
maintainers = { "@amaanq" },
|
||||
}
|
||||
|
||||
list.blueprint = {
|
||||
install_info = {
|
||||
url = "https://gitlab.com/gabmus/tree-sitter-blueprint.git",
|
||||
|
|
|
|||
25
queries/bicep/folds.scm
Normal file
25
queries/bicep/folds.scm
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[
|
||||
(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
|
||||
230
queries/bicep/highlights.scm
Normal file
230
queries/bicep/highlights.scm
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
; Includes
|
||||
|
||||
(import_statement
|
||||
"import" @include)
|
||||
|
||||
(import_with_statement
|
||||
"import" @include
|
||||
"with" @include)
|
||||
|
||||
; Namespaces
|
||||
|
||||
(module_declaration
|
||||
(identifier) @namespace)
|
||||
|
||||
; Builtins
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((member_expression
|
||||
object: (identifier) @type.builtin)
|
||||
(#match? @type.builtin "^sys$"))
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
; 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_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(array_type (identifier) @type))
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(resource_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @parameter
|
||||
(_))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (identifier) @parameter))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (member_expression object: (identifier) @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" @conditional
|
||||
|
||||
(ternary_expression
|
||||
"?" @conditional.ternary
|
||||
":" @conditional.ternary)
|
||||
|
||||
; Loops
|
||||
|
||||
(for_statement
|
||||
"for" @repeat
|
||||
"in"
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"module"
|
||||
"metadata"
|
||||
"output"
|
||||
"param"
|
||||
"resource"
|
||||
"existing"
|
||||
"targetScope"
|
||||
"type"
|
||||
"var"
|
||||
] @keyword
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"||"
|
||||
"&&"
|
||||
"|"
|
||||
"=="
|
||||
"!="
|
||||
"=~"
|
||||
"!~"
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"<"
|
||||
"??"
|
||||
"="
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"in"
|
||||
] @keyword.operator
|
||||
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
(import_string
|
||||
"'" @string
|
||||
(import_name) @namespace
|
||||
"@" @symbol
|
||||
(import_version) @string.special)
|
||||
|
||||
(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
|
||||
18
queries/bicep/indents.scm
Normal file
18
queries/bicep/indents.scm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
(array)
|
||||
(object)
|
||||
] @indent
|
||||
|
||||
"}" @indent_end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @auto
|
||||
4
queries/bicep/injections.scm
Normal file
4
queries/bicep/injections.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @comment
|
||||
74
queries/bicep/locals.scm
Normal file
74
queries/bicep/locals.scm
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(infrastructure)
|
||||
(call_expression)
|
||||
|
||||
(lambda_expression)
|
||||
(subscript_expression)
|
||||
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
|
||||
(array)
|
||||
(object)
|
||||
(interpolation)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(property_identifier) @reference
|
||||
|
||||
(call_expression
|
||||
(identifier) @reference)
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @reference)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @reference)
|
||||
|
||||
; Definitions
|
||||
|
||||
(type) @definition.associated
|
||||
|
||||
(object_property
|
||||
(identifier) @definition.field
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @definition.field
|
||||
(_))
|
||||
|
||||
(import_name) @definition.import
|
||||
|
||||
(module_declaration
|
||||
(identifier) @definition.namespace)
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @definition.parameter
|
||||
(_))
|
||||
|
||||
(type_declaration
|
||||
(identifier) @definition.type
|
||||
(_))
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @definition.var
|
||||
(loop_enumerator) @definition.var))
|
||||
Loading…
Add table
Add a link
Reference in a new issue