[Qt-creator] Qt Creator beautifier plugin vs. built-in code style
Nikolai Kosjar
nikolai.kosjar at qt.io
Tue Aug 22 09:29:19 CEST 2017
On 08/21/2017 08:18 PM, Timur Kristóf wrote:
> Hi,
>
> I noticed that the built-in code style options somewhat clash with the
> beautifier plugin. (I notice that the code style settings don't affect
> the beautifier plugin at all, and the beautifier settings are rather
> rudimentary at the moment.)
>
> What are the long-term plans in this regard?
>
> Do you guys intend to improve the built-in code styling, or do you want
> to eventually replace it with either the beautifier or something based
> on clang-format?
Evaluation is on-going :)
I'm playing around with clang-format for the Qt Creator code base to see
whether it can replace our built-in code style use cases and how well it
can handle our code style/formatting.
Some general observations:
1. Qt Creator has a built-in *indenter*, handling/controlling whitespace
before the first token of a line.
2. clang-format does this and more:
* it handles/controls whitespace everywhere, also taking a maximum
column count into account
* it can e.g. also sort your includes and add comments at the closing
curly brace of namespaces: "} // namespace X".
3. The beautifier-plugin for clang-format allows to format the entire
file or text selections of it. Changed lines are properly indicated by
red vertical stripes in the left editor margin, which is cool. The
plugin does not yet make use of the -cursor argument, which allows to
format the AST at cursor position and probably would be useful/needed to
replace current on-enter-indendation.
Nikolai
More information about the Qt-creator
mailing list