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

Requests/Suggestions on Code Style & Clang-format functionalities

    XMLWordPrintable

Details

    Description

      Here are feature requests from a user, which is about C++ Code style & Clang-format functionalities of Qt Creator.

      1) It would be useful to have an option to choose whether the auto-reformatting by clang-format works in real time, or it works  only when the statement is completed.
         It will try to indent and format code that is incomplete (because I am in the middle of writing), and get it all wrong. While things tend to fix themselves once the statements are complete, the intermediate result can be so disturbing that I stop coding and start re-formatting incomplete statements. It would be useful to have an option to format only finished statements.

      2) Suggestion: Adding a clang-format debug mode, where I see (in a little debug window) which setting comes into play as code I write is formatted. When something happens I don't want to happen, I can look in the debug window, and see which settings have influenced that last formatting or identation.

      3) (Qt Creator 13.0.x)  It's very useful if it's possible to search any word in Edit -> Preferences -> C++ -> Code style -> ClangFormat (the left side pane), for example by Ctrl + f.
        There is a work-around (copy all to a text editor and search there), however, it is more user-friendly if users can immediately search there.

      4) Please consider let the XML file and .clang-format configuration file can be imported/exported together, and displaying a warning in case a XML file which is enabling clang-format is imported without .clang-format file.
        It is very confusing that the .clang-format settings are not included in the XML file exported with "Settings->C++ -> Code Style -> "Export" button.
        Indeed there is a separete configuration file (.clang-format), but it is difficult to become aware of it because Qt Creator does not mention it.

      5) On the whole, the information provided by Qt about the Code style and Clang-format functionalities is limited. I suggest that someone knowledgeable write a blog post about Qt Creator formatting and indentation setting, with a bit of history, where existing settings overlap, what the mid-to-long-term goal is, and which configurations are the recommended ones going forward.

      6) Please consider testing the C++ Code style & Clang-format functionalities again with the automatic indentation disabled. Several unexpected behaviors will be observed there.
        Possibly, testing of clang-format was done with the automatic indentation enabled, so that editor feature masked some shortcomings of the clang-format integration.

       

      Attachments

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

        Activity

          People

            artem.sokolovskii Artem Sokolovskii
            hitoshiito Hitoshi Ito
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes