Open mineo opened 8 years ago
:+1:
M-t
does not add the function signature for me either. I am also using stack so that might be related.
I am using the latest master e278e1414ded that I have built using stack
.
Extra info:
c-c c-t
(ghc-show-type) does work fineM-t
does insert "module Foo where" on a brand new file.:+1: the same here
What about dropping the function from ghc-mod
if there is no care at all about fixing it ?
Is any work being done with this issue? After debugging for a bit it appears that the problem lies in incorrect overlays. Ghc-mod expects ghc-annotated overlays but the overlays don't have the expected properties.
@liarokapisv well it seems you're working on it :)
Can you link to some code maybe?
The relevant call sequence is
ghc-insert-template-or-signature ->
ghc-insert-template
at this point there is a cond expression:
(cond ..
((ghc-check-overlay-at (point))
(or (ghc-check-insert-from-warning)
....
ghc-check-insert-from-warning
is where the extraction is supposed to happen, however
ghc-check-overlay-at
always fails. Internally it filters overlays using the ghc-overlay-p
predicate which matches overlays with the ghc-check
property. The overlays are there but have flycheck properties instead of ghc properties so ghc-check-p
fails.
ghc-check-insert-from-warning
also expects a ghc-msg
property which is replaced by a flycheck property.
I would definitely like to see this work.
This may or may not be a problem with spacemacs, and not ghc-mod itself. There is this line in the spacemacs haskell layer funcs file:
(when (configuration-layer/package-usedp 'flycheck)
;; remove overlays from ghc-check.el if flycheck is enabled
(set-face-attribute 'ghc-face-error nil :underline nil)
(set-face-attribute 'ghc-face-warn nil :underline nil)))
In which case it's obvious why there are no ghc properties in overlays and why the insertions fail. Removing this line doesn't seem to do much, I will have to investigate further.
I've created a test project with
stack new new-template
. In the automatically generatedsrc/Lib.hs
I added the following line:With the point on the beginning of that line, typing
M-t
tells me there's "Nothing to be done". According to http://www.mew.org/~kazu/proj/ghc-mod/en/emacs.html however,I have started emacs from the directory
ghc-20150915.2030
(this is the latest update I use in my normal emacs from melpa) with the commandemacs -Q -L . -l ghc-autoloads.el -L ../haskell-mode-20150920.858 -l ../haskell-mode-20150920.858/haskell-mode-autoloads.el
and calledghc-init
once after opening the fileLib.hs
.This is the output of
ghc-debug
: