Strange error with Syntastic and vim-fsharp when opening F# files
MisanthropicBit opened this issue · 4 comments
When opening a normal *.fs file, I sometimes, but not always, get the following error:
Error detected while processing function <SNR>59_VimEnterHook[7]..<SNR>59_UpdateErrors[15]..<SNR>59_CacheErrors[39]..278[1]..277[24]..SyntaxCheckers_fsharp_syntax_GetLocList[1]..fsharpbinding#python#Curre
ntErrors:
line 24:
failed to parse file. ex: Vim(for):E684: list index out of range: 0
Error detected while processing function <SNR>59_VimEnterHook[7]..<SNR>59_UpdateErrors[15]..<SNR>59_CacheErrors:
line 39:
E170: Missing :endfor
Error detected while processing function <SNR>59_VimEnterHook[7]..<SNR>59_UpdateErrors:
line 15:
E171: Missing :endif
Error detected while processing function <SNR>59_VimEnterHook:
line 7:
E171: Missing :endif
Using trial-and-error I have tracked down the error to the vim-fsharp and Syntastic plugins. The unpredictability of the error might occur when there are some or none syntax errors in the file (the one I opened for this error has no errors).
The error happens somewhere in the fsharpbinding#python#CurrentErrors function in autoload. The branch testing v:version returns true, so the statement in line 161 is executed. It returns an empty list which likely causes the statement in line 166 to fail (although the exception caught in line 177 is an index-out-of-bounds error on what appears to be a dictionary access). I don't know why the "missing" errors pop up. Perhaps because the function is not marked with abort and some subsequent errors occur?
I don't enough about vim-fsharp or Syntastic to tell which plugin is at fault, or if something entirely different is going on, but hopefully someone does. My specs are:
vim8.0 (1-329)Syntasticversion: 3.8.0-26 (Vim 800, Darwin) (most recent as of this writing)- Most recent
vim-fsharpas of this writing (I couldn't find a version number) - Python 2.7.13
- mono 4.8.0 (Stable 4.8.0.495/e4a3cf3 Wed Mar 1 08:20:26 GMT 2017)
- Mac OSX Sierra
Update: If I wrap the offending for loop in if !empty(errs) ... endif, the error goes away. If anyone can confirm that my assumptions are correct, I'd be happy to create a PR.
Not sure if anyone else is experiencing this, but on my end your proposed PR (or branch) would be greatly appreciated. I would love to set it up on a test environment and confirm (or deny) your assumptions.
Some details of my setup:
vim8.0.525, compiled with python 3 supportSyntastic3.8.0-35vim-sharpcurrent versionpython3.5.2- Same mono version as you
Thanks for the response.
I would love to set it up on a test environment and confirm (or deny) your assumptions.
I can set up a test branch on my own repo you can pull from. Meanwhile, I've been running vim-fsharp with my suggested "fix" and it seems like it might be ignoring some errors now. I'm not entirely sure, so any feedback would be great!
Feel free to submit a pr.
closing as PR submitted.