atom / language-c

C support in Atom
Other
118 stars 152 forks source link

C++ Syntax Highlighting gets confused by apostrophes #320

Closed alexr00 closed 5 years ago

alexr00 commented 5 years ago

Edit by @rsese - also an issue with Tree-sitter

From @Aerijo:

Tree sitter also trips on this, it just recovers before the function.

tree-sitter


From @damyanp on January 30, 2019 18:21

Issue Type: Bug

For example:

#error Don't do this
void foo() { }

The syntax highlighter thinks that a string starts from the apostrophe betwee the "n" and "t" in "don't" and highlights the rest of the file as a string until it reaches the next single quote.

Visual Studio gets this correct, since the entire line for the preprocessor directive is highlighted separately and it doesn't look for strings inside it.

Copied from original issue: Microsoft/vscode#67568

alexr00 commented 5 years ago

From @damyanp on January 30, 2019 18:22

Live screenshot: image

alexr00 commented 5 years ago

After the single quote in the error directive everything is categorized as string.quoted.single.c

rsese commented 5 years ago

Thanks for the report!

After the single quote in the error directive everything is categorized as string.quoted.single.c

Looks like this behavior isn't an issue with Tree-sitter? E.g.:

with-tree-sitter

So going to go ahead and close as detailed below.


As you may have heard, we are migrating from our old first-mate grammar engine to the new Tree-sitter engine. This will enable a number of new features, more consistent syntax highlighting, and better performance, among other benefits. In order to free up our limited resources, we have decided to stop maintaining the first-mate grammar when there is a built-in Tree-sitter grammar available. Since this issue applies only to the first-mate grammar, we are going to close it. Please let us know if we have misunderstood the description of the problem.

Aerijo commented 5 years ago

@rsese Tree sitter also trips on this, it just recovers before the function.

rsese commented 5 years ago

Ahhh thanks @Aerijo, just went straight to the function :smile:

tree-sitter

maxbrunsfeld commented 5 years ago

This doesn't affect the Tree-sitter parser anymore.