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

Lightbulb "Apply Changes to definition / declaration" breaks lines for "Switch with Previous/Next Parameter"

    XMLWordPrintable

Details

    • Windows
    • 07da22270 (master)

    Description

      I really like the lightbulb feature, that helps renaming parameter names in functions/methods.

      What I do not like is, that it breaks formatting of the parameter listing of the function declaration or definition (depending on what to adapt to).

      Starting point:

      #include <QDebug>
      
      // declaration
      void foo(
            int i,
            float f
            );
      
      // definition
      void foo(
            int i,
            float f   // put the cursor on 'f'
            )
         {
         qDebug() << i << f;
         }
      
      int main()
         {
         foo(1, 2.);
         }
       

      Now put the cursor on 'f' and choose Context-Menu => Refactor => Switch with Previous Parameter". The result is ok.
      Now click on the lightbulb to "Apply Changes to declaration".

      This refactoring leaves the declaration in an ugly shape.

      #include <QDebug>
      
      // declaration
      void foo(
            float f
            ,
            int i);
      
      // definition
      void foo(
            float f,
            int i
            )
         {
         qDebug() << i << f;
         }
      
      int main()
         {
         foo(1, 2.);
         }

      So, in the declaration I would have expected to just see the lines switched:

      // declaration
      void foo(
            float f,
            int i
            ); 

      As the declaration is typically in another file you would have to switch to the file and fix the formatting.

      Attachments

        Issue Links

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

          Activity

            People

              kandeler Christian Kandeler
              moellney Michael Möllney
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes