-
Notifications
You must be signed in to change notification settings - Fork 206
ghc-mod should be told which version of cabal to use #1373
Comments
Actually the args that are passed to It will basically happen starting from cabal So the actual solution is probably to support v2 properly in HIE. |
Great. Cabal-install 3 is out so would PRs of this nature be welcome? |
Do you mean do add PRs to ghc-mod to support cabal v2? |
@TomMD I'm very fuzzy on the details here, but shouldn't the decision be based on the version of |
@pigmej Do you know where that |
@masaeedu No, that seems the wrong decision. It is unlikely anyone is running a version of cabal that only supports v1 style. All recent cabals support v1 and v2. My specific issue, which I'm guessing is or will be common, is that cabal v2 projects contain many cabal packages. If you use some ugly heuristic, such as looking for You see this issue doesn't lend itself to a heuristic based on files in the local directory nor does it lend itself to a guess based on the version of cabal. Personally I always start my editor from the project directory so there shouldn't be any need to guess but, as mentioned, the current working directory is being changed and tools including cabal wrapper and ghc-mod are quite confused even when I change the hie-passed argument to |
@masaeedu "v1-style" is being passed by a submodule in |
@TomMD I'm using cabal 3, and I just want to use "v3-style" (which is what you get by default by using the |
No, there is no such thing as You can read the docs for what these operations do - they are off topic for this issue. |
Thanks. I'm aware of the distinction between |
Btw, do you have a branch or PR somewhere with your changes to get hie to invoke In my case I don't have any subprojects, so I'm hoping simply passing v2 instead of v1 will make things work. |
You need to Just changing the |
Thanks. I was looking for that in DanielG's repo instead of the fork, that's why I wasn't seeing it ( Would taking the approach of making v2 the default without regard to existence of Specifically, in this check:
If we instead do something like:
Then it will choose That doesn't solve the issue with subpackages that you're mentioning, but it should fix single-cabal file projects, no? |
There is no ghc-mod anymore and we default to nix-style builds for cabal. |
The below was found when using HIE on a cabal v2 project in which the top level directory had a cabal.project with packages in subdirectories containing the .cabal files. I would invoke neovim/hie from the project directory and open a file for editing such as
$TOP/$package/src/file.hs
.ghc-mod uses cabal
configure
ornew-configure
conditionally based on a heuristic of checking fordist-newstyle
in a working directory (seecore/GhcMod/CabalHelper.hs
for the config vs new-config andcore/GhcMod/Cradle
for the directory heuristic). If no newstyle directory is found it assumes v1.A quicker fix for HIE might be to not change the working directory to begin with... not sure where that is done honestly. I start neovim/hie-wrapper in the top level directory (project) but clearly ghc-mod is seeing the subdirectory (package).
The text was updated successfully, but these errors were encountered: