[Qt-creator] Editor style setting for a submodule (+EditorConfig)
mike.jackson at bluequartz.net
Mon Mar 4 20:20:54 CET 2019
There is an option to format while typing in the ClangFormat plugin. I was just using it 5 minutes ago…
From: Qt-creator <qt-creator-bounces at qt-project.org> on behalf of Andy <asmaloney at gmail.com>
Date: Monday, March 4, 2019 at 8:46 AM
To: Eike Ziller <Eike.Ziller at qt.io>
Cc: Qt-creator <qt-creator at qt-project.org>
Subject: Re: [Qt-creator] Editor style setting for a submodule (+EditorConfig)
I have tried all of the code formatting options and could not get the formatting I want. uncrustify comes closest, but with the 1,000 options I still can't quite get there... Clangformat, for example, couldn't format constructor initializers properly unless you add a max line width (if I recall correctly). The docs say one thing, but in practice it does something different. I gave up trying to fight it. I can adjust my style a bit, but some things... not so much :-)
"Creating the definition files for these is up to you though."
"Also, these are not used for formatting while typing...."
That's what I was looking for and why I mentioned EditorConfig since it seems to be well supported across editors. Looks like it generally only supports whitespace formatting though - but even this would be useful!
Andy Maloney // https://asmaloney.com
twitter ~ @asmaloney
On Mon, Mar 4, 2019 at 3:01 AM Eike Ziller <Eike.Ziller at qt.io> wrote:
> On 3. Mar 2019, at 19:38, Andy <asmaloney at gmail.com> wrote:
> Is there a way to have two different editor style settings - one for the main project and one for a submodule?
> Use-case: I have my own code in a submodule (lib) within a project that's "not mine". (Using cmake.) When editing in the main project I want to use its style, but when I edit my own code I want it in my style...
> Right now everything uses the main project's style.
> Secondary question: is there a way to persist styles in a repo so everyone uses the same settings? Preferably using a "standard" like EditorConfig so that non QtC-users can participate as well?
I’d try enabling the Beautifier plugin and using one of the code styling tools that it supports (clang-format, astyle, uncrustify). You can check the format definitions for these into the repo, and Qt Creator should take the first definition it finds in the parent folder hierarchy (or at least can be configured to do so).
Creating the definition files for these is up to you though.
Also, these are not used for formatting while typing, only on saving or explicit request. Except if you use clang-format and try the new experimental ClangFormat plugin (instead of Beautifier), which has the feature of formatting while typing in Qt Creator 4.9.
> I don't see anything here:
> Andy Maloney // https://asmaloney.com
> twitter ~ @asmaloney
> Qt-creator mailing list
> Qt-creator at qt-project.org
Principal Software Engineer
The Qt Company GmbH
Rudower Chaussee 13
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
_______________________________________________ Qt-creator mailing list Qt-creator at qt-project.org https://lists.qt-project.org/listinfo/qt-creator
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qt-creator