Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeff-hykin/better-cpp-syntax
💾 The source of VS Code's C++ syntax highlighting
https://github.com/jeff-hykin/better-cpp-syntax
syntax syntax-highlighter syntax-highlighting textmate-grammar visual-studio-code vscode
Last synced: 5 days ago
JSON representation
💾 The source of VS Code's C++ syntax highlighting
- Host: GitHub
- URL: https://github.com/jeff-hykin/better-cpp-syntax
- Owner: jeff-hykin
- License: gpl-3.0
- Created: 2019-02-02T21:39:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-12T21:36:38.000Z (4 months ago)
- Last Synced: 2024-10-31T13:46:59.286Z (14 days ago)
- Topics: syntax, syntax-highlighter, syntax-highlighting, textmate-grammar, visual-studio-code, vscode
- Language: C++
- Homepage:
- Size: 13.7 MB
- Stars: 156
- Watchers: 4
- Forks: 29
- Open Issues: 123
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
- [XD Theme](https://marketplace.visualstudio.com/items?itemName=jeff-hykin.xd-theme)
- [Noctis](https://marketplace.visualstudio.com/items?itemName=liviuschera.noctis)
- [Kary Pro Colors](https://marketplace.visualstudio.com/items?itemName=karyfoundation.theme-karyfoundation-themes)
- [Material Theme](https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme)
- [One Monokai Theme](https://marketplace.visualstudio.com/items?itemName=azemoh.one-monokai)
- [Winteriscoming](https://marketplace.visualstudio.com/items?itemName=johnpapa.winteriscoming)
- [Popping and Locking](https://marketplace.visualstudio.com/items?itemName=hedinne.popping-and-locking-vscode)
- [Syntax Highlight Theme](https://marketplace.visualstudio.com/items?itemName=peaceshi.syntax-highlight)
- [Default Theme Enhanced](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-themes)## 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)
## How do I use the grammar? (as an upstream for my non-vs code editor)
1. Watch the the "Major Changes" thread [here](https://github.com/jeff-hykin/better-cpp-syntax/issues/64) 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](https://github.com/jeff-hykin/better-cpp-syntax/issues/653) that don't affect VS Code.## What is different from atom/language-c?
It fixes:
- The issue of single quotes inside #error and #warning being highlighted when then shouldn't be
- The issue of initialization functions only highlighting the first parenthesis
- The bug that treats the 'and' and 'or' operator as functions (instead of operators) when they are followed by ()'s
- Old C99 function highlighting that broke the standard function highlighting
- The failure of highlighting for the semicolon after namespaces
- The missing operator overloading symbols
- The failure to tag operator overloading functions as functions
- The failure to tag implicit operator overrides
- The marking of some %'s as invalid inside of strings https://github.com/atom/language-c/issues/289
- The highlighting of namespaces with ::'s https://github.com/atom/language-c/issues/260
- The issue of the C++ syntax depending on (and getting screwed up by) the C syntax
- multiple inheritance https://github.com/atom/language-c/issues/245
- And many many more issues (#318, #309, #270, #246, etc)It adds:
- Parameter highlighting
- Highlighting of embedded assembly code (if you have an assembly syntax installed)
- Function-pointer highlighting
- Lambda highlighting
- C++14 literal support (`100'000ms`)
- Template definition syntax highlighting (including C++ 2020 syntax)
- Better object identification
- Improved scope resolution `::` syntax
- Highlighting of templated function calls `aFunction(arguments)`
- Additional specificity for many existing tags
- Many other features### Like this extension?
-
You'll probably like this as well: My "Better Syntax" Megapack
## 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:
- Add tagging for type-casting statements
- Add tagging for custom types words
- Better support for dereferenced/pointer tagging
- Full C++ 2020 support (module imports, arrow return types, etc.)
- Improving template types
## 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