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 for ./app/devel.hs #1215

Closed
milosavljevic94 opened this issue Jan 16, 2021 · 5 comments
Closed

Multi Cradle : No prefixes matched for ./app/devel.hs #1215

milosavljevic94 opened this issue Jan 16, 2021 · 5 comments
Labels
component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@milosavljevic94
Copy link

milosavljevic94 commented Jan 16, 2021

My environment for develop Haskell/Yesod app : Ubuntu 20.04, VS Code, Haskell plugin and Stack.
Without plugin don't have error, but when plugin is installed error is:

Multi Cradle: No prefixes matched
pwd: /home/nemanja/Diplomski projekat/Manifestation
filepath: /home/nemanja/Diplomski projekat/Manifestation/app/devel.hs
prefixes:
("./src",Stack {component = Just "Manifestation:lib", stackYaml = Nothing})
("./app/main.hs",Stack {component = Just "Manifestation:exe:Manifestation", stackYaml = Nothing})
("./app/DevelMain.hs",Stack {component = Just "Manifestation:exe:Manifestation", stackYaml = Nothing})
("./app/Paths_Manifestation.hs",Stack {component = Just "Manifestation:exe:Manifestation", stackYaml = Nothing})
("./test",Stack {component = Just "Manifestation:test:Manifestation-test", stackYaml = Nothing})

And always get notifications in VS Code :

No cradle found for app/devel.hs.
Proceeding with implicit cradle.
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.

If someone can solve, thanks!

@jneira jneira added component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. type: setup labels Jan 16, 2021
@jneira
Copy link
Member

jneira commented Jan 16, 2021

Hi, thanks for the bug report. The cradle is esentially a configuration that maps filepaths with "components" (libs, executables, test suites, etc). The module you want to load with hls has to match one of the prefixes, and app/devel.hsdoes not match any. I guess that file is not listed in the build config files (.cabal or package.yaml). The implicit configuration uses those config files to generate those prefixes.
So you should have be able to open ./app/main.hs for example, as it is listed in that configuration

You can use an explicit configuration, creating a hie.yaml file in the project root listing the prefixes and try to add devel.hs to load it in the ide: see https://github.com/haskell/haskell-language-server#configuring-your-project-build for mor info

@milosavljevic94
Copy link
Author

Thank you @jneira !
I created something like:

cradle:
  stack:
  - path : "./app/devel.hs"
    component: "Manifestation:lib"

in hie.yaml and error is missing.

Now I get a new one, maybe you know how to solve because they may be related :

Could not load module ‘Application’
It is a member of the hidden package ‘Manifestation-0.0.0’.
You can run ‘:set -package Manifestation’ to expose it.
(Note: this unloads all the modules in the current scope.) 

@jneira
Copy link
Member

jneira commented Jan 16, 2021

@milosavljevic94 that hie.yaml would be incomplete, it should list all posible paths with modules in your project
to create a initial complete file you can run stack install implicit-hie && gen-hie > hie.yaml, and you can add there

- path : "./app/devel.hs"
    component: "Manifestation:lib"

Could you share the code you are trying to load in the ide?

@milosavljevic94
Copy link
Author

@jneira, I use this command to make hie file.
I got the initial file and added the problematic path like :

  • path: "./app/devel.hs"
    component: "Manifestation:exe:Manifestation"

and now there are no more errors.

Thanks a lot, now I can continue working without errors in VS code.

@jneira jneira changed the title Multi Cradle : No prefixes matched Multi Cradle : No prefixes matched for ./app/devel.hs Jan 17, 2021
@jneira
Copy link
Member

jneira commented Jan 17, 2021

great! thanks for reporting the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hie-bios 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