Open jwiegley opened 6 years ago
There are a bunch of flags you can pass to HIE to get some extra information
--debug
will output extra information to stderr--vomit
will output extra information from ghc-mod to stderr-l /log/file
will specify a directory to output logs such about requests received and responses received to a certain directory.Is the project that you're running HIE on a stack project? If so make sure there aren't any dist
or new-dist
or cabal.project.local
or .ghc-environment
files lying around that might trick it into using cabal.
I also found that I got that error when the version of HIE doesn't match the resolver that the project uses, i.e. if you're using GHC 8.2.2 then your client should run hie-8.2.2
that was installed via make build
@jwiegley, the best approach for use under nix is to look at https://github.com/domenkozar/hie-nix
Yes, that's what I've been using.
Great. Does this mean we can close this issue?
Unless you want to make a PR on the docs, and then close it ... :)
I guess the question is: is there a way from the command-line to poke HIE to do what it's going to do when I say, try to lookup an identifier in a file. For example, it's much easier to diagnose hdevtools
problem, because I can run hdevtools check ...
at the command-line to at least take Emacs out of the picture until the CLI is working. But with HIE, it seems that once I run it I enter into some kind of event loop, but I don't know what events to send it. There are too many layers between Emacs and HIE for me to understand what's triggering the error that I see.
This is unfortunately a byproduct on focusing on LSP, and deprecating the other methods (which were always pretty iffy anyway, especially the console).
Hopefully the GSOC work @Bubba is doing will make this easier in future.
Do you know of any CLI that can fabricate the kinds of events Emacs is probably sending?
Not at the moment.
But as I said, most likely option is going to be https://github.com/Bubba/haskell-lsp-test
@jwiegley I ran into the same thing in my local setup (with Nix). I finally found https://github.com/NixOS/nixpkgs/pull/46453, though setting those env variables manually still didn't fix my editor integration. Maybe the other changes in that PR fix it, or maybe it's something else...still investigating.
I guess we should update the README for this, then close it.
I'm willing to tackle some issue on holidays, but i have to idea what proper development process on hie is. For some trivial issues in past i used printf-style debugging and it was barely enough, i guess i need a proper debugger and a way to emulate events and checkout what is going on.
Is there any blog posts \ articles \ gists \ notes \ whatever about it? @alanz @bubba @wz1000 what are your workflows for hie development?
I am a great fan of printf-style debugging, although I generally use logm
and then look at what is happening in /tmp/hie.log
.
You can also have a look at how the functional tests are run, they also generate logs, and you can focus them using the hspec --match
command line parameter.
I have a file test.sh
in my root directory, which looks like this
#!/bin/sh
# stack test haskell-ide-engine:func-test --test-arguments "--failure-report .hspec-failures --rerun"
stack test haskell-ide-engine:func-test --test-arguments "--match \"completes ghc options pragma values\""
You might also see if you can get https://microsoft.github.io/language-server-protocol/inspector/ to work with hie.
Generally, even I use printf debugging with logm etc. Also, --vomit is a good option to have enabled to debug ghc/ghc-mod issues.
For emulating events, you can look at @bubba's lsp-test
stuff, with examples in test/functional
tail -f hie.log | grep -B n "something"
is also a great way to filter out specific stuff from the log
@Anrock if you're using VS Code to develop with HIE, a nice workflow is to print to stderr which then shows up in the output window
If anyone's still running into this, I managed to get things working the way I expected by adding direnv-update-environment
to my language mode hook after setting up all my LSP related hooks. That is, I have
(use-package haskell-mode
...
:hook ((haskell-mode . direnv-update-environment))
...)
where my lang-specific configs are loaded later than my LSP config. This seems to put the direnv hook ahead of the LSP hook, so it does the right thing.
I'm having some difficulties getting haskell-ide-engine working under Emacs with my Nix configuration. Right now I'm facing this:
However, as far as I can tell, this is available in my environment, and cabal is building with this version of the library.
Is there a way to run hie so that I can try to track down where this is coming from? I'm not even sure yet how this is being triggered, since if I just run "hie" on the command-line, it doesn't report any errors, but neither do I know how to simulate whatever Emacs does when I open a Haskell file.
I'm asking here because I don't know what to do next, and I'd love to start using HIE for development. Thanks!