source formatting for .h files: C or C++?

Aleix Pol aleixpol at kde.org
Mon Sep 4 15:40:18 BST 2017


On Mon, Sep 4, 2017 at 2:48 PM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> On Monday September 04 2017 13:35:20 Aleix Pol wrote:
>
>> > Is it correct that the source formatting choice for .h files is taken from the C formatting choice, even if the header is clearly a C++ one?
>>
>> It's clearly not correct.
>
> No, but am I right this is what happens (or can happen, one could imagine an order effect here)?
>
> Not sure if there's an easy fix if file type is determined from the extension, nor even how you'd do a reliable C++ detection from syntax that doesn't check for every C++-specific idiom. And then there's ObjC and ObjC++...
>
> R.

I think that we're just checking the mimetype so that's why:
$ kmimetypefinder5 kcategorizedview.h
text/x-chdr

Maybe you can look at the code how the language is inferred.

Aleix



More information about the KDevelop mailing list