jonascarpay / calligraphy

haskell source code visualizer
BSD 3-Clause "New" or "Revised" License
97 stars 13 forks source link

Always "No files matched your search criteria.." #38

Open simonmichael opened 1 month ago

simonmichael commented 1 month ago

Thanks for calligraphy!

I tried every variant of the MODULE argument and working directory I could think of, but I couldn't figure out how to make it find files. Eg in this repo:

~/src/calligraphy$ calligraphy Calligraphy
No files matched your search criteria..
jonascarpay commented 1 month ago

Did you generate HIE files? If I run this in this repo, it correctly produces the call graph for the Calligraphy module: cabal run --ghc-options=-fwrite-ide-info calligraphy -- Calligraphy --stdout-dot

simonmichael commented 1 month ago

(I had forgotten to generate them after switching to the calligraphy repo to test there, but doing so didn't help.)

I have been using stack. Switching to cabal, I can reproduce success with your command cabal run --ghc-options=-fwrite-ide-info calligraphy -- Calligraphy --stdout-dot. But that's the only command I've found that works, so I still have questions:

~/src/calligraphy$ cabal run --ghc-options=-fwrite-ide-info calligraphy -- Calligraphy --stdout-dot  # works
~/src/calligraphy$ calligraphy -- Calligraphy --stdout-dot
Warning: no output options specified, run with --help to see options
simonmichael commented 1 month ago

Ah, I should have removed the -- when I ran calligraphy by itself, then it works normally (my bad). And I think the original failure is because it finds .hie files generated by a cabal build, but not the ones generated by a stack build.

simonmichael commented 1 month ago

(sample hie file locations:) cabal: dist-newstyle/build/aarch64-osx/ghc-9.8.2/calligraphy-0.1.6/build/extra-compilation-artifacts/hie/* stack: .stack-work/dist/aarch64-osx/ghc-9.8.2/build/*

jonascarpay commented 1 month ago

Very strange. For context, this is what happens for me:

$ find . -name '*.hie' | head
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Compat/Debug.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Compat/Lib.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Compat/GHC.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Prelude.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Util/Lens.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Util/LexTree.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Util/Types.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Util/Printer.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Util/Optparse.hie
./dist-newstyle/build/x86_64-linux/ghc-9.2.8/calligraphy-0.1.6/build/Calligraphy/Phases/Parse.hie
$ calligraphy --stdout-dot Calligraphy | head
digraph calligraphy {
    node [style=filled fillcolor="#ffffffcf"];
    graph [outputorder=edgesfirst];
    subgraph cluster_node_0 {
        style=invis;
        node_0 [label="AppConfig",shape=octagon,style="dashed, filled"];
        subgraph cluster_node_1 {
            style=invis;
            node_1 [label="AppConfig",shape=box,style="dashed, filled"];
            node_2 [label="debugConfig",shape=box,style="rounded, dashed, filled"];
jonascarpay commented 1 month ago

Ah, I hadn't seen your new messages. I'm not very familiar with stack, maybe there's an easy way to pick up stack build artifacts too

simonmichael commented 1 month ago

Thanks for your help. Another small improvement might be to have the error say "no .hie files were found, have you built with CMD" - I thought it was failing to find my source files and wasted time on that.