[Qt-creator] Qt Creator beautifier plugin vs. built-in code style

Andy asmaloney at gmail.com
Tue Aug 22 15:33:47 CEST 2017


Cool - thanks Eike!

Is there a way to turn that on per-project? I don't see anything in the
project settings for that. Aside from my own work, I work on several
open-source projects and switch back-and-forth frequently. Unfortunately
I'm not in a position to force them to use the One True Format...

Another suggestion - it would be very useful to be able to read the
clang-format config per-project from a file (".clang-format.cfg?"). (Does
this already exist too?) This would help avoid misconfiguration when
several developers are on the same codebase.

If we had that, maybe a non-standard "AutoFormatOnSave" option could be
added to it?

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>


On Tue, Aug 22, 2017 at 9:18 AM, Eike Ziller <Eike.Ziller at qt.io> wrote:

>
> > On Aug 22, 2017, at 14:36, Andy <asmaloney at gmail.com> wrote:
> >
> > My 2 cents:
> >
> > I watched the video (good stuff - thanks!) grabbed clang-format, found
> this awesome site to create the configuration:
> >
> >   https://zed0.co.uk/clang-format-configurator/
> >
> > and played with it in Qt Creator.
> >
> > Overall I think it's great. I've done some work with Go and I love that
> go-fmt is run every time I save a file (in Atom). It would be amazing to
> have that capability with clang-format and Qt Creator.
>
> Options > Beautifier > General > Enable auto format on file save (needs
> enabled Beautifier plugin)
>
> > The one thing I couldn't get it to do is indent code after accessor
> keywords. Using "AccessModifierOffset" I can do this:
> >
> > {
> > public:
> >    void foo();
> > }
> >
> > or this:
> >
> > {
> >    public:
> >    void foo();
> > }
> >
> > But not the one I want, which is this:
> >
> > {
> >    public:
> >       void foo();
> > }
> >
> > If anyone has clues on how to accomplish this I'll be a happy humanoid.
> >
> >
> > ---
> > Andy Maloney  //  https://asmaloney.com
> > twitter ~ @asmaloney
> >
> >
> > On Tue, Aug 22, 2017 at 3:29 AM, Nikolai Kosjar <nikolai.kosjar at qt.io>
> wrote:
> > 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
> >
> > _______________________________________________
> > Qt-creator mailing list
> > Qt-creator at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/qt-creator
> >
> > _______________________________________________
> > Qt-creator mailing list
> > Qt-creator at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/qt-creator
>
> --
> Eike Ziller
> Principal Software Engineer
>
> The Qt Company GmbH
> Rudower Chaussee 13
> D-12489 Berlin
> eike.ziller at qt.io
> http://qt.io
> Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170822/e3822c42/attachment.html>


More information about the Qt-creator mailing list