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

C++17 structured binding syntax breaks indentation badly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 4.5.2, Qt Creator 4.11.1
    • C/C++/Obj-C++ Support
    • None

    Description

      It seems like whenever you use C++17 structured binding syntax, the indentation for the whole FILE beginning at that line breaks badly. Whenever you press enter, the cursor would be indented to a fixed (and unreasonable) position. The issue persists even after the end of the function containing the offending statement.

      I attached two screenshots, demonstrating the buggy cursor position when you press enter after the offending statement, and one when you press enter at the end of the file.

      It is especially annoying since the bug affects the whole file, not only the line immediately after it or the scope containing the statement, and it basically breaks all the user experience as an IDE...

      Plugins: I have C++ beautifier, ClangCodeModel, ClangRefactoring, ClassView and CppEditor turned on, but I tried turning off each one and it doesn't help. When I turned on ClangFormat this specific issue is fixed but it introduced a lot of new issues elsewhere (the indentation gets added or removed randomly as you type, not sure if it is intentional or not), so I decided to not use it. It would be nice that this bug could be fixed without forcing users to turn on ClangFormat.

      Attachments

        Issue Links

          Activity

            People

              kandeler Christian Kandeler
              haoranxu510 Haoran Xu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: