Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26615

C++ string literals colored incorrectly

    XMLWordPrintable

Details

    • Linux/X11
    • a3af941adf (qt-creator/qt-creator/master) a3af941adf (qt-creator/qt-creator/qmlprojectstorage)

    Description

      C++ string literals (as in `printf("hello")`) and character literals (as in `s.push_back('a')`) are colored as solid black, as if the literal is not recognized by the C++ code model.

      In the color settings, the "String" line is set to a different color (grey), and I can see it is being applied to include header names, both in angle brackets and double quotes (e.g. in `#include "stddef.h"`), which is expected.

      The problem does not reproduce consistently in all contexts (i.e. string literals may get colored correctly in one code region but not the other). I'm not sure what makes it trigger, but I have found that using UDLs is more likely to trigger it. See the attached screenshot for an example.

      Attachments

        1. qtcreator_string_literal_coloring.tar.xz
          0.5 kB
          Andrey Semashev
        2. Screenshot_20211124_191312.png
          16 kB
          Andrey Semashev
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            lastique Andrey Semashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes