Skip to content

Commit 21b47f2

Browse files
committed
Remove hlint parser error from diagnostics
1 parent 73f669d commit 21b47f2

File tree

1 file changed

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

1 file changed

+3
-13
lines changed

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ rules = do
103103
diagnostics :: NormalizedFilePath -> Either ParseError [Idea] -> [FileDiagnostic]
104104
diagnostics file (Right ideas) =
105105
[(file, ShowDiag, ideaToDiagnostic i) | i <- ideas, ideaSeverity i /= Ignore]
106-
diagnostics file (Left parseErr) =
107-
[(file, ShowDiag, parseErrorToDiagnostic parseErr)]
106+
-- We don't return parse errors as diagnostics cause they match the emitted ones
107+
-- by ghc and they would be duplicated
108+
diagnostics file (Left parseErr) = []
108109

109110
ideaToDiagnostic :: Idea -> Diagnostic
110111
ideaToDiagnostic idea =
@@ -118,17 +119,6 @@ rules = do
118119
, _tags = Nothing
119120
}
120121

121-
parseErrorToDiagnostic :: ParseError -> Diagnostic
122-
parseErrorToDiagnostic (Hlint.ParseError l msg contents) =
123-
LSP.Diagnostic {
124-
_range = srcSpanToRange l
125-
, _severity = Just LSP.DsInfo
126-
, _code = Just (LSP.StringValue "parser")
127-
, _source = Just "hlint"
128-
, _message = T.unlines [T.pack msg,T.pack contents]
129-
, _relatedInformation = Nothing
130-
, _tags = Nothing
131-
}
132122
-- This one is defined in Development.IDE.GHC.Error but here
133123
-- the types could come from ghc-lib or ghc
134124
srcSpanToRange :: SrcSpan -> LSP.Range

0 commit comments

Comments
 (0)