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

Cxx Rename + Apply changes to declaration changes header argument wrapping

    XMLWordPrintable

Details

    • Windows

    Description

      If a method parameter is renamed in the cxx and then the refactoring tool "Apply function signature changes" aka "Apply changes to declaration" is used, it will change the wrapping of the header signature if the first parameter is in a newline.

      Eg

       

      // header
      bool isFoo(
          int firstParamOfLongSignature,
          int secondParamOfLongSignature) const;
      
      // .cxx
      bool isFoo(
          int firstParamOfLongSignature,
          int secondParamOfLongSignature) const 
      {
          ...
      }
      

      Now if I rename the first parameter in the cxx to something different and apply the changes to the header as well, the newline before the first parameter gets lost.

      // header result after applying changes
      bool isFoo(int newNameOfLongSignature,
          int secondParamOfLongSignature) const;
      

      What I would expect is that the existing header wrapping is kept when applying rename changes from the cxx.

       

      This is pretty annoying and I always have to correct it manually by going into the .h file after applying changes.

      Its especially annoying if you use clang format on file save. We've configured clang with "first param in newline means all params in newline" and after applying the name change QtCreator thinks everthing has to be in one line, which results in this formatting:

      // header result after applying changes and saving with clang format
      bool isFoo(int newNameOfLongSignature, int secondParamOfLongSignature) const;
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            alfu alfu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: