Spurious errors from extra-project Haskell files.
I have some Haskell files in my project directory outside of the traditional ./src/, ./app/ and ./test/ directories. Examples are ./dev-tools.hs where I keep some things I like to use in GHCi, and ./.cache/hie-bios/.../Paths_mwb.hs.
Haskell plugin reports errors in these files and tries to set up a multi-cradle project, but I would prefer if it didn't since they are not part of my actual project source.
Is there a way to tell the plugin to only trigger for Haskell files in specific directories?
I think defining an explicit hie.yaml will restrict HLS to the specified directories.
This might be helpful for generating the file: https://github.com/Avi-D-coder/implicit-hie
Thanks, @ilyakooo0! I actually tried this, following the advice on their readme (https://github.com/mpickering/hie-bios#ignoring-directories-1).
My config looked like this:
cradle:
multi:
- path: "./.cache"
config:
cradle:
none:
- path: "./"
config:
cradle:
cabal:
- path: "./src"
component: ...
- path: "./app"
component: ...
- path: "./test"
component: ...
(The ...s above are metasyntactic, as the true values there are incidental to the discussion.)
Unfortunately, when I closed and restarted VS Code, vscode-haskell complained that it could not determine the appropriate GHC version :-/
Oh, I am a fool! That error is being reported in ~/.config/... not in <project_root>/.config/.... Maybe this is a different problem, then. I get build errors and Multi Cradle errors reported from my Paths_<project_name>.hs files.
This is what I'm seeing every time I open my project:
Here are my config files:
- hie.yaml
cradle:
cabal:
- path: "./src"
component: ...
- path: "./test"
component: ...
- path: "./app"
component: ...
- path: "./one-off-task"
component: ...
- .vscode/settings.json
{
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.tabSize": 2,
"haskell.formattingProvider": "ormolu",
"haskell.formatOnImportOn": true,
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix",
}
hi, thanks for the bug report, maybe delete the cache mentioned in the error could help
Did you try opening the Paths_ module? That might produce such errors. (So the suggestion would be, to not do that :) )
I failed to reproduce the issue manually, can you maybe share a project or a minimal example?
Hello, I am having similar issues as well, this is my hie.yaml:
cradle:
multi:
- path: ./examples/ast
config:
cradle:
none:
- path: ./
config:
cradle:
cabal:
cabalProject: ./cabal.project.dev
components:
- path: ./src
component: lib:jbeam-edit
- path: ./src-extra/transformation
component: jbeam-edit:lib:jbeam-edit-transformation
- path: ./app
component: exe:jbeam-edit
- path: ./tools/dump_ast
component: exe:jbeam-edit-dump-ast
- path: ./test
component: test:jbeam-edit-test
https://github.com/webdevred/jbeam_edit/blob/master/hie.yaml
I am getting errror messages whenever opening my AST dumps from my software and I wish I could avoid those errors. I could rename them to something else but I like having the syntax highlighting for them whenever opening the examples. But at same time, since they are generated and intended to be loaded with read by my software they will not be able work in HLS. Or am I doing something wrong by calling my AST dumps *.hs?
Here are messages from my log, it seems like it detects I want to use none cradle but still it tries to start HLS for the file?
661:2025-10-12T16:39:06.764721Z | Debug | hlint: Getting hlint ideas for NormalizedFilePath "/home/debbie/jbeam-edit/examples/ast/jbfl/complex.hs"
706:2025-10-12T16:39:06.769148Z | Info | Cradle path: examples/ast/jbfl/complex.hs
710:2025-10-12T16:39:06.769643Z | Info | None cradle found for /home/debbie/jbeam-edit/examples/ast/jbfl/complex.hs , ignoring the file
Files that failed:
* /home/debbie/jbeam-edit/examples/ast/jbfl/complex.hs*
Edit: I realize that modules not starting without capital letter are unconventional but imo it shouldnt matter since I use a none cradle.