Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run haskell-hie from cli #204

Open
donsbot opened this issue Jun 9, 2022 · 1 comment
Open

How to run haskell-hie from cli #204

donsbot opened this issue Jun 9, 2022 · 1 comment

Comments

@donsbot
Copy link
Contributor

donsbot commented Jun 9, 2022

Just trying out the haskell-hie indexer. I feel like something like this should work but no luck:

# in the tests dir
$ pwd
/home/dons/Glean/glean/lang/haskell/tests/code

# make some .hie files
$ ghc --make -fwrite-ide-info B.hs
Loaded package environment from /home/dons/.ghc/x86_64-linux-8.10.7/environments/default
[1 of 2] Compiling A                ( A.hs, A.o )
[2 of 2] Compiling B                ( B.hs, B.o )

$ ls
A.hi  A.hie  A.hs  A.o  B.hi  B.hie  B.hs  B.o

$ cd
$ cd Glean/
$ glean-shell
Glean Shell, built on 2022-06-09 02:22:49.685202174 UTC, from rev b5af6c875a448322c83bfa50c2148428450e735a
type :help for help.

> :index haskell-hie Glean/glean/lang/haskell/tests/code
I0609 04:20:54.879848 2594231 DefaultMain.hs:44] BEGIN buildXrefMapFiles
I0609 04:20:54.880440 2594231 Builder.hs:93] Path of hiedb = /tmp/extra-file-46386356845652-2594231-0
I0609 04:20:54.880554 2594231 Builder.hs:94] Repo path = .
I0609 04:20:54.880653 2594231 Builder.hs:453] BEGIN getDefsVertices
I0609 04:20:54.880975 2594231 Builder.hs:453] END getDefsVertices
I0609 04:20:54.881105 2594231 Builder.hs:99] Number of vertices in the graph = 0
I0609 04:20:54.881202 2594231 Builder.hs:155] BEGIN mkFileLinesMap
I0609 04:20:54.881250 2594231 Builder.hs:155] END mkFileLinesMap
I0609 04:20:54.881429 2594231 DefaultMain.hs:44] FAILED buildXrefMapFiles: File line map is empty!!

CallStack (from HasCallStack):
  error, called at glean/lang/haskell/HieDBIndexer/Builder.hs:133:7 in main:HieDBIndexer.Builder
hiedb-indexer: File line map is empty!!
CallStack (from HasCallStack):
  error, called at glean/lang/haskell/HieDBIndexer/Builder.hs:133:7 in main:HieDBIndexer.Builder
E0609 04:20:54.888273 2594178 Work.hs:281] code/5: database failed in parcel 0 of task '': callCommand: /home/dons/Glean/dist-newstyle/build/x86_64-linux/ghc-8.10.7/glean-0.1.0.0/x/hiedb-indexer/build/hiedb-indexer/hiedb-indexer '--service' 'localhost:41303' '--repo-name' 'code' '--repo-hash' '5' '--repo-path' '.' '--dont-create-db' 'Glean/glean/lang/haskell/tests/code' '' (exit 1): failed
*** Exception: callCommand: /home/dons/Glean/dist-newstyle/build/x86_64-linux/ghc-8.10.7/glean-0.1.0.0/x/hiedb-indexer/build/hiedb-indexer/hiedb-indexer '--service' 'localhost:41303' '--repo-name' 'code' '--repo-hash' '5' '--repo-path' '.' '--dont-create-db' 'Glean/glean/lang/haskell/tests/code' '' (exit 1): failed
@pepeiborra
Copy link
Contributor

You have to tell haskell-hie where to find the project root, so that it can locate the source files, unless it's the cwd. I think --source-root is the flag for this.

I don't recall why the indexer needs the source files, it would be easier if it didn't.

We should improve the diagnostic output to explain this and other common problems, otherwise it's pretty hard to use effectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants