【发布时间】:2018-09-20 04:20:54
【问题描述】:
如何防止 Visual Studio Code 将链式 JavaScript 函数推到新行,如下 GIF 所示:
如您所见,它使代码极难查看,并将简单的if 签入扩展到多行。我正在使用名为 Prettier - Code Formatter 的扩展程序,我查看了首选项并发现以下内容:
// Format a file on save. A formatter must be available, the file must not be
//auto-saved, and editor must not be shutting down.
"editor.formatOnSave": false
当您点击保存时,它会完全停止格式化。我查看了其他选项,但找不到此设置。
上面的进程有名字吗?
我怎样才能保留formatOnSave,但防止它按原样格式化?
【问题讨论】:
-
我很确定这不是原生的 VScode 行为。你刚刚让我下载了一个新插件。主题虽然:为什么不在他们的 git 页面上询问 github.com/prettier/prettier/issues
标签: javascript visual-studio-code code-formatting