rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 94 forks source link

Hoogle failed database generation causes documentation to be unavailable #682

Open marcozucchi opened 2 years ago

marcozucchi commented 2 years ago

I am citing this issue, since I keep having this problem with IntelliJ's Haskell plugin

Problem

Hoogle Documentation is not available for me out-of-the-box

Explanation of the problem

Activating the Haskell logs and having a look at them, shows that the plugin executes a command similar to the following

/home/{username}/.cache/intellij-haskell/lts-18/bin/hoogle generate --local=/tmp/{project name}/.stack-work/install/x86_64-linux-tinfo6/c133d91acae5e16553a0fed130e42febc6425489b117552f09e66cb9be01b797/8.10.7/doc --local=/home/{username}/.stack/snapshots/x86_64-linux-tinfo6/c133d91acae5e16553a0fed130e42febc6425489b117552f09e66cb9be01b797/8.10.7/doc --database=/home/{username}/.cache/intellij-haskell/{projectName}/hoogle

The above script executes and tries to build the Hoogle database but at some point the build fails with the following message:

[70/155] hoogle...
hoogle: hseToItem failed, Add mode = embed support

Nevertheless, the plugin doesn't warn the user, that the build has failed (in fact, according to IntelliJ the plugin hasn't failed, you can only see the failed build status if you go to the Build tab). However, quick-documentation is unavailable as shown in the following screenshot:

image

Haskell Event Log shows that it can't access the Hoogle database since it's been trucated.

Haskell Event Log

224de1867a06ea1059bc17a3165e0d6a

Temporal fix

I tried to fix this problem and I found out that when the database is manually generated where the plugin expects it, it works fine. To achieve this, I removed both --local parameters from the hoogle command executed by the plugin:

/home/{USER}/.cache/intellij-haskell/lts-18/bin/hoogle generate --database=/home/{USER}/.cache/intellij-haskell/ProgramaTutorial/hoogle

The "hoogle generate" command will pull the whole Hoogle database from the Internet and Quick-Documentation (Ctrl+Q) will work as expected:

image

Originally posted by @marcozucchi in https://github.com/rikvdkleij/intellij-haskell/issues/659#issuecomment-1052201194