node.js 如何在 WebStorm 中重新格式化 JavaScript 代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15851023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:08:38  来源:igfitidea点击:

How can I reformat JavaScript code in WebStorm?

node.jsidewebstorm

提问by vcxz

I am using JetBrains WebStorm IDE. But I think there is not shortcut to autoformat (beautify) the code. In Netbeans, its CtrlShiftFcommand which formats the whole file. Is there any command for this? Do I need to install any plugin or something to enable this function?

我正在使用 JetBrains WebStorm IDE。但我认为没有自动格式化(美化)代码的快捷方式。在 Netbeans 中,它的CtrlShiftF命令用于格式化整个文件。有没有这方面的命令?我是否需要安装任何插件或其他东西才能启用此功能?

回答by CrazyCoder

Code| Reformat Code...(Ctrl+Alt+L):

Code| Reformat Code...( Ctrl+ Alt+ L):

enter image description here

在此处输入图片说明

Keyboard shortcut can be changed in File| Settings| Keymap:

可以在File| 中更改键盘快捷键 Settings| Keymap

enter image description here

在此处输入图片说明

If you are not familiar with IDE features yet, use Help| Find Action:

如果您还不熟悉 IDE 功能,请使用Help| Find Action

enter image description here

在此处输入图片说明

This feature is also documented.

功能也记录在案

回答by 7zark7

Yes.

是的。

Opt+Cmd+L (Mac, or whatever your platform combo is)

Opt+Cmd+L(Mac 或任何平台组合)

Or Code > Reformat Code...

或代码 > 重新格式化代码...

回答by Tifu

Using WebStorm 8.0.4 in Windows the hotkey is (has become?) Alt-F8.

在 Windows 中使用 WebStorm 8.0.4 热键是(已经变成?)Alt-F8。