diff --git a/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs b/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs index 92039aa39..a93dcb393 100644 --- a/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs +++ b/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs @@ -201,7 +201,10 @@ Just (Ex (ProjLocV2File { plProjectDirV2 = "/Foo/"})) In the given example, it is not guaranteed which project type is found, it is only guaranteed that it will not identify the project -as a cabal v1-project. +as a cabal v1-project. Note that with cabal-helper version (1.0), +by default a *.cabal file is identified as a 'ProjLocV2Dir' project. +The same issue as before exists and we look for a 'ProjLocV2File' or +'ProjLocStackYaml' before deciding that 'ProjLocV2Dir' marks the project root. Note that this will not return any project types for which the corresponding build tool is not on the PATH. This is "stack" and "cabal" for stack and cabal @@ -219,13 +222,13 @@ findCabalHelperEntryPoint fp = do let supportedProjs = filter (\x -> supported x isStackInstalled isCabalInstalled) allProjs debugm $ "These projects have the build tools installed: " ++ show (map (\(Ex x) -> show x) supportedProjs) - case filter (\p -> isCabalNewProject p || isStackProject p) supportedProjs of + case filter (\p -> isCabalV2FileProject p || isStackProject p) supportedProjs of (x:_) -> return $ Just x - [] -> case filter isCabalOldProject supportedProjs of + [] -> case filter isCabalProject supportedProjs of (x:_) -> return $ Just x [] -> return Nothing where - supported :: (Ex ProjLoc) -> Bool -> Bool -> Bool + supported :: Ex ProjLoc -> Bool -> Bool -> Bool supported (Ex ProjLocStackYaml {}) stackInstalled _ = stackInstalled supported (Ex ProjLocV2Dir {}) _ cabalInstalled = cabalInstalled supported (Ex ProjLocV2File {}) _ cabalInstalled = cabalInstalled @@ -235,13 +238,14 @@ findCabalHelperEntryPoint fp = do isStackProject (Ex ProjLocStackYaml {}) = True isStackProject _ = False - isCabalNewProject (Ex ProjLocV2Dir {}) = True - isCabalNewProject (Ex ProjLocV2File {}) = True - isCabalNewProject _ = False + isCabalV2FileProject (Ex ProjLocV2File {}) = True + isCabalV2FileProject _ = False - isCabalOldProject (Ex ProjLocV1Dir {}) = True - isCabalOldProject (Ex ProjLocV1CabalFile {}) = True - isCabalOldProject _ = False + isCabalProject (Ex ProjLocV1CabalFile {}) = True + isCabalProject (Ex ProjLocV1Dir {}) = True + isCabalProject (Ex ProjLocV2File {}) = True + isCabalProject (Ex ProjLocV2Dir {}) = True + isCabalProject _ = False {- | Given a FilePath, find the cradle the FilePath belongs to.