atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Haskell-ghc-mod: ghc-mod crash freezes atom #133

Closed wdanilo closed 8 years ago

wdanilo commented 8 years ago

Hello! There is a somehow connected issue there: https://github.com/atom-haskell/haskell-ghc-mod/issues/112

I'm working on a pretty big, stack based project - about 20 custom libraries and a core library, which uses all of them. In the core library I've got several stack.yaml configs - one of them uses the sources of libraries by relative local paths (so for example it uses a library in ../libs/foo). These libraries depend on each other. While compiling the main library, all the needed local libraries are compiled with other local libraries as dependencies.

This workflow allows me to change multiple libraries and just fire stack and I'm sure that all changed code will be re-compiled. After making some changes I bulk-update all the libraries. The problem is, that if I edit the code of one of the libraries, it's stack.yaml is not aware of the local paths provided by the special stack.yaml in the main library, which causes ghc-mod to throw errors every time I open such file. It could be ok, but it almost freezes atom - in fact, these errors are thrown very frequently and after 10 - 15 seconds atom crashes or freezes completely.

In this bug report I would like to ask for fixing two issues: 1) giving the ability to silence errors in some special cases, or just not throwing them so frequently (currently if I press escape, after 2-3 seconds I see 4 - 5 errors) 2) make something with freezeing atom when ghc-mod crashes.

If I can provide any further info, I'd love to - just write what I should do.

Thank you, Wojciech

EDIT: An example stack trace from such crash is:

ghc-modi crashed
    at module.exports.Util.mkError (/Users/<user>/.atom/packages/haskell-ghc-mod/lib/util.coffee:171:15)
    at ChildProcess.exitCallback (/Users/<user>/.atom/packages/haskell-ghc-mod/lib/ghc-mod/interactive-process.coffee:76:20)
    at emitTwo (events.js:92:20)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
lierdakil commented 8 years ago

See https://github.com/atom-haskell/haskell-ghc-mod/issues/132 for a workaround.

lierdakil commented 8 years ago

TL;DR: haskell-ghc-mod will silently drop all ghc-mod commands if it finds .disable-ghc-mod file in the local root directory (nearest one to current file that contains *.cabal file).

wdanilo commented 8 years ago

Perfect! Is there any documentation where such features are described?

lierdakil commented 8 years ago

I just implemented this recently as a hot fix. So a) didn't have time to update docs and b) details might change down the line. Again, see #132 for discussion and background.

lierdakil commented 8 years ago

Letting you know that since haskell-ghc-mod-1.15.0 .disable-ghc-mod will not work anymore. Instead, see https://github.com/atom-haskell/haskell-ghc-mod#advanced-configuration

TL;DR create .haskell-ghc-mod.json in project root with following contents to replicate the behavior of .disable-ghc-mod:

{ "disable": true }

You can alternatively suppress error pop-ups if you want to (see readme)