You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode Arduino扩展编译后配置重置,如何保留includePath自定义修改?

解决VSCode Arduino扩展覆盖c_cpp_properties.json配置的问题

问题根源

Arduino扩展默认会在编译时自动生成并覆盖项目的.vscode/c_cpp_properties.json文件,导致手动添加的includePath配置被重置。

可行解决方案

1. 禁用扩展自动生成配置的功能

  • 打开VSCode设置(快捷键Ctrl+,),搜索**Arduino: Use Intelli Sense Config**选项。
  • 将该选项设置为false,扩展将不再自动生成或覆盖c_cpp_properties.json,手动添加的includePath配置会永久保留。

2. 自定义扩展的IntelliSense配置模板

若不想完全禁用自动生成功能,可让扩展生成配置时自动包含所需路径:

  • 打开VSCode设置,搜索**Arduino: Intelli Sense Config Template**,点击编辑 in settings.json。
  • 在settings.json中添加自定义配置,示例如下:
    "arduino.intelliSenseConfigTemplate": {
        "includePath": [
            "c:\\users\\USER\\appdata\\local\\arduino15\\packages\\rp2040\\tools\\**",
            "c:\\users\\USER\\appdata\\local\\arduino15\\packages\\rp2040\\hardware\\**",
            "${workspaceFolder}/**"
        ],
        "defines": [],
        "compilerPath": "c:\\users\\USER\\appdata\\local\\arduino15\\packages\\rp2040\\tools\\arm-none-eabi-gcc\\12.3.1-1.2/bin/arm-none-eabi-gcc.exe",
        "cStandard": "c17",
        "cppStandard": "c++17",
        "intelliSenseMode": "gcc-arm"
    }
    
    此后扩展生成c_cpp_properties.json时,会自动包含指定路径,无需手动修改。

3. 临时应急:将配置文件设为只读(不推荐)

找到项目下的.vscode/c_cpp_properties.json文件,右键选择属性并勾选只读。该方法能阻止扩展覆盖配置,但后续修改配置需先取消只读,灵活性较差,仅作临时方案使用。


内容的提问来源于stack exchange,提问作者Vishesh Varma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 20:35:26