haskell / haskell-ide-engine

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

HIE should generate local Hoogle database #1285

Open infinisil opened 5 years ago

infinisil commented 5 years ago

It makes sense for HIE to generate the hoogle database itself, locally in the project, because:

(Correct me if some of those don't hold)

This should be implemented by having HIE generate the database in the background and having a status indicator like "Indexing packages.." that indicates that not all features are available until it's done.

Ping @fendor

lukel97 commented 5 years ago

This makes a lot of sense to me. Generating the hoogle database can take a couple of minutes though. Is there any disadvantage to sharing a global hoogle database?

nponeccop commented 5 years ago

Is there any disadvantage to sharing a global hoogle database?

Different versions of the same package in different projects?

lorenzo commented 5 years ago

I’m in favor of doing this, I get bitten by the lack of a proper Hoogle database constantly

lukel97 commented 5 years ago

Is there any disadvantage to sharing a global hoogle database?

Different versions of the same package in different projects?

I think at the moment the README.md just tells people to run hoogle generate, and it turns that just generates a database for the current version of Stackage LTS. Looks like there's also a --local option but that only generates links for packages built with documentation, so the user would need to have that turned on in their config (or could we specify it ghc-mod/hie-bios?)

lorenzo commented 5 years ago

We can certainly add extra dynamicsc flags with ghc-mod

wz1000 commented 5 years ago

To generate a local/project specific hoogle database, both stack and cabal first need to generate haddock documentation. However, if haddock documentation is available, HIE will try to use that instead of hoogle, as it is generally more accurate and preserves the original markup. So I don't see the point of generating local hoogle dbs.

The global hoogle db is meant to be a fallback to when local haddock documentation is not available, as it is often slow and unreliable to generate haddock docs.

fendor commented 5 years ago

HsImport uses the hoogle db. I dont know how this change would affect the plugin. If only local/installed packages are searched, it may impact the search results of hoogle.

jneira commented 4 years ago

So afaiu hie will use the local generated haddock docs so the option could be make hie generate them. But that should be done on demand, to recreate it only when needed. Not sure if there would be a reliable way to know when the docs should be regenerated. Otoh users can always use cabal or stack themselves to do it. So not sure if documenting it would be enough or show a warning to users to let then know why document on hover is not working and how to fix i . @Infinisil what do you think?