mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
feat: add Cairo
This commit is contained in:
parent
ec7db4ba3f
commit
f45ea99454
7 changed files with 496 additions and 0 deletions
68
queries/cairo/locals.scm
Normal file
68
queries/cairo/locals.scm
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
; References
|
||||
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
(#set! reference.kind "type"))
|
||||
((field_identifier) @reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(program)
|
||||
(block)
|
||||
(function_definition)
|
||||
(loop_expression)
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(match_arm)
|
||||
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @scope
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.method
|
||||
(parameter (self)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
|
||||
(parameter
|
||||
[ (identifier) (self) ] @definition.parameter)
|
||||
|
||||
; Types
|
||||
|
||||
(struct_item
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
; Module
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @definition.namespace)
|
||||
|
||||
; Variables
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @definition.var)
|
||||
Loading…
Add table
Add a link
Reference in a new issue