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

ClangFormat destroys formatting in the whole file on saving

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Sometimes, when the edited .cpp file is saved, ClangFormat removes any indentation from the saved file before it is written to filesystem. I.e. the file is saved with completely destroyed formatting and there is no way to restore it.

      I'm attaching a screencast with this issue being reproduced. I'm editing a .cpp file and then press Ctrl+S to save it. Then I press Ctrl+Z to undo the formatting and you see that the restored formatting is marked with red bars on the left, i.e. it is treated as modified content, compared to what is saved in the file. Saving the file again destroys the formatting again.

      This doesn''t happen with the builtin code formatter.

      Attachments

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

        Activity

          People

            artem.sokolovskii Artem Sokolovskii
            lastique Andrey Semashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes