visual-studio-code - VSCode 和 clang 格式 : use my own file extension

标签 visual-studio-code clang-format

我使用带有 clang-format 扩展名的 Visual Studio Code 来格式化 .c 源代码文件 - 它有效。

现在我有特殊文件(也有 C 风格),但该文件无法识别格式,因为它们具有另一个文件扩展名 (.kki)。

如何在 Visual Studio Code 中配置 clang-format 扩展以将我的 .kki 文件识别为 C 源代码文件?

最佳答案

检查您是否可以遵循“Adding a file extension to a language ”部分:

You can add new file extensions to an existing language with the files.associations setting.

For example, the setting below adds the .myphp file extension to the php language identifier:

"files.associations": {
    "*.myphp": "php"
}

IntelliSense (Ctrl+Space) will show you the available language identifiers.

https://code.visualstudio.com/assets/docs/languages/overview/language-id-intellisense.png

就您而言:

"files.associations": {
    "*.kki": "c"
}

关于visual-studio-code - VSCode 和 clang 格式 : use my own file extension,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50977305/

相关文章:

ios - 构建失败 : Could not find an option named "track-widget-creation"

clang-format 与数组初始化

clang-format - 防止 clang-format 缩进 lambdas

visual-studio-code - 在vscode中长时间下载c/c++扩展

visual-studio-code - 使用 Visual Studio Code 的 REST 客户端扩展发出 POST 请求

c++ - 如何使用 clang-tidy 通过 visual studio 实现现代化

c++ - 在 operator=( 以 clang 格式后中断

visual-studio-code - Visual Studio Code 显示调用层次结构

typescript - Jest + Typescript + 绝对路径 (baseUrl) 给出错误 : Cannot find module