Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>CMS FormatNew to Visual Studio Code? Get it now.
CMS Format

CMS Format

dihong.ding

|
13 installs
| (0) | Free
Import grouping/sort and JSX/HTML attribute sort by length (short to long)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CMS Format

VS Code 扩展:按团队约定对 import 与 JSX/HTML 开标签属性 做「短→长」排序。

功能

命令 快捷键 说明
Import: 分类排序(保留多行 import,多行置底) Alt+I 分组 + 组内单行先排、多行 import 保持格式并沉底
Import: 分类排序(全部压成单行) Alt+Shift+I 每条 import 先压成一行,再分组排序
CMS Format: 单行开标签展开为多行并排序 Alt+S 单行开标签 → 多行(属性短→长),/> 单独一行
CMS Format: 多行开标签属性排序 Alt+M 多行开标签重排属性,/> 单独一行,去掉尾随逗号
CMS Format: 多行开标签压成单行并排序 Alt+Shift+M 多行 <Tag … /> 压成一行再排序
CMS Format: 选中行按长度排序 Alt+R 仅对当前选中的多行按长度短→长排序,不改文件其他部分

纯 .html 文件中 import 排序为 no-op;属性排序仍可用。

开发(yarn)

yarn install
yarn compile       # esbuild 打包到 dist/ + tsc 生成 out/(单测用)
yarn watch         # esbuild 监听
yarn test:unit

F5 调试:用 VS Code 打开本仓库 → Run Extension(入口为 dist/extension.js)。

打包 .vsix

运行时依赖由 esbuild 打进 dist/extension.js,不再把整个 node_modules 打进包。

yarn install
yarn package      # compile:prod + vsce package --no-dependencies

当前产物约 1.3MB(原先整包 node_modules 约 5.6MB)。图标已压缩为 128×128。

安装:扩展面板 → 从 VSIX 安装 → 选 cms-format-x.x.x.vsix → 完全重启编辑器。

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft