Skip to content

Commit 4e38e8d

Browse files
committed
Use new pretty instances
1 parent 5d1e7bb commit 4e38e8d

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

ghcide/src/Development/IDE/Plugin/HLS.hs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,15 @@ instance Pretty Log where
6565
LogPluginError (PluginId pId) err ->
6666
pretty pId <> ":" <+> pretty err
6767
LogResponseError (PluginId pId) err ->
68-
pretty pId <> ":" <+> prettyResponseError err
68+
pretty pId <> ":" <+> pretty err
6969
LogNoPluginForMethod (Some method) ->
70-
"No plugin enabled for " <> pretty (show method)
70+
"No plugin enabled for " <> pretty method
7171
LogInvalidCommandIdentifier-> "Invalid command identifier"
7272
ExceptionInPlugin plId (Some method) exception ->
7373
"Exception in plugin " <> viaShow plId <> " while processing "
74-
<> viaShow method <> ": " <> viaShow exception
74+
<> pretty method <> ": " <> viaShow exception
7575
instance Show Log where show = renderString . layoutCompact . pretty
7676

77-
-- various error message specific builders
78-
prettyResponseError :: ResponseError -> Doc a
79-
prettyResponseError err = errorCode <> ":" <+> errorBody
80-
where
81-
errorCode = pretty $ show $ err ^. L.code
82-
errorBody = pretty $ err ^. L.message
83-
8477
noPluginEnabled :: Recorder (WithPriority Log) -> SMethod m -> [PluginId] -> IO (Either ResponseError c)
8578
noPluginEnabled recorder m fs' = do
8679
logWith recorder Warning (LogNoPluginForMethod $ Some m)

hls-plugin-api/src/Ide/Plugin/Resolve.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ instance Pretty Log where
4141
DoesNotSupportResolve fallback->
4242
"Client does not support resolve," <+> pretty fallback
4343
ApplyWorkspaceEditFailed err ->
44-
"ApplyWorkspaceEditFailed:" <+> viaShow err
44+
"ApplyWorkspaceEditFailed:" <+> pretty err
4545

4646
-- |When provided with both a codeAction provider and an affiliated codeAction
4747
-- resolve provider, this function creates a handler that automatically uses

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ instance Pretty Log where
7575
"Determined completion context:"
7676
<+> viaShow context
7777
<+> "for cursor position:"
78-
<+> viaShow position
78+
<+> pretty position
7979
LogCompletions logs -> pretty logs
8080

8181
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ data Log
2727

2828
instance Pretty Log where
2929
pretty = \case
30-
LogFileSplitError pos -> "An error occured when trying to separate the lines of the cabal file at position:" <+> viaShow pos
30+
LogFileSplitError pos -> "An error occured when trying to separate the lines of the cabal file at position:" <+> pretty pos
3131
LogUnknownKeyWordInContextError kw ->
3232
"Lookup of key word failed for:" <+> viaShow kw
3333
LogUnknownStanzaNameInContextError sn ->
3434
"Lookup of stanza name failed for:" <+> viaShow sn
3535
LogFilePathCompleterIOError fp ioErr ->
36-
"When trying to complete the file path:" <+> viaShow fp <+> "the following unexpected IO error occured" <+> viaShow ioErr
36+
"When trying to complete the file path:" <+> pretty fp <+> "the following unexpected IO error occured" <+> viaShow ioErr
3737
LogUseWithStaleFastNoResult -> "Package description couldn't be read"
38-
LogMapLookUpOfKnownKeyFailed key -> "Lookup of key in map failed even though it should exist" <+> viaShow key
38+
LogMapLookUpOfKnownKeyFailed key -> "Lookup of key in map failed even though it should exist" <+> pretty key
3939

4040
type instance RuleResult ParseCabal = Parse.GenericPackageDescription
4141

plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ data Log
7373
instance Pretty Log where
7474
pretty = \case
7575
LogShake logMsg -> pretty logMsg
76-
LogWAEResponseError rspErr -> "RequestWorkspaceApplyEdit Failed with " <+> viaShow rspErr
76+
LogWAEResponseError rspErr -> "RequestWorkspaceApplyEdit Failed with " <+> pretty rspErr
7777
LogResolve msg -> pretty msg
7878

7979
-- | The "main" function of a plugin

0 commit comments

Comments
 (0)