CodeEdit
CodeEdit copied to clipboard
🐞 C++ Syntax highlighting: Different colors for same keyword
Description
When opening the attached header file, syntax highlighting fails on many occasions of the keyword double. The color switches between bright and dark blue.
Download source file
Pastebin: Show file CPoint.h
To Reproduce
- Download and open the attached file
Expected Behavior
Correct syntax highlighting.
Version Information
CodeEdit: 0.0.3-alpha (32) macOS: 13.4 Xcode: 14.3.1
Additional Context
No response
Screenshots
Moving to CETV for further investigation
This is happening due to the fact that CE primarily uses the filename to detect which language the file is. Because this is a .h file, CE decides that it's a C header file rather than a Cpp header file. In the latest CE version you can select what language is being used to parse the file for syntax using the inspector sidebar. The below screenshot was taken using the Cpp parser and you can see it recognizes private and public as keywords of their own.
A fix for this would be to add a way to override filetypes for detection using a setting like this. I'm going to move this to CE again (sorry) because that setting should be implemented there.
Hi there. I have been looking into this issue, and would like to work on it. If there has been any update on anything regarding it, please let me know.
Regarding the suggestion for language identifiers like VSCode, do you have any ideas @thecoolwinter on how exactly you want that implemented? I've looked through the code a little and see how it might play into the existing FileType enum and CodeLanguage struct. If there are any more details or ideas that you may have thought about, please let me know as I begin to work this out.