Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ ".h" header files are always detected as C headers #305

Closed
aaronfranke opened this issue Feb 20, 2019 · 1 comment
Closed

C++ ".h" header files are always detected as C headers #305

aaronfranke opened this issue Feb 20, 2019 · 1 comment

Comments

@aaronfranke
Copy link

The current definition for C++ headers looks like this:

            "extensions":[
                "hh",
                "hpp",
                "hxx",
                "inl",
                "ipp"
]

However, this incorrectly identifies C++ header files as C, as seen with this front-end program:

deepinscreenshot_select-area_20190216225726

What this is missing from the above definition is .h, which is commonly used for both C and C++. Detecting which is which may be a little bit tricky. I suggest inspecting the code of GitHub Linguist to see how it detects this (as it does so properly).

To test if it works or not, you can test on Godot. It should show up as about 94.4% C++ code.

@XAMPPRocky
Copy link
Owner

@aaronfranke Thank you for your issue! This is at least some what of a duplicate of #67. So I'm going to close this issue in favour of that. I will say that these kinds of "mistakes" are quite intentional as I don't like the idea of language detection being something that is obfuscated or nondeterministic.

However there is definitely more language detection methods on the table that are quite deterministic (like modeline) that I do want to add to tokei, and for the rest of the cases I want to provide easy configuration so that you the user gets what they expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants