File with non-standard extension causes editor's Language Mode to keep reverting back to C #12466
Labels
bug
fixed
Check the Milestone for the release in which the fix is or will be available.
Language Service
Milestone
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
Our development environment involves opening files that are symlinks to files with "odd" file extensions. One contrived example:
When opening either the symlink or the actual file, VSCode starts with a Language Mode of C++. But after some time automatically (or after making a small edit to the file), it will revert to a Language Mode of C. Even if I manually change the Language Mode back to C++, it will still revert to C later. These files are C++ source files, so the C++ start is correct. Reverting to C causes incorrect syntax highlighting and false positives for compiler errors. Making a copy of the file to a different place without the odd part at the end of the file causes the Language Mode of the editor to stay on C++. So there is something odd about the extension of the actual file.
I have tried adding the following to my user settings to see if that would make a difference, but while it did get VSCode to recognize both files a C++ files without manual intervention initially, it still ended up reverting back to C at some point:
Changing the state of
C_Cpp.autoAddFileAssociations
did not seem to make any difference. Also, this issue did not occur with the"C_Cpp.intelliSenseEngine": "Tag Parser"
setting (it stayed on C++ Language Mode for both the symlink and the actual file). So it appears to be something with the default IntelliSense engine.Steps to reproduce:
Test.C,1.1^123
, make it a simple "Hello World" like the below:Expected behavior:
The Language Mode should not automatically revert to C, even after manually changed by the user to C++.
Configuration and Logs
Other Extensions
N/A
Additional context
Screen.Recording.2024-07-11.at.6.02.21.PM.mov
The text was updated successfully, but these errors were encountered: