-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Editor gets angry with C++ in Header files. #2961
Comments
Hi, this is related to the respective linter and his setup is used based on the detected file type. Currently the file type detection is somehow inaccurate, which then impacts the used linter. Since you named your C++ header with *.h extension it will be detected as C header file instead of C++ header file. This can be corrected by renaming the extension or after the above PR, when we additionally add Long story short (updated): |
I'm excited to see #2819 merged in general (I think the idea of signatures is great, and so much more flexible than the filename detect!), so I'm curious: would the solution using the patched code be to add something like a |
Ahh, I see. What might a temporary fix for that be then, is that something stored on configs or at the source code level? I'd love to get micro linting working with cpp projects, even if it's just a quick hack :) |
You can force your file to be interpret as C++ file and then you can use the adaptations of #2962 to move the linter into the right direction. ;) options.md...
;) |
Yesssss, thank you @JoeKar! I ended up merging the |
btw you should be using .hpp for C++ header files |
I have been using version 2.0.10 to write C++ for about a year and noticed that the syntax highlighting for the headerfiles (*.h) was off, but didn't mind too much. Recently, I noticed that this version of the editor seems to default to Objective-C for header files, so I set it to C++, which fixed the highlighting, but instead started complaining about the code when saving the document. Since this code was legal and compiled without any warnings or notes from the compiler (g++ of GCC), I assumed it was a bug and updated the editor to 2.0.12.
Now, the editor not only gets angry when filetype is set to 'c++', but saving with the default/assumed filetype (which is 'c' with this version) also makes it complain. This did not happen previously.
2.0.10: If default is Objective-C, it does not get angry when saving, but if set explicitly it would be. If default is C, it would be.
2.0.12: The default is now C, and it gets angry by default.
When filetype is set to 'c++', which is what I want to do, commenting out and moving code makes it upset with different things, and it will even remember the line it used to get angry with, even if the code is removed and the file is saved.
This is only an issue with C++ code in *.h-files, *.cpp-files do not upset the editor.
Commit hash: c2cebaa
OS: Zorin OS 16.1
Terminal: GNOME Terminal 3.36.2
The text was updated successfully, but these errors were encountered: