begriffs / haskell-vim-now

One-line Haskell Vim install
MIT License
988 stars 100 forks source link

Can't get ",ht" working. #266

Open capn-freako opened 7 years ago

capn-freako commented 7 years ago

Using this simple example:

outFile :: String -> String
outFile name = outDir++"/"++name++".v"

and with my cursor positioned on the 'n' at the beginning of the first occurrence of the word "name" in the second line, I tried ",ht" in normal mode, but got:

ghcmod#command#type: Cannot guess type.

I'd previously rebuilt, using the --enable-test Cabal flag:

stack build :hardware-examples --flag *:enable-test

but, apparently, that wasn't the problem.

Does anyone know how I can get ",ht" working?

begriffs commented 7 years ago

Ghc-mod has trouble working with projects which use a different version of cabal than that which was used to build ghc-mod. You could check where haskell-vim-now installed ghc-mod (perhaps ~/.local/bin), and turn ghc-mod into a symlink which you can point at versions that you build with different versions of cabal.

capn-freako commented 7 years ago

So, I did: stack install ghc-mod. And that overwrote the existing executables in ~/.local/bin. However, I'm still getting the same error, when I try to use ",ht". Curiously, using ghc-mod explicitly, from the MacVim command prompt, works:

:!ghc-mod type /CNN.hs 168 1 168 1 175 67 "CNNParams Double -> BoxedImage Word8 -> Lbl Double"

capn-freako commented 7 years ago

Okay, I was able to get ',ht' working, by following the advice given here: Issue 88

However, there's a caveat:

You must be in the directory containing your stack.yaml file, before opening the file in which you wish to use ',ht'.

Note that ':cd'ing into that directory, after opening the file will not work!

begriffs commented 7 years ago

Interesting, so it's a pathing issue? Maybe we could tweak https://github.com/begriffs/haskell-vim-now/blob/master/vimrc.haskell#L1-L7 ?

Thanks a lot for continuing to research this, I've been missing the ,ht functionality which has been broken for a while.

capn-freako commented 7 years ago

Hi Joe,

I looked at that code, but don't understand it; sorry. I'm happy to chat anytime about this (or, anything else): (408)829-3037

Thanks, -db