Skip to content

Commit 0a465d2

Browse files
committed
logs, docs
1 parent 7440aa3 commit 0a465d2

File tree

1 file changed

+6
-3
lines changed
  • plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ hiddenPackageSuggestion maxCompletions diag = take maxCompletions $ getMatch (ms
202202

203203
command :: Logger.Recorder (Logger.WithPriority Log) -> CommandFunction IdeState CabalAddCommandParams
204204
command recorder state _ params@(CabalAddCommandParams {cabalPath = path, verTxtDocId = verTxtDocId, buildTarget = target, dependency = dep, version = mbVer}) = do
205-
Logger.logWith recorder Logger.Info $ LogCalledCabalAddCommand params
205+
Logger.logWith recorder Logger.Debug $ LogCalledCabalAddCommand params
206206
let specifiedDep = case mbVer of
207207
Nothing -> dep
208208
Just ver -> dep <> " ^>=" <> ver
209209
caps <- lift pluginGetClientCapabilities
210210
let env = (state, caps, verTxtDocId)
211211
edit <- getDependencyEdit recorder env path target (fromList [T.unpack specifiedDep])
212212
void $ lift $ pluginSendRequest SMethod_WorkspaceApplyEdit (ApplyWorkspaceEditParams Nothing edit) (\_ -> pure ())
213-
Logger.logWith recorder Logger.Info LogExecutedCommand
213+
Logger.logWith recorder Logger.Debug LogExecutedCommand
214214
pure $ InR Null
215215

216216
-- | Constructs prerequisites for the @executeConfig@
@@ -259,7 +259,7 @@ getDependencyEdit recorder env cabalFilePath buildTarget dependency = do
259259
Nothing -> throwE $ PluginInternalError $ T.pack $ "Cannot extend build-depends in " ++ cabalFilePath
260260
Just newContents -> do
261261
let edit = diffText caps (verTxtDocId, T.decodeUtf8 cnfOrigContents) (T.decodeUtf8 newContents) SkipDeletions
262-
Logger.logWith recorder Logger.Info $ LogCreatedEdit edit
262+
Logger.logWith recorder Logger.Debug $ LogCreatedEdit edit
263263
pure edit
264264

265265
-- | Given a path to a haskell file, returns the closest cabal file.
@@ -283,6 +283,9 @@ findResponsibleCabalFile haskellFilePath = do
283283
-- | Gives cabal file's contents or throws error.
284284
-- Inspired by @readCabalFile@ in cabal-add,
285285
-- Distribution.Client.Main
286+
--
287+
-- This is a fallback option!
288+
-- Use only if the `GetFileContents` fails.
286289
readCabalFile :: MonadIO m => FilePath -> ExceptT PluginError m ByteString
287290
readCabalFile fileName = do
288291
cabalFileExists <- liftIO $ doesFileExist fileName

0 commit comments

Comments
 (0)