この関数がcoffeescriptファイルにあるとします
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"
配列が長くなりすぎて、いくつかの行に分割するまで、すべて問題ありません。このような
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"
その場合、空の関数がパラメーターとして渡されるため、これは間違っています。これはバグですか、それとも自分で修正できますか?