From 1873b02c637dd67e6580eb5ecb3d55a450f327c2 Mon Sep 17 00:00:00 2001 From: TheZombie1999 Date: Wed, 21 Aug 2024 23:05:54 +0000 Subject: [PATCH] Fixed for grammar not being able to fetch. Implementation of indent and textobjects querry for c3. --- languages.toml | 2 +- runtime/queries/c3/indents.scm | 13 +++++++++++++ runtime/queries/c3/textobjects.scm | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/c3/indents.scm create mode 100644 runtime/queries/c3/textobjects.scm diff --git a/languages.toml b/languages.toml index 4f5272476..0465a2522 100644 --- a/languages.toml +++ b/languages.toml @@ -420,7 +420,7 @@ source = { git = "https://github.com/sogaiu/tree-sitter-janet-simple", rev = "51 [[grammar]] name = "c3" -source = { git = "https://github.com/c3lang/tree-sitter-c3.git" , rev = "790a0326833cd647e00d8dec01268aa1ec2e3bdb" } +source = { git = "https://github.com/c3lang/tree-sitter-c3" , rev = "790a0326833cd647e00d8dec01268aa1ec2e3bdb" } [[language]] name = "c3" diff --git a/runtime/queries/c3/indents.scm b/runtime/queries/c3/indents.scm new file mode 100644 index 000000000..901abf38d --- /dev/null +++ b/runtime/queries/c3/indents.scm @@ -0,0 +1,13 @@ +[ + (func_definition) + (if_stmt) + (enum_declaration) + (for_stmt) + (while_stmt) + (case_stmt) + (macro_declaration) +] @indent + +[ + "}" +] @outdent diff --git a/runtime/queries/c3/textobjects.scm b/runtime/queries/c3/textobjects.scm new file mode 100644 index 000000000..8c0a3d514 --- /dev/null +++ b/runtime/queries/c3/textobjects.scm @@ -0,0 +1,17 @@ +(func_definition + body: (_) @function.inside) @function.around + +(struct_declaration + body: (_) @class.inside) @class.around + +(enum_declaration + body: (_) @class.inside) @class.around + +(fn_parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(line_comment) @comment.inside +(line_comment)+ @comment.around + +(doc_comment) @comment.inside +(doc_comment)+ @comment.outside