ghcide-2.9.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Types.Diagnostics

Synopsis

- data Diagnostic = Diagnostic {
  - _range :: Range
  - _severity :: Maybe DiagnosticSeverity
  - _code :: Maybe (Int32 |? Text)
  - _codeDescription :: Maybe CodeDescription
  - _source :: Maybe Text
  - _message :: Text
  - _tags :: Maybe [DiagnosticTag]
  - _relatedInformation :: Maybe [DiagnosticRelatedInformation]
  - _data_ :: Maybe Value
  }
- data ShowDiagnostic
  - = ShowDiag
  - | HideDiag
- type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic)
- type IdeResult v = ([FileDiagnostic], Maybe v)
- data DiagnosticSeverity
  - = DiagnosticSeverity_Error
  - | DiagnosticSeverity_Warning
  - | DiagnosticSeverity_Information
  - | DiagnosticSeverity_Hint
- type DiagnosticStore = HashMap NormalizedUri StoreItem
- ideErrorText :: NormalizedFilePath -> Text -> FileDiagnostic
- ideErrorWithSource :: Maybe Text -> Maybe DiagnosticSeverity -> a -> Text -> (a, ShowDiagnostic, Diagnostic)
- showDiagnostics :: [FileDiagnostic] -> Text
- showDiagnosticsColored :: [FileDiagnostic] -> Text
- type IdeResultNoDiagnosticsEarlyCutoff v = (Maybe ByteString, Maybe v)

# Documentation

data Diagnostic #

Constructors

Diagnostic |

Fields

- _range :: Range
- _severity :: Maybe DiagnosticSeverity
- _code :: Maybe (Int32 |? Text)
- _codeDescription :: Maybe CodeDescription
- _source :: Maybe Text
- _message :: Text
- _tags :: Maybe [DiagnosticTag]
- _relatedInformation :: Maybe [DiagnosticRelatedInformation]
- _data_ :: Maybe Value

#### Instances

Instances details

FromJSON Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods parseJSON :: Value -> Parser Diagnostic # parseJSONList :: Value -> Parser [Diagnostic] # omittedField :: Maybe Diagnostic #
ToJSON Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods toJSON :: Diagnostic -> Value # toEncoding :: Diagnostic -> Encoding # toJSONList :: [Diagnostic] -> Value # toEncodingList :: [Diagnostic] -> Encoding # omitField :: Diagnostic -> Bool #
NFData Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods rnf :: Diagnostic -> () #
Generic Diagnostic |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.Diagnostic

Associated Types

type Rep Diagnostic |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.Diagnostic

type Rep Diagnostic = D1 ('MetaData "Diagnostic" "Language.LSP.Protocol.Internal.Types.Diagnostic" "lsp-types-2.3.0.1-DRgHF6G3wOAK70a4XwHYCC" 'False) (C1 ('MetaCons "Diagnostic" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_range") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Range) :*: S1 ('MetaSel ('Just "_severity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe DiagnosticSeverity))) :*: (S1 ('MetaSel ('Just "_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (Int32 |? Text))) :*: S1 ('MetaSel ('Just "_codeDescription") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe CodeDescription)))) :*: ((S1 ('MetaSel ('Just "_source") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "_tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DiagnosticTag])) :*: (S1 ('MetaSel ('Just "_relatedInformation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DiagnosticRelatedInformation])) :*: S1 ('MetaSel ('Just "_data_") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Value)))))))

Methods

from :: Diagnostic -> Rep Diagnostic x #

to :: Rep Diagnostic x -> Diagnostic #

Show Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods showsPrec :: Int -> Diagnostic -> ShowS # show :: Diagnostic -> String # showList :: [Diagnostic] -> ShowS #
Eq Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods (==) :: Diagnostic -> Diagnostic -> Bool # (/=) :: Diagnostic -> Diagnostic -> Bool #
Ord Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods compare :: Diagnostic -> Diagnostic -> Ordering # (<) :: Diagnostic -> Diagnostic -> Bool # (<=) :: Diagnostic -> Diagnostic -> Bool # (>) :: Diagnostic -> Diagnostic -> Bool # (>=) :: Diagnostic -> Diagnostic -> Bool # max :: Diagnostic -> Diagnostic -> Diagnostic # min :: Diagnostic -> Diagnostic -> Diagnostic #
Hashable Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods hashWithSalt :: Int -> Diagnostic -> Int # hash :: Diagnostic -> Int #
Pretty Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods pretty :: Diagnostic -> Doc ann # prettyList :: [Diagnostic] -> Doc ann #
HasMessage Diagnostic Text |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods message :: Lens' Diagnostic Text
HasRange Diagnostic Range |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods range :: Lens' Diagnostic Range
HasCode Diagnostic (Maybe (Int32 |? Text)) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods code :: Lens' Diagnostic (Maybe (Int32 |? Text))
HasCodeDescription Diagnostic (Maybe CodeDescription) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods codeDescription :: Lens' Diagnostic (Maybe CodeDescription)
HasData_ Diagnostic (Maybe Value) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods data_ :: Lens' Diagnostic (Maybe Value)
HasDiagnostics CodeAction (Maybe [Diagnostic]) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods diagnostics :: Lens' CodeAction (Maybe [Diagnostic])
HasDiagnostics CodeActionContext [Diagnostic] |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods diagnostics :: Lens' CodeActionContext [Diagnostic]
HasDiagnostics PublishDiagnosticsParams [Diagnostic] |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods diagnostics :: Lens' PublishDiagnosticsParams [Diagnostic]
HasItems FullDocumentDiagnosticReport [Diagnostic] |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods items :: Lens' FullDocumentDiagnosticReport [Diagnostic]
HasItems RelatedFullDocumentDiagnosticReport [Diagnostic] |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods items :: Lens' RelatedFullDocumentDiagnosticReport [Diagnostic]
HasItems WorkspaceFullDocumentDiagnosticReport [Diagnostic] |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods items :: Lens' WorkspaceFullDocumentDiagnosticReport [Diagnostic]
HasRelatedInformation Diagnostic (Maybe [DiagnosticRelatedInformation]) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods relatedInformation :: Lens' Diagnostic (Maybe [DiagnosticRelatedInformation])
HasSeverity Diagnostic (Maybe DiagnosticSeverity) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods severity :: Lens' Diagnostic (Maybe DiagnosticSeverity)
HasSource Diagnostic (Maybe Text) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods source :: Lens' Diagnostic (Maybe Text)
HasTags Diagnostic (Maybe [DiagnosticTag]) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods tags :: Lens' Diagnostic (Maybe [DiagnosticTag])
type Rep Diagnostic |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.Diagnostic

type Rep Diagnostic = D1 ('MetaData "Diagnostic" "Language.LSP.Protocol.Internal.Types.Diagnostic" "lsp-types-2.3.0.1-DRgHF6G3wOAK70a4XwHYCC" 'False) (C1 ('MetaCons "Diagnostic" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_range") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Range) :*: S1 ('MetaSel ('Just "_severity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe DiagnosticSeverity))) :*: (S1 ('MetaSel ('Just "_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (Int32 |? Text))) :*: S1 ('MetaSel ('Just "_codeDescription") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe CodeDescription)))) :*: ((S1 ('MetaSel ('Just "_source") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "_tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DiagnosticTag])) :*: (S1 ('MetaSel ('Just "_relatedInformation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DiagnosticRelatedInformation])) :*: S1 ('MetaSel ('Just "_data_") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Value)))))))

data ShowDiagnostic #

Defines whether a particular diagnostic should be reported back to the user.

One important use case is "missing signature" code lenses, for which we need to enable the corresponding warning during type checking. However, we do not want to show the warning unless the programmer asks for it (#261).

Constructors

ShowDiag | Report back to the user
HideDiag | Hide from user

#### Instances

Instances details

NFData ShowDiagnostic # |
Instance details Defined in Development.IDE.Types.Diagnostics Methods rnf :: ShowDiagnostic -> () #
Show ShowDiagnostic # |
Instance details Defined in Development.IDE.Types.Diagnostics Methods showsPrec :: Int -> ShowDiagnostic -> ShowS # show :: ShowDiagnostic -> String # showList :: [ShowDiagnostic] -> ShowS #
Eq ShowDiagnostic # |
Instance details Defined in Development.IDE.Types.Diagnostics Methods (==) :: ShowDiagnostic -> ShowDiagnostic -> Bool # (/=) :: ShowDiagnostic -> ShowDiagnostic -> Bool #
Ord ShowDiagnostic # |

Instance details

Defined in Development.IDE.Types.Diagnostics

Methods

compare :: ShowDiagnostic -> ShowDiagnostic -> Ordering #

(<) :: ShowDiagnostic -> ShowDiagnostic -> Bool #

(<=) :: ShowDiagnostic -> ShowDiagnostic -> Bool #

(>) :: ShowDiagnostic -> ShowDiagnostic -> Bool #

(>=) :: ShowDiagnostic -> ShowDiagnostic -> Bool #

max :: ShowDiagnostic -> ShowDiagnostic -> ShowDiagnostic #

min :: ShowDiagnostic -> ShowDiagnostic -> ShowDiagnostic #

type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic) #

Human readable diagnostics for a specific file.

This type packages a pretty printed, human readable error message along with the related source location so that we can display the error on either the console or in the IDE at the right source location.

type IdeResult v = ([FileDiagnostic], Maybe v) #

The result of an IDE operation. Warnings and errors are in the Diagnostic, and a value is in the Maybe. For operations that throw an error you expect a non-empty list of diagnostics, at least one of which is an error, and a Nothing. For operations that succeed you expect perhaps some warnings and a Just. For operations that depend on other failing operations you may get empty diagnostics and a Nothing, to indicate this phase throws no fresh errors but still failed.

A rule on a file should only return diagnostics for that given file. It should not propagate diagnostic errors through multiple phases.

data DiagnosticSeverity #

Constructors

DiagnosticSeverity_Error |
DiagnosticSeverity_Warning |
DiagnosticSeverity_Information |
DiagnosticSeverity_Hint |

#### Instances

Instances details

FromJSON DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods parseJSON :: Value -> Parser DiagnosticSeverity # parseJSONList :: Value -> Parser [DiagnosticSeverity] # omittedField :: Maybe DiagnosticSeverity #
ToJSON DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods toJSON :: DiagnosticSeverity -> Value # toEncoding :: DiagnosticSeverity -> Encoding # toJSONList :: [DiagnosticSeverity] -> Value # toEncodingList :: [DiagnosticSeverity] -> Encoding # omitField :: DiagnosticSeverity -> Bool #
NFData DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods rnf :: DiagnosticSeverity -> () #
Generic DiagnosticSeverity |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity

Associated Types

type Rep DiagnosticSeverity |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity

type Rep DiagnosticSeverity = D1 ('MetaData "DiagnosticSeverity" "Language.LSP.Protocol.Internal.Types.DiagnosticSeverity" "lsp-types-2.3.0.1-DRgHF6G3wOAK70a4XwHYCC" 'False) ((C1 ('MetaCons "DiagnosticSeverity_Error" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DiagnosticSeverity_Warning" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DiagnosticSeverity_Information" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DiagnosticSeverity_Hint" 'PrefixI 'False) (U1 :: Type -> Type)))

Methods

from :: DiagnosticSeverity -> Rep DiagnosticSeverity x #

to :: Rep DiagnosticSeverity x -> DiagnosticSeverity #

Show DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods showsPrec :: Int -> DiagnosticSeverity -> ShowS # show :: DiagnosticSeverity -> String # showList :: [DiagnosticSeverity] -> ShowS #
Eq DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods (==) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool # (/=) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool #
Ord DiagnosticSeverity |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity

Methods

compare :: DiagnosticSeverity -> DiagnosticSeverity -> Ordering #

(<) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool #

(<=) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool #

(>) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool #

(>=) :: DiagnosticSeverity -> DiagnosticSeverity -> Bool #

max :: DiagnosticSeverity -> DiagnosticSeverity -> DiagnosticSeverity #

min :: DiagnosticSeverity -> DiagnosticSeverity -> DiagnosticSeverity #

Hashable DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods hashWithSalt :: Int -> DiagnosticSeverity -> Int # hash :: DiagnosticSeverity -> Int #
LspEnum DiagnosticSeverity |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity

Associated Types

type EnumBaseType DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity type EnumBaseType DiagnosticSeverity = UInt

Methods

knownValues :: Set DiagnosticSeverity

toEnumBaseType :: DiagnosticSeverity -> EnumBaseType DiagnosticSeverity

fromEnumBaseType :: EnumBaseType DiagnosticSeverity -> Maybe DiagnosticSeverity

Pretty DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity Methods pretty :: DiagnosticSeverity -> Doc ann # prettyList :: [DiagnosticSeverity] -> Doc ann #
HasSeverity Diagnostic (Maybe DiagnosticSeverity) |
Instance details Defined in Language.LSP.Protocol.Types.Lens Methods severity :: Lens' Diagnostic (Maybe DiagnosticSeverity)
type Rep DiagnosticSeverity |

Instance details

Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity

type Rep DiagnosticSeverity = D1 ('MetaData "DiagnosticSeverity" "Language.LSP.Protocol.Internal.Types.DiagnosticSeverity" "lsp-types-2.3.0.1-DRgHF6G3wOAK70a4XwHYCC" 'False) ((C1 ('MetaCons "DiagnosticSeverity_Error" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DiagnosticSeverity_Warning" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DiagnosticSeverity_Information" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DiagnosticSeverity_Hint" 'PrefixI 'False) (U1 :: Type -> Type)))

type EnumBaseType DiagnosticSeverity |
Instance details Defined in Language.LSP.Protocol.Internal.Types.DiagnosticSeverity type EnumBaseType DiagnosticSeverity = UInt

type DiagnosticStore = HashMap NormalizedUri StoreItem #

ideErrorText :: NormalizedFilePath -> Text -> FileDiagnostic #

ideErrorWithSource :: Maybe Text -> Maybe DiagnosticSeverity -> a -> Text -> (a, ShowDiagnostic, Diagnostic) #

showDiagnostics :: [FileDiagnostic] -> Text #

showDiagnosticsColored :: [FileDiagnostic] -> Text #

type IdeResultNoDiagnosticsEarlyCutoff v = (Maybe ByteString, Maybe v) #

an IdeResult with a fingerprint