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

Commit 416c184

Browse files
committed
Fix pluginCommand error messages
1 parent 2bdff3f commit 416c184

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,17 @@ toDynJSON = CD.toDyn
276276
-- arguments in the form of a JSON object.
277277
runPluginCommand :: PluginId -> CommandId -> Value
278278
-> IdeGhcM (IdeResult DynamicJSON)
279-
runPluginCommand p com arg = do
279+
runPluginCommand p@(PluginId pText) com@(CommandId comText) arg = do
280280
m <- getPlugins
281281
case Map.lookup p m of
282282
Nothing -> return $
283-
IdeResultFail $ IdeError UnknownPlugin (T.pack $ "Plugin " <> show p <> " doesn't exist") Null
283+
IdeResultFail $ IdeError UnknownPlugin ("Plugin " <> pText <> " doesn't exist") Null
284284
Just PluginDescriptor { pluginCommands = xs } -> case List.find ((com ==) . commandId) xs of
285285
Nothing -> return $ IdeResultFail $
286-
IdeError UnknownCommand (T.pack $ "Command " <> show com <> " isn't defined for plugin " <> show p <> ". Legal commands are: " <> (show $ map commandId xs)) Null
286+
IdeError UnknownCommand ("Command " <> comText <> " isn't defined for plugin " <> pText <> ". Legal commands are: " <> (T.pack $ show $ map (\(CommandId x) -> x) $ map commandId xs)) Null
287287
Just (PluginCommand _ f) -> case fromJSON arg of
288288
Error err -> return $ IdeResultFail $
289-
IdeError ParameterError (T.pack $ "error while parsing args for " <> show com <> " in plugin " <> show p <> ": " <> err) Null
289+
IdeError ParameterError ("error while parsing args for " <> comText <> " in plugin " <> pText <> ": " <> T.pack err) Null
290290
Success a -> do
291291
res <- f a
292292
return $ fmap toDynJSON res

0 commit comments

Comments
 (0)