简体   繁体   中英

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

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

example changes shown by git

I think I can't simply add the whole file to.gitignore. Is there a way to prevent the file.associations to change every time without losing any functionality?

That's not kind of problem, it's just your choice to ignore it in git or not. If you want to share your .vscode to git -- you keep it. Or you can add .vscode to .gitignore and it won't be committed and also you can just ignore only your

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

"files.associations": {
    "*.h": "c",
    "*.c": "c"
}

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM