清C盘, vscode-cpptools ipch文件夹高达10G

又到了日常扣C盘的环节(系统缓存,qq,wx等缓存都清完了但是C盘还是小得有点可怜)

持续性竭泽而渔

在系统目录下发现了一个vscode-cpptools, 其中的ipch竟然高达十几个G

C:\Users\(你的用户名)\AppData\Local\Microsoft\vscode-cpptools

查询官方文档

C/C++ 扩展常见问题解答 (visualstudio.com)icon-default.png?t=M3K6https://code.visualstudio.com/docs/cpp/faq-cpp

What is the ipch folder?

The language server caches information about included header files to improve the performance of IntelliSense. When you edit C/C++ files in your workspace folder, the language server will store cache files in the ipch folder. By default, the ipch folder is stored under the user directory. Specifically, it is stored under %LocalAppData%/Microsoft/vscode-cpptools on Windows, and for Linux and macOS it is under ~/.vscode-cpptools. By using the user directory as the default path, it will create one cache location per user for the extension. As the cache size limit is applied to a cache location, having one cache location per user will limit the disk space usage of the cache to that one folder for everyone using the default setting value.

VS Code per-workspace storage folders were not used because the location provided by VS Code is not well known and we didn't want to write GB's of files where users may not see them or know where to find them.

With this in mind, we knew that we would not be able to meet the needs of every different development environment, so we provided settings to allow you to customize the way that works best for your situation.

"C_Cpp.intelliSenseCachePath": <string>

This setting allows you to set workspace or global overrides for the cache path. For example, if you want to share a single cache location for all workspace folders, open the VS Code settings, and add a User setting for IntelliSense Cache Path.

"C_Cpp.intelliSenseCacheSize": <number>

This setting allows you to set a limit on the amount of caching the extension does. This is an approximation, but the extension will make a best effort to keep the cache size as close to the limit you set as possible. If you are sharing the cache location across workspaces as explained above, you can still increase/decrease the limit, but you should make sure that you add a User setting for IntelliSense Cache Size.

How do I disable the IntelliSense cache (ipch)?

If you do not want to use the IntelliSense caching feature that improves the performance of IntelliSense, you can disable the feature by setting the IntelliSense Cache Size setting to 0 (or "C_Cpp.intelliSenseCacheSize": 0" in the JSON settings editor).

简而言之这是智能感知缓存的路径,编辑C/C++ 文件时,vscode的语言服务会将缓存文件存储在该文件夹中(每编译一次都对应着ipch里的一个文件夹)

在vscode的设置中搜索C_Cpp.intelliSenseCache, 把目录改到其他盘, 而在c盘中的缓存可以直接删除(无异常情况)

如果不想使用智能感知缓存功能,可以通过将缓存大小设置设置为 0(或在 JSON 设置编辑器中)来禁用该功能。"C_Cpp.intelliSenseCacheSize": 0"

posted @ 2022-05-10 21:07  泥烟  阅读(2255)  评论(0编辑  收藏  举报