idris-hackers / idris-vim

Idris mode for vim
221 stars 52 forks source link

Multiple loads of file during add-clause #55

Open steshaw opened 7 years ago

steshaw commented 7 years ago

I happened to be logging the arguments the idris process to a log file while testing the interactive features with vim. It seems that when you do a case-split, the file is loading 3 times.

args = ["--client",":l  test/interactive001/test032.idr "]
args = ["--client",":l  test/interactive001/test032.idr "]
args = ["--client",":l /Users/steshaw/Projects/idris/test/interactive001/test032.idr"]
args = ["--client",":ac! 6 f"]

This makes things feel quite sluggish.

I had a peek at ftplugin.vim but I'm not that familiar with Vim Script. Looks like at least one of the loads comes from a call to w (but I don't see how w calls back to IdrisReload).

Note that originally, I was outputting the idris args to stderr but it seemed to interfere with idris-vim. If you want to set up your idris like I did, a minimal code change to main/Main.hs is to update your main to something like this:

main = do
  args <- getArgs
  appendFile "idris.log" ("args = " ++ show args ++ "\n")
  opts <- runArgParser
  runMain (runIdris opts)