Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop VS Code to keep adding standard c++ libraries to the file.associations?

Each time I commit the changes in my VS Code project, VS Code automatically adds many standard C++ libraries to the files.associations list inside of workspace.code-workspace.

Example:

example changes shown by git

I think I can't simply add the whole file to .gitignore, because I want to allow anyone from the company to just clone the repository and open the workspace from this file. Is there a way to prevent the file.associations to change every time without losing any functionality?

like image 672
gunar.kroeger Avatar asked Nov 28 '25 19:11

gunar.kroeger


2 Answers

According to this issue: https://github.com/microsoft/vscode-cpptools/issues/722 :

You can add to your workspace.code-workspace file the setting: "C_Cpp.autoAddFileAssociations": false inside "settings".

You can also add this as a user setting only if you'll search for autoAddFileAssociations in the settings GUI.

It does mean that VSCode won't treat those files as C++ but as plain text. A proper fix still seems to be in progress in https://github.com/microsoft/vscode-cpptools/issues/4077 .

like image 155
theroyn Avatar answered Dec 01 '25 10:12

theroyn


I've added something like this and it helped me:

"files.associations": {
    "*.h": "c",
    "*.c": "c"
}
like image 37
Ilya Pikin Avatar answered Dec 01 '25 09:12

Ilya Pikin