Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit a9ea9a5

Browse files
committed
Update Signatures to use Package
1 parent 1999dab commit a9ea9a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Haskell/Ide/Engine/Plugin/Package.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ data AddParams = AddParams
6969
-- library/executable/test-suite you want to
7070
-- add the package to. May be a realtive oir
7171
-- absolute path, thus, must be normalised.
72-
, packageParam :: T.Text -- ^ The name of the package to add.
72+
, packageParam :: Package -- ^ The name of the package to add.
7373
}
7474
deriving (Eq, Show, Read, Generic, ToJSON, FromJSON)
7575

@@ -296,7 +296,7 @@ codeActionProvider plId docId _ context = do
296296
concatPkgs = concatMap (\(d, ts) -> map (d,) ts)
297297

298298
-- | Create the Add Package Action with the given diagnostics and the found package name.
299-
mkAddPackageAction :: Maybe FilePath -> J.Diagnostic -> T.Text -> IdeM (Maybe J.CodeAction)
299+
mkAddPackageAction :: Maybe FilePath -> J.Diagnostic -> Package -> IdeM (Maybe J.CodeAction)
300300
mkAddPackageAction mRootDir diag pkgName = case (mRootDir, J.uriToFilePath (docId ^. J.uri)) of
301301
(Just rootDir, Just docFp) -> do
302302
let title = "Add " <> pkgName <> " as a dependency"
@@ -305,12 +305,12 @@ codeActionProvider plId docId _ context = do
305305
return $ Just (J.CodeAction title (Just J.CodeActionQuickFix) (Just (J.List [diag])) Nothing (Just cmd))
306306
_ -> return Nothing
307307

308-
getAddablePackages :: J.Diagnostic -> Maybe (J.Diagnostic, T.Text)
308+
getAddablePackages :: J.Diagnostic -> Maybe (J.Diagnostic, Package)
309309
getAddablePackages diag@(J.Diagnostic _ _ _ (Just "ghcmod") msg _) = (diag,) <$> extractModuleName msg
310310
getAddablePackages _ = Nothing
311311

312312
-- | Extract a module name from an error message.
313-
extractModuleName :: T.Text -> Maybe T.Text
313+
extractModuleName :: T.Text -> Maybe Package
314314
extractModuleName msg
315315
| T.isPrefixOf "Could not find module " msg = Just $ T.tail $ T.init nameAndQuotes
316316
| T.isPrefixOf "Could not load module " msg = Just $ T.tail $ T.init nameAndQuotes

0 commit comments

Comments
 (0)