haskell-language-server-2.7.0.0: LSP server for GHC

Safe Haskell | None
Language | GHC2021

Ide.Plugin.Cabal.Diagnostics

Contents

- Re-exports

Synopsis

- errorDiagnostic :: NormalizedFilePath -> PError -> FileDiagnostic
- warningDiagnostic :: NormalizedFilePath -> PWarning -> FileDiagnostic
- positionFromCabalPosition :: Position -> Position
- type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic)
- 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
  }

# Documentation

errorDiagnostic :: NormalizedFilePath -> PError -> FileDiagnostic #

Produce a diagnostic from a Cabal parser error

warningDiagnostic :: NormalizedFilePath -> PWarning -> FileDiagnostic #

Produce a diagnostic from a Cabal parser warning

positionFromCabalPosition :: Position -> Position #

Convert a `Position` from Cabal to a `Range` that LSP understands.

Prefer this function over hand-rolled unpacking/packing, since LSP is zero-based, while Cabal is one-based.

    >>> positionFromCabalPosition $ Lib.Position 1 1
    Position 0 0

# Re-exports

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.

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 #
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.2.0.0-8Xein21J7hgLjsXepwEL9j" '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 #
NFData Diagnostic |
Instance details Defined in Language.LSP.Protocol.Internal.Types.Diagnostic Methods rnf :: Diagnostic -> () #
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.2.0.0-8Xein21J7hgLjsXepwEL9j" '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)))))))