atom-haskell / ide-haskell

Haskell IDE plugin for Atom editor

Home Page:https://atom.io/packages/ide-haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lint suggestions are clearing the errors tab

freeman42x opened this issue · comments

If the project does not build and there are also lint suggestions the build errors are seen on their tab for a very small amount of time and then the focus goes to the lint tab and the errors tab gets cleared.

errors tab gets cleared

That is very unexpected. This actually shouldn't happen.

A bit of a design explanation. Every package that can show messages via ide-haskell output panel manages it's own messages completely and sets those more or less atomically. Messages from different sources, in general, do not interfere, with one exception: if literally the same messages (meaning location, text, etc are the same) already exist, "ownership" gets reassigned.

Lint is handled by haskell-ghc-mod. Build errors can come from either haskell-ghc-mod or ide-haskell-cabal.

In any case, I can't imagine a scenario where error tab would be cleared.

More detailed reproduction instructions could help.

@lierdakil The instructions above are as detailed as needed, you just need to take some file that compiles and get it to not compile, then add some unneeded parentheses or something so you get a HLint error. Once you do that you will only see the HLint tab messages but there will be no errors shown on their tab - unless you fix the HLint issue.

Well, I can't reproduce with instructions given.

@lierdakil A basic example to reproduce, create a file HelloError.hs with content:

module HelloError where

add a b = a + [b]

Error tab should show the error:

/home/neo/HaskellLearning/IdeTest/src/HelloError.hs: 3, 1

  • Non type-variable argument in the constraint: Num [t]
    (Use FlexibleContexts to permit this)
  • When checking the inferred type
    add :: forall t. Num [t] => [t] -> t -> [t]

Now put parentheses around a to get a HLint issue:

module HelloError where

add a b = (a) + [b]

The error will be shown for a split second then the Error tab will be cleared and only the HLint will be focused and shown it its tab:

/home/neo/HaskellLearning/IdeTest/src/HelloError.hs: 3, 11
Redundant bracket
Found:
(a)
Why not:
a

Well, I still can't repro, but the particular way you're phrasing this makes me wonder what your haskell-ghc-mod settings are. In particular, 'Check/Lint On Change/Save'

haskell-ghc-mod has:

  • On Save Check set
  • On Save Lint set
  • On Change Check unset
  • On Change Lint unset

The issue I am getting is upon saving the file after making the changes.

Huh... I think having only one of 'Change/Save' enabled can lead to the described behaviour (at least I did find a bug in the implementation, which I just fixed in haskell-ghc-mod@v2.2.3). But with these settings, I honestly have no idea how that would be possible since both check and lint results are set together.

EDIT: re-reading, it's not obvious what I mean by "only one of 'Change/Save' enabled". What I mean is situations similar to this:

  • On Save Check
  • On Save Lint
  • On Change Check
  • On Change Lint

Check that you're running Atom >= 1.23.3 and all related packages are up to date. You might as well test haskell-ghc-mod@v2.2.3, on the off chance that it somehow helps with this issue.

And just to show that I've actually tried reproducing:
idehaskell225

I am running Atom 1.23.3 and updated to haskell-ghc-mod 2.2.3 and the issue is still happening.

No idea. Restart Atom? Reinstall ide-haskell & friends?

I'm on Gentoo with Atom installed via Nix package manager, so my environment should be pretty close to yours...

And besides, to the best of my knowledge, there are no code paths that could produce the described behaviour in the first place. Except for maybe bizarre cases where a package somehow managed to activate twice or something like that due to some obscure race condition somewhere, but you shouldn't be able to consistently reproduce an obscure race condition.

@lierdakil I uninstalled Atom, then installed the following plugins only:

language-haskell
ide-haskell
haskell-ghc-mod

Pressing save does not show an error in the error tab - for add a b = (a) + [b]
Pressing save does show lint errors though - for add a b = (a) + [b]
If I build the project using Builder -> Build (with stack) the error is shown - for add a b = a + [b]
Fixing the error and pressing save has no effect - the error is still shown in its tab - for add a b = a + [b]
Adding parentheses does trigger the HLint on saving though. add a b = (a) + [b] but the error tab is still empty/cleared.
Running Builder -> Build doesn't show any error but shows the lint issue - for add a b = (a) + [b]

As you can see the behavior is very flaky and in any case in which there is a HLint issue the errors can't be seen.

I was using GHC version 8.0.2 because I knew ghc-mod had issues with latest GHC versions.

I'll try downgrading cabal-install from version 2 to version 1 and see if that helps.

Just noticed that on saving even with compiling program (add a b = a + b) the following errors/warnings appear in the developer console:

Uncaught Error: read ECONNRESET
at exports._errnoException (util.js:1022)
at Pipe.onread (net.js:572)
exports._errnoException @ util.js:1022
onread @ net.js:572
util.ts:52 haskell-ghc-mod warning:
warn @ util.ts:52
proc.once @ interactive-process.ts:131
onceWrapper @ events.js:290
emitTwo @ events.js:111
emit @ events.js:191
ChildProcess._handle.onexit @ internal/child_process.js:215
upi-consumer.ts:508 Haskell-ghc-mod: ghc-mod interactive command check failed with error GHCModInteractiveCrash caps:
{
"version": [
5,
8,
0,
0
],
"fileMap": true,
"quoteArgs": true,
"optparse": true,
"typeConstraints": true,
"browseParents": true,
"interactiveCaseSplit": true,
"importedFrom": false,
"browseMain": false
}
Args:
{
"interactive": true,
"command": "check",
"uri": "/home/neo/HaskellLearning/IdeTest/src/HelloError.hs"
}
message:

cabal-helper-wrapper: /home/neo/.ghc-mod/cabal-helper/cabal-helper-0.7.3.0-Cabal-1.24.2.0: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory),ghc-mod: readCreateProcess: /nix/store/07wnp40jsxzavj5n31ld2n1536w87spa-cabal-helper-0.7.3.0/libexec/x86_64-linux-ghc-8.0.2/cabal-helper-0.7.3.0/cabal-helper-wrapper "--with-ghc=/nix/store/fd5vgah6xcwzy6xahlkl1xg637xy2n50-ghc-8.0.2/bin/ghc" "--with-ghc-pkg=/nix/store/fd5vgah6xcwzy6xahlkl1xg637xy2n50-ghc-8.0.2/bin/ghc-pkg" "--with-cabal=cabal" "/home/neo/HaskellLearning/IdeTest" "/home/neo/HaskellLearning/IdeTest/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed
log:

consoleReport @ upi-consumer.ts:508
handleProcessError @ upi-consumer.ts:524
module.exports.Emitter.simpleDispatch @ :65955
module.exports.Emitter.emit @ :66071
disposables.add.backend.onError @ index.ts:403
module.exports.Emitter.simpleDispatch @ :65955
module.exports.Emitter.emit @ :66071
run @ ghc-modi-process-real.ts:145
_tickCallback @ internal/process/next_tick.js:103

Tried with:

cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library

and it still behaves the same way.

Apparently, ghc-mod is not working with Cabal v.2 DanielG/ghc-mod#910 (comment)

I installed ghc-mod for ghc 8.2.2 via DanielG/ghc-mod#922 (comment) and now I am no longer seeing the errors in the developer console.

Probably the issue was caused by partially broken ghc-mod.

Closing since I can no longer reproduce this issue.