<p></p>
<p>Files with the <code>.h</code> extension are currently treated as C source code.  However, the extension is also used for C++.  It would be nice if Geany filetype auto detection switched the header type to C/C++ based on whether a corresponding source file is found.</p>
<p>For instance, many projects match <code>.cc</code> and <code>.h</code> files.  If both <code>filename.cc</code> and <code>filename.h</code> exist, it would be reasonable to expect the <code>.h</code> file to be a C++ header.  But if <code>filename.c</code> is found instead, the <code>.h</code> file is most likely a C header.</p>
<p>Since there are fewer C file extensions to check (just <code>.c</code>), the default could be for <code>.h</code> files to be treated as C++ and switched to C if a corresponding <code>.c</code> file is found.  There is a potential issue when isolated <code>.h</code> files are loaded.  I don't know how bothersome it would be fore users to have C files treated as C++.</p>
<p>Another option is to treat <code>.h</code> files as C and to switch filetype when a <code>.cc</code> file is detected, since that seems to be the most common mismatched pair.</p>
<p>Notes:</p>
<ul>
<li>
<p>I searched and read parts of the manual related to file types, but did not see anything that indicated this has already been implemented in Geany.  I apologize if I missed it.  But the manual is over 70 pages long when printed.</p>
</li>
<li>
<p>This feature could be implemented in a plugin.  But the plugins related to managing source code and projects didn't appear to have it.</p>
</li>
<li>
<p>I have implemented this feature in a personal plugin, so whether this is implemented in the main program doesn't really affect me personally.  However, I do wonder whether this would be appropriate as a standard feature.</p>
</li>
<li>
<p>This functionality can likely be implemented as a Lua script.  However, I am concerned about the longevity of the GeanyLua plugin because Lua 5.1 is over 9 years past EOL.</p>
</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/2946">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ4HCHU4RX4WNUKIYU3UHKYLTANCNFSM5GEXDZLQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ32XITMRKXAE6JLXPLUHKYLTA5CNFSM5GEXDZL2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PKKRJIQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/2946",
"url": "https://github.com/geany/geany/issues/2946",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>