{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.WorkspaceEdit 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.Map
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Language.LSP.Protocol.Internal.Types.ChangeAnnotation
import qualified Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier
import qualified Language.LSP.Protocol.Internal.Types.CreateFile
import qualified Language.LSP.Protocol.Internal.Types.DeleteFile
import qualified Language.LSP.Protocol.Internal.Types.RenameFile
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentEdit
import qualified Language.LSP.Protocol.Internal.Types.TextEdit
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri
data WorkspaceEdit = WorkspaceEdit
{
WorkspaceEdit -> Maybe (Map Uri [TextEdit])
_changes :: (Maybe (Data.Map.Map Language.LSP.Protocol.Types.Uri.Uri [Language.LSP.Protocol.Internal.Types.TextEdit.TextEdit]))
,
WorkspaceEdit
-> Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
_documentChanges :: (Maybe [(Language.LSP.Protocol.Internal.Types.TextDocumentEdit.TextDocumentEdit Language.LSP.Protocol.Types.Common.|? (Language.LSP.Protocol.Internal.Types.CreateFile.CreateFile Language.LSP.Protocol.Types.Common.|? (Language.LSP.Protocol.Internal.Types.RenameFile.RenameFile Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.DeleteFile.DeleteFile)))])
,
WorkspaceEdit
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
_changeAnnotations :: (Maybe (Data.Map.Map Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier.ChangeAnnotationIdentifier Language.LSP.Protocol.Internal.Types.ChangeAnnotation.ChangeAnnotation))
}
deriving stock (Int -> WorkspaceEdit -> ShowS
[WorkspaceEdit] -> ShowS
WorkspaceEdit -> String
(Int -> WorkspaceEdit -> ShowS)
-> (WorkspaceEdit -> String)
-> ([WorkspaceEdit] -> ShowS)
-> Show WorkspaceEdit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkspaceEdit -> ShowS
showsPrec :: Int -> WorkspaceEdit -> ShowS
$cshow :: WorkspaceEdit -> String
show :: WorkspaceEdit -> String
$cshowList :: [WorkspaceEdit] -> ShowS
showList :: [WorkspaceEdit] -> ShowS
Show, WorkspaceEdit -> WorkspaceEdit -> Bool
(WorkspaceEdit -> WorkspaceEdit -> Bool)
-> (WorkspaceEdit -> WorkspaceEdit -> Bool) -> Eq WorkspaceEdit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkspaceEdit -> WorkspaceEdit -> Bool
== :: WorkspaceEdit -> WorkspaceEdit -> Bool
$c/= :: WorkspaceEdit -> WorkspaceEdit -> Bool
/= :: WorkspaceEdit -> WorkspaceEdit -> Bool
Eq, Eq WorkspaceEdit
Eq WorkspaceEdit =>
(WorkspaceEdit -> WorkspaceEdit -> Ordering)
-> (WorkspaceEdit -> WorkspaceEdit -> Bool)
-> (WorkspaceEdit -> WorkspaceEdit -> Bool)
-> (WorkspaceEdit -> WorkspaceEdit -> Bool)
-> (WorkspaceEdit -> WorkspaceEdit -> Bool)
-> (WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit)
-> (WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit)
-> Ord WorkspaceEdit
WorkspaceEdit -> WorkspaceEdit -> Bool
WorkspaceEdit -> WorkspaceEdit -> Ordering
WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit
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 :: WorkspaceEdit -> WorkspaceEdit -> Ordering
compare :: WorkspaceEdit -> WorkspaceEdit -> Ordering
$c< :: WorkspaceEdit -> WorkspaceEdit -> Bool
< :: WorkspaceEdit -> WorkspaceEdit -> Bool
$c<= :: WorkspaceEdit -> WorkspaceEdit -> Bool
<= :: WorkspaceEdit -> WorkspaceEdit -> Bool
$c> :: WorkspaceEdit -> WorkspaceEdit -> Bool
> :: WorkspaceEdit -> WorkspaceEdit -> Bool
$c>= :: WorkspaceEdit -> WorkspaceEdit -> Bool
>= :: WorkspaceEdit -> WorkspaceEdit -> Bool
$cmax :: WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit
max :: WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit
$cmin :: WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit
min :: WorkspaceEdit -> WorkspaceEdit -> WorkspaceEdit
Ord, (forall x. WorkspaceEdit -> Rep WorkspaceEdit x)
-> (forall x. Rep WorkspaceEdit x -> WorkspaceEdit)
-> Generic WorkspaceEdit
forall x. Rep WorkspaceEdit x -> WorkspaceEdit
forall x. WorkspaceEdit -> Rep WorkspaceEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. WorkspaceEdit -> Rep WorkspaceEdit x
from :: forall x. WorkspaceEdit -> Rep WorkspaceEdit x
$cto :: forall x. Rep WorkspaceEdit x -> WorkspaceEdit
to :: forall x. Rep WorkspaceEdit x -> WorkspaceEdit
Generic)
deriving anyclass (WorkspaceEdit -> ()
(WorkspaceEdit -> ()) -> NFData WorkspaceEdit
forall a. (a -> ()) -> NFData a
$crnf :: WorkspaceEdit -> ()
rnf :: WorkspaceEdit -> ()
NFData, Eq WorkspaceEdit
Eq WorkspaceEdit =>
(Int -> WorkspaceEdit -> Int)
-> (WorkspaceEdit -> Int) -> Hashable WorkspaceEdit
Int -> WorkspaceEdit -> Int
WorkspaceEdit -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> WorkspaceEdit -> Int
hashWithSalt :: Int -> WorkspaceEdit -> Int
$chash :: WorkspaceEdit -> Int
hash :: WorkspaceEdit -> Int
Hashable)
deriving (forall ann. WorkspaceEdit -> Doc ann)
-> (forall ann. [WorkspaceEdit] -> Doc ann) -> Pretty WorkspaceEdit
forall ann. [WorkspaceEdit] -> Doc ann
forall ann. WorkspaceEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. WorkspaceEdit -> Doc ann
pretty :: forall ann. WorkspaceEdit -> Doc ann
$cprettyList :: forall ann. [WorkspaceEdit] -> Doc ann
prettyList :: forall ann. [WorkspaceEdit] -> Doc ann
Pretty via (ViaJSON WorkspaceEdit)
instance Aeson.ToJSON WorkspaceEdit where
toJSON :: WorkspaceEdit -> Value
toJSON (WorkspaceEdit Maybe (Map Uri [TextEdit])
arg0 Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
arg1 Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
arg2) = [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
$ [String
"changes" String -> Maybe (Map Uri [TextEdit]) -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Map Uri [TextEdit])
arg0
,String
"documentChanges" String
-> Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
-> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
arg1
,String
"changeAnnotations" String
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
arg2]
instance Aeson.FromJSON WorkspaceEdit where
parseJSON :: Value -> Parser WorkspaceEdit
parseJSON = String
-> (Object -> Parser WorkspaceEdit)
-> Value
-> Parser WorkspaceEdit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"WorkspaceEdit" ((Object -> Parser WorkspaceEdit) -> Value -> Parser WorkspaceEdit)
-> (Object -> Parser WorkspaceEdit)
-> Value
-> Parser WorkspaceEdit
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe (Map Uri [TextEdit])
-> Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit
WorkspaceEdit (Maybe (Map Uri [TextEdit])
-> Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit)
-> Parser (Maybe (Map Uri [TextEdit]))
-> Parser
(Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe (Map Uri [TextEdit]))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"changes" Parser
(Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))]
-> Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit)
-> Parser
(Maybe
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))])
-> Parser
(Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit)
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
[TextDocumentEdit |? (CreateFile |? (RenameFile |? DeleteFile))])
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"documentChanges" Parser
(Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation)
-> WorkspaceEdit)
-> Parser (Maybe (Map ChangeAnnotationIdentifier ChangeAnnotation))
-> Parser WorkspaceEdit
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 (Map ChangeAnnotationIdentifier ChangeAnnotation))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"changeAnnotations"