Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>wpy-beautifyNew to Visual Studio Code? Get it now.
wpy-beautify

wpy-beautify

doingweb

|
49,929 installs
| (1) | Free
Beautify wpy/vue code in place for vscode
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

wpy/vue-beautify for vscode

Features

Beautify Vue or wpy code in Visual Studio Code.

preview

Usage

  1. Keyboard Shortcut: ctrl+shift+6 ;
  2. Open context menu in wpy, choose Beautify wpy ;
  3. Press F1, search Beautify wpy, and click the item.

Indent Option

The wpy-beautify's indent option according to the textEditor's indent option, like this:

indent option

Keyboard Shortcut

Use the following to embed a beautify shortcut in keybindings.json. Replace with your preferred key bindings.

    {
      "key": "ctrl+shift+6",          
      "command": "wpyBeautify.format",
      "when": "editorTextFocus && !editorReadonly" 
    }

ps

最近做微信小程序开发,使用到了wepy框架。wpy的文件都是用vue的高亮规则,配置[首选项]-[设置]:

"files.associations": {
        "*.vue": "vue",
        "*.wpy": "vue",
        "*.wxml": "html",
        "*.wxss": "css"
    },
    "emmet.syntaxProfiles": {
        "vue-html": "html",
        "vue": "html"
    },

但是,没有好的格式化工具。wepy官网推荐修改后缀为.vue。并使用vue-beautify来格式化。本人还是希望使用wpy后缀,所以就在vue-beautify基础上优化了配置。并解决了vue-beautify格式化后有大量空行的问题。wpy-beautify有如下功能(在mac上验证ok):

  1. 支持.vue和.wpy文件格式化 ;
  2. 使用快捷键shift+cmd+6格式化 ;
  3. 可以使用shift+cmd+p调出命令窗口,然后输入wpy,按回车生效。
  4. 可以在当前文件窗口,鼠标右击菜单中选择beautify wpy。
  5. 本插件已上传vscode的官网。也可以手动安装目录下.vsix文件。(扩展管理器-》从VSIX安装,然后重启vscode)
  6. vscode插件开发方法网上有很多栗子。如:https://segmentfault.com/a/1190000008968904#articleHeader3
  7. gif动画工具,mac上使用的是LICEcap for mac。
  8. 版本号与参考时vue-beautify的一致。

Github

https://github.com/webdzq/plugins/raw/master/wpy-beautify

参考工具:

vscode插件开发文档

https://github.com/peakchen90/vue-beautify

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