{- 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.DocumentSymbol where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
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.Internal.Types.SymbolKind
import qualified Language.LSP.Protocol.Internal.Types.SymbolTag
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents programming constructs like variables, classes, interfaces etc.
that appear in a document. Document symbols can be hierarchical and they
have two ranges: one that encloses its definition and one that points to
its most interesting range, e.g. the range of an identifier.
-}
data DocumentSymbol = DocumentSymbol 
  { {-|
  The name of this symbol. Will be displayed in the user interface and therefore must not be
  an empty string or a string only consisting of white spaces.
  -}
  DocumentSymbol -> Text
_name :: Data.Text.Text
  , {-|
  More detail for this symbol, e.g the signature of a function.
  -}
  DocumentSymbol -> Maybe Text
_detail :: (Maybe Data.Text.Text)
  , {-|
  The kind of this symbol.
  -}
  DocumentSymbol -> SymbolKind
_kind :: Language.LSP.Protocol.Internal.Types.SymbolKind.SymbolKind
  , {-|
  Tags for this document symbol.

  @since 3.16.0
  -}
  DocumentSymbol -> Maybe [SymbolTag]
_tags :: (Maybe [Language.LSP.Protocol.Internal.Types.SymbolTag.SymbolTag])
  , {-|
  Indicates if this symbol is deprecated.

  @deprecated Use tags instead
  -}
  DocumentSymbol -> Maybe Bool
_deprecated :: (Maybe Bool)
  , {-|
  The range enclosing this symbol not including leading/trailing whitespace but everything else
  like comments. This information is typically used to determine if the clients cursor is
  inside the symbol to reveal in the symbol in the UI.
  -}
  DocumentSymbol -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
  Must be contained by the `range`.
  -}
  DocumentSymbol -> Range
_selectionRange :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  Children of this symbol, e.g. properties of a class.
  -}
  DocumentSymbol -> Maybe [DocumentSymbol]
_children :: (Maybe [Language.LSP.Protocol.Internal.Types.DocumentSymbol.DocumentSymbol])
  }
  deriving stock (Int -> DocumentSymbol -> ShowS
[DocumentSymbol] -> ShowS
DocumentSymbol -> String
(Int -> DocumentSymbol -> ShowS)
-> (DocumentSymbol -> String)
-> ([DocumentSymbol] -> ShowS)
-> Show DocumentSymbol
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentSymbol -> ShowS
showsPrec :: Int -> DocumentSymbol -> ShowS
$cshow :: DocumentSymbol -> String
show :: DocumentSymbol -> String
$cshowList :: [DocumentSymbol] -> ShowS
showList :: [DocumentSymbol] -> ShowS
Show, DocumentSymbol -> DocumentSymbol -> Bool
(DocumentSymbol -> DocumentSymbol -> Bool)
-> (DocumentSymbol -> DocumentSymbol -> Bool) -> Eq DocumentSymbol
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DocumentSymbol -> DocumentSymbol -> Bool
== :: DocumentSymbol -> DocumentSymbol -> Bool
$c/= :: DocumentSymbol -> DocumentSymbol -> Bool
/= :: DocumentSymbol -> DocumentSymbol -> Bool
Eq, Eq DocumentSymbol
Eq DocumentSymbol =>
(DocumentSymbol -> DocumentSymbol -> Ordering)
-> (DocumentSymbol -> DocumentSymbol -> Bool)
-> (DocumentSymbol -> DocumentSymbol -> Bool)
-> (DocumentSymbol -> DocumentSymbol -> Bool)
-> (DocumentSymbol -> DocumentSymbol -> Bool)
-> (DocumentSymbol -> DocumentSymbol -> DocumentSymbol)
-> (DocumentSymbol -> DocumentSymbol -> DocumentSymbol)
-> Ord DocumentSymbol
DocumentSymbol -> DocumentSymbol -> Bool
DocumentSymbol -> DocumentSymbol -> Ordering
DocumentSymbol -> DocumentSymbol -> DocumentSymbol
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 :: DocumentSymbol -> DocumentSymbol -> Ordering
compare :: DocumentSymbol -> DocumentSymbol -> Ordering
$c< :: DocumentSymbol -> DocumentSymbol -> Bool
< :: DocumentSymbol -> DocumentSymbol -> Bool
$c<= :: DocumentSymbol -> DocumentSymbol -> Bool
<= :: DocumentSymbol -> DocumentSymbol -> Bool
$c> :: DocumentSymbol -> DocumentSymbol -> Bool
> :: DocumentSymbol -> DocumentSymbol -> Bool
$c>= :: DocumentSymbol -> DocumentSymbol -> Bool
>= :: DocumentSymbol -> DocumentSymbol -> Bool
$cmax :: DocumentSymbol -> DocumentSymbol -> DocumentSymbol
max :: DocumentSymbol -> DocumentSymbol -> DocumentSymbol
$cmin :: DocumentSymbol -> DocumentSymbol -> DocumentSymbol
min :: DocumentSymbol -> DocumentSymbol -> DocumentSymbol
Ord, (forall x. DocumentSymbol -> Rep DocumentSymbol x)
-> (forall x. Rep DocumentSymbol x -> DocumentSymbol)
-> Generic DocumentSymbol
forall x. Rep DocumentSymbol x -> DocumentSymbol
forall x. DocumentSymbol -> Rep DocumentSymbol x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DocumentSymbol -> Rep DocumentSymbol x
from :: forall x. DocumentSymbol -> Rep DocumentSymbol x
$cto :: forall x. Rep DocumentSymbol x -> DocumentSymbol
to :: forall x. Rep DocumentSymbol x -> DocumentSymbol
Generic)
  deriving anyclass (DocumentSymbol -> ()
(DocumentSymbol -> ()) -> NFData DocumentSymbol
forall a. (a -> ()) -> NFData a
$crnf :: DocumentSymbol -> ()
rnf :: DocumentSymbol -> ()
NFData, Eq DocumentSymbol
Eq DocumentSymbol =>
(Int -> DocumentSymbol -> Int)
-> (DocumentSymbol -> Int) -> Hashable DocumentSymbol
Int -> DocumentSymbol -> Int
DocumentSymbol -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DocumentSymbol -> Int
hashWithSalt :: Int -> DocumentSymbol -> Int
$chash :: DocumentSymbol -> Int
hash :: DocumentSymbol -> Int
Hashable)
  deriving (forall ann. DocumentSymbol -> Doc ann)
-> (forall ann. [DocumentSymbol] -> Doc ann)
-> Pretty DocumentSymbol
forall ann. [DocumentSymbol] -> Doc ann
forall ann. DocumentSymbol -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DocumentSymbol -> Doc ann
pretty :: forall ann. DocumentSymbol -> Doc ann
$cprettyList :: forall ann. [DocumentSymbol] -> Doc ann
prettyList :: forall ann. [DocumentSymbol] -> Doc ann
Pretty via (ViaJSON DocumentSymbol)

instance Aeson.ToJSON DocumentSymbol where
  toJSON :: DocumentSymbol -> Value
toJSON (DocumentSymbol Text
arg0 Maybe Text
arg1 SymbolKind
arg2 Maybe [SymbolTag]
arg3 Maybe Bool
arg4 Range
arg5 Range
arg6 Maybe [DocumentSymbol]
arg7) = [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
"name" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"detail" 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
    ,[Key
"kind" Key -> SymbolKind -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= SymbolKind
arg2]
    ,String
"tags" String -> Maybe [SymbolTag] -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [SymbolTag]
arg3
    ,String
"deprecated" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg4
    ,[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
arg5]
    ,[Key
"selectionRange" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg6]
    ,String
"children" String -> Maybe [DocumentSymbol] -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [DocumentSymbol]
arg7]

instance Aeson.FromJSON DocumentSymbol where
  parseJSON :: Value -> Parser DocumentSymbol
parseJSON = String
-> (Object -> Parser DocumentSymbol)
-> Value
-> Parser DocumentSymbol
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentSymbol" ((Object -> Parser DocumentSymbol)
 -> Value -> Parser DocumentSymbol)
-> (Object -> Parser DocumentSymbol)
-> Value
-> Parser DocumentSymbol
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text
-> Maybe Text
-> SymbolKind
-> Maybe [SymbolTag]
-> Maybe Bool
-> Range
-> Range
-> Maybe [DocumentSymbol]
-> DocumentSymbol
DocumentSymbol (Text
 -> Maybe Text
 -> SymbolKind
 -> Maybe [SymbolTag]
 -> Maybe Bool
 -> Range
 -> Range
 -> Maybe [DocumentSymbol]
 -> DocumentSymbol)
-> Parser Text
-> Parser
     (Maybe Text
      -> SymbolKind
      -> Maybe [SymbolTag]
      -> Maybe Bool
      -> Range
      -> Range
      -> Maybe [DocumentSymbol]
      -> DocumentSymbol)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"name" Parser
  (Maybe Text
   -> SymbolKind
   -> Maybe [SymbolTag]
   -> Maybe Bool
   -> Range
   -> Range
   -> Maybe [DocumentSymbol]
   -> DocumentSymbol)
-> Parser (Maybe Text)
-> Parser
     (SymbolKind
      -> Maybe [SymbolTag]
      -> Maybe Bool
      -> Range
      -> Range
      -> Maybe [DocumentSymbol]
      -> DocumentSymbol)
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
"detail" Parser
  (SymbolKind
   -> Maybe [SymbolTag]
   -> Maybe Bool
   -> Range
   -> Range
   -> Maybe [DocumentSymbol]
   -> DocumentSymbol)
-> Parser SymbolKind
-> Parser
     (Maybe [SymbolTag]
      -> Maybe Bool
      -> Range
      -> Range
      -> Maybe [DocumentSymbol]
      -> DocumentSymbol)
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 SymbolKind
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"kind" Parser
  (Maybe [SymbolTag]
   -> Maybe Bool
   -> Range
   -> Range
   -> Maybe [DocumentSymbol]
   -> DocumentSymbol)
-> Parser (Maybe [SymbolTag])
-> Parser
     (Maybe Bool
      -> Range -> Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
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 [SymbolTag])
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"tags" Parser
  (Maybe Bool
   -> Range -> Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
-> Parser (Maybe Bool)
-> Parser
     (Range -> Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"deprecated" Parser (Range -> Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
-> Parser Range
-> Parser (Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" Parser (Range -> Maybe [DocumentSymbol] -> DocumentSymbol)
-> Parser Range
-> Parser (Maybe [DocumentSymbol] -> DocumentSymbol)
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"selectionRange" Parser (Maybe [DocumentSymbol] -> DocumentSymbol)
-> Parser (Maybe [DocumentSymbol]) -> Parser DocumentSymbol
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 [DocumentSymbol])
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"children"