Skip to content

Commit e71f1c1

Browse files
VenInffendor
andauthored
Apply suggestions from code review
Co-authored-by: fendor <[email protected]>
1 parent 1d6ecde commit e71f1c1

File tree

1 file changed

+10
-9
lines changed
  • plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal

1 file changed

+10
-9
lines changed

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/CabalAdd.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ data CabalAddCommandParams =
114114

115115
instance Logger.Pretty CabalAddCommandParams where
116116
pretty CabalAddCommandParams{..} =
117-
"CabalAdd parameters:\n" Logger.<+>
118-
"| cabal path: " Logger.<+> Logger.pretty cabalPath Logger.<+> "\n" Logger.<+>
119-
"| target: " Logger.<+> Logger.pretty buildTarget Logger.<+> "\n" Logger.<+>
120-
"| dependendency: " Logger.<+> Logger.pretty dependency Logger.<+> "\n" Logger.<+>
121-
"| version: " Logger.<+> Logger.pretty version Logger.<+> "\n"
117+
"CabalAdd parameters:" <+> vcat
118+
[ "cabal path:" <+> pretty cabalPath
119+
, "target:" <+> pretty buildTarget
120+
, "dependendency:" <+> pretty dependency
121+
, "version:" <+> pretty version
122+
]
122123

123124
-- | Gives a code action that calls the command,
124125
-- if a suggestion for a missing dependency is found.
@@ -204,10 +205,10 @@ getDependencyEdit :: MonadIO m => Logger.Recorder (Logger.WithPriority Log) -> (
204205
FilePath -> Maybe String -> NonEmpty String -> ExceptT PluginError m WorkspaceEdit
205206
getDependencyEdit recorder env cabalFilePath buildTarget dependency = do
206207
let (state, caps, verTxtDocId) = env
207-
(mbCnfOrigContents, mbFields, mbPackDescr) <- liftIO $ runAction "cabal.cabal-add" state $ do
208-
contents <- Development.IDE.useWithStale GetFileContents $ toNormalizedFilePath cabalFilePath
209-
inFields <- Development.IDE.useWithStale ParseCabalFields $ toNormalizedFilePath cabalFilePath
210-
inPackDescr <- Development.IDE.useWithStale ParseCabalFile $ toNormalizedFilePath cabalFilePath
208+
runActionE "cabal.cabal-add" state $ do
209+
contents <- useWithStaleE GetFileContents $ toNormalizedFilePath cabalFilePath
210+
inFields <- useWithStaleE ParseCabalFields $ toNormalizedFilePath cabalFilePath
211+
inPackDescr <- useWithStaleE ParseCabalFile $ toNormalizedFilePath cabalFilePath
211212
let mbCnfOrigContents = case snd . fst <$> contents of
212213
Just (Just txt) -> Just $ encodeUtf8 txt
213214
_ -> Nothing

0 commit comments

Comments
 (0)