forked from yetone/avante.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: avante repo map rust crate (yetone#628)
- Loading branch information
Showing
23 changed files
with
1,399 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[package] | ||
name = "avante-repo-map" | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
[build-dependencies] | ||
cc="*" | ||
|
||
[dependencies] | ||
mlua = { workspace = true } | ||
minijinja = { workspace = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
tree-sitter = "0.23" | ||
tree-sitter-language = "0.1" | ||
tree-sitter-rust = "0.23" | ||
tree-sitter-python = "0.23" | ||
tree-sitter-javascript = "0.23" | ||
tree-sitter-typescript = "0.23" | ||
tree-sitter-go = "0.23" | ||
tree-sitter-c = "0.23" | ||
tree-sitter-cpp = "0.23" | ||
tree-sitter-lua = "0.2" | ||
tree-sitter-ruby = "0.23" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
lua51 = ["mlua/lua51"] | ||
lua52 = ["mlua/lua52"] | ||
lua53 = ["mlua/lua53"] | ||
lua54 = ["mlua/lua54"] | ||
luajit = ["mlua/luajit"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;; Capture extern functions, variables, public classes, and methods | ||
(function_definition | ||
(storage_class_specifier) @extern | ||
) @function | ||
(class_specifier | ||
(public) @class | ||
(function_definition) @method | ||
) @class | ||
(declaration | ||
(storage_class_specifier) @extern | ||
) @variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;; Capture extern functions, variables, public classes, and methods | ||
(function_definition | ||
(storage_class_specifier) @extern | ||
) @function | ||
(class_specifier | ||
(public) @class | ||
(function_definition) @method | ||
) @class | ||
(declaration | ||
(storage_class_specifier) @extern | ||
) @variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
;; Capture top-level functions and struct definitions | ||
(var_declaration | ||
(var_spec) @variable | ||
) | ||
(const_declaration | ||
(const_spec) @variable | ||
) | ||
(function_declaration) @function | ||
(type_declaration | ||
(type_spec (struct_type)) @class | ||
) | ||
(type_declaration | ||
(type_spec | ||
(struct_type | ||
(field_declaration_list | ||
(field_declaration) @class_variable))) | ||
) | ||
(method_declaration) @method |
23 changes: 23 additions & 0 deletions
23
crates/avante-repo-map/queries/tree-sitter-javascript-defs.scm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
;; Capture exported functions, arrow functions, variables, classes, and method definitions | ||
(export_statement | ||
declaration: (lexical_declaration | ||
(variable_declarator) @variable | ||
) | ||
) | ||
(export_statement | ||
declaration: (function_declaration) @function | ||
) | ||
(export_statement | ||
declaration: (class_declaration | ||
body: (class_body | ||
(field_definition) @class_variable | ||
) | ||
) | ||
) | ||
(export_statement | ||
declaration: (class_declaration | ||
body: (class_body | ||
(method_definition) @method | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
;; Capture function and method definitions | ||
(variable_list) @variable | ||
(function_declaration) @function |
25 changes: 25 additions & 0 deletions
25
crates/avante-repo-map/queries/tree-sitter-python-defs.scm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
;; Capture top-level functions, class, and method definitions | ||
(module | ||
(expression_statement | ||
(assignment) @assignment | ||
) | ||
) | ||
(module | ||
(function_definition) @function | ||
) | ||
(module | ||
(class_definition | ||
body: (block | ||
(expression_statement | ||
(assignment) @class_assignment | ||
) | ||
) | ||
) | ||
) | ||
(module | ||
(class_definition | ||
body: (block | ||
(function_definition) @method | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
;; Capture top-level methods, class definitions, and methods within classes | ||
(program | ||
(class | ||
(body_statement | ||
(call) @class_call | ||
(assignment) @class_assignment | ||
(method) @method | ||
) | ||
) @class | ||
) | ||
(program | ||
(method) @function | ||
) | ||
(program | ||
(assignment) @assignment | ||
) |
Oops, something went wrong.