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

Multi Cradle: No prefixes matched when editing Setup.hs #3710

Closed
k355l3r-5yndr0m3 opened this issue Jul 11, 2023 · 4 comments
Closed

Multi Cradle: No prefixes matched when editing Setup.hs #3710

k355l3r-5yndr0m3 opened this issue Jul 11, 2023 · 4 comments
Labels
build tool: cabal build tool: stack type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@k355l3r-5yndr0m3
Copy link

Your environment

Arch Linux
Cabal
Neovim (lsp-config)

Steps to reproduce

  1. Create new project
  2. Change build-type to Custom
build-type:         Custom
custom-setup
  setup-depends:
    base,
    Cabal
  1. Create a Setup.hs file and build
  2. Open Setup.hs

Expected behaviour

hls works seamlessly on Setup.hs

Actual behaviour

hls output this error

Multi Cradle: No prefixes matched
pwd: /home/cha0s/testing
filepath: /home/cha0s/testing/Setup.hs
prefixes:
("app/Main.hs",Cabal {component = Just "testing:exe:testing"})

Debug information

I found this reddit post describing something similar but Stack is used instead.
The custom build script Setup.hs is the only file affected, the other seems to work fine.

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

fendor commented Jul 12, 2023

Hi!

Unfortunately, this is simply not supported at this time. Here is an issue for the underlying hie-bios issue: haskell/hie-bios#208

@k355l3r-5yndr0m3
Copy link
Author

That's a bit disappointing, but I've managed to figure out a temporary solution. Adding an hie.yaml file with the following content.

cradle:
  cabal:

will change the error into something like this.

   Error: cabal: Failed extracting script block: `{- cabal:` start marker not
   found

Inserting the following lines at the top of the Setup.hs file will fix it and allow hls to function.

{- cabal: 
build-depends: base,
               Cabal
-}

If Setup.hs depends on other packages, you would need to add it both to the .cabal file and Setup.hs/

@fendor
Copy link
Collaborator

fendor commented Jul 12, 2023

I did not know this was possible. Thank you very much for this workaround :)

@fendor
Copy link
Collaborator

fendor commented Jul 31, 2023

Closing in favour of #3735 which also documents this workaround

@fendor fendor closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: cabal build tool: stack 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