VS 代码格式化失败(.clang-format:49:1:错误:未知键"自定义三元操作")



我在Ubuntu 20.04上运行VS Code,尽管我安装了必要的扩展,但代码格式似乎不适用于C/C++。当我按下";Ctrl+Alt+I";上面写着Formatting failed. See the output window for details.

以下是输出窗口显示的内容。

Formatting failed:
/home/fmu/.vscode/extensions/ms-vscode.cpptools-1.7.1/bin/../LLVM/bin/clang-format -style=file -fallback-style=LLVM -assume-filename=/home/fmu/temp/coqoshv/src/core/vcpu-mgr/_new.c
/home/fmu/temp/coqoshv/src/core/.clang-format:49:1: error: unknown key 'CustomTernaryOps'
CustomTernaryOps: true # custom option for not breaking lines on ternary ops when possible
^~~~~~~~~~~~~~~~
Error reading /home/fmu/temp/coqoshv/src/core/.clang-format: Invalid argument

有人能帮我解决这里可能出现的问题吗。谢谢

检查[llvm.org][1]中选项所需的格式化程序版本。

然后您可以手动运行格式化程序来查看它的版本

我遇到了一个问题,它甚至没有在输出窗口中发布消息。

但是,通过手动运行位于那里的格式化程序~/.vscode/extensions/ms-vscode.cpptools-1.9.8-linux-x64/LLVM/bin/clang-format,我收到了一些消息,指出我有一个选项,它只适用于比支持的格式化程序更高的版本。

最新更新