Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>代码格式化大师 (Code Formatter Plus)New to Visual Studio Code? Get it now.
代码格式化大师 (Code Formatter Plus)

代码格式化大师 (Code Formatter Plus)

哎哟兔

|
1 install
| (1) | Free
强大的VSCode代码格式化和压缩扩展 Code formatting and compression extensions
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

代码格式化大师 (Code Formatter Plus)

一个功能强大的VSCode扩展,支持HTML、CSS、JavaScript和JSON代码的格式化和压缩功能。

A powerful VSCode extension that supports formatting and minification for HTML, CSS, JavaScript, and JSON code.

功能特性

支持的文件类型

  • HTML - 格式化和压缩
  • CSS - 格式化和压缩
  • JavaScript/TypeScript - 格式化和压缩
  • JSON/JSONC - 格式化和压缩

核心功能

  • 🎨 代码格式化 - 使用Prettier进行专业的代码格式化
  • 🗜️ 代码压缩 - 使用业界标准工具进行代码压缩
  • 📁 新标签页显示 - 处理结果在新标签页中显示,不覆盖原文件
  • 💾 自动保存 - 按规范命名自动保存到同目录
  • 🔄 版本管理 - 自动版本号递增,避免文件冲突
  • 🖱️ 智能右键菜单 - 根据文件类型显示相关操作

安装方法

  1. 打开VSCode
  2. 按 Ctrl+Shift+X 打开扩展面板
  3. 搜索 "代码格式化大师" 或 "Code Formatter Plus"
  4. 点击安装

使用方法

右键菜单操作

在编辑器或文件资源管理器中右键点击支持的文件,选择:

Code Formatter Plus ►
├── Format HTML
├── Format CSS
├── Format JavaScript
├── Format JSON
├── ─────────────────
├── Minify HTML
├── Minify CSS
├── Minify JavaScript
├── Minify JSON

文件命名规范

处理后的文件将按以下规范命名:

  • 格式化文件: 原文件名_formatted_v版本号.扩展名
  • 压缩文件: 原文件名_min_v版本号.扩展名

示例:

原文件: index.html
格式化: index_formatted_v1.html
压缩: index_min_v1.html

配置选项

在VSCode设置中搜索 "Code Formatter Plus" 可配置以下选项:

Prettier 配置

  • codeFormatterPlus.prettier.tabWidth - 缩进空格数 (默认: 2)
  • codeFormatterPlus.prettier.useTabs - 使用Tab缩进 (默认: false)
  • codeFormatterPlus.prettier.singleQuote - 使用单引号 (默认: true)

HTML 配置

  • codeFormatterPlus.html.removeComments - 压缩时移除注释 (默认: true)

CSS 配置

  • codeFormatterPlus.css.removeComments - 压缩时移除注释 (默认: true)

JavaScript 配置

  • codeFormatterPlus.js.mangle - 压缩时混淆变量名 (默认: true)

享受愉快的编码体验! 🚀

赞赏支持

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