fix: AvanteShowRepoMap failed to parse query for c (#2629)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
(function_definition
|
||||
(storage_class_specifier) @extern
|
||||
) @function
|
||||
(class_specifier
|
||||
(public) @class
|
||||
(function_definition) @method
|
||||
) @class
|
||||
(struct_specifier) @struct
|
||||
(struct_specifier
|
||||
body: (field_declaration_list
|
||||
(field_declaration
|
||||
declarator: (field_identifier))? @class_variable
|
||||
)
|
||||
)
|
||||
(declaration
|
||||
(storage_class_specifier) @extern
|
||||
) @variable
|
||||
|
||||
@@ -1714,6 +1714,31 @@ mod tests {
|
||||
assert_eq!(stringified, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_c() {
|
||||
let source = r#"
|
||||
#include <stdio.h>
|
||||
|
||||
int test_var = 2;
|
||||
extern int extern_test_var;
|
||||
|
||||
int TestFunc(bool b) { return b ? 42 : -1; }
|
||||
extern void ExternTestFunc();
|
||||
|
||||
struct Foo {
|
||||
int a;
|
||||
int b;
|
||||
};
|
||||
|
||||
typedef int my_int;
|
||||
"#;
|
||||
let definitions = extract_definitions("c", source).unwrap();
|
||||
let stringified = stringify_definitions(&definitions);
|
||||
println!("{stringified}");
|
||||
let expected = "var extern int extern_test_var;:int;var extern void ExternTestFunc();:void;class Foo{var int a;:int;var int b;:int;};";
|
||||
assert_eq!(stringified, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cpp() {
|
||||
let source = r#"
|
||||
|
||||
Reference in New Issue
Block a user