Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve C++ Tree-sitter queries #18016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

VacheDesNeiges
Copy link
Contributor

@VacheDesNeiges VacheDesNeiges commented Sep 18, 2024

I made a few tree-sitter queries for improving the highlighting of C++.

There is one query that I'm not totally certain about and would appreciate some feedback on it, the one that concerns attributes.

Many editor only highlight the identifier as a keyword (This is the behavior implemented in this commit), while others, for example the tree-sitter plugin for neovim, tags the entire attribute for highlighting (double brackets included). I don't know which one is preferable. Here are screenshots of the two versions:

image

image

Release Notes:

  • Fixed C++ attributes identifiers being wrongly highlighed through the tag "variable"
  • C++ attribute identifiers (nodiscard,deprecated, noreturn, etc.. ) are now highlighted through the tag "keyword"
  • Changed C++ primitives types (void, bool, int, size_t, etc.. ) to no longer be highlighted with the tag "keyword", they can now be highlighted by the tag "type.primitive".
  • Added a tag "concept" for highlighting C++ concept identifiers. (This tag name has been chosen to be the same than the one returned by clangd's semantic tokens)

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 18, 2024
@maxdeviant maxdeviant changed the title C++ tree-sitter's queries improvements Improve C++ Tree-sitter queries Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant