c.tmbundle
c.tmbundle copied to clipboard
single-line comments break highlighting on the next line
On GitHub.com, C++ code is incorrectly highlighted after a line that contains a //
comment.
Example code demonstrating the problem:
const byte hello = 1; // This is a comment
const byte world = 2; // `const` should be highlighted, but it is not
const byte foo = 3; /* This problem does not occur with multiline comments. */
/* Multiple
lines */
const byte bar = 4;
// This comment breaks highlighting as well.
const byte a = 5;
const byte b = 6;
// This also breaks highlighting in other ways
int main() {}
int test() {}
// Even this breaks
x_y();
y_z();
// Another example
a_z(); a_z();
Reporting here because of instructions in this repo.
It took me literally half an hour of digging through source code, github support, and google, to find this.
As of some recent update, Github syntax highlighting for C++ is terribly broken by this error, especially if you have multi-line comments following a single-line comment as our codebase does:
namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Calculate the transport cross section for the Wentzel OK and VI model.
*
* \note This performs the same calculation as Geant4's
* G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom.
*/
class WentzelTransportXsCalculator
{
public:
//!@{
//! \name Type aliases
using XsUnits = units::Native; // [len^2]
using Charge = units::ElementaryCharge;
using Mass = units::MevMass;
using MomentumSq = units::MevMomentumSq;
//!@}
/* and so forth */
};
The first single-line comment causes the /*!
block highlight to be ignored, which then causes the apostrophe inside the comment to be interpreted as a character string...
(this renders for me, as of Feb 2024, as
)
I don't think this is a bug in this repository because the issue only recently started manifesting on GitHub, and the last commit for this repository was years ago.