ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Neovim plugin requires filename to passed to :Ghcid command #270

Open DestyNova opened 5 years ago

DestyNova commented 5 years ago

This might be some sort of configuration issue on my end, because I can't see any similar issues.

When I run :Ghcid in a Haskell buffer (note, without Cabal or Stack project files), it calls the global ghci without actually including the filename, so it just errors out immediately:

Loading ghci -fno-code -fno-break-on-exception -fno-break-on-error -v1 -ferror-spans -j ...                                                                              
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help                                                                                                            
Loaded GHCi configuration from /home/omf/.ghc/ghci.conf                                                                                                                  
Loaded GHCi configuration from /home/omf/.ghci                                                                                                                           

No files loaded, GHCi is not working properly.                                                                                                                           
Command: ghci -fno-code -fno-break-on-exception -fno-break-on-error -v1 -ferror-spans -j                                                                                 

Error detected while processing function 112:                                                                                                                            
line    2:                                                                                                                                                               
Ghcid: Exited with status 1                                                                                                                                              
Press ENTER or type command to continue    

One thing that makes this difficult to debug is that as soon as I hit enter, the quickfix window is hidden and cleared, so there's no way to scroll up (this means if I run :Ghcid -v, I can see almost none of the output).

I can work around it by making a change to the s:ghcid(...) function in haskell.vim, but I get the feeling this is not supposed to be necessary?

ndmitchell commented 5 years ago

CC @cloudhead who maintains the neovim pieces.

cloudhead commented 5 years ago

Hmm this is pretty much intended behavior - running :Ghcid is like running ghcid in the the cwd. I guess it could be made to accept a file if ghcid supports that?

ndmitchell commented 5 years ago

@cloudhead do you mean a file on stdin? That is not supported, since ghci doesn't support it.

cloudhead commented 5 years ago

I'm referring to @DestyNova 's initial comment about the plugin not passing a filename to [sic] ghcid

ndmitchell commented 5 years ago

ghcid can take filenames. Generally speaking it just appends those to the command it uses for running ghci.

cloudhead commented 5 years ago

Ok, well arguments passed to :Ghcid should be passed down to ghcid, so I guess you'd have to do :Ghcid <filename>, but it won't do it automatically for you.

573 commented 2 years ago

Workaround with cabal: :Ghcid -c 'cabal new-repl'

A bit sluggish still.