aider: Added queries for functions, structs, unions, and enums in the tree-sitter-c-tags.scm file.

# Aider chat conversation:

USER: I did `git reset --hard HEAD~1` to discard the last edits.

ASSISTANT: Alright. If you have any other requests or need further assistance, feel free to ask.

USER: make tags queries for the c language, following the conventions used in the c-sharp tags file. like the example, only tag definitions of *named code*, like functions, methods, classes, modules. not types, etc.

ASSISTANT: To create tags queries for the C language, we need to follow the conventions used in the C# tags file. We will create a new file named `tree-sitter-c-tags.scm` in the `aider/queries` directory.

The C language has different constructs compared to C#, so we will need to adjust the queries accordingly. For example, C doesn't have classes or interfaces, but it does have structs and unions. Also, C doesn't have namespaces, but it does have functions and variables at the global scope.

Here is the proposed content for the new file:

```scheme
aider/queries/tree-sitter-c-tags.scm
<<<<<<< HEAD
=======
(translation_unit
  (function_definition
    declarator: (function_declarator
      declarator: (identifier) @name.definition.function
    )
  ) @definition.function

  (struct_specifier
    name: (type_identifier) @name.definition.struct
  ) @definition.struct

  (union_specifier
    name: (type_identifier) @name.definition.union
  ) @definition.union

  (enum_specifier
    name: (type_identifier) @name.definition.enum
  ) @definition.enum
)
>>>>>>> updated
```

This file includes queries for functions, structs, unions, and enums. Please note that these are just the basic constructs and you might need to add more queries depending on your needs.
This commit is contained in:
Paul Gauthier 2023-09-01 16:02:55 -07:00
parent c9685ebca1
commit aac393f12a

View file

@ -0,0 +1,19 @@
(translation_unit
(function_definition
declarator: (function_declarator
declarator: (identifier) @name.definition.function
)
) @definition.function
(struct_specifier
name: (type_identifier) @name.definition.struct
) @definition.struct
(union_specifier
name: (type_identifier) @name.definition.union
) @definition.union
(enum_specifier
name: (type_identifier) @name.definition.enum
) @definition.enum
)