{-# LANGUAGE DuplicateRecordFields      #-}
{-# LANGUAGE TemplateHaskell            #-}
module Language.Haskell.LSP.Types.TextDocument where

import           Data.Aeson.TH
import           Data.Text                      ( Text )
import           Language.Haskell.LSP.Types.Constants
import           Language.Haskell.LSP.Types.Location
import           Language.Haskell.LSP.Types.Progress
import           Language.Haskell.LSP.Types.Uri

-- ---------------------------------------------------------------------
{-
TextDocumentIdentifier

https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#textdocumentidentifier

Text documents are identified using a URI. On the protocol level, URIs are
passed as strings. The corresponding JSON structure looks like this:

interface TextDocumentIdentifier {
    /**
     * The text document's URI.
     */
    uri: string;
}
-}
data TextDocumentIdentifier =
  TextDocumentIdentifier
    { TextDocumentIdentifier -> Uri
_uri :: Uri
    } deriving (Int -> TextDocumentIdentifier -> ShowS
[TextDocumentIdentifier] -> ShowS
TextDocumentIdentifier -> String
(Int -> TextDocumentIdentifier -> ShowS)
-> (TextDocumentIdentifier -> String)
-> ([TextDocumentIdentifier] -> ShowS)
-> Show TextDocumentIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDocumentIdentifier] -> ShowS
$cshowList :: [TextDocumentIdentifier] -> ShowS
show :: TextDocumentIdentifier -> String
$cshow :: TextDocumentIdentifier -> String
showsPrec :: Int -> TextDocumentIdentifier -> ShowS
$cshowsPrec :: Int -> TextDocumentIdentifier -> ShowS
Show, ReadPrec [TextDocumentIdentifier]
ReadPrec TextDocumentIdentifier
Int -> ReadS TextDocumentIdentifier
ReadS [TextDocumentIdentifier]
(Int -> ReadS TextDocumentIdentifier)
-> ReadS [TextDocumentIdentifier]
-> ReadPrec TextDocumentIdentifier
-> ReadPrec [TextDocumentIdentifier]
-> Read TextDocumentIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextDocumentIdentifier]
$creadListPrec :: ReadPrec [TextDocumentIdentifier]
readPrec :: ReadPrec TextDocumentIdentifier
$creadPrec :: ReadPrec TextDocumentIdentifier
readList :: ReadS [TextDocumentIdentifier]
$creadList :: ReadS [TextDocumentIdentifier]
readsPrec :: Int -> ReadS TextDocumentIdentifier
$creadsPrec :: Int -> ReadS TextDocumentIdentifier
Read, TextDocumentIdentifier -> TextDocumentIdentifier -> Bool
(TextDocumentIdentifier -> TextDocumentIdentifier -> Bool)
-> (TextDocumentIdentifier -> TextDocumentIdentifier -> Bool)
-> Eq TextDocumentIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDocumentIdentifier -> TextDocumentIdentifier -> Bool
$c/= :: TextDocumentIdentifier -> TextDocumentIdentifier -> Bool
== :: TextDocumentIdentifier -> TextDocumentIdentifier -> Bool
$c== :: TextDocumentIdentifier -> TextDocumentIdentifier -> Bool
Eq)

deriveJSON lspOptions ''TextDocumentIdentifier

{-
TextDocumentItem

https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#textdocumentitem

    New: An item to transfer a text document from the client to the server.

interface TextDocumentItem {
    /**
     * The text document's URI.
     */
    uri: string;

    /**
     * The text document's language identifier.
     */
    languageId: string;

    /**
     * The version number of this document (it will strictly increase after each
     * change, including undo/redo).
     */
    version: number;

    /**
     * The content of the opened text document.
     */
    text: string;
}
-}

data TextDocumentItem =
  TextDocumentItem {
    TextDocumentItem -> Uri
_uri        :: Uri
  , TextDocumentItem -> Text
_languageId :: Text
  , TextDocumentItem -> Int
_version    :: Int
  , TextDocumentItem -> Text
_text       :: Text
  } deriving (Int -> TextDocumentItem -> ShowS
[TextDocumentItem] -> ShowS
TextDocumentItem -> String
(Int -> TextDocumentItem -> ShowS)
-> (TextDocumentItem -> String)
-> ([TextDocumentItem] -> ShowS)
-> Show TextDocumentItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDocumentItem] -> ShowS
$cshowList :: [TextDocumentItem] -> ShowS
show :: TextDocumentItem -> String
$cshow :: TextDocumentItem -> String
showsPrec :: Int -> TextDocumentItem -> ShowS
$cshowsPrec :: Int -> TextDocumentItem -> ShowS
Show, ReadPrec [TextDocumentItem]
ReadPrec TextDocumentItem
Int -> ReadS TextDocumentItem
ReadS [TextDocumentItem]
(Int -> ReadS TextDocumentItem)
-> ReadS [TextDocumentItem]
-> ReadPrec TextDocumentItem
-> ReadPrec [TextDocumentItem]
-> Read TextDocumentItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextDocumentItem]
$creadListPrec :: ReadPrec [TextDocumentItem]
readPrec :: ReadPrec TextDocumentItem
$creadPrec :: ReadPrec TextDocumentItem
readList :: ReadS [TextDocumentItem]
$creadList :: ReadS [TextDocumentItem]
readsPrec :: Int -> ReadS TextDocumentItem
$creadsPrec :: Int -> ReadS TextDocumentItem
Read, TextDocumentItem -> TextDocumentItem -> Bool
(TextDocumentItem -> TextDocumentItem -> Bool)
-> (TextDocumentItem -> TextDocumentItem -> Bool)
-> Eq TextDocumentItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDocumentItem -> TextDocumentItem -> Bool
$c/= :: TextDocumentItem -> TextDocumentItem -> Bool
== :: TextDocumentItem -> TextDocumentItem -> Bool
$c== :: TextDocumentItem -> TextDocumentItem -> Bool
Eq)

deriveJSON lspOptions ''TextDocumentItem

-- ---------------------------------------------------------------------
{-
TextDocumentPositionParams

https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#textdocumentpositionparams

    Changed: Was TextDocumentPosition in 1.0 with inlined parameters


interface TextDocumentPositionParams {
    /**
     * The text document.
     */
    textDocument: TextDocumentIdentifier;

    /**
     * The position inside the text document.
     */
    position: Position;
}

-}
data TextDocumentPositionParams =
  TextDocumentPositionParams
    { TextDocumentPositionParams -> TextDocumentIdentifier
_textDocument :: TextDocumentIdentifier
    , TextDocumentPositionParams -> Position
_position     :: Position
    , TextDocumentPositionParams -> Maybe ProgressToken
_workDoneToken :: Maybe ProgressToken -- ^ An optional token that a server can use to report work done progress.
    } deriving (Int -> TextDocumentPositionParams -> ShowS
[TextDocumentPositionParams] -> ShowS
TextDocumentPositionParams -> String
(Int -> TextDocumentPositionParams -> ShowS)
-> (TextDocumentPositionParams -> String)
-> ([TextDocumentPositionParams] -> ShowS)
-> Show TextDocumentPositionParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDocumentPositionParams] -> ShowS
$cshowList :: [TextDocumentPositionParams] -> ShowS
show :: TextDocumentPositionParams -> String
$cshow :: TextDocumentPositionParams -> String
showsPrec :: Int -> TextDocumentPositionParams -> ShowS
$cshowsPrec :: Int -> TextDocumentPositionParams -> ShowS
Show, ReadPrec [TextDocumentPositionParams]
ReadPrec TextDocumentPositionParams
Int -> ReadS TextDocumentPositionParams
ReadS [TextDocumentPositionParams]
(Int -> ReadS TextDocumentPositionParams)
-> ReadS [TextDocumentPositionParams]
-> ReadPrec TextDocumentPositionParams
-> ReadPrec [TextDocumentPositionParams]
-> Read TextDocumentPositionParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextDocumentPositionParams]
$creadListPrec :: ReadPrec [TextDocumentPositionParams]
readPrec :: ReadPrec TextDocumentPositionParams
$creadPrec :: ReadPrec TextDocumentPositionParams
readList :: ReadS [TextDocumentPositionParams]
$creadList :: ReadS [TextDocumentPositionParams]
readsPrec :: Int -> ReadS TextDocumentPositionParams
$creadsPrec :: Int -> ReadS TextDocumentPositionParams
Read, TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
(TextDocumentPositionParams -> TextDocumentPositionParams -> Bool)
-> (TextDocumentPositionParams
    -> TextDocumentPositionParams -> Bool)
-> Eq TextDocumentPositionParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c/= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
== :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c== :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
Eq)

deriveJSON lspOptions ''TextDocumentPositionParams