Skip to content

Commit e6c866f

Browse files
committed
Limit CodeActions within passed range
Return only actions within range specified by client.
1 parent 9f8a172 commit e6c866f

File tree

1 file changed

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

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,16 @@ getHlintSettingsRule usage =
268268
-- ---------------------------------------------------------------------
269269

270270
codeActionProvider :: PluginMethodHandler IdeState TextDocumentCodeAction
271-
codeActionProvider ideState plId (CodeActionParams _ _ docId _ context) = Right . LSP.List . map InR <$> liftIO getCodeActions
271+
codeActionProvider ideState plId (CodeActionParams _ _ docId codeActionRange context) = Right . LSP.List . map InR <$> liftIO getCodeActions
272272
where
273-
274273
getCodeActions = do
275274
diags <- getDiagnostics ideState
276275
let docNfp = toNormalizedFilePath' <$> uriToFilePath' (docId ^. LSP.uri)
277276
numHintsInDoc = length
278-
[d | (nfp, _, d) <- diags
277+
[d | (nfp, _, d@LSP.Diagnostic{_range=range}) <- diags
279278
, validCommand d
280279
, Just nfp == docNfp
280+
, subRange range codeActionRange
281281
]
282282
-- We only want to show the applyAll code action if there is more than 1
283283
-- hint in the current document

0 commit comments

Comments
 (0)