jyp / dante

391 stars 52 forks source link

Flycheck: cannot get flycheck to work after default configuration #133

Closed asheshambasta closed 4 years ago

asheshambasta commented 4 years ago

So my emacs configuration for dante is:


(use-package dante
  :ensure t
  :after haskell-mode
  :commands 'dante-mode
  :init
  (add-hook 'haskell-mode-hook 'flycheck-mode) ;; error highlighting (?)
  (add-hook 'haskell-mode-hook 'company-mode) ;; autocompletions 
  ;; OR:
  ;; (add-hook 'haskell-mode-hook 'flymake-mode)
  (add-hook 'haskell-mode-hook 'dante-mode)
  )
(setq flymake-no-changes-timeout nil)
(setq flymake-start-syntax-check-on-newline nil)
(setq flycheck-check-syntax-automatically '(save mode-enabled))

;; hlint + dante 
(add-hook 'dante-mode-hook
   '(lambda () (flycheck-add-next-checker 'haskell-dante
                '(warning . haskell-hlint))))

And when I open a haskell buffer, I see that the modes are all initialised correctly. However, flycheck seems to not find any errors whatsoever: there's no highlighting in the buffer and flycheck-next-error results in:

user-error: No more Flycheck errors

Does this mean something is wrong with my configuration? How can I diagnose this?


Screenshot: image (the red box is where I'd expect the errors to be highlighted)


dante-diagnose:

default-directory "/home/ashesh/code/centralapp/core/"
dante-command-line ("stack" "repl")
dante-state (ghc-err (compiling "Main"))
dante-queue nil
dante-loaded-file "/home/ashesh/code/centralapp/core/app/Main.hs"
dante-load-message (("/home/ashesh/code/centralapp/core/app/Main.hs" "49:1-17" "error:" "    Parse error: module header, import declaration
    or top-level declaration expected.
"))
lcr-process-callback nil

Further experimenting with my setup, I see that I need to close the buffer and reopen it to see flycheck errors.

tomjaguarpaw commented 4 years ago

I am also seeing this problem. I am trying to upgrade from an old version of dante (and some old dependent packages) but I see the exact same problem. In the status line when there is an error it says "Dante:ghc-err" and "FlyC" but it used to say "Dante:error" and "FlyC:1/0" (indicating 1 error, 0 warnings).

tomjaguarpaw commented 4 years ago

Aha, in the status line at the start I see

error in process filter: Wrong type argument: flycheck-error, [cl-struct-flycheck-error nil haskell-dante ...
tomjaguarpaw commented 4 years ago

@asheshambasta I have had success by using the latest of everything from MELPA. You might like to look at my .emacs. EDIT: corrected below

You will see I had to use a workaround for https://github.com/jyp/dante/issues/134.

tomjaguarpaw commented 4 years ago

Sorry, I gave you a stale link. It should be

https://github.com/tomjaguarpaw/dotfiles/blob/d1e664d7e146df85a5da0192fe7d26ec1af5f48b/Emacs/emacs

jyp commented 4 years ago

It seems that this is fixed. I'll close; feel free to re-open, or open a narrowed-down issue.

asheshambasta commented 4 years ago

@jyp @tomjaguarpaw this is indeed fixed for me. I'll try to drill down to the root cause and reopen this with more details if I can repro this.

tomjaguarpaw commented 4 years ago

It would be great to know under what conditions this occurs. I'm trying to get a deterministic Emacs setup (using straight.el) so I hope to not see regressions like this anymore, but it would still be helpful to know what the root cause is.

asheshambasta commented 4 years ago

@tomjaguarpaw yeah same here; although I think I can try to repro this the coming weekend. However, I'm also looking into a deterministic Emacs setup (in my case, I'm looking into home-manager since I'm on NixOS)