haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

HIE seems to stop working on some projects #355

Closed xldenis closed 6 years ago

xldenis commented 6 years ago

I've noticed that on some of my projects HIE seems to not do anything after displaying diagnostics once.

I'm using Sublime Text with the LSP plugin (latest version 0.4.0) and latest master Version 0.1.0.0, Git revision 9e39517408fd2948c60ac49e56267c93051f8878 (1066 commits) x86_64.

I turned on all the debug options available in LSP and it produces this:

LSP: starting in /Users/xavier/Code/xldenis/ill
LSP: starting ['stack', 'exec', '/Users/xavier/.local/bin/hie', '--', '--lsp']
LSP:  --> initialize
LSP: hie not available for view /Users/xavier/Code/xldenis/ill/app/Main.hs in window 4
2017-11-17 20:03:52.884921 [ThreadId 11] - Setting home directory:/Users/xavier:
2017-11-17 20:03:52.885868 [ThreadId 11] - run entered for HIE Version 0.1.0.0, Git revision 9e39517408fd2948c60ac49e56267c93051f8878 (1066 commits) x86_64:
2017-11-17 20:03:52.886752 [ThreadId 11] - Current directory:/Users/xavier:
LSP:      {'capabilities': {'renameProvider': True, 'documentSymbolProvider': True, 'codeActionProvider': True, 'documentFormattingProvider': True, 'executeCommandProvider': {'commands': ['applyrefact:applyOne', 'hare:demote']}, 'completionProvider': {'triggerCharacters': ['.'], 'resolveProvider': True}, 'hoverProvider': True, 'documentHighlightProvider': True, 'textDocumentSync': {'willSave': False, 'change': 2, 'willSaveWaitUntil': False, 'openClose': True, 'save': {'includeText': False}}, 'definitionProvider': True, 'documentRangeFormattingProvider': True}}
LSP:  --> initialized
LSP: hie client registered for window 4
LSP:  --> textDocument/didOpen
LSP: <--  client/registerCapability
LSP:      {'registrations': [{'id': 'hare:demote', 'registerOptions': {'documentSelector': {'language': 'haskell'}}, 'method': 'workspace/executeCommand'}]}
LSP: Unhandled request client/registerCapability
Using hoogle db at: /Users/xavier/.hoogle/default-haskell-5.0.13.hoo:
hie: /Users/xavier/.stack/programs/x86_64-osx/ghc-8.2.1/lib/ghc-8.2.1/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!):
LSP: <--  textDocument/publishDiagnostics
LSP:      {'uri': 'file:///Users/xavier/Code/xldenis/ill/app/Main.hs', 'diagnostics': []}
LSP:  --> textDocument/formatting
LSP:  --> textDocument/didChange
LSP:  --> textDocument/didChange

It's almost as if HIE stops responding...

If there is anything I can do to help debug I'd be happy to help.

robinvd commented 6 years ago

I have the same problem, it happens on a project with just cabal (no stack or stack.yaml file). It indeed displays correct error messages once. I will post my logs later

EDIT: https://gist.github.com/robinvd/a4b5674dd87c52c24feb7459544ef899 using

let g:LanguageClient_serverCommands = {
  \ 'haskell' : ['hie', '--lsp', '-d', '-l', '~/hie.log']
  \ }

in neovim

xldenis commented 6 years ago

Interesting, I use stack for everything.

xldenis commented 6 years ago

https://github.com/tomv564/LSP/issues/209#issuecomment-346739248

HIE seems to return the error:

hie: /Users/xavier/.stack/programs/x86_64-osx/ghc-8.2.1/lib/ghc-8.2.1/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!):
xldenis commented 6 years ago

Investigation shows that this is likely this error: https://github.com/DanielG/ghc-mod/issues/586.

I built a version of hie using ghc-8.2.1 by running stack build --stack-yaml=stack-8.2.1.yaml which appears to have changed nothing apart from turning up the fan speed on my computer.

If you'd like for me to run any tests I'd be happy to but I don't really know how to move forward from here since I have no insight into the root problem.

Incidentally, it would be nice if HIE could warn when it won't be able to work with a project's GHC version.

unode commented 6 years ago

I have a similar output with neovim:

haskell-lsp:Starting up server ...
2017-12-03 23:28:10.631805731 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"initializationOptions":null,"processId":26881,"rootUri":"file:///home/ralves/projects/PERSONAL/mdo","trace":"off","rootPath":"/home/ralves/projects/PERSONAL/mdo","capabilities":{"workspace":{"applyEdit":true},"textDocument":{"completion":{"completionItem":{"snippetSupport":true}}}}}}
2017-12-03 23:28:10.63207521 [ThreadId 11] - haskell-lsp:initializeRequestHandler: setting current dir to project root:/home/ralves/projects/PERSONAL/mdo
2017-12-03 23:28:10.652009095 [ThreadId 12] - <--2--{"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"willSave":false,"willSaveWaitUntil":false,"save":{"includeText":false}},"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"renameProvider":true,"executeCommandProvider":{"commands":["applyrefact:applyOne","hare:demote"]}}},"jsonrpc":"2.0","id":0}
2017-12-03 23:28:10.653922498 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
2017-12-03 23:28:10.654131091 [ThreadId 15] - reactor:didChangeConfiguration notification:NotificationMessage {_jsonrpc = "2.0", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [])}}
2017-12-03 23:28:10.654192277 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"haskell-lsp:didChangeConfiguration error. NotificationMessage {_jsonrpc = \"2.0\", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [])}} \"key \\\"languageServerHaskell\\\" not present\""}}
2017-12-03 23:28:10.654216426 [ThreadId 15] - reactor:didChangeConfiguration diagsOn:True
2017-12-03 23:28:10.661275569 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"version":1,"uri":"file:///home/ralves/projects/PERSONAL/mdo/app/Main.hs","languageId":"haskell","text":"module Main where\n\nimport qualified Data.Text.IO as T\nimport Lib\n\nmain :: IO ()\nmain = do\n    let path = \"test/data/input.mdo\"\n    sample <- T.readFile path\n    print $ parseMarkdown sample\n"}}}
2017-12-03 23:28:10.661444378 [ThreadId 15] - ****** reactor: processing NotDidOpenTextDocument
2017-12-03 23:28:10.682954531 [ThreadId 14] - dispatcherP: top of loop
2017-12-03 23:28:10.683037408 [ThreadId 14] - got request with id: Nothing
2017-12-03 23:28:10.713295897 [ThreadId 14] - dispatcherP: top of loop
2017-12-03 23:28:10.713382303 [ThreadId 14] - got request with id: Nothing
2017-12-03 23:28:10.713423055 [ThreadId 14] - Processing request as version matches
2017-12-03 23:28:13.391913306 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"position":{"line":9,"character":12},"textDocument":{"uri":"file:///home/ralves/projects/PERSONAL/mdo/app/Main.hs"}}}
2017-12-03 23:28:18.649855943 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":2,"method":"textDocument/hover","params":{"position":{"line":9,"character":12},"textDocument":{"uri":"file:///home/ralves/projects/PERSONAL/mdo/app/Main.hs"}}}
2017-12-03 23:28:23.79664855 [ThreadId 11] - 
haskell-lsp:Got EOF, exiting 1 ...

Above was with Version 0.1.0.0, Git revision 19d5494f519934c0208d6816fcee7545e6aef443 (1092 commits) x86_64 from https://github.com/alanz/haskell-ide-engine/commit/19d5494f519934c0208d6816fcee7545e6aef443

Using current master has the same result.

nponeccop commented 6 years ago

@unode can you check /tmp/LanguageClient.log and /tmp/LanguageServer.log for any clues?

@xldenis can you delete the cached cabal-helpers and retry? They are in ~/.cache/cabal-helper/ and ghc-mod rebuilds them if they are not there. Note that we have cabal-helper version updated, so everybody need to regenerate the cache

xldenis commented 6 years ago

So far no luck! I've removed the cabal helpers and nothing changed. I'm currently rebuilding from latest master as my previous version was:

Version 0.1.0.0, Git revision 04af8885a89402168cf464b119697d2539df1e61 (1071 commits) x86_64

I'm building with stack build --stack-yaml=stack-8.2.1.yaml and that produces a binary:

Version 0.1.0.0, Git revision 358c6489eb1724b5d29698fe28fc389c12cdc10f (1096 commits) x86_64

Wow! it doesn't crash now but leads to an almost worse error... image

Pops up everytime I save! Strictly speaking that error message is correct they aren't in other-modules they are in exposed-modules I don't know what could be causing this though.

Initial research shows that this could be a problem for cabal files that specify multiple targets (ie: app + lib) ?

xldenis commented 6 years ago

Here is a log of me booting up HIE in sublime and waiting for diagnostics to pop up.

LSP: global clients: hie=True
LSP: starting active= /Users/xavier/Code/xldenis/ill/src/Ill/Codegen.hs other= 0
LSP: starting in /Users/xavier/Code/xldenis/ill
LSP: starting ['stack', 'exec', '/Users/xavier/.local/bin/hie', '--', '--lsp', '--debug', '--vomit']
LSP:  --> initialize
2017-12-04 22:42:22.249127 [ThreadId 11] - Setting home directory:/Users/xavier:
2017-12-04 22:42:22.250429 [ThreadId 11] - run entered for HIE Version 0.1.0.0, Git revision 358c6489eb1724b5d29698fe28fc389c12cdc10f (1096 commits) x86_64:
2017-12-04 22:42:22.251145 [ThreadId 11] - Current directory:/Users/xavier:
2017-12-04 22:42:22.251493 [ThreadId 11] -:
:
:
:
:
haskell-lsp:Starting up server ...:
2017-12-04 22:42:22.252539 [ThreadId 11] - ---> {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"processId": 17492, "capabilities": {"workspace": {"applyEdit": true}, "textDocument": {"synchronization": {"didSave": true}, "completion": {"completionItem": {"snippetSupport": true}}}}, "rootPath": "/Users/xavier/Code/xldenis/ill", "rootUri": "file:///Users/xavier/Code/xldenis/ill"}}:
2017-12-04 22:42:22.254333 [ThreadId 11] - haskell-lsp:initializeRequestHandler: setting current dir to project root:/Users/xavier/Code/xldenis/ill:
LSP:  --> initialized
LSP: hie client registered for window 2
2017-12-04 22:42:22.25524 [ThreadId 12] - <--2--{"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"willSave":false,"willSaveWaitUinntfiol:" :Ffoaulnsde ,S"tsaacvke "p:r{o"jiencctl uadte:T e/xUts"e:rfsa/lxsaev}i}e,r"/hCoovdeer/Pxrlodveindiesr/"i:ltlr:
LSP:  --> textDocument/didOpen
ue,"completionProvider":{"resolveProvideirn"f:ot:r uSeT,A"CtKr_iEggXeEr Csheatr,a cptreerfse"r:r[i"n.g" ]S}t,a"cdke fpirnoijteicotn:
Provider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"renameProvider":true,"executeCommandProvider":{"commands":["applyrefact:applyOne","hare:demote"]}}},"jsonrpc":"2.0","id":1}:
2017-12-04 22:42:22.255989 [ThreadId 11] - ---> {"jsonrpc": "2.0", "method": "initialized", "params": {}}:
2017-12-04 22:42:22.261944 [ThreadId 11] - ---> {"jsonrpc": "2.0", "method": "textDocument/didOpen", "params": {"textDocument": {"version": 0, "text": "{-# LANGUAGE RecursiveDo, OverloadedStrings #-}\nmodule Ill.Codegen where\n\nimport Ill.Syntax.Core\nimport Ill.Syntax.Type\nimport Ill.Syntax.Name\n\nimport IRBuilder.Monad\nimport IRBuilder.Instruction\nimport qualified LLVM.AST.Type as T\nimport LLVM.AST.AddrSpace\n\nimport LLVM.Pretty\n\nimport Data.String\nimport ModuleBuilder\n\nimport Control.Monad (forM)\nimport qualified Control.Monad as M\n\n\nprettyModule mod = ppllvm $ compileModule mod\n\ncompileModule mod = buildModule \"example\" $ mdo\n  forM (constructors mod) compileConstructor\n  forM (filter isLambda $ bindings mod) compileBinding\n  where\n  isLambda (NonRec _ (Lambda{})) = True\n  isLambda _ = False\n\ncompileConstructor :: MonadModuleBuilder m => (Name, (Int, Type Name)) -> m ()\ncompileConstructor (nm, (_, ty)) = do\n  typedef (fromString nm) (Just $ T.StructureType False $ llvmArgTys)\n  where\n  llvmArgTys = map typeToLlvmType argTys\n  argTys = init (unwrapFnType ty)\n\nptr x = T.PointerType x (AddrSpace 0)\ntypeToLlvmType = ptr . typeToLlvmType'\ntypeToLlvmType' (TVar nm) = T.NamedTypeReference (fromString nm)\ntypeToLlvmType' (Arrow a b) = T.FunctionType (typeToLlvmType' b) [typeToLlvmType' a] False\ntypeToLlvmType' (TAp (TAp (TConstructor \"->\") a) b) = T.FunctionType (typeToLlvmType' b) [typeToLlvmType' a] False\ntypeToLlvmType' (TConstructor nm) = T.NamedTypeReference (fromString nm)\ntypeToLlvmType' t = T.void\n\n\ncompileBinding :: MonadModuleBuilder m => Bind Var -> m ()\ncompileBinding (NonRec nm l@(Lambda _ _)) = M.void . function (fromString $ varName nm) args ret $ \\args -> mdo\n  block `named` \"entry\" ; do\n    unreachable\n  pure ()\n\n  where\n  args = map (\\var -> (typeToLlvmType (idTy var), fromString $ varName var)) argVars\n  ret  = T.void\n  (body, argVars) = unwrapLambda l\n  unwrapLambda :: Core Var -> (Core Var, [Var])\n  unwrapLambda (Lambda b@(Id{}) e) = (b :) <$> unwrapLambda e\n  unwrapLambda (Lambda _ e) = unwrapLambda e\n  unwrapLambda e = (e, [])\n-- compileBinding exp = unreachable -- error $ show exp\n\ncompileBody exp = error $ show exp\n", "languageId": "haskell", "uri": "file:///Users/xavier/Code/xldenis/ill/src/Ill/Codegen.hs"}}}:
2017-12-04 22:42:22.262031 [ThreadId 15] - ****** reactor: processing Initialized Notification:
LSP: <--  client/registerCapability
LSP: Unhandled request client/registerCapability
2017-12-04 22:42:22.289626 [ThreadId 15] - ****** reactor: processing NotDidOpenTextDocument:
2017-12-04 22:42:22.289768 [ThreadId 12] - <--2--{"jsonrpc":"2.0","id":0,"method":"client/registerCapability","params":{"registrations":[{"registerOptions":{"documentSelector":{"language":"haskell"}},"method":"workspace/executeCommand","id":"hare:demote"}]}}:
info: Using Stack project at: /Users/xavier/Code/xldenis/ill:
2017-12-04 22:42:22.393041 [ThreadId 14] - dispatcherP: top of loop:
2017-12-04 22:42:22.393404 [ThreadId 14] - got request with id: Nothing:
Using hoogle db at: /Users/xavier/.hoogle/default-haskell-5.0.13.hoo:
2017-12-04 22:42:22.393943 [ThreadId 14] - dispatcherP: top of loop:
2017-12-04 22:42:22.394071 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"Using hoogle db at: /Users/xavier/.hoogle/default-haskell-5.0.13.hoo"}}:
2017-12-04 22:42:22.394278 [ThreadId 14] - got request with id: Nothing:
info: Found Stack project at: /Users/xavier/Code/xldenis/ill:
info: STACK_EXE set, preferring Stack project:
info: Using Stack project at: /Users/xavier/Code/xldenis/ill:
2017-12-04 22:42:22.540884 [ThreadId 14] - dispatcherP: top of loop:
2017-12-04 22:42:22.54123 [ThreadId 14] - got request with id: Nothing:
2017-12-04 22:42:22.541559 [ThreadId 14] - Processing request as version matches:
2017-12-04 22:42:22.59522 [ThreadId 14] - dispatcherP: top of loop:
2017-12-04 22:42:22.595483 [ThreadId 14] - got request with id: Nothing:
2017-12-04 22:42:22.595717 [ThreadId 14] - Processing request as version matches:
DEBUG: reading cache: /Users/xavier/Code/xldenis/ill/.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/setup-config.ghc-mod.cabal-components:
DEBUG: resolveEntrypoint::
["-i","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen/cabal_macros.h"]:
DEBUG: resolveEntrypoint::
LSP: <--  textDocument/publishDiagnostics
["-i","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/buil2d0/1i7l-l1-2t-e0s4t /2i2l:l4-2t:e2s2t.-7t0m1p9"9,2" -[iTtherseta"d,I"d- i1.2s]t a-c k<--w-o2r-k-/{d"ijssto/nxr8p6c_"6:4"-2o.s0x"/,C"ambeatlh-o2d."0:."0t.e2x/tbDuoicludm/einltl/-ptuebslti/sahuDtioaggenno"s,t"i-cis."s,t"apcakr-awmosr"k:/{d"iusrti/"x:8"6f_i6l4e-:o/s/x//UCsaebrasl/-x2a.v0i.e0r./2C/obduei/lxdl/dgelnoibsa/li-lalu/tsorgce/nI"l,l"/-CIo.dsetgaecnk.-hwso"r,k"/ddiiasgtn/oxs8t6i_c6s4"-:o[s{x"/sCeavbearli-t2y."0:.30,."2r/abnugiel"d:/{i"lslt-atrets"t:/{a"ultiongee"n:"2,7",-"Ic.hsatraacckt-ewro"r:k2/1d}i,s"te/nxd8"6:_{6"4l-ionsex"/:C2a7b,a"lc-h2a.r0a.c0t.e2r/"b:u3i1l}d}/,g"lsoobuarlc-ea"u:t"ohgleinn"t,"",-"Im.esstsaacgke-"w:o"rRke/dduinsdta/nxt8 6b_r6a4c-koestx\/nCFaobuanld-:2\.n0 . 0(.L2a/mbbudial{d}/)i\lnlW-htye snto/ti:l\ln- t eLsatm-btdmap{"},\"n-"o}p,t{P"-sienvcelruidtey"",:"3-,o"prtaPn.gset"a:c{k"-swtoarrkt/"d:i{s"tl/ixn8e6"_:6341-,o"scxh/aCraabcatle-r2".:03.50}.,2"/ebnudi"l:d{/"illiln-et"e:s3t2/,a"ucthoagreanc/tcearb"a:l6_9m}a}c,r"osso.uhr"c]e:
":"hlint","message":"Redundant do\nFound:\n  do typedef (fromString nm)\n     (Just $ T.StructureType False $ llvmArgTys)\nWhy not:\n  typedef (fromString nm) (Just $ T.StructureType False $ llvmArgTys)\n"},{"severity":4,"range":{"start":{"line":32,"character":34},"end":{"line":32,"character":68}},"source":"hlint","message":"Redundant $\nFound:\n  T.StructureType False $ llvmArgTys\nWhy not:\n  T.StructureType False llvmArgTys\n"},{"severity":3,"range":{"start":{"line":48,"character":26},"end":{"line":49,"character":15}},"source":"hlint","message":"Redundant do\nFound:\n  do unreachable\nWhy not:\n  unreachable\n"},{"severity":3,"range":{"start":{"line":57,"character":25},"end":{"line":57,"character":31}},"source":"hlint","message":"Redundant bracket\nFound:\n  (Id{})\nWhy not:\n  Id{}\n"}]}}:
DEBUG: resolveEntrypoint::
["-i","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/ill/ill-tmp","-iapp","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/ill/autogen","-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/ill/autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/ill/ill-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/ill/autogen/cabal_macros.h"]:
DEBUG: resolveEntrypoint: []:
DEBUG: making sure autogen files exist:
DEBUG: reading cache: .stack-work/dist/x86_64-osx/Cabal-2.0.0.2/setup-config.ghc-mod.resolved-components:
VOMIT: Using the following mapped files: "/Users/xavier/Code/xldenis/ill/src/Ill/Codegen.hs":
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" ".stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-odir" ".stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-hidir" ".stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-stubdir" ".stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-i" "-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-isrc" "-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen" "-i.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen" "-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen" "-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/global-autogen" "-I.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build" "-optP-include" "-optP.stack-work/dist/x86_64-osx/Cabal-2.0.0.2/build/autogen/cabal_macros.h" "-this-unit-id" "ill-0.1.0.0-1Uwl6pTjVI3I7AGzQZvALi" "-hide-all-packages" "-Wmissing-home-modules" "-no-user-package-db" "-package-db" "/Users/xavier/.stack/snapshots/x86_64-osx/nightly-2017-10-31/8.2.1/pkgdb" "-package-db" "/Users/xavier/Code/xldenis/ill/.stack-work/install/x86_64-osx/nightly-2017-10-31/8.2.1/pkgdb" "-package-id" "megaparsec-6.2.0-FFfCVvl3couBaRbvjJAQlq" "-package-id" "text-1.2.2.2-Ja5vhWvrB3PHMSPwq0buEf" "-package-id" "base-4.10.0.0" "-package-id" "mtl-2.2.1-19EL8AGBsN3DnnOhrC9xY3" "-package-id" "free-4.12.4-8ba9GYDKZ8aHvmBcbKiAb" "-package-id" "comonad-5.0.2-AJkdorM0Eq34gBAfIhPSf6" "-package-id" "prettyprinter-1.1-64OylnBtbolEhArGDFcs7V" "-package-id" "prettyprinter-ansi-terminal-1.1-Bi4FIWRfLV883xIdkAAKX2" "-package-id" "lens-4.15.4-9nqBRPiZXNvCeZCsneO73P" "-package-id" "unordered-containers-0.2.8.0-Gyt5v4dJjM77pHzycDWM9B" "-package-id" "containers-0.5.10.2" "-package-id" "bifunctors-5.4.2-3X2cod1XF1V8VJmfcxAWhz" "-package-id" "llvm-hs-5.1.0-Kyabbjt1Hxf26NyJ9r37QY" "-package-id" "llvm-hs-pure-5.1.0-BBpjVHHU6l71hhxpLDYYdg" "-package-id" "llvm-hs-pretty-0.1.0.0-DY4O4ahFkjS6lNjHdrnMoh" "-package-id" "irbuilder-0.1.0.0-1MasmLgS3RbJFq45Mfjtc2" "-package-id" "bytestring-0.10.8.2" "-XHaskell2010" "-XFlexibleContexts" "-fwarn-incomplete-uni-patterns" "-fdiagnostics-color=always" "-O0":
DEBUG: initSession: Session not initialized, creating new one:
VOMIT: Using the following targets: "/Users/xavier/Code/xldenis/ill/src/Ill/Codegen.hs":
DEBUG: loadTargets::
Loading: /private/var/folders/zd/cdf056jn17s14wlrp527whgw0000gn/T/ghc-mod17493/Codegen17492-0.hs:
DEBUG: loadTargets: filterModSums: True:
info: loadTargets::
Target needs interpeter, switching to LinkInMemory/HscInterpreted. Perfectly normal if anything is using TemplateHaskell, QuasiQuotes or PatternSynonyms.:
DEBUG: loadTargets: Loading done:
2017-12-04 22:42:24.254251 [ThreadId 14] - dispatcherP: top of loop:LSP: <--  window/showMessage

2017-12-04 22:42:24.254393 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Got error while processing diagnostics: These modules are needed for compilation but not listed in your .cabal file's other-modules: Control.Monad.Fresh\n                                                                                             Control.Monad.Unify\n                                                                                             Ill.Syntax.Core\n                                                                                             Ill.Syntax.Kind\n                                                                                             Ill.Syntax.Literal\n                                                                                             Ill.Syntax.Name\n                                                                                             Ill.Syntax.Pretty\n                                                                                             Ill.Syntax.Type"}}:
2017-12-04 22:42:24.257518 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Got error while processing diagnostics: These modules are needed for compilation but not listed in your .cabal file's other-modules: Control.Monad.Fresh\n                                                                                             Control.Monad.Unify\n                                                                                             Ill.Syntax.Core\n                                                                                             Ill.Syntax.Kind\n                                                                                             Ill.Syntax.Literal\n                                                                                             Ill.Syntax.Name\n                                                                                             Ill.Syntax.Pretty\n                                                                                             Ill.Syntax.Type"}}:
2017-12-04 22:42:24.260181 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/xavier/Code/xldenis/ill/src/Ill/Codegen.hs","diagnostics":[{"severity":3,"range":{"start":{"line":27,"character":21},"end":{"line":27,"character":31}},"source":"hlint","message":"Redundant bracket\nFound:\n  (Lambda{})\nWhy not:\n  Lambda{}\n"},{"severity":3,"range":{"start":{"line":31,"character":35},"end":{"line":32,"character":69}},"source":"hlint","message":"Redundant do\nFound:\n  do typedef (fromString nm)\n     (Just $ T.StructureType False $ llvmArgTys)\nWhy not:\n  typedef (fromString nm) (Just $ T.StructureType False $ llvmArgTys)\n"},{"severity":4,"range":{"start":{"line":32,"character":34},"end":{"line":32,"character":68}},"source":"hlint","message":"Redundant $\nFound:\n  T.StructureType False $ llvmArgTys\nWhy not:\n  T.StructureType False llvmArgTys\n"},{"severity":3,"range":{"start":{"line":48,"character":26},"end":{"line":49,"character":15}},"source":"hlint","message":"Redundant do\nFound:\n  do unreachable\nWhy not:\n  unreachable\n"},{"severity":3,"range":{"start":{"line":57,"character":25},"end":{"line":57,"character":31}},"source":"hlint","message":"Redundant bracket\nFound:\n  (Id{})\nWhy not:\n  Id{}\n"}]}}:
Package Control: Skipping automatic upgrade, last run at 2017-12-04 22:29:01, next run at 2017-12-04 23:29:01 or after
LSP: <--  window/showMessage
LSP: <--  textDocument/publishDiagnostics

This is amazing though, it appears as if code actions work and hits pop up! I can even hover over terms to get type information 😄 . Once that annoying popup issue is solved I can finally use HIE!

nponeccop commented 6 years ago

From messages like

ue,"completionProvider":{"resolveProvideirn"f:ot:r uSeT,A"CtKr_iEggXeEr Csheatr,a cptreerfse"r:r[i"n.g" ]S}t,a"cdke fpirnoijteicotn:

it seems we have a racing condition. Hopefully it's just the logger.

The popups come from these lines:

2017-12-04 22:42:24.254393 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Got error while processing diagnostics: These modules are needed for compilation but not listed in your .cabal file's other-modules: Control.Monad.Fresh\n                                                                                             Control.Monad.Unify\n                                                                                             Ill.Syntax.Core\n                                                                                             Ill.Syntax.Kind\n                                                                                             Ill.Syntax.Literal\n                                                                                             Ill.Syntax.Name\n                                                                                             Ill.Syntax.Pretty\n                                                                                             Ill.Syntax.Type"}}:
nponeccop commented 6 years ago

The showMessage is emitted from here:

https://github.com/haskell/haskell-ide-engine/blob/master/src/Haskell/Ide/Engine/Transport/LspStdio.hs#L826

and it's sort of failed assertion, so it's good that it's so loud in Sublime.

The message about "these modules" originates from GHC itself:

https://github.com/ghc/ghc/commit/b0c9f34aa3da914524ef37294bba78afefc3ada7#diff-cba18dd33a1f0755b737e26ed3bf08e9R200

unode commented 6 years ago

Removed all log files, restarted neovim and this is what I get:

# LanguageClient.log

11:33:51 WARNING [MainThread] Unknown parameter key: rootPath
11:33:51 WARNING [MainThread] Unknown parameter key: settingsPath
11:33:51 WARNING [MainThread] register completion manager source failed. Error: NvimError(b'Error calling function.',)
# LanguageServer.log

hie: user error (Failed to find requested hint files:
  /home/unode/system/bin/data/hlint.yaml
)

/home/unode/system/bin is where hie's binary is located. No clue why it would be looking for hlint configuration there.

# hie.log (hie started with -l /tmp/hie.log

2017-12-05 11:33:51.579909239 [ThreadId 11] - Setting home directory:/home/unode
2017-12-05 11:33:51.580081626 [ThreadId 11] - run entered for HIE Version 0.1.0.0, Git revision 34900cc444bb0a7f512ac92e9aaf9cb52ff37899 (1090 commits) x86_64
2017-12-05 11:33:51.580162899 [ThreadId 11] - Current directory:/home/unode
2017-12-05 11:33:51.580217049 [ThreadId 11] - 

haskell-lsp:Starting up server ...
2017-12-05 11:33:51.580525296 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":9804,"trace":"off","initializationOptions":null,"rootPath":"/home/unode/projects/PERSONAL/mdo","rootUri":"file:///home/unode/projects/PERSONAL/mdo","capabilities":{"textDocument":{"completion":{"completionItem":{"snippetSupport":true}}},"workspace":{"applyEdit":true}}}}
2017-12-05 11:33:51.580757874 [ThreadId 11] - haskell-lsp:initializeRequestHandler: setting current dir to project root:/home/unode/projects/PERSONAL/mdo
2017-12-05 11:33:51.600756134 [ThreadId 12] - <--2--{"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"willSave":false,"willSaveWaitUntil":false,"save":{"includeText":false}},"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"renameProvider":true,"executeCommandProvider":{"commands":["applyrefact:applyOne","hare:demote"]}}},"jsonrpc":"2.0","id":0}
2017-12-05 11:33:51.602974501 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
2017-12-05 11:33:51.603174737 [ThreadId 15] - reactor:didChangeConfiguration notification:NotificationMessage {_jsonrpc = "2.0", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [])}}
2017-12-05 11:33:51.603210302 [ThreadId 12] - <--2--{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"haskell-lsp:didChangeConfiguration error. NotificationMessage {_jsonrpc = \"2.0\", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [])}} \"key \\\"languageServerHaskell\\\" not present\""}}
2017-12-05 11:33:51.603268992 [ThreadId 15] - reactor:didChangeConfiguration diagsOn:True
2017-12-05 11:33:51.605519488 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs","text":"module Main where\n\nimport qualified Data.Text.IO as T\nimport Lib\n\nmain :: IO ()\nmain = do\n    let path = \"test/data/input.mdo\"\n    sample <- T.readFile path\n    print $ parseMarkdown sample\n","languageId":"haskell","version":1}}}
2017-12-05 11:33:51.6057192 [ThreadId 15] - ****** reactor: processing NotDidOpenTextDocument
2017-12-05 11:33:58.828788744 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":1,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}}
2017-12-05 11:33:58.828957108 [ThreadId 15] - reactor:got Document symbol request:RequestMessage {_jsonrpc = "2.0", _id = IdInt 1, _method = TextDocumentDocumentSymbol, _params = DocumentSymbolParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}}}
2017-12-05 11:34:00.072089232 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":2,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:34:00.072273401 [ThreadId 15] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 2, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}, _position = Position {_line = 9, _character = 12}}}
2017-12-05 11:34:00.072371419 [ThreadId 15] - reactor:HoverRequest done
2017-12-05 11:34:00.072433696 [ThreadId 12] - <--2--{"result":{"contents":[]},"jsonrpc":"2.0","id":2}
2017-12-05 11:34:02.02046922 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":3,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:34:02.020664491 [ThreadId 15] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 3, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}, _position = Position {_line = 9, _character = 12}}}
2017-12-05 11:34:02.020760422 [ThreadId 15] - reactor:HoverRequest done
2017-12-05 11:34:02.020819814 [ThreadId 12] - <--2--{"result":{"contents":[]},"jsonrpc":"2.0","id":3}
2017-12-05 11:34:08.538997335 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":4,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:34:08.539194881 [ThreadId 15] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 4, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}, _position = Position {_line = 9, _character = 12}}}
2017-12-05 11:34:08.539283108 [ThreadId 15] - reactor:HoverRequest done
2017-12-05 11:34:08.539340039 [ThreadId 12] - <--2--{"result":{"contents":[]},"jsonrpc":"2.0","id":4}
2017-12-05 11:34:11.158553092 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":5,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}}
2017-12-05 11:34:11.158741791 [ThreadId 15] - reactor:got Document symbol request:RequestMessage {_jsonrpc = "2.0", _id = IdInt 5, _method = TextDocumentDocumentSymbol, _params = DocumentSymbolParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}}}
2017-12-05 11:34:13.385815522 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":6,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:34:13.385995091 [ThreadId 15] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 6, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"}}, _position = Position {_line = 9, _character = 12}}}
2017-12-05 11:34:13.386093024 [ThreadId 15] - reactor:HoverRequest done
2017-12-05 11:34:13.386130451 [ThreadId 12] - <--2--{"result":{"contents":[]},"jsonrpc":"2.0","id":6}
2017-12-05 11:34:28.832721923 [ThreadId 14] - dispatcherP: top of loop
2017-12-05 11:34:28.832824336 [ThreadId 14] - got request with id: Nothing
2017-12-05 11:34:29.749025289 [ThreadId 14] - dispatcherP: top of loop
2017-12-05 11:34:29.749137125 [ThreadId 14] - got request with id: Nothing
2017-12-05 11:34:29.749405924 [ThreadId 14] - Processing request as version matches
2017-12-05 11:34:36.73431197 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":7,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:34:38.924529921 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":8,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:35:07.523791321 [ThreadId 11] - ---> {"jsonrpc":"2.0","id":9,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/unode/projects/PERSONAL/mdo/app/Main.hs"},"position":{"line":9,"character":12}}}
2017-12-05 11:35:12.044216457 [ThreadId 11] - 
haskell-lsp:Got EOF, exiting 1 ...
nponeccop commented 6 years ago

Since the original issue is gone and now we have 2 different issues, I'm closing this issue. I created 2 issues and pasted the relevant info there:

@robinvd if you still have any issues please open a new issue (or reopen this one)