intellijidea js-intellj怎么格式化js代码

JavaScript012

intellijidea js-intellj怎么格式化js代码,第1张

intellijidea

js-intellj格式化js代码是利用快捷键ctrl+alt+l实现的

1、intellij

idea提供了对

javascript

关键词,变量,标签,函数也包括了html事件句柄的自动完成

2、javascript代码格式化,对javascript的格式化的支持是可以通过设置定制的。

方法如下:

1. Formatter设置

Menu: SuiteCloudIDE ->Preferences... ->JavaScript ->Code Style ->Formatter

快捷键:Command + ,

Active profile中显示的是当前正在使用的代码自动格式化配置。点击“Export All...”按钮可以导出Eclipse中的代码自动格式化配置,点击“Import...”按钮可以导入本地已有的配置文件,导入和导出的文件都是xml格式。可以点击“New...”按钮,在Eclipse中的一个已有配置基础上,新建一个自己的配置。

进行Formatter设置后,你就可以使用Option + Command + F或者右键菜单Source ->Format格式化选择的代码。(Mac快捷键)

2. Save Actions设置

选择“Perform the selected actions on save”以及下面的三个复选框,其中“Format source code”就是根据前面设置的Formatter对Save文件中的代码进行自动格式化,整个JS文件都会被Format。

phpstorm 代码格式化方法: 快捷键:Ctrl + Alt + L设置代码样式:File ->Settings ->Code Style ->PHP根据个人php代码规范和个人喜好设置 PHP 等代码的样式结构。phpstorm可以设置:1、等号对齐2、中括号显示方式...3、空格 显示方式等...总之,只要你想要的都可以设置,自己慢慢折腾吧...代码示范:<?phpclass HellowordController extends Controller{ public function actionIndex($id) { echo 'hello word!' echo $id } public function actions() { return array('edit' =>'application.controllers.helloword.UpdateAction',) }}另外,对 phpstorm 设置好后,可以把设置信息导出,以便后续安装后再次使用。导出设置方法:File ->Export Settings导入设置方法:File ->Import Settings