Open JacksonGariety opened 10 years ago
I completely agree to this. I write code in angularJs, and to the controllers, i pass anonymous functions. Right now with js3-mode, it looks like,
angular.controller('firstController', ["$scope", "$state",
function($scope, $state){
console.log("this is a function argument");
}
]);
Web-mode got it right as,
angular.controller('firstController', ["$scope", "$state",
function($scope, $state){
console.log("this is a function argument");
}
]);
Web-mode's indentation is more readable & unnecessary code wraps.
The parser also seems to lack respect for all closures,
function tagListener( ) {
this.search = (function( ) {
var value = ""
, result = []
function exec(resolve, reject) {
function f(resultSet) {
result = resultSet
resolve(result)
}
API.do('Search', 'user-search'
, {
resource: 'user-search'
, params: { search: value }
})
.then(f).catch(reject)
}
return function(term) {
if(term == value) return Promise.resolve(result)
value = term
return new Promise(exec)
}
})( )
}
So I must fight with it, for example to produce this readable indentation:
function tagListener( ) {
this.search = (function( ) {
var value = ""
, result = []
function exec(resolve, reject) {
function f(resultSet) {
result = resultSet
resolve(result)
}
API.do('Search', 'user-search'
, {
resource: 'user-search'
, params: { search: value }
})
.then(f).catch(reject)
}
return function(term) {
if(term == value) return Promise.resolve(result)
value = term
return new Promise(exec)
}
})( )
}
Lets say I want to define a variable, export it from a CommonJS module, and set it to a function. js3-mode will auto-indent this as follows:
Wouldn't it make more sense to indent it to the variable name?
This is the opposite issue of #94.