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

本文介绍如何清理Visual Studio Code(CPP)插件vscode-cpptools中的巨大ipch缓存,提供C_Cpp.intelliSenseCachePath和C_Cpp.intelliSenseCacheSize设置的使用方法,教你调整智能感知缓存路径并控制空间消耗。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

又到了日常扣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"

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

泥烟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值