tree-sitter / tree-sitter-c

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

bug: @comment.todo and others no longer work #195

Closed benjamin051000 closed 6 months ago

benjamin051000 commented 6 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

I'm not sure which version of treesitter-nvim or this C parser I was using before (no more than 8 months old), but the following comment tags had special highlighting:

// TODO 
// WARNING
// BUG
// NOTE
// ERROR (I think)

Now that I've updated to the latest treesitter-nvim and the latest C parser, these no longer have special highlighting and are the same color as a normal comment.

I did find this in the contributing.md of treesitter-nvim, perhaps it is relevant?

As languages differ quite a lot, here is a set of captures available to you when building a highlights.scm query. Note that your color scheme needs to define (or link) these captures as highlight groups.

...

@comment               ; line and block comments
@comment.documentation ; comments documenting code

@comment.error         ; error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED:`)
@comment.warning       ; warning-type comments (e.g. `WARNING:`, `FIX:`, `HACK:`)
@comment.todo          ; todo-type comments (e.g. `TODO:`, `WIP:`, `FIXME:`)
@comment.note          ; note-type comments (e.g. `NOTE:`, `INFO:`, `XXX`)

Let me know if you need any additional info, or if I should move this issue upstream to treesitter or treesitter-nvim. Thank you!

Steps To Reproduce/Bad Parse Tree

Write a C comment with one of the aforementioned keywords and enable TS highlighting.

Expected Behavior/Parse Tree

I expected these to have relevant highlighting.

Repro

No response

benjamin051000 commented 6 months ago

I see this line: https://github.com/tree-sitter/tree-sitter-c/blob/f64a422d4e46a44315abe75295035554d334bdab/queries/highlights.scm#L81

But this file doesn't appear to have changed much. That makes me think that either this issue is in another file, or upstream.

amaanq commented 6 months ago

this is the grammar, your issue belongs at nvim-treesitter