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

Code highlighting doesn't work for some files with clangd

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 7.0.1
    • Qt Creator 7.0.0
    • C/C++/Obj-C++ Support
    • None
    • Kubuntu 21.10 x86-64. QtCreator 7.0.1 build 681 from revision 06703e17d4. ffmpeg 4.4 or 5.0.
    • Linux/X11
    • 0cb569a39b (qt-creator/qt-creator/7.0) 0cb569a39b (qt-creator/qt-creator/master) 0cb569a39b (qt-creator/qt-creator/qds-3.3) 0cb569a39b (qt-creator/tqtc-qt-creator/7.0)

    Description

      In my CMake project, QtCreator doesn't highlight code in some files, other than:

      • Preprocessor keywords
      • String literals
      • C++ keywords
      • Comments

      All other text is displayed black, as if not recognized. This applies to the whole file that is affected, while code coloring may work for other files in the same project, even the same CMake target.

      In the files that are affected, code navigation (e.g. follow to symbol definition) does work. Also, moving the cursor at a word does highlight the same word elsewhere in the editor. No code model errors are reported, all include files are resolved, and the project compiles successfully.

      The problem seems to affect files that are including ffmpeg headers, but that is not the definitive feature. I have some files that include ffmpeg headers that are affected and others that are not affected.

      I have attached a test project that reproduces the problem. The project relies on pkg-config, which is standard on most Linux systems. You will need to have ffmpeg headers installed to configure the project (libavcodec-dev and libavutil-dev packages on Debian-based systems). After opening the project, configure it and open libav_decoder.h or libav_decoder.cpp in the editor. Code coloring may appear briefly and then disappear.

      This only reproduces with clangd enabled.

      Attachments

        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:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes