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

Auto-indent stops working when line ends with a string literal

    XMLWordPrintable

Details

    • c6ac773b9a2d6fc5cb581cd56785525d0a352a4a (qt-creator/qt-creator/5.0)

    Description

      It worked properly in 4.11 and many previous versions over the years. Yesterday, jumped straight to current beta, and stumbled on this.

      template <typename ...Args>
      void some_foo(Args && ...args)
      { }
      
      
      int main()
      {
          int argument1 = 0;
          int argument2 = 0;
          int argument3 = 0;
      
          // Proper indentation.
          some_foo(argument1
                   // Auto-indents properly.
                   , argument2
                   // Auto-indents properly.
                   , argument3
                   );
      
          // Bad indentation.
          some_foo(argument1
                   , "some str literal"
      , argument2 // At this point, auto-indent stops working.
                   // Here it works again.
                   , argument3
                   );
      
          // Another example.
          some_foo("some str literal"
      "continuation" // At this point, auto-indent stops working.
                   // Here it works again.
                   , argument2
                   , argument3
                   );
      
          // Another example: even a single comment line fixes auto-indent.
          some_foo("some str literal"
      // This comment line won't auto-indent
                   // But this one will!
                   "continuation"
                   // Here it works again.
                   , argument2
                   , argument3
                   );
      
          // Another example: no issue.
          some_foo("some str literal", argument1
                   // Auto-indents properly.
                   , argument2
                   , argument3
                   );
          
          // Another example: no issue.
          some_foo("some str literal" // Even comment at the end of line stops the issue.
                   // Auto-indents properly.
                   , argument1
                   , argument2
                   , argument3
                   );
          return 0;
      }
      

      It seems that it only affects the line that immediately follows the literal. All following lines work as expected.

      Please, help with solving this issue, because it's pretty counter-productive.

      Attachments

        Issue Links

          Activity

            People

              kandeler Christian Kandeler
              greenscape Paul
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: