2014-09-20 47 views
0

所以我花了大量的时间试图让intellij中的JavaScript代码样式选项做我想做的事,但还没有找到解决方案。 如果我宣布multple VAR提供意见,像这样Intellij Idea javascript格式的多线变种

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.谢谢!

回答

0

Project Settings - Code Style - JavaScript - Wrapping and Braces - 勾选Comment at first column

+0

这是多行变量是正确的。还有一些格式化的副作用,但值得更新。链接函数的第二部分已经被识别为intellij中的一个bug,并且存在一个未解决的问题。 https://youtrack.jetbrains.com/issue/WEB-13538 – 2014-09-29 19:15:03