Skip to content

Commit ff0e4c7

Browse files
committed
Add and update comments
1 parent b549506 commit ff0e4c7

File tree

1 file changed

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

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ type instance RuleResult GetHlintDiagnostics = ()
8989
-- | This rule is recomputed when:
9090
-- | - The files of interest have changed via `getFilesOfInterest`
9191
-- | - One of those files has been edited via
92-
-- | - `getIdeas` -> `getParsedModule`, if the hls ghc matches the hlint default ghc
93-
-- | - `getIdeas` -> `getFileContents` otherwise (hlint is using ghc-lib)
92+
-- | - `getIdeas` -> `getParsedModule` in any case
93+
-- | - `getIdeas` -> `getFileContents` if the hls ghc does not match the hlint default ghc
9494
-- | - The client settings have changed, to honour the `hlintOn` setting, via `getClientConfigAction`
9595
-- | - The hlint specific settings have changed, via `getHlintSettingsRule`
9696
rules :: Rules ()
@@ -119,6 +119,7 @@ rules = do
119119
LSP.Diagnostic {
120120
_range = srcSpanToRange $ ideaSpan idea
121121
, _severity = Just LSP.DsInfo
122+
-- we are encoding the fact that idea has refactorings in diagnostic code
122123
, _code = Just (LSP.StringValue $ T.pack $ codePre ++ ideaHint idea)
123124
, _source = Just "hlint"
124125
, _message = T.pack $ show idea
@@ -265,6 +266,7 @@ codeActionProvider _lf ideState plId docId _ context = Right . LSP.List . map CA
265266
Just . codeAction <$> mkLspCommand plId "applyOne" title (Just args)
266267
where
267268
codeAction cmd = LSP.CodeAction title (Just LSP.CodeActionQuickFix) (Just (LSP.List [diag])) Nothing (Just cmd)
269+
-- we have to recover the original ideaHint removing the prefix
268270
ideaHint = T.replace "refact:" "" code
269271
title = "Apply hint: " <> ideaHint
270272
-- need 'file', 'start_pos' and hint title (to distinguish between alternative suggestions at the same location)

0 commit comments

Comments
 (0)