@@ -89,8 +89,8 @@ type instance RuleResult GetHlintDiagnostics = ()
89
89
-- | This rule is recomputed when:
90
90
-- | - The files of interest have changed via `getFilesOfInterest`
91
91
-- | - 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
94
94
-- | - The client settings have changed, to honour the `hlintOn` setting, via `getClientConfigAction`
95
95
-- | - The hlint specific settings have changed, via `getHlintSettingsRule`
96
96
rules :: Rules ()
@@ -119,6 +119,7 @@ rules = do
119
119
LSP. Diagnostic {
120
120
_range = srcSpanToRange $ ideaSpan idea
121
121
, _severity = Just LSP. DsInfo
122
+ -- we are encoding the fact that idea has refactorings in diagnostic code
122
123
, _code = Just (LSP. StringValue $ T. pack $ codePre ++ ideaHint idea)
123
124
, _source = Just " hlint"
124
125
, _message = T. pack $ show idea
@@ -265,6 +266,7 @@ codeActionProvider _lf ideState plId docId _ context = Right . LSP.List . map CA
265
266
Just . codeAction <$> mkLspCommand plId " applyOne" title (Just args)
266
267
where
267
268
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
268
270
ideaHint = T. replace " refact:" " " code
269
271
title = " Apply hint: " <> ideaHint
270
272
-- need 'file', 'start_pos' and hint title (to distinguish between alternative suggestions at the same location)
0 commit comments