Ghcide: Generated .HIE files incompatible with STAN

Created on 28 Jun 2020  Â·  2Comments  Â·  Source: haskell/ghcide

Stan doesnt work with HIE files generated by Haskell Language Server / ghcide.

The issue was described in reddit and the explanation of what is missing:

I think I know what happens. When contributing GHC-8.10 support in ghcide, I noticed that they create HIE files artificially and they erase source content from HIE files completely. That's why you see an error about too large index — there's simply no source code info in HIE files.

We can check indexes on our side in Stan, but you will see blank lines in report, which won't make it that useful to users.

If this is indeed what is happening, what you can do is to try to discuss this issue with the Haskell IDE engine team, reporting the bug to them. I see how this issue can break the integration of different tools and that resolving it can help different tools not to interfere with each other. I believe it's a good idea, in general, to build tooling around the same API and same expectations, otherwise we will have the broken ecosystem in area of IDE.

I confirmed in ghcide that the source bytestring is empty: https://github.com/digital-asset/ghcide/blob/master/src/Development/IDE/Core/Compile.hs#L281 and https://github.com/digital-asset/ghcide/blob/master/src-ghc88/Development/IDE/GHC/HieAst.hs#L94

Issue originally posted to https://github.com/kowainik/stan/issues/327#issue-646721049

I attempted to patch the linked code to use getFileContents to write the source to the HIE files, but it didnt work (e.g. the same error was thrown). I am happy to attempt a PR, but I am wondering if it is a sensible approach to use getFileContents.

Most helpful comment

Fixing this would only make sense if aiming for stan integration in hls.

I thought that would be a nice idea, no?

All 2 comments

The HIE files generated by ghcide are internal and live in the .cache folder (in ghcide HEAD). Fixing this would only make sense if aiming for stan integration in hls.

getFileContents only works for VFS files, you need to read from disk if it returns Nothing

Fixing this would only make sense if aiming for stan integration in hls.

I thought that would be a nice idea, no?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zeta-00 picture zeta-00  Â·  6Comments

decapo01 picture decapo01  Â·  4Comments

fendor picture fendor  Â·  7Comments

sshine picture sshine  Â·  8Comments

meditans picture meditans  Â·  6Comments