Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

C++ Syntax Highlighting gets confused by apostrophes #320

Closed
alexr00 opened this issue Jan 31, 2019 · 6 comments
Closed

C++ Syntax Highlighting gets confused by apostrophes #320

alexr00 opened this issue Jan 31, 2019 · 6 comments

Comments

@alexr00
Copy link

alexr00 commented Jan 31, 2019

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
Copy link
Author

alexr00 commented Jan 31, 2019

From @damyanp on January 30, 2019 18:22

Live screenshot:
image

@alexr00
Copy link
Author

alexr00 commented Jan 31, 2019

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

@rsese
Copy link

rsese commented Feb 1, 2019

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.

@rsese rsese closed this as completed Feb 1, 2019
@Aerijo
Copy link

Aerijo commented Feb 1, 2019

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

@rsese
Copy link

rsese commented Feb 1, 2019

Ahhh thanks @Aerijo, just went straight to the function 😄

tree-sitter

@maxbrunsfeld
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants