diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,14 @@
 # Revision history for haskell-lsp-types
 
+## 0.5.0.0  -- 2018-08-03
+
+* Update Command.arguments to match specification
+* Update ClientCapabilities to v3.10
+* Add MarkupContent
+* Add new CompletionKinds
+* Add new SymbolKinds
+* Add preset version capabilities
+
 ## 0.4.0.0  -- 2018-07-10
 
 * CodeAction support as per v3.8 of the specification, by @Bubba
diff --git a/haskell-lsp-types.cabal b/haskell-lsp-types.cabal
--- a/haskell-lsp-types.cabal
+++ b/haskell-lsp-types.cabal
@@ -1,5 +1,5 @@
 name:                haskell-lsp-types
-version:             0.4.0.0
+version:             0.5.0.0
 synopsis:            Haskell library for the Microsoft Language Server Protocol, data types
 
 description:         An implementation of the types to allow language implementors to
@@ -22,14 +22,17 @@
                      , Language.Haskell.LSP.TH.DataTypesJSON
                      , Language.Haskell.LSP.TH.MessageFuncs
                      , Language.Haskell.LSP.TH.Utils
-  other-modules:       Language.Haskell.LSP.TH.Command
-                     , Language.Haskell.LSP.TH.CodeAction
+  other-modules:       Language.Haskell.LSP.TH.CodeAction
+                     , Language.Haskell.LSP.TH.Command
+                     , Language.Haskell.LSP.TH.Completion
                      , Language.Haskell.LSP.TH.Diagnostic
+                     , Language.Haskell.LSP.TH.DocumentFilter
                      , Language.Haskell.LSP.TH.List
                      , Language.Haskell.LSP.TH.Location
+                     , Language.Haskell.LSP.TH.MarkupContent
                      , Language.Haskell.LSP.TH.Message
                      , Language.Haskell.LSP.TH.Symbol
-                     , Language.Haskell.LSP.TH.TextDocumentIdentifier
+                     , Language.Haskell.LSP.TH.TextDocument
                      , Language.Haskell.LSP.TH.Uri
                      , Language.Haskell.LSP.TH.WorkspaceEdit
  -- other-extensions:
diff --git a/src/Language/Haskell/LSP/TH/ClientCapabilities.hs b/src/Language/Haskell/LSP/TH/ClientCapabilities.hs
--- a/src/Language/Haskell/LSP/TH/ClientCapabilities.hs
+++ b/src/Language/Haskell/LSP/TH/ClientCapabilities.hs
@@ -7,7 +7,10 @@
 import qualified Data.Aeson as A
 import Language.Haskell.LSP.TH.Constants
 import Language.Haskell.LSP.TH.CodeAction
+import Language.Haskell.LSP.TH.Completion
 import Language.Haskell.LSP.TH.List
+import Language.Haskell.LSP.TH.MarkupContent
+import Language.Haskell.LSP.TH.Symbol
 import Data.Default
 
 -- ---------------------------------------------------------------------
@@ -15,9 +18,6 @@
 New in 3.0
 ----------
 
-WorkspaceClientCapabilities
-
-define capabilities the editor / tool provides on the workspace:
 /**
  * Workspace specific client capabilities.
  */
@@ -66,6 +66,23 @@
                  * Symbol request supports dynamic registration.
                  */
                 dynamicRegistration?: boolean;
+
+                /**
+                 * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
+                 */
+                symbolKind?: {
+                        /**
+                         * The symbol kind values the client supports. When this
+                         * property exists the client also guarantees that it will
+                         * handle values outside its set gracefully and falls back
+                         * to a default value when unknown.
+                         *
+                         * If this property is not present the client only supports
+                         * the symbol kinds from `File` to `Array` as defined in
+                         * the initial version of the protocol.
+                         */
+                        valueSet?: SymbolKind[];
+                }
         };
 
         /**
@@ -77,6 +94,20 @@
                  */
                 dynamicRegistration?: boolean;
         };
+
+        /**
+         * The client has support for workspace folders.
+         *
+         * Since 3.6.0
+         */
+        workspaceFolders?: boolean;
+
+        /**
+         * The client supports `workspace/configuration` requests.
+         *
+         * Since 3.6.0
+         */
+        configuration?: boolean;
 }
 -}
 
@@ -114,10 +145,48 @@
 
 -- -------------------------------------
 
+data SymbolKindClientCapabilities =
+  SymbolKindClientCapabilities
+   { -- | The symbol kind values the client supports. When this
+     -- property exists the client also guarantees that it will
+     -- handle values outside its set gracefully and falls back
+     -- to a default value when unknown.
+     -- 
+     -- If this property is not present the client only supports
+     -- the symbol kinds from `File` to `Array` as defined in
+     -- the initial version of the protocol. 
+     _valueSet :: Maybe (List SymbolKind)
+   } deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''SymbolKindClientCapabilities)
+
+instance Default SymbolKindClientCapabilities where
+  def = SymbolKindClientCapabilities (Just $ List allKinds)
+    where allKinds = [ SkFile
+                     , SkModule
+                     , SkNamespace
+                     , SkPackage
+                     , SkClass
+                     , SkMethod
+                     , SkProperty
+                     , SkField
+                     , SkConstructor
+                     , SkEnum
+                     , SkInterface
+                     , SkFunction
+                     , SkVariable
+                     , SkConstant
+                     , SkString
+                     , SkNumber
+                     , SkBoolean
+                     , SkArray
+                     ]
+
 data SymbolClientCapabilities =
   SymbolClientCapabilities
     { _dynamicRegistration :: Maybe Bool -- ^Symbol request supports dynamic
                                          -- registration.
+    , _symbolKind :: Maybe SymbolKindClientCapabilities -- ^ Specific capabilities for the `SymbolKind`.
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''SymbolClientCapabilities)
@@ -154,21 +223,23 @@
 
       -- | Capabilities specific to the `workspace/executeCommand` request.
     , _executeCommand :: Maybe ExecuteClientCapabilities
+
+      -- | The client has support for workspace folders.
+    , _workspaceFolders :: Maybe Bool
+
+      -- | The client supports `workspace/configuration` requests.
+    , _configuration :: Maybe Bool
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''WorkspaceClientCapabilities)
 
 instance Default WorkspaceClientCapabilities where
-  def = WorkspaceClientCapabilities def def def def def def
+  def = WorkspaceClientCapabilities def def def def def def def def
 
 -- ---------------------------------------------------------------------
 {-
 New in 3.0
 ----------
-
-TextDocumentClientCapabilities
-    define capabilities the editor / tool provides on text documents.
-
 /**
  * Text document specific client capabilities.
  */
@@ -221,7 +292,48 @@
                          * that is typing in one will update others too.
                          */
                         snippetSupport?: boolean;
+
+                        /**
+                         * Client supports commit characters on a completion item.
+                         */
+                        commitCharactersSupport?: boolean
+
+                        /**
+                         * Client supports the follow content formats for the documentation
+                         * property. The order describes the preferred format of the client.
+                         */
+                        documentationFormat?: MarkupKind[];
+
+                        /**
+                         * Client supports the deprecated property on a completion item.
+                         */
+                        deprecatedSupport?: boolean;
+
+                        /**
+                         * Client supports the preselect property on a completion item.
+                         */
+                        preselectSupport?: boolean;
                 }
+
+                completionItemKind?: {
+                        /**
+                         * The completion item kind values the client supports. When this
+                         * property exists the client also guarantees that it will
+                         * handle values outside its set gracefully and falls back
+                         * to a default value when unknown.
+                         *
+                         * If this property is not present the client only supports
+                         * the completion items kinds from `Text` to `Reference` as defined in
+                         * the initial version of the protocol.
+                         */
+                        valueSet?: CompletionItemKind[];
+                },
+
+                /**
+                 * The client supports to send additional context information for a
+                 * `textDocument/completion` request.
+                 */
+                contextSupport?: boolean;
         };
 
         /**
@@ -232,6 +344,12 @@
                  * Whether hover supports dynamic registration.
                  */
                 dynamicRegistration?: boolean;
+
+                /**
+                 * Client supports the follow content formats for the content
+                 * property. The order describes the preferred format of the client.
+                 */
+                contentFormat?: MarkupKind[];
         };
 
         /**
@@ -242,6 +360,18 @@
                  * Whether signature help supports dynamic registration.
                  */
                 dynamicRegistration?: boolean;
+
+                /**
+                 * The client supports the following `SignatureInformation`
+                 * specific properties.
+                 */
+                signatureInformation?: {
+                        /**
+                         * Client supports the follow content formats for the documentation
+                         * property. The order describes the preferred format of the client.
+                         */
+                        documentationFormat?: MarkupKind[];
+                };
         };
 
         /**
@@ -272,6 +402,23 @@
                  * Whether document symbol supports dynamic registration.
                  */
                 dynamicRegistration?: boolean;
+
+                /**
+                 * Specific capabilities for the `SymbolKind`.
+                 */
+                symbolKind?: {
+                        /**
+                         * The symbol kind values the client supports. When this
+                         * property exists the client also guarantees that it will
+                         * handle values outside its set gracefully and falls back
+                         * to a default value when unknown.
+                         *
+                         * If this property is not present the client only supports
+                         * the symbol kinds from `File` to `Array` as defined in
+                         * the initial version of the protocol.
+                         */
+                        valueSet?: SymbolKind[];
+                }
         };
 
         /**
@@ -315,6 +462,34 @@
         };
 
         /**
+         * Capabilities specific to the `textDocument/typeDefinition`
+         *
+         * Since 3.6.0
+         */
+        typeDefinition?: {
+                /**
+                 * Whether typeDefinition supports dynamic registration. If this is set to `true`
+                 * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+                 * return value for the corresponding server capability as well.
+                 */
+                dynamicRegistration?: boolean;
+        };
+
+        /**
+         * Capabilities specific to the `textDocument/implementation`.
+         *
+         * Since 3.6.0
+         */
+        implementation?: {
+                /**
+                 * Whether implementation supports dynamic registration. If this is set to `true`
+                 * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+                 * return value for the corresponding server capability as well.
+                 */
+                dynamicRegistration?: boolean;
+        };
+
+        /**
          * Capabilities specific to the `textDocument/codeAction`
          */
         codeAction?: {
@@ -322,6 +497,28 @@
                  * Whether code action supports dynamic registration.
                  */
                 dynamicRegistration?: boolean;
+                /**
+                 * The client support code action literals as a valid
+                 * response of the `textDocument/codeAction` request.
+                 *
+                 * Since 3.8.0
+                 */
+                codeActionLiteralSupport?: {
+                        /**
+                         * The code action kind is support with the following value
+                         * set.
+                         */
+                        codeActionKind: {
+
+                                /**
+                                 * The code action kind values the client supports. When this
+                                 * property exists the client also guarantees that it will
+                                 * handle values outside its set gracefully and falls back
+                                 * to a default value when unknown.
+                                 */
+                                valueSet: CodeActionKind[];
+                        };
+                };
         };
 
         /**
@@ -345,6 +542,21 @@
         };
 
         /**
+         * Capabilities specific to the `textDocument/documentColor` and the
+         * `textDocument/colorPresentation` request.
+         *
+         * Since 3.6.0
+         */
+        colorProvider?: {
+                /**
+                 * Whether colorProvider supports dynamic registration. If this is set to `true`
+                 * the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+                 * return value for the corresponding server capability as well.
+                 */
+                dynamicRegistration?: boolean;
+        }
+
+        /**
          * Capabilities specific to the `textDocument/rename`
          */
         rename?: {
@@ -353,6 +565,16 @@
                  */
                 dynamicRegistration?: boolean;
         };
+
+        /**
+         * Capabilities specific to `textDocument/publishDiagnostics`.
+         */
+        publishDiagnostics?: {
+                /**
+                 * Whether the clients accepts diagnostics with related information.
+                 */
+                relatedInformation?: boolean;
+        };
 }
 
 -}
@@ -386,23 +608,49 @@
 
 data CompletionItemClientCapabilities =
   CompletionItemClientCapabilities
-    {
-      -- | Client supports snippets as insert text.
+    { -- | Client supports snippets as insert text.
       --
       -- A snippet can define tab stops and placeholders with `$1`, `$2` and
       -- `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of
       -- the snippet. Placeholders with equal identifiers are linked, that is
       -- typing in one will update others too.
       _snippetSupport :: Maybe Bool
+
+      -- | Client supports commit characters on a completion item.
+    , _commitCharactersSupport :: Maybe Bool
+
+      -- | Client supports the follow content formats for the documentation
+      -- property. The order describes the preferred format of the client.
+    , _documentationFormat :: Maybe (List MarkupKind)
+
+      -- | Client supports the deprecated property on a completion item.
+    , _deprecatedSupport :: Maybe Bool
+
+      -- | Client supports the preselect property on a completion item.
+    , _preselectSupport :: Maybe Bool
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''CompletionItemClientCapabilities)
 
+data CompletionItemKindClientCapabilities =
+  CompletionItemKindClientCapabilities
+    { -- | The completion item kind values the client supports. When this
+      -- property exists the client also guarantees that it will
+      --  handle values outside its set gracefully and falls back
+      --  to a default value when unknown.
+      _valueSet :: Maybe (List CompletionItemKind)
+    }
+  deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''CompletionItemKindClientCapabilities)
+
 data CompletionClientCapabilities =
   CompletionClientCapabilities
     { _dynamicRegistration :: Maybe Bool -- ^Whether completion supports dynamic
                                          -- registration.
     , _completionItem :: Maybe CompletionItemClientCapabilities
+    , _completionItemKind :: Maybe CompletionItemKindClientCapabilities
+    , _contextSupport :: Maybe Bool
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''CompletionClientCapabilities)
@@ -412,15 +660,31 @@
 data HoverClientCapabilities =
   HoverClientCapabilities
     { _dynamicRegistration :: Maybe Bool
+    , _contentFormat :: Maybe (List MarkupKind)
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''HoverClientCapabilities)
 
 -- -------------------------------------
 
+data SignatureInformationClientCapabilities = 
+  SignatureInformationClientCapabilities
+    { -- | Client supports the follow content formats for the documentation
+      -- property. The order describes the preferred format of the client.
+      documentationFormat :: Maybe (List MarkupKind)
+    }
+  deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''SignatureInformationClientCapabilities)
+
 data SignatureHelpClientCapabilities =
   SignatureHelpClientCapabilities
-    { _dynamicRegistration :: Maybe Bool
+    { -- | Whether signature help supports dynamic registration.
+      _dynamicRegistration :: Maybe Bool
+      
+      -- | The client supports the following `SignatureInformation`
+      -- specific properties.
+    , _signatureInformation :: Maybe SignatureInformationClientCapabilities
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''SignatureHelpClientCapabilities)
@@ -445,9 +709,28 @@
 
 -- -------------------------------------
 
+data DocumentSymbolKindClientCapabilities =
+  DocumentSymbolKindClientCapabilities
+    { -- | The symbol kind values the client supports. When this
+      --  property exists the client also guarantees that it will
+      --  handle values outside its set gracefully and falls back
+      --  to a default value when unknown.
+      --  
+      --  If this property is not present the client only supports
+      --  the symbol kinds from `File` to `Array` as defined in
+      --  the initial version of the protocol.
+      _valueSet :: Maybe (List SymbolKind)
+    }
+  deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''DocumentSymbolKindClientCapabilities)
+
 data DocumentSymbolClientCapabilities =
   DocumentSymbolClientCapabilities
-    { _dynamicRegistration :: Maybe Bool
+    { -- | Whether document symbol supports dynamic registration.
+      _dynamicRegistration :: Maybe Bool
+      -- | Specific capabilities for the `SymbolKind`.
+    , _symbolKind :: Maybe DocumentSymbolKindClientCapabilities
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''DocumentSymbolClientCapabilities)
@@ -490,13 +773,43 @@
 
 -- -------------------------------------
 
-data CodeActionKindValueSet =
-  CodeActionKindValueSet
-   { _valueSet :: List CodeActionKind
+data TypeDefinitionClientCapabilities =
+  TypeDefinitionClientCapabilities
+    { -- | Whether typeDefinition supports dynamic registration. If this is set to `true`
+      --  the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+      --  return value for the corresponding server capability as well.
+      _dynamicRegistration :: Maybe Bool
+    } deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''TypeDefinitionClientCapabilities)
+
+-- -------------------------------------
+--
+data ImplementationClientCapabilities =
+  ImplementationClientCapabilities
+    { -- | Whether implementation supports dynamic registration. If this is set to `true`
+      -- the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+      -- return value for the corresponding server capability as well.
+      _dynamicRegistration :: Maybe Bool
+    } deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''ImplementationClientCapabilities)
+
+-- -------------------------------------
+
+data CodeActionKindClientCapabilities =
+  CodeActionKindClientCapabilities
+   { -- | The code action kind values the client supports. When this
+     -- property exists the client also guarantees that it will
+     -- handle values outside its set gracefully and falls back
+     -- to a default value when unknown.
+      _valueSet :: List CodeActionKind
    } deriving (Show, Read, Eq)
 
-instance Default CodeActionKindValueSet where
-  def = CodeActionKindValueSet (List allKinds)
+$(deriveJSON lspOptions ''CodeActionKindClientCapabilities)
+
+instance Default CodeActionKindClientCapabilities where
+  def = CodeActionKindClientCapabilities (List allKinds)
     where allKinds = [ CodeActionQuickFix
                      , CodeActionRefactor
                      , CodeActionRefactorExtract
@@ -506,11 +819,9 @@
                      , CodeActionSourceOrganizeImports
                      ]
 
-$(deriveJSON lspOptions ''CodeActionKindValueSet)
-
 data CodeActionLiteralSupport =
   CodeActionLiteralSupport
-    { _codeActionKind :: CodeActionKindValueSet -- ^ The code action kind is support with the following value set.
+    { _codeActionKind :: CodeActionKindClientCapabilities -- ^ The code action kind is support with the following value set.
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''CodeActionLiteralSupport)
@@ -519,8 +830,8 @@
   CodeActionClientCapabilities
     { _dynamicRegistration      :: Maybe Bool -- ^ Whether code action supports dynamic registration.
     , _codeActionLiteralSupport :: Maybe CodeActionLiteralSupport -- ^ The client support code action literals as a valid response
-                                                                 -- of the `textDocument/codeAction` request.
-                                                                 -- Since 3.8.0
+                                                                  -- of the `textDocument/codeAction` request.
+                                                                  -- Since 3.8.0
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''CodeActionClientCapabilities)
@@ -545,6 +856,18 @@
 
 -- -------------------------------------
 
+data ColorProviderClientCapabilities =
+  ColorProviderClientCapabilities
+    { -- | Whether colorProvider supports dynamic registration. If this is set to `true`
+      --  the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+      --  return value for the corresponding server capability as well.
+      _dynamicRegistration :: Maybe Bool
+    } deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''ColorProviderClientCapabilities)
+
+-- -------------------------------------
+
 data RenameClientCapabilities =
   RenameClientCapabilities
     { _dynamicRegistration :: Maybe Bool
@@ -554,6 +877,16 @@
 
 -- -------------------------------------
 
+data PublishDiagnosticsClientCapabilities =
+  PublishDiagnosticsClientCapabilities
+    { -- | Whether the clients accepts diagnostics with related information.
+      _relatedInformation :: Maybe Bool
+    } deriving (Show, Read, Eq)
+
+$(deriveJSON lspOptions ''PublishDiagnosticsClientCapabilities)
+
+-- -------------------------------------
+
 data TextDocumentClientCapabilities =
   TextDocumentClientCapabilities
     { _synchronization :: Maybe SynchronizationTextDocumentClientCapabilities
@@ -588,6 +921,12 @@
       -- | Capabilities specific to the `textDocument/definition`
     , _definition :: Maybe DefinitionClientCapabilities
 
+      -- | Capabilities specific to the `textDocument/typeDefinition`
+    , _typeDefinition :: Maybe TypeDefinitionClientCapabilities
+
+      -- | Capabilities specific to the `textDocument/implementation`
+    , _implementation :: Maybe ImplementationClientCapabilities
+
       -- | Capabilities specific to the `textDocument/codeAction`
     , _codeAction :: Maybe CodeActionClientCapabilities
 
@@ -597,15 +936,23 @@
       -- | Capabilities specific to the `textDocument/documentLink`
     , _documentLink :: Maybe DocumentLinkClientCapabilities
 
+      -- | Capabilities specific to the `textDocument/documentColor` and the
+      -- `textDocument/colorPresentation` request
+    , _colorProvider :: Maybe ColorProviderClientCapabilities
+
       -- | Capabilities specific to the `textDocument/rename`
     , _rename :: Maybe RenameClientCapabilities
+
+      -- | Capabilities specific to `textDocument/publishDiagnostics`
+    , _publishDiagnostics :: Maybe PublishDiagnosticsClientCapabilities
     } deriving (Show, Read, Eq)
 
 $(deriveJSON lspOptions ''TextDocumentClientCapabilities)
 
 instance Default TextDocumentClientCapabilities where
-  def = TextDocumentClientCapabilities def def def def def def def
+  def = TextDocumentClientCapabilities def def def def def def def def
                                        def def def def def def def def
+                                       def def def
 
 -- ---------------------------------------------------------------------
 {-
diff --git a/src/Language/Haskell/LSP/TH/CodeAction.hs b/src/Language/Haskell/LSP/TH/CodeAction.hs
--- a/src/Language/Haskell/LSP/TH/CodeAction.hs
+++ b/src/Language/Haskell/LSP/TH/CodeAction.hs
@@ -14,7 +14,7 @@
 import           Language.Haskell.LSP.TH.List
 import           Language.Haskell.LSP.TH.Location
 import           Language.Haskell.LSP.TH.Message
-import           Language.Haskell.LSP.TH.TextDocumentIdentifier
+import           Language.Haskell.LSP.TH.TextDocument
 import           Language.Haskell.LSP.TH.WorkspaceEdit
 
 
diff --git a/src/Language/Haskell/LSP/TH/Command.hs b/src/Language/Haskell/LSP/TH/Command.hs
--- a/src/Language/Haskell/LSP/TH/Command.hs
+++ b/src/Language/Haskell/LSP/TH/Command.hs
@@ -6,6 +6,7 @@
 import           Data.Aeson.TH
 import           Data.Text
 import           Language.Haskell.LSP.TH.Constants
+import           Language.Haskell.LSP.TH.List
 -- ---------------------------------------------------------------------
 {-
 Command
@@ -38,7 +39,7 @@
   Command
     { _title     :: Text
     , _command   :: Text
-    , _arguments :: Maybe Value
+    , _arguments :: Maybe (List Value)
     } deriving (Show, Read, Eq)
 
 deriveJSON lspOptions ''Command
diff --git a/src/Language/Haskell/LSP/TH/Completion.hs b/src/Language/Haskell/LSP/TH/Completion.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/LSP/TH/Completion.hs
@@ -0,0 +1,421 @@
+{-# LANGUAGE DuplicateRecordFields      #-}
+{-# LANGUAGE OverloadedStrings          #-}
+{-# LANGUAGE TemplateHaskell            #-}
+module Language.Haskell.LSP.TH.Completion where
+
+import qualified Data.Aeson                    as A
+import           Data.Aeson.TH
+import           Data.Text                      ( Text )
+import           Language.Haskell.LSP.TH.Command
+import           Language.Haskell.LSP.TH.Constants
+import           Language.Haskell.LSP.TH.DocumentFilter
+import           Language.Haskell.LSP.TH.List
+import           Language.Haskell.LSP.TH.Message
+import           Language.Haskell.LSP.TH.TextDocument
+import           Language.Haskell.LSP.TH.Utils
+import           Language.Haskell.LSP.TH.WorkspaceEdit
+
+data CompletionItemKind = CiText
+                        | CiMethod
+                        | CiFunction
+                        | CiConstructor
+                        | CiField
+                        | CiVariable
+                        | CiClass
+                        | CiInterface
+                        | CiModule
+                        | CiProperty
+                        | CiUnit
+                        | CiValue
+                        | CiEnum
+                        | CiKeyword
+                        | CiSnippet
+                        | CiColor
+                        | CiFile
+                        | CiReference
+                        | CiFolder
+                        | CiEnumMember
+                        | CiConstant
+                        | CiStruct
+                        | CiEvent
+                        | CiOperator
+                        | CiTypeParameter
+         deriving (Read,Show,Eq,Ord)
+
+instance A.ToJSON CompletionItemKind where
+  toJSON CiText          = A.Number 1
+  toJSON CiMethod        = A.Number 2
+  toJSON CiFunction      = A.Number 3
+  toJSON CiConstructor   = A.Number 4
+  toJSON CiField         = A.Number 5
+  toJSON CiVariable      = A.Number 6
+  toJSON CiClass         = A.Number 7
+  toJSON CiInterface     = A.Number 8
+  toJSON CiModule        = A.Number 9
+  toJSON CiProperty      = A.Number 10
+  toJSON CiUnit          = A.Number 11
+  toJSON CiValue         = A.Number 12
+  toJSON CiEnum          = A.Number 13
+  toJSON CiKeyword       = A.Number 14
+  toJSON CiSnippet       = A.Number 15
+  toJSON CiColor         = A.Number 16
+  toJSON CiFile          = A.Number 17
+  toJSON CiReference     = A.Number 18
+  toJSON CiFolder        = A.Number 19
+  toJSON CiEnumMember    = A.Number 20
+  toJSON CiConstant      = A.Number 21
+  toJSON CiStruct        = A.Number 22
+  toJSON CiEvent         = A.Number 23
+  toJSON CiOperator      = A.Number 24
+  toJSON CiTypeParameter = A.Number 25
+
+instance A.FromJSON CompletionItemKind where
+  parseJSON (A.Number  1) = pure CiText
+  parseJSON (A.Number  2) = pure CiMethod
+  parseJSON (A.Number  3) = pure CiFunction
+  parseJSON (A.Number  4) = pure CiConstructor
+  parseJSON (A.Number  5) = pure CiField
+  parseJSON (A.Number  6) = pure CiVariable
+  parseJSON (A.Number  7) = pure CiClass
+  parseJSON (A.Number  8) = pure CiInterface
+  parseJSON (A.Number  9) = pure CiModule
+  parseJSON (A.Number 10) = pure CiProperty
+  parseJSON (A.Number 11) = pure CiUnit
+  parseJSON (A.Number 12) = pure CiValue
+  parseJSON (A.Number 13) = pure CiEnum
+  parseJSON (A.Number 14) = pure CiKeyword
+  parseJSON (A.Number 15) = pure CiSnippet
+  parseJSON (A.Number 16) = pure CiColor
+  parseJSON (A.Number 17) = pure CiFile
+  parseJSON (A.Number 18) = pure CiReference
+  parseJSON (A.Number 19) = pure CiFolder
+  parseJSON (A.Number 20) = pure CiEnumMember
+  parseJSON (A.Number 21) = pure CiConstant
+  parseJSON (A.Number 22) = pure CiStruct
+  parseJSON (A.Number 23) = pure CiEvent
+  parseJSON (A.Number 24) = pure CiOperator
+  parseJSON (A.Number 25) = pure CiTypeParameter
+  parseJSON _             = mempty
+
+
+-- ---------------------------------------------------------------------
+{-
+Completion Request
+
+The Completion request is sent from the client to the server to compute
+completion items at a given cursor position. Completion items are presented in
+the IntelliSense user interface. If computing full completion items is
+expensive, servers can additionally provide a handler for the completion item
+resolve request ('completionItem/resolve'). This request is sent when a
+completion item is selected in the user interface. A typically use case is for
+example: the 'textDocument/completion' request doesn't fill in the documentation
+property for returned completion items since it is expensive to compute. When
+the item is selected in the user interface then a 'completionItem/resolve'
+request is sent with the selected completion item as a param. The returned
+completion item should have the documentation property filled in.
+
+    Changed: In 2.0 the request uses TextDocumentPositionParams with a proper
+    textDocument and position property. In 1.0 the uri of the referenced text
+    document was inlined into the params object.
+
+Request
+
+    method: 'textDocument/completion'
+    params: TextDocumentPositionParams
+-}
+
+-- -------------------------------------
+
+{-
+
+Response
+
+    result: CompletionItem[] | CompletionList
+
+/**
+ * Represents a collection of [completion items](#CompletionItem) to be presented
+ * in the editor.
+ */
+interface CompletionList {
+    /**
+     * This list it not complete. Further typing should result in recomputing
+     * this list.
+     */
+    isIncomplete: boolean;
+    /**
+     * The completion items.
+     */
+    items: CompletionItem[];
+}
+
+
+New in 3.0 : InsertTextFormat
+
+/**
+ * Defines whether the insert text in a completion item should be interpreted as
+ * plain text or a snippet.
+ */
+namespace InsertTextFormat {
+        /**
+         * The primary text to be inserted is treated as a plain string.
+         */
+        export const PlainText = 1;
+
+        /**
+         * The primary text to be inserted is treated as a snippet.
+         *
+         * A snippet can define tab stops and placeholders with `$1`, `$2`
+         * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+         * the end of the snippet. Placeholders with equal identifiers are linked,
+         * that is typing in one will update others too.
+         *
+         * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
+         */
+        export const Snippet = 2;
+}
+
+
+
+interface CompletionItem {
+    /**
+     * The label of this completion item. By default
+     * also the text that is inserted when selecting
+     * this completion.
+     */
+    label: string;
+    /**
+     * The kind of this completion item. Based of the kind
+     * an icon is chosen by the editor.
+     */
+    kind?: number;
+    /**
+     * A human-readable string with additional information
+     * about this item, like type or symbol information.
+     */
+    detail?: string;
+    /**
+     * A human-readable string that represents a doc-comment.
+     */
+    documentation?: string;
+    /**
+     * A string that shoud be used when comparing this item
+     * with other items. When `falsy` the label is used.
+     */
+    sortText?: string;
+    /**
+     * A string that should be used when filtering a set of
+     * completion items. When `falsy` the label is used.
+     */
+    filterText?: string;
+    /**
+     * A string that should be inserted a document when selecting
+     * this completion. When `falsy` the label is used.
+     */
+    insertText?: string;
+    -- Following field is new in 3.0
+        /**
+         * The format of the insert text. The format applies to both the `insertText` property
+         * and the `newText` property of a provided `textEdit`.
+         */
+    insertTextFormat?: InsertTextFormat;
+        /**
+         * An edit which is applied to a document when selecting this completion. When an edit is provided the value of
+         * `insertText` is ignored.
+         *
+         * *Note:* The range of the edit must be a single line range and it must contain the position at which completion
+         * has been requested.
+         */
+
+    textEdit?: TextEdit;
+
+    -- Following field is new in 3.0
+        /**
+         * An optional array of additional text edits that are applied when
+         * selecting this completion. Edits must not overlap with the main edit
+         * nor with themselves.
+         */
+    additionalTextEdits?: TextEdit[];
+    -- Following field is new in 3.0
+        /**
+         * An optional command that is executed *after* inserting this completion. *Note* that
+         * additional modifications to the current document should be described with the
+         * additionalTextEdits-property.
+         */
+
+    command?: Command;
+        /**
+         * An data entry field that is preserved on a completion item between
+         * a completion and a completion resolve request.
+         */
+
+    data?: any
+}
+
+Where CompletionItemKind is defined as follows:
+
+/**
+ * The kind of a completion entry.
+ */
+enum CompletionItemKind {
+    Text = 1,
+    Method = 2,
+    Function = 3,
+    Constructor = 4,
+    Field = 5,
+    Variable = 6,
+    Class = 7,
+    Interface = 8,
+    Module = 9,
+    Property = 10,
+    Unit = 11,
+    Value = 12,
+    Enum = 13,
+    Keyword = 14,
+    Snippet = 15,
+    Color = 16,
+    File = 17,
+    Reference = 18
+}
+
+    error: code and message set in case an exception happens during the completion request.
+-}
+
+-- -------------------------------------
+
+data InsertTextFormat
+  = PlainText -- ^The primary text to be inserted is treated as a plain string.
+  | Snippet
+      -- ^ The primary text to be inserted is treated as a snippet.
+      --
+      -- A snippet can define tab stops and placeholders with `$1`, `$2`
+      -- and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+      -- the end of the snippet. Placeholders with equal identifiers are linked,
+      -- that is typing in one will update others too.
+      --
+      -- See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
+    deriving (Show, Read, Eq)
+
+instance A.ToJSON InsertTextFormat where
+  toJSON PlainText = A.Number 1
+  toJSON Snippet   = A.Number 2
+
+instance A.FromJSON InsertTextFormat where
+  parseJSON (A.Number  1) = pure PlainText
+  parseJSON (A.Number  2) = pure Snippet
+  parseJSON _             = mempty
+
+data CompletionItem =
+  CompletionItem
+    { _label               :: Text -- ^ The label of this completion item. By default also
+                       -- the text that is inserted when selecting this
+                       -- completion.
+    , _kind                :: Maybe CompletionItemKind
+    , _detail              :: Maybe Text -- ^ A human-readable string with additional
+                              -- information about this item, like type or
+                              -- symbol information.
+    , _documentation       :: Maybe Text -- ^ A human-readable string that represents
+                                    -- a doc-comment.
+    , _sortText            :: Maybe Text -- ^ A string that should be used when filtering
+                                -- a set of completion items. When `falsy` the
+                                -- label is used.
+    , _filterText          :: Maybe Text -- ^ A string that should be used when
+                                  -- filtering a set of completion items. When
+                                  -- `falsy` the label is used.
+    , _insertText          :: Maybe Text -- ^ A string that should be inserted a
+                                  -- document when selecting this completion.
+                                  -- When `falsy` the label is used.
+    , _insertTextFormat    :: Maybe InsertTextFormat
+         -- ^ The format of the insert text. The format applies to both the
+         -- `insertText` property and the `newText` property of a provided
+         -- `textEdit`.
+    , _textEdit            :: Maybe TextEdit
+         -- ^ An edit which is applied to a document when selecting this
+         -- completion. When an edit is provided the value of `insertText` is
+         -- ignored.
+         --
+         -- *Note:* The range of the edit must be a single line range and it
+         -- must contain the position at which completion has been requested.
+    , _additionalTextEdits :: Maybe (List TextEdit)
+         -- ^ An optional array of additional text edits that are applied when
+         -- selecting this completion. Edits must not overlap with the main edit
+         -- nor with themselves.
+    , _command             :: Maybe Command
+        -- ^ An optional command that is executed *after* inserting this
+        -- completion. *Note* that additional modifications to the current
+        -- document should be described with the additionalTextEdits-property.
+    , _xdata               :: Maybe A.Value -- ^ An data entry field that is preserved on a
+                              -- completion item between a completion and a
+                              -- completion resolve request.
+    } deriving (Read,Show,Eq)
+
+deriveJSON lspOptions{ fieldLabelModifier = customModifier } ''CompletionItem
+
+data CompletionListType =
+  CompletionListType
+    { _isIncomplete :: Bool
+    , _items        :: List CompletionItem
+    } deriving (Read,Show,Eq)
+
+deriveJSON lspOptions ''CompletionListType
+
+data CompletionResponseResult
+  = CompletionList CompletionListType
+  | Completions (List CompletionItem)
+  deriving (Read,Show,Eq)
+
+deriveJSON defaultOptions { fieldLabelModifier = rdrop (length ("CompletionResponseResult"::String)), sumEncoding = UntaggedValue } ''CompletionResponseResult
+
+type CompletionResponse = ResponseMessage CompletionResponseResult
+type CompletionRequest = RequestMessage ClientMethod TextDocumentPositionParams CompletionResponseResult
+
+-- -------------------------------------
+{-
+New in 3.0
+-----------
+Registration Options: CompletionRegistrationOptions options defined as follows:
+
+export interface CompletionRegistrationOptions extends TextDocumentRegistrationOptions {
+        /**
+         * The characters that trigger completion automatically.
+         */
+        triggerCharacters?: string[];
+
+        /**
+         * The server provides support to resolve additional
+         * information for a completion item.
+         */
+        resolveProvider?: boolean;
+}
+-}
+
+data CompletionRegistrationOptions =
+  CompletionRegistrationOptions
+    { _documentSelector  :: Maybe DocumentSelector
+    , _triggerCharacters :: Maybe (List String)
+    , _resolveProvider   :: Maybe Bool
+    } deriving (Show, Read, Eq)
+
+deriveJSON lspOptions ''CompletionRegistrationOptions
+
+-- ---------------------------------------------------------------------
+{-
+Completion Item Resolve Request
+
+https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#completion-item-resolve-request
+
+The request is sent from the client to the server to resolve additional
+information for a given completion item.
+
+Request
+
+    method: 'completionItem/resolve'
+    params: CompletionItem
+
+Response
+
+    result: CompletionItem
+    error: code and message set in case an exception happens during the completion resolve request.
+-}
+
+type CompletionItemResolveRequest  = RequestMessage ClientMethod CompletionItem CompletionItem
+type CompletionItemResolveResponse = ResponseMessage CompletionItem
diff --git a/src/Language/Haskell/LSP/TH/DataTypesJSON.hs b/src/Language/Haskell/LSP/TH/DataTypesJSON.hs
--- a/src/Language/Haskell/LSP/TH/DataTypesJSON.hs
+++ b/src/Language/Haskell/LSP/TH/DataTypesJSON.hs
@@ -14,12 +14,15 @@
     ( module Language.Haskell.LSP.TH.DataTypesJSON
     , module Language.Haskell.LSP.TH.CodeAction
     , module Language.Haskell.LSP.TH.Command
+    , module Language.Haskell.LSP.TH.Completion
     , module Language.Haskell.LSP.TH.Diagnostic
+    , module Language.Haskell.LSP.TH.DocumentFilter
     , module Language.Haskell.LSP.TH.List
     , module Language.Haskell.LSP.TH.Location
+    , module Language.Haskell.LSP.TH.MarkupContent
     , module Language.Haskell.LSP.TH.Message
     , module Language.Haskell.LSP.TH.Symbol
-    , module Language.Haskell.LSP.TH.TextDocumentIdentifier
+    , module Language.Haskell.LSP.TH.TextDocument
     , module Language.Haskell.LSP.TH.Uri
     , module Language.Haskell.LSP.TH.WorkspaceEdit
     ) where
@@ -35,142 +38,20 @@
 import           Language.Haskell.LSP.TH.ClientCapabilities
 import           Language.Haskell.LSP.TH.CodeAction
 import           Language.Haskell.LSP.TH.Command
+import           Language.Haskell.LSP.TH.Completion
 import           Language.Haskell.LSP.TH.Constants
 import           Language.Haskell.LSP.TH.Diagnostic
+import           Language.Haskell.LSP.TH.DocumentFilter
 import           Language.Haskell.LSP.TH.List
 import           Language.Haskell.LSP.TH.Location
+import           Language.Haskell.LSP.TH.MarkupContent
 import           Language.Haskell.LSP.TH.Message
 import           Language.Haskell.LSP.TH.Symbol
-import           Language.Haskell.LSP.TH.TextDocumentIdentifier
+import           Language.Haskell.LSP.TH.TextDocument
 import           Language.Haskell.LSP.TH.Utils
 import           Language.Haskell.LSP.TH.Uri
 import           Language.Haskell.LSP.TH.WorkspaceEdit
 
--- ---------------------------------------------------------------------
-
-
-{-
-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 {
-    _uri        :: Uri
-  , _languageId :: Text
-  , _version    :: Int
-  , _text       :: Text
-  } deriving (Show, Read, Eq)
-
-deriveJSON lspOptions ''TextDocumentItem
-makeFieldsNoPrefix ''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
-    { _textDocument :: TextDocumentIdentifier
-    , _position     :: Position
-    } deriving (Show, Read, Eq)
-
-deriveJSON lspOptions ''TextDocumentPositionParams
-makeFieldsNoPrefix ''TextDocumentPositionParams
-
--- ---------------------------------------------------------------------
-{-
-New in 3.0
-----------
-
-DocumentFilter
-https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#new-documentfilter
-
-A document filter denotes a document through properties like language, schema or
-pattern. Examples are a filter that applies to TypeScript files on disk or a
-filter the applies to JSON files with name package.json:
-
-    { language: 'typescript', scheme: 'file' }
-    { language: 'json', pattern: '**/package.json' }
-
-export interface DocumentFilter {
-        /**
-         * A language id, like `typescript`.
-         */
-        language?: string;
-
-        /**
-         * A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
-         */
-        scheme?: string;
-
-        /**
-         * A glob pattern, like `*.{ts,js}`.
-         */
-        pattern?: string;
-}
--}
-data DocumentFilter =
-  DocumentFilter
-    { _language :: Text
-    , _scheme   :: Text
-    , _pattern  :: Maybe Text
-    } deriving (Show, Read, Eq)
-
-deriveJSON lspOptions ''DocumentFilter
-makeFieldsNoPrefix ''DocumentFilter
-
-{-
-A document selector is the combination of one or many document filters.
-
-export type DocumentSelector = DocumentFilter[];
--}
-type DocumentSelector = List DocumentFilter
-
 -- =====================================================================
 -- ACTUAL PROTOCOL -----------------------------------------------------
 -- =====================================================================
@@ -1652,398 +1533,6 @@
 
 -- ---------------------------------------------------------------------
 {-
-Completion Request
-
-The Completion request is sent from the client to the server to compute
-completion items at a given cursor position. Completion items are presented in
-the IntelliSense user interface. If computing full completion items is
-expensive, servers can additionally provide a handler for the completion item
-resolve request ('completionItem/resolve'). This request is sent when a
-completion item is selected in the user interface. A typically use case is for
-example: the 'textDocument/completion' request doesn't fill in the documentation
-property for returned completion items since it is expensive to compute. When
-the item is selected in the user interface then a 'completionItem/resolve'
-request is sent with the selected completion item as a param. The returned
-completion item should have the documentation property filled in.
-
-    Changed: In 2.0 the request uses TextDocumentPositionParams with a proper
-    textDocument and position property. In 1.0 the uri of the referenced text
-    document was inlined into the params object.
-
-Request
-
-    method: 'textDocument/completion'
-    params: TextDocumentPositionParams
--}
-
--- -------------------------------------
-
-{-
-
-Response
-
-    result: CompletionItem[] | CompletionList
-
-/**
- * Represents a collection of [completion items](#CompletionItem) to be presented
- * in the editor.
- */
-interface CompletionList {
-    /**
-     * This list it not complete. Further typing should result in recomputing
-     * this list.
-     */
-    isIncomplete: boolean;
-    /**
-     * The completion items.
-     */
-    items: CompletionItem[];
-}
-
-
-New in 3.0 : InsertTextFormat
-
-/**
- * Defines whether the insert text in a completion item should be interpreted as
- * plain text or a snippet.
- */
-namespace InsertTextFormat {
-        /**
-         * The primary text to be inserted is treated as a plain string.
-         */
-        export const PlainText = 1;
-
-        /**
-         * The primary text to be inserted is treated as a snippet.
-         *
-         * A snippet can define tab stops and placeholders with `$1`, `$2`
-         * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
-         * the end of the snippet. Placeholders with equal identifiers are linked,
-         * that is typing in one will update others too.
-         *
-         * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
-         */
-        export const Snippet = 2;
-}
-
-
-
-interface CompletionItem {
-    /**
-     * The label of this completion item. By default
-     * also the text that is inserted when selecting
-     * this completion.
-     */
-    label: string;
-    /**
-     * The kind of this completion item. Based of the kind
-     * an icon is chosen by the editor.
-     */
-    kind?: number;
-    /**
-     * A human-readable string with additional information
-     * about this item, like type or symbol information.
-     */
-    detail?: string;
-    /**
-     * A human-readable string that represents a doc-comment.
-     */
-    documentation?: string;
-    /**
-     * A string that shoud be used when comparing this item
-     * with other items. When `falsy` the label is used.
-     */
-    sortText?: string;
-    /**
-     * A string that should be used when filtering a set of
-     * completion items. When `falsy` the label is used.
-     */
-    filterText?: string;
-    /**
-     * A string that should be inserted a document when selecting
-     * this completion. When `falsy` the label is used.
-     */
-    insertText?: string;
-    -- Following field is new in 3.0
-        /**
-         * The format of the insert text. The format applies to both the `insertText` property
-         * and the `newText` property of a provided `textEdit`.
-         */
-    insertTextFormat?: InsertTextFormat;
-        /**
-         * An edit which is applied to a document when selecting this completion. When an edit is provided the value of
-         * `insertText` is ignored.
-         *
-         * *Note:* The range of the edit must be a single line range and it must contain the position at which completion
-         * has been requested.
-         */
-
-    textEdit?: TextEdit;
-
-    -- Following field is new in 3.0
-        /**
-         * An optional array of additional text edits that are applied when
-         * selecting this completion. Edits must not overlap with the main edit
-         * nor with themselves.
-         */
-    additionalTextEdits?: TextEdit[];
-    -- Following field is new in 3.0
-        /**
-         * An optional command that is executed *after* inserting this completion. *Note* that
-         * additional modifications to the current document should be described with the
-         * additionalTextEdits-property.
-         */
-
-    command?: Command;
-        /**
-         * An data entry field that is preserved on a completion item between
-         * a completion and a completion resolve request.
-         */
-
-    data?: any
-}
-
-Where CompletionItemKind is defined as follows:
-
-/**
- * The kind of a completion entry.
- */
-enum CompletionItemKind {
-    Text = 1,
-    Method = 2,
-    Function = 3,
-    Constructor = 4,
-    Field = 5,
-    Variable = 6,
-    Class = 7,
-    Interface = 8,
-    Module = 9,
-    Property = 10,
-    Unit = 11,
-    Value = 12,
-    Enum = 13,
-    Keyword = 14,
-    Snippet = 15,
-    Color = 16,
-    File = 17,
-    Reference = 18
-}
-
-    error: code and message set in case an exception happens during the completion request.
--}
-
--- -------------------------------------
-
-data InsertTextFormat
-  = PlainText -- ^The primary text to be inserted is treated as a plain string.
-  | Snippet
-      -- ^ The primary text to be inserted is treated as a snippet.
-      --
-      -- A snippet can define tab stops and placeholders with `$1`, `$2`
-      -- and `${3:foo}`. `$0` defines the final tab stop, it defaults to
-      -- the end of the snippet. Placeholders with equal identifiers are linked,
-      -- that is typing in one will update others too.
-      --
-      -- See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
-    deriving (Show, Read, Eq)
-
-instance A.ToJSON InsertTextFormat where
-  toJSON PlainText = A.Number 1
-  toJSON Snippet   = A.Number 2
-
-instance A.FromJSON InsertTextFormat where
-  parseJSON (A.Number  1) = pure PlainText
-  parseJSON (A.Number  2) = pure Snippet
-  parseJSON _             = mempty
-
--- -------------------------------------
-
-data CompletionItemKind = CiText
-                        | CiMethod
-                        | CiFunction
-                        | CiConstructor
-                        | CiField
-                        | CiVariable
-                        | CiClass
-                        | CiInterface
-                        | CiModule
-                        | CiProperty
-                        | CiUnit
-                        | CiValue
-                        | CiEnum
-                        | CiKeyword
-                        | CiSnippet
-                        | CiColor
-                        | CiFile
-                        | CiReference
-         deriving (Read,Show,Eq,Ord)
-
-instance A.ToJSON CompletionItemKind where
-  toJSON CiText        = A.Number 1
-  toJSON CiMethod      = A.Number 2
-  toJSON CiFunction    = A.Number 3
-  toJSON CiConstructor = A.Number 4
-  toJSON CiField       = A.Number 5
-  toJSON CiVariable    = A.Number 6
-  toJSON CiClass       = A.Number 7
-  toJSON CiInterface   = A.Number 8
-  toJSON CiModule      = A.Number 9
-  toJSON CiProperty    = A.Number 10
-  toJSON CiUnit        = A.Number 11
-  toJSON CiValue       = A.Number 12
-  toJSON CiEnum        = A.Number 13
-  toJSON CiKeyword     = A.Number 14
-  toJSON CiSnippet     = A.Number 15
-  toJSON CiColor       = A.Number 16
-  toJSON CiFile        = A.Number 17
-  toJSON CiReference   = A.Number 18
-
-instance A.FromJSON CompletionItemKind where
-  parseJSON (A.Number  1) = pure CiText
-  parseJSON (A.Number  2) = pure CiMethod
-  parseJSON (A.Number  3) = pure CiFunction
-  parseJSON (A.Number  4) = pure CiConstructor
-  parseJSON (A.Number  5) = pure CiField
-  parseJSON (A.Number  6) = pure CiVariable
-  parseJSON (A.Number  7) = pure CiClass
-  parseJSON (A.Number  8) = pure CiInterface
-  parseJSON (A.Number  9) = pure CiModule
-  parseJSON (A.Number 10) = pure CiProperty
-  parseJSON (A.Number 11) = pure CiUnit
-  parseJSON (A.Number 12) = pure CiValue
-  parseJSON (A.Number 13) = pure CiEnum
-  parseJSON (A.Number 14) = pure CiKeyword
-  parseJSON (A.Number 15) = pure CiSnippet
-  parseJSON (A.Number 16) = pure CiColor
-  parseJSON (A.Number 17) = pure CiFile
-  parseJSON (A.Number 18) = pure CiReference
-  parseJSON _             = mempty
-
-
--- -------------------------------------
-
-data CompletionItem =
-  CompletionItem
-    { _label               :: Text -- ^ The label of this completion item. By default also
-                       -- the text that is inserted when selecting this
-                       -- completion.
-    , _kind                :: Maybe CompletionItemKind
-    , _detail              :: Maybe Text -- ^ A human-readable string with additional
-                              -- information about this item, like type or
-                              -- symbol information.
-    , _documentation       :: Maybe Text -- ^ A human-readable string that represents
-                                    -- a doc-comment.
-    , _sortText            :: Maybe Text -- ^ A string that should be used when filtering
-                                -- a set of completion items. When `falsy` the
-                                -- label is used.
-    , _filterText          :: Maybe Text -- ^ A string that should be used when
-                                  -- filtering a set of completion items. When
-                                  -- `falsy` the label is used.
-    , _insertText          :: Maybe Text -- ^ A string that should be inserted a
-                                  -- document when selecting this completion.
-                                  -- When `falsy` the label is used.
-    , _insertTextFormat    :: Maybe InsertTextFormat
-         -- ^ The format of the insert text. The format applies to both the
-         -- `insertText` property and the `newText` property of a provided
-         -- `textEdit`.
-    , _textEdit            :: Maybe TextEdit
-         -- ^ An edit which is applied to a document when selecting this
-         -- completion. When an edit is provided the value of `insertText` is
-         -- ignored.
-         --
-         -- *Note:* The range of the edit must be a single line range and it
-         -- must contain the position at which completion has been requested.
-    , _additionalTextEdits :: Maybe (List TextEdit)
-         -- ^ An optional array of additional text edits that are applied when
-         -- selecting this completion. Edits must not overlap with the main edit
-         -- nor with themselves.
-    , _command             :: Maybe Command
-        -- ^ An optional command that is executed *after* inserting this
-        -- completion. *Note* that additional modifications to the current
-        -- document should be described with the additionalTextEdits-property.
-    , _xdata               :: Maybe A.Value -- ^ An data entry field that is preserved on a
-                              -- completion item between a completion and a
-                              -- completion resolve request.
-    } deriving (Read,Show,Eq)
-
-deriveJSON lspOptions{ fieldLabelModifier = customModifier } ''CompletionItem
-makeFieldsNoPrefix ''CompletionItem
-
-data CompletionListType =
-  CompletionListType
-    { _isIncomplete :: Bool
-    , _items        :: List CompletionItem
-    } deriving (Read,Show,Eq)
-
-deriveJSON lspOptions ''CompletionListType
-makeFieldsNoPrefix ''CompletionListType
-
-
-data CompletionResponseResult
-  = CompletionList CompletionListType
-  | Completions (List CompletionItem)
-  deriving (Read,Show,Eq)
-
-deriveJSON defaultOptions { fieldLabelModifier = rdrop (length ("CompletionResponseResult"::String)), sumEncoding = UntaggedValue } ''CompletionResponseResult
-
-type CompletionResponse = ResponseMessage CompletionResponseResult
-type CompletionRequest = RequestMessage ClientMethod TextDocumentPositionParams CompletionResponseResult
-
--- -------------------------------------
-{-
-New in 3.0
------------
-Registration Options: CompletionRegistrationOptions options defined as follows:
-
-export interface CompletionRegistrationOptions extends TextDocumentRegistrationOptions {
-        /**
-         * The characters that trigger completion automatically.
-         */
-        triggerCharacters?: string[];
-
-        /**
-         * The server provides support to resolve additional
-         * information for a completion item.
-         */
-        resolveProvider?: boolean;
-}
--}
-
-data CompletionRegistrationOptions =
-  CompletionRegistrationOptions
-    { _documentSelector  :: Maybe DocumentSelector
-    , _triggerCharacters :: Maybe (List String)
-    , _resolveProvider   :: Maybe Bool
-    } deriving (Show, Read, Eq)
-
-deriveJSON lspOptions ''CompletionRegistrationOptions
-makeFieldsNoPrefix ''CompletionRegistrationOptions
-
--- ---------------------------------------------------------------------
-{-
-Completion Item Resolve Request
-
-https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#completion-item-resolve-request
-
-The request is sent from the client to the server to resolve additional
-information for a given completion item.
-
-Request
-
-    method: 'completionItem/resolve'
-    params: CompletionItem
-
-Response
-
-    result: CompletionItem
-    error: code and message set in case an exception happens during the completion resolve request.
--}
-
-type CompletionItemResolveRequest  = RequestMessage ClientMethod CompletionItem CompletionItem
-type CompletionItemResolveResponse = ResponseMessage CompletionItem
-
--- ---------------------------------------------------------------------
-{-
 Hover Request
 
 The hover request is sent from the client to the server to request hover
@@ -2311,23 +1800,46 @@
 
 -- {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///tmp/Foo.hs"},"position":{"line":1,"character":8}}}
 
-data DefinitionResponseParams = SingleLoc Location | MultiLoc [Location]
+data LocationResponseParams = SingleLoc Location | MultiLoc [Location]
   deriving (Eq,Read,Show)
 
-instance A.ToJSON DefinitionResponseParams where
+instance A.ToJSON LocationResponseParams where
   toJSON (SingleLoc x) = toJSON x
   toJSON (MultiLoc xs) = toJSON xs
 
-instance A.FromJSON DefinitionResponseParams where
+instance A.FromJSON LocationResponseParams where
   parseJSON xs@(A.Array _) = MultiLoc <$> parseJSON xs
   parseJSON x              = SingleLoc <$> parseJSON x
 
-type DefinitionRequest  = RequestMessage ClientMethod TextDocumentPositionParams DefinitionResponseParams
-type DefinitionResponse = ResponseMessage DefinitionResponseParams
+type DefinitionRequest  = RequestMessage ClientMethod TextDocumentPositionParams LocationResponseParams
+type DefinitionResponse = ResponseMessage LocationResponseParams
 
 -- ---------------------------------------------------------------------
 
 {-
+Goto Implementation Request (:leftwards_arrow_with_hook:)
+Since version 3.6.0
+
+The goto implementation request is sent from the client to the server to resolve the implementation location of a symbol at a given text document position.
+
+Request:
+
+method: ‘textDocument/implementation’
+params: TextDocumentPositionParams
+Response:
+
+result: Location | Location[] | null
+error: code and message set in case an exception happens during the definition request.
+Registration Options: TextDocumentRegistrationOptions
+-}
+
+
+type ImplementationRequest  = RequestMessage ClientMethod TextDocumentPositionParams LocationResponseParams
+type ImplementationResponse = ResponseMessage LocationResponseParams
+
+-- ---------------------------------------------------------------------
+
+{-
 Find References Request
 
 https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#find-references-request
@@ -3177,11 +2689,19 @@
 makeFieldsNoPrefix ''Range
 makeFieldsNoPrefix ''Location
 
+-- Completion
+makeFieldsNoPrefix ''CompletionItem
+makeFieldsNoPrefix ''CompletionListType
+makeFieldsNoPrefix ''CompletionRegistrationOptions
+
 -- CodeActions
 makeFieldsNoPrefix ''CodeActionContext
 makeFieldsNoPrefix ''CodeActionParams
 makeFieldsNoPrefix ''CodeAction
 
+-- DocumentFilter
+makeFieldsNoPrefix ''DocumentFilter
+
 -- WorkspaceEdit
 makeFieldsNoPrefix ''TextEdit
 makeFieldsNoPrefix ''VersionedTextDocumentIdentifier
@@ -3195,8 +2715,10 @@
 makeFieldsNoPrefix ''NotificationMessage
 makeFieldsNoPrefix ''CancelParams
 
--- TextDocumentIdentifier
+-- TextDocument
+makeFieldsNoPrefix ''TextDocumentItem
 makeFieldsNoPrefix ''TextDocumentIdentifier
+makeFieldsNoPrefix ''TextDocumentPositionParams
 
 -- Command
 makeFieldsNoPrefix ''Command
diff --git a/src/Language/Haskell/LSP/TH/DocumentFilter.hs b/src/Language/Haskell/LSP/TH/DocumentFilter.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/LSP/TH/DocumentFilter.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE TemplateHaskell            #-}
+module Language.Haskell.LSP.TH.DocumentFilter where
+
+import           Data.Aeson.TH
+import           Data.Text                      ( Text )
+import           Language.Haskell.LSP.TH.Constants
+import           Language.Haskell.LSP.TH.List
+
+-- ---------------------------------------------------------------------
+{-
+New in 3.0
+----------
+
+DocumentFilter
+https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#new-documentfilter
+
+A document filter denotes a document through properties like language, schema or
+pattern. Examples are a filter that applies to TypeScript files on disk or a
+filter the applies to JSON files with name package.json:
+
+    { language: 'typescript', scheme: 'file' }
+    { language: 'json', pattern: '**/package.json' }
+
+export interface DocumentFilter {
+        /**
+         * A language id, like `typescript`.
+         */
+        language?: string;
+
+        /**
+         * A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
+         */
+        scheme?: string;
+
+        /**
+         * A glob pattern, like `*.{ts,js}`.
+         */
+        pattern?: string;
+}
+-}
+data DocumentFilter =
+  DocumentFilter
+    { _language :: Text
+    , _scheme   :: Text
+    , _pattern  :: Maybe Text
+    } deriving (Show, Read, Eq)
+
+deriveJSON lspOptions ''DocumentFilter
+
+{-
+A document selector is the combination of one or many document filters.
+
+export type DocumentSelector = DocumentFilter[];
+-}
+type DocumentSelector = List DocumentFilter
diff --git a/src/Language/Haskell/LSP/TH/MarkupContent.hs b/src/Language/Haskell/LSP/TH/MarkupContent.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/LSP/TH/MarkupContent.hs
@@ -0,0 +1,122 @@
+{-# LANGUAGE DuplicateRecordFields      #-}
+{-# LANGUAGE OverloadedStrings          #-}
+{-# LANGUAGE TemplateHaskell            #-}
+
+-- | A MarkupContent literal represents a string value which content can
+-- be represented in different formats.
+-- Currently plaintext and markdown are supported formats.
+-- A MarkupContent is usually used in documentation properties of result
+-- literals like CompletionItem or SignatureInformation.
+module Language.Haskell.LSP.TH.MarkupContent where
+
+import           Data.Aeson
+import           Data.Aeson.TH
+import           Data.Text                                      (Text)
+import           Language.Haskell.LSP.TH.Constants
+
+{-
+/**
+ * Describes the content type that a client supports in various
+ * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
+ *
+ * Please note that `MarkupKinds` must not start with a `$`. This kinds
+ * are reserved for internal usage.
+ */
+export namespace MarkupKind {
+	/**
+	 * Plain text is supported as a content format
+	 */
+	export const PlainText: 'plaintext' = 'plaintext';
+
+	/**
+	 * Markdown is supported as a content format
+	 */
+	export const Markdown: 'markdown' = 'markdown';
+}
+export type MarkupKind = 'plaintext' | 'markdown';
+-}
+
+-- |  Describes the content type that a client supports in various
+-- result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
+data MarkupKind = MkPlainText -- ^ Plain text is supported as a content format
+                | MkMarkdown -- ^ Markdown is supported as a content format
+  deriving (Read, Show, Eq)
+
+instance ToJSON MarkupKind where
+  toJSON MkPlainText = String "plaintext"
+  toJSON MkMarkdown  = String "markdown"
+
+instance FromJSON MarkupKind where
+  parseJSON (String "plaintext") = pure MkPlainText
+  parseJSON (String "markdown")  = pure MkMarkdown
+  parseJSON _                    = mempty
+
+
+{-
+/**
+ * A `MarkupContent` literal represents a string value which content is interpreted base on its
+ * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
+ *
+ * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
+ * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
+ *
+ * Here is an example how such a string can be constructed using JavaScript / TypeScript:
+ * ```ts
+ * let markdown: MarkdownContent = {
+ *  kind: MarkupKind.Markdown,
+ *	value: [
+ *		'# Header',
+ *		'Some text',
+ *		'```typescript',
+ *		'someCode();',
+ *		'```'
+ *	].join('\n')
+ * };
+ * ```
+ *
+ * *Please Note* that clients might sanitize the return markdown. A client could decide to
+ * remove HTML from the markdown to avoid script execution.
+ */
+export interface MarkupContent {
+	/**
+	 * The type of the Markup
+	 */
+	kind: MarkupKind;
+
+	/**
+	 * The content itself
+	 */
+	value: string;
+}
+-}
+
+-- | A `MarkupContent` literal represents a string value which content is interpreted base on its
+-- | kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
+-- |
+-- | If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
+-- | See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
+-- |
+-- | Here is an example how such a string can be constructed using JavaScript / TypeScript:
+-- | ```ts
+-- | let markdown: MarkdownContent = {
+-- |  kind: MarkupKind.Markdown,
+-- |	value: [
+-- |		'# Header',
+-- |		'Some text',
+-- |		'```typescript',
+-- |		'someCode();',
+-- |		'```'
+-- |	].join('\n')
+-- | };
+-- | ```
+-- |
+-- | *Please Note* that clients might sanitize the return markdown. A client could decide to
+-- | remove HTML from the markdown to avoid script execution.
+data MarkupContent =
+  MarkupContent
+    { _kind  :: MarkupKind -- ^ The type of the Markup
+    , _value :: Text -- ^ The content itself
+    }
+  deriving (Read, Show, Eq)
+
+deriveJSON lspOptions ''MarkupContent
diff --git a/src/Language/Haskell/LSP/TH/Message.hs b/src/Language/Haskell/LSP/TH/Message.hs
--- a/src/Language/Haskell/LSP/TH/Message.hs
+++ b/src/Language/Haskell/LSP/TH/Message.hs
@@ -101,6 +101,7 @@
  | TextDocumentRangeFormatting
  | TextDocumentOnTypeFormatting
  | TextDocumentDefinition
+ | TextDocumentImplementation
  | TextDocumentCodeAction
  | TextDocumentCodeLens
  | CodeLensResolve
@@ -142,6 +143,7 @@
   parseJSON (A.String "textDocument/rangeFormatting")     = return TextDocumentRangeFormatting
   parseJSON (A.String "textDocument/onTypeFormatting")    = return TextDocumentOnTypeFormatting
   parseJSON (A.String "textDocument/definition")          = return TextDocumentDefinition
+  parseJSON (A.String "textDocument/implementation")      = return TextDocumentImplementation
   parseJSON (A.String "textDocument/codeAction")          = return TextDocumentCodeAction
   parseJSON (A.String "textDocument/codeLens")            = return TextDocumentCodeLens
   parseJSON (A.String "codeLens/resolve")                 = return CodeLensResolve
@@ -183,6 +185,7 @@
   toJSON TextDocumentRangeFormatting     = A.String "textDocument/rangeFormatting"
   toJSON TextDocumentOnTypeFormatting    = A.String "textDocument/onTypeFormatting"
   toJSON TextDocumentDefinition          = A.String "textDocument/definition"
+  toJSON TextDocumentImplementation      = A.String "textDocument/implementation"
   toJSON TextDocumentCodeAction          = A.String "textDocument/codeAction"
   toJSON TextDocumentCodeLens            = A.String "textDocument/codeLens"
   toJSON CodeLensResolve                 = A.String "codeLens/resolve"
diff --git a/src/Language/Haskell/LSP/TH/Symbol.hs b/src/Language/Haskell/LSP/TH/Symbol.hs
--- a/src/Language/Haskell/LSP/TH/Symbol.hs
+++ b/src/Language/Haskell/LSP/TH/Symbol.hs
@@ -5,7 +5,7 @@
 import           Data.Aeson.TH
 import           Data.Text                                      (Text)
 import           Language.Haskell.LSP.TH.Constants
-import           Language.Haskell.LSP.TH.TextDocumentIdentifier
+import           Language.Haskell.LSP.TH.TextDocument
 import           Language.Haskell.LSP.TH.List
 import           Language.Haskell.LSP.TH.Location
 import           Language.Haskell.LSP.TH.Message
@@ -124,28 +124,45 @@
     | SkNumber
     | SkBoolean
     | SkArray
+    | SkObject
+    | SkKey
+    | SkNull
+    | SkEnumMember
+    | SkStruct
+    | SkEvent
+    | SkOperator
+    | SkTypeParameter
     deriving (Read,Show,Eq)
 
 instance ToJSON SymbolKind where
-  toJSON SkFile        = Number 1
-  toJSON SkModule      = Number 2
-  toJSON SkNamespace   = Number 3
-  toJSON SkPackage     = Number 4
-  toJSON SkClass       = Number 5
-  toJSON SkMethod      = Number 6
-  toJSON SkProperty    = Number 7
-  toJSON SkField       = Number 8
-  toJSON SkConstructor = Number 9
-  toJSON SkEnum        = Number 10
-  toJSON SkInterface   = Number 11
-  toJSON SkFunction    = Number 12
-  toJSON SkVariable    = Number 13
-  toJSON SkConstant    = Number 14
-  toJSON SkString      = Number 15
-  toJSON SkNumber      = Number 16
-  toJSON SkBoolean     = Number 17
-  toJSON SkArray       = Number 18
+  toJSON SkFile          = Number 1
+  toJSON SkModule        = Number 2
+  toJSON SkNamespace     = Number 3
+  toJSON SkPackage       = Number 4
+  toJSON SkClass         = Number 5
+  toJSON SkMethod        = Number 6
+  toJSON SkProperty      = Number 7
+  toJSON SkField         = Number 8
+  toJSON SkConstructor   = Number 9
+  toJSON SkEnum          = Number 10
+  toJSON SkInterface     = Number 11
+  toJSON SkFunction      = Number 12
+  toJSON SkVariable      = Number 13
+  toJSON SkConstant      = Number 14
+  toJSON SkString        = Number 15
+  toJSON SkNumber        = Number 16
+  toJSON SkBoolean       = Number 17
+  toJSON SkArray         = Number 18
+  toJSON SkObject        = Number 19
+  toJSON SkKey           = Number 20
+  toJSON SkNull          = Number 21
+  toJSON SkEnumMember    = Number 22
+  toJSON SkStruct        = Number 23
+  toJSON SkEvent         = Number 24
+  toJSON SkOperator      = Number 25
+  toJSON SkTypeParameter = Number 26
 
+
 instance FromJSON SymbolKind where
   parseJSON (Number  1) = pure SkFile
   parseJSON (Number  2) = pure SkModule
@@ -165,6 +182,14 @@
   parseJSON (Number 16) = pure SkNumber
   parseJSON (Number 17) = pure SkBoolean
   parseJSON (Number 18) = pure SkArray
+  parseJSON (Number 19) = pure SkObject
+  parseJSON (Number 20) = pure SkKey
+  parseJSON (Number 21) = pure SkNull
+  parseJSON (Number 22) = pure SkEnumMember
+  parseJSON (Number 23) = pure SkStruct
+  parseJSON (Number 24) = pure SkEvent
+  parseJSON (Number 25) = pure SkOperator
+  parseJSON (Number 26) = pure SkTypeParameter
   parseJSON _             = mempty
 
 
diff --git a/src/Language/Haskell/LSP/TH/TextDocument.hs b/src/Language/Haskell/LSP/TH/TextDocument.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/LSP/TH/TextDocument.hs
@@ -0,0 +1,103 @@
+{-# LANGUAGE DuplicateRecordFields      #-}
+{-# LANGUAGE TemplateHaskell            #-}
+module Language.Haskell.LSP.TH.TextDocument where
+
+import           Data.Aeson.TH
+import           Data.Text                      ( Text )
+import           Language.Haskell.LSP.TH.Constants
+import           Language.Haskell.LSP.TH.Location
+import           Language.Haskell.LSP.TH.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
+    { _uri :: Uri
+    } deriving (Show, Read, 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 {
+    _uri        :: Uri
+  , _languageId :: Text
+  , _version    :: Int
+  , _text       :: Text
+  } deriving (Show, Read, 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
+    { _textDocument :: TextDocumentIdentifier
+    , _position     :: Position
+    } deriving (Show, Read, Eq)
+
+deriveJSON lspOptions ''TextDocumentPositionParams
diff --git a/src/Language/Haskell/LSP/TH/TextDocumentIdentifier.hs b/src/Language/Haskell/LSP/TH/TextDocumentIdentifier.hs
deleted file mode 100644
--- a/src/Language/Haskell/LSP/TH/TextDocumentIdentifier.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# LANGUAGE DuplicateRecordFields      #-}
-{-# LANGUAGE TemplateHaskell            #-}
-module Language.Haskell.LSP.TH.TextDocumentIdentifier where
-
-import           Data.Aeson.TH
-import           Language.Haskell.LSP.TH.Constants
-import           Language.Haskell.LSP.TH.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
-    { _uri :: Uri
-    } deriving (Show, Read, Eq)
-
-deriveJSON lspOptions ''TextDocumentIdentifier
diff --git a/src/Language/Haskell/LSP/TH/Uri.hs b/src/Language/Haskell/LSP/TH/Uri.hs
--- a/src/Language/Haskell/LSP/TH/Uri.hs
+++ b/src/Language/Haskell/LSP/TH/Uri.hs
@@ -33,7 +33,7 @@
 
 platformAdjustFromUriPath :: SystemOS -> String -> FilePath
 platformAdjustFromUriPath systemOS srcPath =
-  if systemOS /= windowsOS then srcPath
+  if systemOS /= windowsOS || null srcPath then srcPath
     else let
       firstSegment:rest = (FPP.splitDirectories . tail) srcPath  -- Drop leading '/' for absolute Windows paths
       drive = if FPW.isDrive firstSegment then FPW.addTrailingPathSeparator firstSegment else firstSegment
