Skip to content

Commit 8b8e568

Browse files
committed
Fix apply refactoring
1 parent 1c1f7f3 commit 8b8e568

File tree

1 file changed

+4
-3
lines changed
  • plugins/hls-hlint-plugin/src/Ide/Plugin

1 file changed

+4
-3
lines changed

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ rules = do
119119
LSP.Diagnostic {
120120
_range = srcSpanToRange $ ideaSpan idea
121121
, _severity = Just LSP.DsInfo
122-
, _code = Just $ (LSP.StringValue $ T.pack $ codePre ++ ideaHint idea)
122+
, _code = Just (LSP.StringValue $ T.pack $ codePre ++ ideaHint idea)
123123
, _source = Just "hlint"
124124
, _message = T.pack $ show idea
125125
, _relatedInformation = Nothing
@@ -265,9 +265,10 @@ codeActionProvider _lf ideState plId docId _ context = Right . LSP.List . map CA
265265
Just . codeAction <$> mkLspCommand plId "applyOne" title (Just args)
266266
where
267267
codeAction cmd = LSP.CodeAction title (Just LSP.CodeActionQuickFix) (Just (LSP.List [diag])) Nothing (Just cmd)
268-
title = T.replace "refact:" "Apply hint: " code
268+
ideaHint = T.replace "refact:" "" code
269+
title = "Apply hint: " <> ideaHint
269270
-- need 'file', 'start_pos' and hint title (to distinguish between alternative suggestions at the same location)
270-
args = [toJSON (AOP (docId ^. LSP.uri) start code)]
271+
args = [toJSON (AOP (docId ^. LSP.uri) start ideaHint)]
271272
mkHlintAction (LSP.Diagnostic _r _s _c _source _m _ _) = return Nothing
272273

273274
-- ---------------------------------------------------------------------

0 commit comments

Comments
 (0)