jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
155 stars 30 forks source link
syntax syntax-highlighter syntax-highlighting textmate-grammar visual-studio-code vscode

Screen Shot 2022-02-11 at 12 01 19 PM

Sponsors

Easy pair programming with any IDE. Duckly enables you to talk, share your code in real-time, server and terminal with people using different IDEs.
Try it out for free


What does this extension do?

This will get you the bleeding-edge syntax highlighting for C++. Which means your theme will be able to color your code better. This used to be a fix, but then VS Code starting using it as the official source for C and C++ highlighting.

NOTE: The default VS Code theme does not color much. Switch to the Dark+ theme (installed by default) or use a theme like one of the following to benefit from the changes:

How do I use the extension?

Just install the VS Code extension and the changes will automatically be applied to all relevant files.
Link: https://marketplace.visualstudio.com/items?itemName=jeff-hykin.better-cpp-syntax

Comparison (Material Theme)

compare

How do I use the grammar? (as an upstream for my non-vs code editor)

  1. Watch the the "Major Changes" thread here to know when I change licenses, the codebase structure, or just major highlighting changes.
  2. I support non-VS Code usecases. E.g. yes, you are welcome to open issues like this one that don't affect VS Code.

What is different from atom/language-c?

It fixes:

It adds:

Like this extension?

Contributing

If you'd like to help improve the syntax, take a look at main/main.rb. And make sure to take a look at documentation/CONTRIBUTING.md to get a better idea of how the code works.

Planned future fixes/features:

What if I see a highlighting bug?

Let me know! Post an issue on https://github.com/jeff-hykin/better-cpp-syntax I love regular expressions, and PR's are always welcome.

Did you write all of this yourself?

The original JSON was taken from https://github.com/atom/language-c
@matter123 wrote every massive pull request, from simple bugfixes up to the entire textmate testing suite
@j-cortial has fixed many lingering bugs
The #error fix was taken from fnadeau's pull request here: https://github.com/atom/language-c/pull/251
Thank you @matter123, @j-cortial, and @fnadeau!
The rest of the ruby is authored by @jeff-hykin