Skip to content

Commit

Permalink
better filter loading files
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Nov 3, 2024
1 parent ea002d7 commit c78b197
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ packages:
./ghcide
./hls-plugin-api
./hls-test-utils
-- ../hiebios


index-state: 2024-10-21T00:00:00Z
Expand Down Expand Up @@ -46,3 +47,8 @@ constraints:
if impl(ghc >= 9.9)
-- https://github.com/haskell/haskell-language-server/issues/4324
benchmarks: False

source-repository-package
type: git
location: https://github.com/soulomoon/hie-bios.git
tag: 7dd19b547ba30b760053b5f796c439cba6ac6a07
5 changes: 4 additions & 1 deletion ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,10 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
| otherwise -> return (([renderPackageSetupException cfp GhcVersionMismatch{..}], Nothing),[])
-- Failure case, either a cradle error or the none cradle
Left err -> do
errors <- mapM (makeError hieYaml cradle err) $ Set.toList pendingFiles
let failedLoadingFiles = nub $ cfp:concatMap cradleErrorLoadingFiles err

Check warning on line 661 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in loadSessionWithOptions in module Development.IDE.Session: Use nubOrd ▫︎ Found: "nub" ▫︎ Perhaps: "nubOrd"
let remainPendingFiles = Set.delete cfp $ pendingFiles `Set.difference` Set.fromList failedLoadingFiles
atomically $ forM_ remainPendingFiles (writeTQueue pendingFilesTQueue)
errors <- mapM (makeError hieYaml cradle err) $ failedLoadingFiles

Check warning on line 664 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in loadSessionWithOptions in module Development.IDE.Session: Redundant $ ▫︎ Found: "mapM (makeError hieYaml cradle err) $ failedLoadingFiles" ▫︎ Perhaps: "mapM (makeError hieYaml cradle err) failedLoadingFiles"
return ((concat errors, Nothing), maybe [] pure hieYaml ++ concatMap cradleErrorDependencies err)

let
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data CradleErrorDetails =
Depicts the cradle error in a user-friendly way.
-}
renderCradleError :: CradleError -> Cradle a -> NormalizedFilePath -> FileDiagnostic
renderCradleError (CradleError deps _ec ms) cradle nfp
renderCradleError (CradleError deps _ec ms _fps) cradle nfp
| HieBios.isCabalCradle cradle =
let (fp, showDiag, diag) = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) nfp $ T.unlines $ map T.pack userFriendlyMessage in
(fp, showDiag, diag{_data_ = Just $ Aeson.toJSON CradleErrorDetails{cabalProjectFiles=absDeps}})
Expand Down

0 comments on commit c78b197

Please sign in to comment.