假设我有在CoffeeScript的文件这一功能如何在IDEA中将函数作为参数传递给多行数组?
test = (arr, fn) ->
console.log item for item in arr
fn()
这是我如何把它
test [1, 2, 3, 4, 5], ->
console.log "start"
# function body
console.log "finish"
一切OK,直到阵列变得太长,我想拆它几行。像这样
test ["first element here",
"second element here",
"third element here",
"fourth element here",
"fifth element here"], ->
console.log "start"
# function body
console.log "finish"
这是有效的,因为CoffeeScript的编译器编译它正是我期待的,但IDEA说有在console.log "start"
线意外缩进。我按按Ctrl + Alt + L和IDEA给了我这个
test ["first element here",
"second element here",
"third element here",
"fourth element here",
"fifth element here"], ->
console.log "start"
# function body
console.log "finish"
这是不对的,因为在这种情况下,空函数作为参数传递。这是一个错误还是我可以自己修复它?
我觉得你应该把它报告给的IntelliJ的CoffeeScript插件团队:) – Ven 2013-05-11 11:11:05
是的,我已经openned问题 – 2013-05-11 13:56:42