File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ getDependencyEdit recorder env cabalFilePath buildTarget dependency = do
277
277
logWith recorder Debug $ LogCreatedEdit edit
278
278
pure edit
279
279
280
- -- | Given a path to a haskell file, returns the closest cabal file.
280
+ -- | Given a path to a haskell file, returns the closest cabal file, except if package.yaml is also present .
281
281
-- If cabal file wasn't found, gives Nothing.
282
282
findResponsibleCabalFile :: FilePath -> IO (Maybe FilePath )
283
283
findResponsibleCabalFile haskellFilePath = do
@@ -293,7 +293,12 @@ findResponsibleCabalFile haskellFilePath = do
293
293
cabalFiles <- filterM (\ c -> doesFileExist c) objectsCabalExtension
294
294
case safeHead cabalFiles of
295
295
Nothing -> go ps
296
- Just cabalFile -> pure $ Just cabalFile
296
+ Just cabalFile -> guardAgainstHpack path cabalFile
297
+ where
298
+ guardAgainstHpack :: FilePath -> FilePath -> IO (Maybe FilePath )
299
+ guardAgainstHpack path cabalFile = do
300
+ exists <- doesFileExist $ path </> " package.yaml"
301
+ if exists then pure Nothing else pure $ Just cabalFile
297
302
298
303
-- | Gives cabal file's contents or throws error.
299
304
-- Inspired by @readCabalFile@ in cabal-add,
You can’t perform that action at this time.
0 commit comments