Giter Club home page Giter Club logo

cpp-textmate-grammar's Introduction

Like this extension?

You'll probably like this as well: The Better Syntax Megapack

What does this do?

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

NOTE: The default VS Code theme does not color much. Use a theme like one of the following to benefit from the changes:

How do I use it?

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

Before After
material_before material_after

What is different from atom/language-c?

It fixes:

  • The issue of single quotes inside #error and #warning being highlighted when they shouldn't be
  • The issue of initialization functions only highlighting the first parenthese
  • 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 atom/language-c#289
  • The highlighting of namespaces with ::'s atom/language-c#260
  • The issue of the C++ syntax depending on (and getting screwed up by) the C syntax
  • multiple inheritance atom/language-c#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<int>(arguments)
  • Additional specificity for many existing tags
  • Many other features

Contributing

A Haiku for this repository

Syntax highlighting
You might think it is working
It’s actually not

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

Planned future fixes/features:

  • Add tagging for type-casting statements
  • Add tagging for template-usage (rather than only template definition)
  • Add tagging for custom types words
  • Better support for dereferenced/pointer tagging

What if I see a highlighting bug?

Let me know! Post an issue on https://github.com/jeff-hykin/cpp-textmate-grammar This repo will be actively maintained and accepts PR's.

Did you write all of this yourself?

The original JSON was taken from https://github.com/atom/language-c
The #error fix was taken from fnadeau's pull request here: atom/language-c#251
@matter123 has written basically every pull request, from simple bugfixes up to the entire textmate testing suite
Thanks @matter123!
The rest of the ruby is authored by @jeff-hykin

cpp-textmate-grammar's People

Contributors

asottile avatar davidgoldman avatar dependabot[bot] avatar dodoent avatar hyrious avatar jeff-hykin avatar jogo- avatar mansoormohsin avatar matter123 avatar peaceshi avatar yanpas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.