Update C++ grammar#7352
Conversation
lildude
left a comment
There was a problem hiding this comment.
We can't accept tree-sitter grammars, only TextMate compatible grammars as stated in the CONTRIBUTING.md file. The tree-sitter grammars you see referenced are pulled in directly by the syntax highlighting engine and are managed independently by the team that manages the engine. We update that README whenever that team adds a new grammar.
I don't know that team's plans but as C++ is very popular, it's likely to be switching to C++ some time.
Because those other languages aren't getting their grammars from Linguist. They're being pulled in directly by the syntax highlighting engine. That's why we have this line right at the top of the Line 6 in 964e265 Essentially GitHub has two syntax highlighting engines: the old engine that uses TextMate-compatible grammars and the new engine that uses tree-sitter grammars. Linguist provides the grammars for the former (in the tarball attached to every release). The latter pulls the tree-sitter grammars in directly. There is a plan to slowly phase out the old TextMate-compatible engine, in favour of the new tree-sitter engine, and at this point the team involved may extend the ability to add tree-sitter grammars via Linguist or some other means, but we're no where near that point right now as it turns out tree-sitter grammars aren't all created equal and some have severe performance issues. So adding a tree-sitter grammar to Linguist will have no effect and the |
How can we get the tree-sitter-cpp grammar into the GitHub syntax highlighter then like the other languages that use it (i.e. C, C#, etc.)? |
It's up to the team that maintains the engine. You would need to raise a support ticket with GitHub support to get this onto the team's radar. |
|
I have gone ahead and went back to using my fork, removing the file with the obscenely long regular expression (which I don't think had any useful purpose). |
|
Hi, may I ask what needs to be changed before the pull request can be merged? |
|
It's stated right at the top of the failure output: This should have been run when you ran Line 140 in 964e265 The second failure is because the submodules aren't sorted. This too should have been done with the Line 139 in 964e265 |
|
Thanks, I'll fix these |
|
I have made the necessary changes, can the tests be run now? |

This pull request changes the grammar used for C++ to a fork of the same repository with updated keywords, at least until the tree-sitter-cpp grammar can be used.
Description
Checklist:
I am adding a new extension to a language.
I am adding a new language.
#RRGGBBI am fixing a misclassified language
I am changing the source of a syntax highlighting grammar
I am updating a grammar submodule
I am adding new or changing current functionality
I am changing the color associated with a language