From 983f0523bee96fb3ad9e783c194ee2e95d569536 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Mon, 25 Jan 2021 00:09:06 +0000 Subject: [PATCH] Do not error out on failed rewrite The error call was only for diagnostics, so I have replaced it with a debug trace (commented out) --- ghcide/src/Development/IDE/Plugin/CodeAction.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghcide/src/Development/IDE/Plugin/CodeAction.hs b/ghcide/src/Development/IDE/Plugin/CodeAction.hs index 1dbddf9e6a..d14023f349 100644 --- a/ghcide/src/Development/IDE/Plugin/CodeAction.hs +++ b/ghcide/src/Development/IDE/Plugin/CodeAction.hs @@ -97,8 +97,10 @@ codeAction lsp state _ (TextDocumentIdentifier uri) _range CodeActionContext{_di , Just ps <- [annotatedPS] , Just dynflags <- [df] , (title, graft) <- suggestExactAction exportsMap dynflags ps x - , let edit = either error id $ - rewriteToEdit dynflags uri (annsA ps) graft + , Right edit <- + [ -- either (Left . traceShow) Right $ + rewriteToEdit dynflags uri (annsA ps) graft + ] ] actions'' = caRemoveRedundantImports parsedModule text diag xs uri <> actions