[Qt-creator] Clang Completion & Format

Björn Schäpers qt-maillist at hazardy.de
Tue Oct 26 10:14:29 CEST 2021


Am 25.10.2021 um 11:17 schrieb Eike Ziller:
> Hi,
>
>> On Oct 25, 2021, at 10:43, Björn Schäpers <qt-maillist at hazardy.de> wrote:
>>
>> Hi,
>>
>> I'm using a self compiled LLVM (recent main with the format patch) and QtCreator (d7c7089ff3ff2877fe89ac09cc2afa9a3da041c0).
>>
>> I'm not using clangd, but "plain" Clang Code Model and the Clang Format Plugin.
>>
>> I've noticed that completion and highlighting is slower than it was in the latest 4.x version.
> Did you compile LLVM in release mode?
> Otherwise I see that we apply
> https://code.qt.io/cgit/clang/llvm-project.git/commit/?h=release_130-based&id=9dabab650113687b3349e4a71eec1b1c223c4df9
> "Cache preamble-related data"
> as well.

Yes release build. But that patch is missing, I will try it soon.

>> But the most annoying thing right now is that my code is not formatted anymore while typing. Before the last modified lines were formatted when I entered a ; or }, but now (with the same config) I have manually to start the formatting and I have to select all the lines I want to format.
> There have been some changes there, maybe most notably
> ClangFormat: Sprinkle some more magic pixie dust (Ia78ecb9e) · Gerrit Code Review
> https://codereview.qt-project.org/c/qt-creator/qt-creator/+/336378
> ClangFormat: Prevent adding/removing lines when indenting (Ida6e729f) · Gerrit Code Review
> https://codereview.qt-project.org/c/qt-creator/qt-creator/+/358178
> and
> ClangFormat: Prepend a space character to our inserted line comment (Ic0b53586) · Gerrit Code Review
> https://codereview.qt-project.org/c/qt-creator/qt-creator/+/358190
>
> Maybe something broke your case.
>
>> Do I have to change my configuration? Do I have to switch to clangd? My understanding is that that's not complete yet.
> Clangd should be complete now in Qt Creator 6, and I'm using it for daily development. It can still have some rough edges here or there though.
> Not sure how it could help with your ClangFormat issue though.


I gave clangd a short try and have to say it is not yet up to what I want:
- I get suggest-override warnings from Q_OBJECT
- The highlighting is a bit fuzzy, the #define from the include guard was bold, 
until you edit it, but then the color of a forward declaration went away

Not tested or checked any speeds or completion.



More information about the Qt-creator mailing list