假設我有在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