{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.DocumentLink where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Data.Text
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
A document link is a range in a text document that links to an internal or external resource, like another
text document or a web site.
-}
data DocumentLink = DocumentLink 
  { {-|
  The range this link applies to.
  -}
  DocumentLink -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The uri this link points to. If missing a resolve request is sent later.
  -}
  DocumentLink -> Maybe Text
_target :: (Maybe Data.Text.Text)
  , {-|
  The tooltip text when you hover over this link.

  If a tooltip is provided, is will be displayed in a string that includes instructions on how to
  trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
  user settings, and localization.

  @since 3.15.0
  -}
  DocumentLink -> Maybe Text
_tooltip :: (Maybe Data.Text.Text)
  , {-|
  A data entry field that is preserved on a document link between a
  DocumentLinkRequest and a DocumentLinkResolveRequest.
  -}
  DocumentLink -> Maybe Value
_data_ :: (Maybe Data.Aeson.Value)
  }
  deriving stock (Int -> DocumentLink -> ShowS
[DocumentLink] -> ShowS
DocumentLink -> String
(Int -> DocumentLink -> ShowS)
-> (DocumentLink -> String)
-> ([DocumentLink] -> ShowS)
-> Show DocumentLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentLink -> ShowS
showsPrec :: Int -> DocumentLink -> ShowS
$cshow :: DocumentLink -> String
show :: DocumentLink -> String
$cshowList :: [DocumentLink] -> ShowS
showList :: [DocumentLink] -> ShowS
Show, DocumentLink -> DocumentLink -> Bool
(DocumentLink -> DocumentLink -> Bool)
-> (DocumentLink -> DocumentLink -> Bool) -> Eq DocumentLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DocumentLink -> DocumentLink -> Bool
== :: DocumentLink -> DocumentLink -> Bool
$c/= :: DocumentLink -> DocumentLink -> Bool
/= :: DocumentLink -> DocumentLink -> Bool
Eq, Eq DocumentLink
Eq DocumentLink =>
(DocumentLink -> DocumentLink -> Ordering)
-> (DocumentLink -> DocumentLink -> Bool)
-> (DocumentLink -> DocumentLink -> Bool)
-> (DocumentLink -> DocumentLink -> Bool)
-> (DocumentLink -> DocumentLink -> Bool)
-> (DocumentLink -> DocumentLink -> DocumentLink)
-> (DocumentLink -> DocumentLink -> DocumentLink)
-> Ord DocumentLink
DocumentLink -> DocumentLink -> Bool
DocumentLink -> DocumentLink -> Ordering
DocumentLink -> DocumentLink -> DocumentLink
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DocumentLink -> DocumentLink -> Ordering
compare :: DocumentLink -> DocumentLink -> Ordering
$c< :: DocumentLink -> DocumentLink -> Bool
< :: DocumentLink -> DocumentLink -> Bool
$c<= :: DocumentLink -> DocumentLink -> Bool
<= :: DocumentLink -> DocumentLink -> Bool
$c> :: DocumentLink -> DocumentLink -> Bool
> :: DocumentLink -> DocumentLink -> Bool
$c>= :: DocumentLink -> DocumentLink -> Bool
>= :: DocumentLink -> DocumentLink -> Bool
$cmax :: DocumentLink -> DocumentLink -> DocumentLink
max :: DocumentLink -> DocumentLink -> DocumentLink
$cmin :: DocumentLink -> DocumentLink -> DocumentLink
min :: DocumentLink -> DocumentLink -> DocumentLink
Ord, (forall x. DocumentLink -> Rep DocumentLink x)
-> (forall x. Rep DocumentLink x -> DocumentLink)
-> Generic DocumentLink
forall x. Rep DocumentLink x -> DocumentLink
forall x. DocumentLink -> Rep DocumentLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DocumentLink -> Rep DocumentLink x
from :: forall x. DocumentLink -> Rep DocumentLink x
$cto :: forall x. Rep DocumentLink x -> DocumentLink
to :: forall x. Rep DocumentLink x -> DocumentLink
Generic)
  deriving anyclass (DocumentLink -> ()
(DocumentLink -> ()) -> NFData DocumentLink
forall a. (a -> ()) -> NFData a
$crnf :: DocumentLink -> ()
rnf :: DocumentLink -> ()
NFData, Eq DocumentLink
Eq DocumentLink =>
(Int -> DocumentLink -> Int)
-> (DocumentLink -> Int) -> Hashable DocumentLink
Int -> DocumentLink -> Int
DocumentLink -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DocumentLink -> Int
hashWithSalt :: Int -> DocumentLink -> Int
$chash :: DocumentLink -> Int
hash :: DocumentLink -> Int
Hashable)
  deriving (forall ann. DocumentLink -> Doc ann)
-> (forall ann. [DocumentLink] -> Doc ann) -> Pretty DocumentLink
forall ann. [DocumentLink] -> Doc ann
forall ann. DocumentLink -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DocumentLink -> Doc ann
pretty :: forall ann. DocumentLink -> Doc ann
$cprettyList :: forall ann. [DocumentLink] -> Doc ann
prettyList :: forall ann. [DocumentLink] -> Doc ann
Pretty via (ViaJSON DocumentLink)

instance Aeson.ToJSON DocumentLink where
  toJSON :: DocumentLink -> Value
toJSON (DocumentLink Range
arg0 Maybe Text
arg1 Maybe Text
arg2 Maybe Value
arg3) = [Pair] -> Value
Aeson.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Pair]] -> [Pair]) -> [[Pair]] -> [Pair]
forall a b. (a -> b) -> a -> b
$  [[Key
"range" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,String
"target" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg1
    ,String
"tooltip" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg2
    ,String
"data" String -> Maybe Value -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Value
arg3]

instance Aeson.FromJSON DocumentLink where
  parseJSON :: Value -> Parser DocumentLink
parseJSON = String
-> (Object -> Parser DocumentLink) -> Value -> Parser DocumentLink
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentLink" ((Object -> Parser DocumentLink) -> Value -> Parser DocumentLink)
-> (Object -> Parser DocumentLink) -> Value -> Parser DocumentLink
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Maybe Text -> Maybe Text -> Maybe Value -> DocumentLink
DocumentLink (Range -> Maybe Text -> Maybe Text -> Maybe Value -> DocumentLink)
-> Parser Range
-> Parser (Maybe Text -> Maybe Text -> Maybe Value -> DocumentLink)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" Parser (Maybe Text -> Maybe Text -> Maybe Value -> DocumentLink)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Value -> DocumentLink)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser (Maybe Text)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"target" Parser (Maybe Text -> Maybe Value -> DocumentLink)
-> Parser (Maybe Text) -> Parser (Maybe Value -> DocumentLink)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser (Maybe Text)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"tooltip" Parser (Maybe Value -> DocumentLink)
-> Parser (Maybe Value) -> Parser DocumentLink
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser (Maybe Value)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"data"