tree-sitter / tree-sitter-c

C grammar for tree-sitter
MIT License
225 stars 100 forks source link

Request for Updatation on Preprocessor Function Definition in Tree-sitter-c #176

Closed Raghava-Ch closed 9 months ago

Raghava-Ch commented 10 months ago

I have come across a situation where the preprocessor function definition value seems to be generalised to "preproc_arg." The issue lies in the fact that the entire value appears in the same color, even though it comprises multiple parts. I believe it would greatly enhance the usability and clarity of Tree-sitter-c if the value of the preprocessor could be further broken down.

Here is an example for reference: #define CALL_FUNCTION(arg1, arg2) myFunction(arg1, arg2)

In the provided translation unit, the value is represented as "preproc_arg [0, 33] - [0, 56]" but is expected to be further broken down.

If there's a way to enhance the representation of preprocessor function definition values in Tree-sitter-c, it would be immensely beneficial for users seeking a more detailed understanding of their code.

amaanq commented 9 months ago

Feel free to inject it with itself in the injections query, but the fact of the matter is macros can quite literally be anything