Skip to content

Coloring gets wrong after finding a single quote character in a raw C++ string #636

Description

@heriberto-delgado-ev

Checklist

  • [ X ] This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"

If Disabling that^ makes the problem go away, then follow this to make an issue on the C++ extension:
https://github.com/microsoft/vscode-cpptools/issues/new/choose

The code with a problem is:

#include "MyAwesomeDatabaseLibrary.h"
#include <string>
#include <iostream>

int main(int argc, char** argv)
{
    std::string plate = argv[1];

    AwesomeDBConnection conn;

    conn.Open("myconnectionstring");

    auto query = conn.Execute(R"sql(

        SELECT uid, part_name, install_date FROM CarParts
         WHERE plate = ')sql" + plate + "' ORDER BY install_date");

    for (const auto& entry : query)
    {
        std::cout << entry["uid"] << ": ";
        std::cout << entry["part_name"] << ", ";
        std::cout << entry["install_date"] << std::endl;
    }

    conn.Close();

    return 0;
}

It looks like:

Screenshot 2023-06-08 114206

It should look like:

(Well, not like that :D - after finding the first quote character in the raw C++ string, somehow, the process's interpretation of what is
a token and what is the inside of a string, gets reversed. It is as if raw strings are not correctly interpreted here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions