Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[原文发表地址] Visual Studio Code C/C++ extension October 2017 update
[原文发表时间] 2017/10/20
昨天我们发布了2017年10月的Visual Studio Code C / C ++扩展的更新。根据上个月发布的Lightbulb的智能感知包含路径功能的建议,我们正在添加另一个功能让智能感应设置更容易——支持compile_commands.json文件,无需手动配置includes和defines。此外,此更新还引入了新的UI来显示智能感应得解析状态。
Compile_commands.json为智能感应提供includes和defines的相关信息
compile_commands.json文件由一系列“命令对象”组成的编译数据库,其中每个命令对象指定了一种在项目中编译翻译单元的方法。 它的格式会在Clang文档中被指定,可以由许多构建系统自动生成,包括CMake和Ninja。当智能感知引擎设置为“Default”时,如果c_cpp_properties.json文件的“compileCommands”属性中指定了compile_commands.json,它将先从compile_commands.json文件中读取includes和defines来启动智能感应功能。
如果解析失败,智能感知引擎将会回退然后读取c_cpp_properties.json文件,从文件中的“includePath”属性中使用include路径,从“defines”属性中读取defines。
尝试使用基于编译器的智能感知
请注意,compile_commands.json文件仅仅在您启用了新的基于编译器的引擎时被支持。这样您将获得改善,对于多个智能感应的功能会获取更加准确的结果,包括类/结构/命名空间成员的自动完成建议,快速信息工具提示,错误曲线,高亮引用和参数提示。在您的settings.json文件中,通过更改“C_Cpp.intelliSenseEngine”属性, 从“Tag Parser”改为“Default”(从菜单上的File-> Preferences-> Settings中打开),来打开新的智能感知功能。
智能感知状态指示器
在状态栏的右上角,您会发现两个图标可以显示智能感知引擎的解析状态 ——红焰图标代表基于编译器的智能感知引擎,白色数据库图标用来显示Tag Parser在解析文件中的位置。将鼠标悬浮在数据库图标上可通过提示信息了解已解析的文件数和需要解析的文件总数。
告诉我们您的想法
下载Visual Studio Code的C / C ++扩展,尝试一下,让我们知道您的想法。关于GitHub的文件问题和建议。在本次快速调查中为我们提供反馈意见,以帮助您根据自己的需要制定此扩展。您也可以在Twitter上找到我们(@VisualC)。
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in