Intellij Idea javascript格式化多行var

时间:2014-09-20 20:37:02

标签: javascript intellij-idea formatting

因此,我花了大量时间尝试制作javascript代码样式intellij中的选项做我想要的并且找不到解决方案。 如果我有多个变量声明用这样的评论声明

var obj = {
  a: 1,
  b: 2,
  c: 'three',
  value1: 'abc',
  // This is the comment about the. next var
  value3: 'four;

我格式化了我最终的代码

var obj = {
  a: 1,
  b: 2,
  c: 'three',
  value1: 'abc',
// This is the comment about the next var
  value3: 'four;

无论如何要保留评论意见吗?我在链式函数上看到了类似的行为

angular.module('aModule', [])
  /**
   * This is a controller
   */
  .controller('MyCtrl', function($scope) {
    $scope = [1,2,3];
  });

格式文件

angular.module('aModule', [])
/**
 * This is a controller
 */
  .controller('MyCtrl', function($scope) {
    $scope = [1,2,3];
  });

我正在使用intellij Idea 13.谢谢!

1 个答案:

答案 0 :(得分:0)

Project Settings - Code Style - JavaScript - Wrapping and Braces - 查看Comment at first column