Skip to content

No prefixes matched #3734

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

Closed
noughtmare opened this issue Jul 29, 2023 · 5 comments
Closed

No prefixes matched #3734

noughtmare opened this issue Jul 29, 2023 · 5 comments
Labels
component: implicit-hie type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@noughtmare
Copy link
Contributor

noughtmare commented Jul 29, 2023

Your environment

Which OS do you use?

NixOS

Which version of GHC do you use and how did you install it?

9.4.5 from nixpkgs

How is your project built (alternative: link to the project)?

with cabal, see https://github.com/noughtmare/gigaparsec

Which LSP client (editor/plugin) do you use?

VS Codium+vscode-haskell

Which version of HLS do you use and how did you install it?

haskell-language-server version: 1.10.0.0 (GHC: 9.4.5) (PATH: /nix/store/g3mjflh04dizbfgzq0rp6k61sjq6ggp4-haskell-language-server-1.10.0.0/bin/haskell-language-server-wrapper)
From nixpkgs

Have you configured HLS in any way (especially: a hie.yaml file)?

No

Steps to reproduce

optionally: nix-shell -p haskell.compiler.ghc945 haskell.packages.ghc945.haskell-language-server

git clone https://github.com/noughtmare/gigaparsec.git
cd gigaparsec
git checkout 9b41b8b1c1e945599b72bad9166eca401f9c71d0
codium . -n -g experiments/Experiment2.hs

Unfortunately, I wasn't able to reproduce this on an even smaller project.

Expected behaviour

No prefix matching errors.

Actual behaviour

Multi Cradle: No prefixes matched
pwd: /home/user/haskell/gigaparsec
filepath: /home/user/haskell/gigaparsec/experiments/Experiment2.hs
prefixes:
("src",Cabal {component = Just "lib:gigaparsec"})
("examples/Main.hs",Cabal {component = Just "gigaparsec:exe:gpc-examples"})
("tests",Cabal {component = Just "gigaparsec:test:gpc-test"})
("experiments/Experiment1.hs",Cabal {component = Just "gigaparsec:exe:gpc-experiment1"})
("./Experiment2.hs",Cabal {component = Just "gigaparsec:exe:gpc-experiment2"})

Especially that last line seems wrong.

Debug information

Notes

I found out that it works fine if I swap the order of the main-is and hs-source-dirs fields of the gpc-experiment2 component.

@noughtmare noughtmare added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Jul 29, 2023
@fendor
Copy link
Collaborator

fendor commented Jul 29, 2023

Have you tried an explicit hie.yaml with the contents:

cradle:
  cabal:

that should work in all cabal cases.

@noughtmare
Copy link
Contributor Author

noughtmare commented Jul 29, 2023

Thanks, that seems to fix the problem as well.

@fendor
Copy link
Collaborator

fendor commented Jul 29, 2023

Closing in favour of #3695

@fendor fendor closed this as completed Jul 29, 2023
@noughtmare
Copy link
Contributor Author

noughtmare commented Jul 29, 2023

@fendor I don't think that issue subsumes this. In this case the module location should be known to HLS, because it is listed in the cabal file:

executable gpc-experiment2
    import:           common
    main-is:          Experiment2.hs
    hs-source-dirs:   experiments

The problem seems to be that implicit-hie picks up the wrong location for Experiment2.hs. It should be experiments/Experiment2.hs, not ./Experiment2.hs.

@fendor
Copy link
Collaborator

fendor commented Jul 29, 2023

Upstream issue: Avi-D-coder/implicit-hie#1

We aim to migrate away from implicit-hie, or at least generate smarter cradles in the future. That issue at least touches this topic. I will create a meta issue for implicit-hie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: implicit-hie type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants