Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>KFormatNew to Visual Studio Code? Get it now.
KFormat

KFormat

ks-lint

|
718 installs
| (0) | Free
Formatting and Linting C++/C Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

KFormat for VSCode

KFormat 是一个基于 clang 的代码工具,具有 format 和 lint 功能,支持 C++/C

环境要求

本插件目前仅支持在 Mac VSCode 环境下使用

插件命令

本插件支持以下命令:

  • Lint: lint 当前文件
  • Lint & fix: lint 当前文件并 fix error
  • Format: 格式化当前文件
  • Format Check: 仅检查当前文件格式问题,不进行格式化
  • Export Config: 导出默认的 KFormat 配置文件供用户修改使用

插件配置

本插件支持以下配置: Automatically lint files when they are opened:打开文件时自动 lint Automatically lint files when they are saved :保存文件时自动 lint

修改配置方法:在 VSCode 左侧面板分别点击选择: Manage - Settings - Extensions - KFormat,勾选你期望的方式

使用方法

在 VSCode Workspace 下添加代码目录,打开目录下的代码文件,对当前文件进行相关命令操作,Mac 调出命令面板快捷键:command + shift + p

插件命令使用方法:

  • 1.打开 WorkSpace 下某个代码文件
  • 2.调出命令输入面板,输入'KFormat: your command','your command'代表输入的命令
  • 3.命令执行后自动打开 KFormat OUTPUT 窗口,显示处理结果

要求和说明:

  • 1.lint 功能要求代码是可编译的,WorkSpace 目录需存在 Makefile 或 CMakeLists.txt
  • 2.lint 功能耗时会比较长,在 lint 过程中弹出窗口会显示"Linting current file..."
  • 3.lint 功能要求 WorkSpace 目录下存在 .kformat 文件,如果没有该文件,插件可以导出一份默认配置,除了 "BuildSystem" 需根据实际环境进行配置,目前支持 make/cmake/bazel,其他的配置项可以使用默认值
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft