{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.RelativePattern 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 Language.LSP.Protocol.Internal.Types.Pattern
import qualified Language.LSP.Protocol.Internal.Types.WorkspaceFolder
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri
data RelativePattern = RelativePattern
{
RelativePattern -> WorkspaceFolder |? Uri
_baseUri :: (Language.LSP.Protocol.Internal.Types.WorkspaceFolder.WorkspaceFolder Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Types.Uri.Uri)
,
RelativePattern -> Pattern
_pattern :: Language.LSP.Protocol.Internal.Types.Pattern.Pattern
}
deriving stock (Int -> RelativePattern -> ShowS
[RelativePattern] -> ShowS
RelativePattern -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelativePattern] -> ShowS
$cshowList :: [RelativePattern] -> ShowS
show :: RelativePattern -> String
$cshow :: RelativePattern -> String
showsPrec :: Int -> RelativePattern -> ShowS
$cshowsPrec :: Int -> RelativePattern -> ShowS
Show, RelativePattern -> RelativePattern -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelativePattern -> RelativePattern -> Bool
$c/= :: RelativePattern -> RelativePattern -> Bool
== :: RelativePattern -> RelativePattern -> Bool
$c== :: RelativePattern -> RelativePattern -> Bool
Eq, Eq RelativePattern
RelativePattern -> RelativePattern -> Bool
RelativePattern -> RelativePattern -> Ordering
RelativePattern -> RelativePattern -> RelativePattern
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
min :: RelativePattern -> RelativePattern -> RelativePattern
$cmin :: RelativePattern -> RelativePattern -> RelativePattern
max :: RelativePattern -> RelativePattern -> RelativePattern
$cmax :: RelativePattern -> RelativePattern -> RelativePattern
>= :: RelativePattern -> RelativePattern -> Bool
$c>= :: RelativePattern -> RelativePattern -> Bool
> :: RelativePattern -> RelativePattern -> Bool
$c> :: RelativePattern -> RelativePattern -> Bool
<= :: RelativePattern -> RelativePattern -> Bool
$c<= :: RelativePattern -> RelativePattern -> Bool
< :: RelativePattern -> RelativePattern -> Bool
$c< :: RelativePattern -> RelativePattern -> Bool
compare :: RelativePattern -> RelativePattern -> Ordering
$ccompare :: RelativePattern -> RelativePattern -> Ordering
Ord, forall x. Rep RelativePattern x -> RelativePattern
forall x. RelativePattern -> Rep RelativePattern x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelativePattern x -> RelativePattern
$cfrom :: forall x. RelativePattern -> Rep RelativePattern x
Generic)
deriving anyclass (RelativePattern -> ()
forall a. (a -> ()) -> NFData a
rnf :: RelativePattern -> ()
$crnf :: RelativePattern -> ()
NFData, Eq RelativePattern
Int -> RelativePattern -> Int
RelativePattern -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: RelativePattern -> Int
$chash :: RelativePattern -> Int
hashWithSalt :: Int -> RelativePattern -> Int
$chashWithSalt :: Int -> RelativePattern -> Int
Hashable)
deriving forall ann. [RelativePattern] -> Doc ann
forall ann. RelativePattern -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [RelativePattern] -> Doc ann
$cprettyList :: forall ann. [RelativePattern] -> Doc ann
pretty :: forall ann. RelativePattern -> Doc ann
$cpretty :: forall ann. RelativePattern -> Doc ann
Pretty via (ViaJSON RelativePattern)
instance Aeson.ToJSON RelativePattern where
toJSON :: RelativePattern -> Value
toJSON (RelativePattern WorkspaceFolder |? Uri
arg0 Pattern
arg1) = [Pair] -> Value
Aeson.object forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ [[Key
"baseUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= WorkspaceFolder |? Uri
arg0]
,[Key
"pattern" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Pattern
arg1]]
instance Aeson.FromJSON RelativePattern where
parseJSON :: Value -> Parser RelativePattern
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"RelativePattern" forall a b. (a -> b) -> a -> b
$ \Object
arg -> (WorkspaceFolder |? Uri) -> Pattern -> RelativePattern
RelativePattern forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"baseUri" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"pattern"