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

Combined behavior of toggle commend and auto indent is unpleasant

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 7.0.2
    • Quick / QML Support
    • None

    Description

      The combination of the behavior of the toggle comment shortcut and the auto-indent shortcut cause a bit annoying results. For example, given this code:

      Item {
        Item {
          property string prop1: ""
          property string prop2: ""
        }
      }

      Now let's comment out the property prop2 using Ctrl+Shift+7. Results in:

      Item {
        Item {
          property string pro1: ""
      //    property string prop2: ""
        }
      }
      

      Ok. Now Let's wrap the whole thing in another item

      Item {
      Item {
        Item {
          property string prop1: ""
      //    property string prop2: ""
        }
      }
      }
      

      And select everything and use Ctrl+i to clean up the indentation:

      Item {
        Item {
          Item {
            property string prop1: ""
            //    property string prop2: ""
          }
        }
      }
      

      Now the auto-indent moves the commented out property in too much.

       

      Obviously in this constructed mini example it's not so much of a big deal and in C++ I never really noticed this badly, but especially in QML where one moves Items around quite a lot to move them into a layout, wrap them into a colored Rectangle for visual debugging, comment out something temporarily etc, this causes the developer to having to fix the indentation quite a lot.

      Attachments

        Activity

          People

            fawzi Fawzi Mohamed
            mzanetti2 Michael Zanetti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: