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

Code indentation in lambda functions incorrect

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 3.5.0, Qt Creator 4.0.0, Qt Creator 4.5.0-rc1, Qt Creator 4.7.0
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None

      Description

      When typing multi-line C++ code inside a lambda function that is indented relative to the outer scope, the editor ignores the lambda indentation and indents the lambda body relative to the outer scope.

      For instance, try typing this piece of code:

      std::thread // 1
      (
          []() //2
          {
              try //3
              {
              }
              catch()
              {
              }
          }
      ).detach();
      

      Note that the lambda body is indented deeper than the std::thread declaration scope (1). Yet as I type the lambda body, the editor puts closing braces and the cursor after a newline to the lambda level (2) instead of one level deeper (3).

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              kosjar Nikolai Kosjar
              Reporter:
              lastique Andrey Semashev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes