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

C++ Syntax Highlighting gets confused by apostrophes #320

Closed

Description

@alexr00

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

Activity

  1. alexr00 commented on Jan 31, 2019

    @alexr00
    Author

    From @damyanp on January 30, 2019 18:22

    Live screenshot:
    image

  2. alexr00 commented on Jan 31, 2019

    @alexr00
    Author

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

  3. rsese commented on Feb 1, 2019

    @rsese

    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.

  4. Aerijo commented on Feb 1, 2019

    @Aerijo

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

  5. rsese commented on Feb 1, 2019

    @rsese

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

    tree-sitter

  6. reopened this on Feb 1, 2019
  7. maxbrunsfeld commented on May 8, 2019

    @maxbrunsfeld
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions