lsp-test-0.17.1.1: Functional test framework for LSP servers.

Maintainer | luke_lau@icloud.com
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | GHC2021

Language.LSP.Test

Contents

- Sessions
  - Config
  - Exceptions
- Sending
- Receiving
- Utilities
  - Initialization
  - Config
  - Documents
  - Symbols
  - Diagnostics
  - Commands
  - Code Actions
  - Completions
  - References
  - Definitions
  - Renaming
  - Hover
  - Highlights
  - Formatting
  - Edits
  - Code lenses
  - Inlay Hints
  - Call hierarchy
  - SemanticTokens
  - Capabilities

Description

Provides the framework to start functionally testing Language Server Protocol servers. You should import Language.LSP.Types alongside this.

Synopsis

- data Session a
- runSession :: String -> ClientCapabilities -> FilePath -> Session a -> IO a
- runSessionWithConfig :: SessionConfig -> String -> ClientCapabilities -> FilePath -> Session a -> IO a
- runSessionWithConfigCustomProcess :: (CreateProcess -> CreateProcess) -> SessionConfig -> String -> ClientCapabilities -> FilePath -> Session a -> IO a
- runSessionWithHandles :: Handle -> Handle -> SessionConfig -> ClientCapabilities -> FilePath -> Session a -> IO a
- runSessionWithHandles' :: Maybe ProcessHandle -> Handle -> Handle -> SessionConfig -> ClientCapabilities -> FilePath -> Session a -> IO a
- setIgnoringLogNotifications :: Bool -> Session ()
- setIgnoringConfigurationRequests :: Bool -> Session ()
- setIgnoringRegistrationRequests :: Bool -> Session ()
- data SessionConfig = SessionConfig {
  - messageTimeout :: Int
  - logStdErr :: Bool
  - logMessages :: Bool
  - logColor :: Bool
  - lspConfig :: Object
  - ignoreLogNotifications :: Bool
  - ignoreConfigurationRequests :: Bool
  - ignoreRegistrationRequests :: Bool
  - initialWorkspaceFolders :: Maybe [WorkspaceFolder]
  }
- defaultConfig :: SessionConfig
- fullLatestClientCaps :: ClientCapabilities
- data SessionException
  - = Timeout (Maybe FromServerMessage)
  - | NoContentLengthHeader
  - | UnexpectedMessage String FromServerMessage
  - | ReplayOutOfOrder FromServerMessage [FromServerMessage]
  - | UnexpectedDiagnostics
  - | IncorrectApplyEditRequest String
  - | Show (ErrorData m) => UnexpectedResponseError (LspId m) (TResponseError m)
  - | UnexpectedServerTermination
  - | IllegalInitSequenceMessage FromServerMessage
  - | MessageSendError Value IOError
- anySessionException :: SessionException -> Bool
- withTimeout :: Int -> Session a -> Session a
- request :: forall (m :: Method 'ClientToServer 'Request). SClientMethod m -> MessageParams m -> Session (TResponseMessage m)
- request_ :: forall (m :: Method 'ClientToServer 'Request). SClientMethod m -> MessageParams m -> Session ()
- sendRequest :: forall (m :: Method 'ClientToServer 'Request). SClientMethod m -> MessageParams m -> Session (LspId m)
- sendNotification :: forall (m :: Method 'ClientToServer 'Notification). SClientMethod m -> MessageParams m -> Session ()
- sendResponse :: forall {f :: MessageDirection} (m :: Method f 'Request). (ToJSON (MessageResult m), ToJSON (ErrorData m)) => TResponseMessage m -> Session ()
- satisfy :: (FromServerMessage -> Bool) -> Session FromServerMessage
- satisfyMaybe :: (FromServerMessage -> Maybe a) -> Session a
- message :: forall {t :: MessageKind} (m :: Method 'ServerToClient t). SServerMethod m -> Session (TMessage m)
- response :: forall (m :: Method 'ClientToServer 'Request). SMethod m -> Session (TResponseMessage m)
- responseForId :: forall (m :: Method 'ClientToServer 'Request). SMethod m -> LspId m -> Session (TResponseMessage m)
- customRequest :: forall (s :: Symbol). KnownSymbol s => Proxy s -> Session (TMessage ('Method_CustomMethod s :: Method 'ServerToClient 'Request))
- customNotification :: forall (s :: Symbol). KnownSymbol s => Proxy s -> Session (TMessage ('Method_CustomMethod s :: Method 'ServerToClient 'Notification))
- anyRequest :: Session FromServerMessage
- anyResponse :: Session FromServerMessage
- anyNotification :: Session FromServerMessage
- anyMessage :: Session FromServerMessage
- loggingNotification :: Session FromServerMessage
- configurationRequest :: Session FromServerMessage
- loggingOrConfiguration :: Session FromServerMessage
- publishDiagnosticsNotification :: Session (TMessage 'Method_TextDocumentPublishDiagnostics)
- initializeResponse :: Session (TResponseMessage 'Method_Initialize)
- modifyConfig :: (Object -> Object) -> Session ()
- setConfig :: Object -> Session ()
- modifyConfigSection :: String -> (Value -> Value) -> Session ()
- setConfigSection :: String -> Value -> Session ()
- createDoc :: FilePath -> LanguageKind -> Text -> Session TextDocumentIdentifier
- openDoc :: FilePath -> LanguageKind -> Session TextDocumentIdentifier
- closeDoc :: TextDocumentIdentifier -> Session ()
- changeDoc :: TextDocumentIdentifier -> [TextDocumentContentChangeEvent] -> Session ()
- documentContents :: TextDocumentIdentifier -> Session Text
- getDocumentEdit :: TextDocumentIdentifier -> Session Text
- getDocUri :: FilePath -> Session Uri
- getVersionedDoc :: TextDocumentIdentifier -> Session VersionedTextDocumentIdentifier
- getDocumentSymbols :: TextDocumentIdentifier -> Session (Either [SymbolInformation] [DocumentSymbol])
- waitForDiagnostics :: Session [Diagnostic]
- waitForDiagnosticsSource :: String -> Session [Diagnostic]
- noDiagnostics :: Session ()
- getCurrentDiagnostics :: TextDocumentIdentifier -> Session [Diagnostic]
- getIncompleteProgressSessions :: Session (Set ProgressToken)
- executeCommand :: Command -> Session ()
- getCodeActions :: TextDocumentIdentifier -> Range -> Session [Command |? CodeAction]
- getAndResolveCodeActions :: TextDocumentIdentifier -> Range -> Session [Command |? CodeAction]
- getAllCodeActions :: TextDocumentIdentifier -> Session [Command |? CodeAction]
- executeCodeAction :: CodeAction -> Session ()
- resolveCodeAction :: CodeAction -> Session CodeAction
- resolveAndExecuteCodeAction :: CodeAction -> Session ()
- getCompletions :: TextDocumentIdentifier -> Position -> Session [CompletionItem]
- getAndResolveCompletions :: TextDocumentIdentifier -> Position -> Session [CompletionItem]
- getReferences :: TextDocumentIdentifier -> Position -> Bool -> Session [Location]
- getDeclarations :: TextDocumentIdentifier -> Position -> Session (Declaration |? ([DeclarationLink] |? Null))
- getDefinitions :: TextDocumentIdentifier -> Position -> Session (Definition |? ([DefinitionLink] |? Null))
- getTypeDefinitions :: TextDocumentIdentifier -> Position -> Session (Definition |? ([DefinitionLink] |? Null))
- getImplementations :: TextDocumentIdentifier -> Position -> Session (Definition |? ([DefinitionLink] |? Null))
- rename :: TextDocumentIdentifier -> Position -> String -> Session ()
- getHover :: TextDocumentIdentifier -> Position -> Session (Maybe Hover)
- getHighlights :: TextDocumentIdentifier -> Position -> Session [DocumentHighlight]
- formatDoc :: TextDocumentIdentifier -> FormattingOptions -> Session ()
- formatRange :: TextDocumentIdentifier -> FormattingOptions -> Range -> Session ()
- applyEdit :: TextDocumentIdentifier -> TextEdit -> Session VersionedTextDocumentIdentifier
- getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]
- getAndResolveCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]
- resolveCodeLens :: CodeLens -> Session CodeLens
- getInlayHints :: TextDocumentIdentifier -> Range -> Session [InlayHint]
- getAndResolveInlayHints :: TextDocumentIdentifier -> Range -> Session [InlayHint]
- resolveInlayHint :: InlayHint -> Session InlayHint
- prepareCallHierarchy :: CallHierarchyPrepareParams -> Session [CallHierarchyItem]
- incomingCalls :: CallHierarchyIncomingCallsParams -> Session [CallHierarchyIncomingCall]
- outgoingCalls :: CallHierarchyOutgoingCallsParams -> Session [CallHierarchyOutgoingCall]
- getSemanticTokens :: TextDocumentIdentifier -> Session (SemanticTokens |? Null)
- getRegisteredCapabilities :: Session [SomeRegistration]

# Sessions

data Session a #

A session representing one instance of launching and connecting to a server.

You can send and receive messages to the server within `Session` via `message`, `sendRequest` and `sendNotification`.

#### Instances

Instances details

MonadIO Session # |
Instance details Defined in Language.LSP.Test.Session Methods liftIO :: IO a -> Session a #
MonadThrow Session # |
Instance details Defined in Language.LSP.Test.Session Methods throwM :: (HasCallStack, Exception e) => e -> Session a #
Alternative Session # |
Instance details Defined in Language.LSP.Test.Session Methods empty :: Session a # (<|>) :: Session a -> Session a -> Session a # some :: Session a -> Session [a] # many :: Session a -> Session [a] #
Applicative Session # |
Instance details Defined in Language.LSP.Test.Session Methods pure :: a -> Session a # (<*>) :: Session (a -> b) -> Session a -> Session b # liftA2 :: (a -> b -> c) -> Session a -> Session b -> Session c # (*>) :: Session a -> Session b -> Session b # (<*) :: Session a -> Session b -> Session a #
Functor Session # |
Instance details Defined in Language.LSP.Test.Session Methods fmap :: (a -> b) -> Session a -> Session b # (<$) :: a -> Session b -> Session a #
Monad Session # |
Instance details Defined in Language.LSP.Test.Session Methods (>>=) :: Session a -> (a -> Session b) -> Session b # (>>) :: Session a -> Session b -> Session b # return :: a -> Session a #
MonadFail Session # |
Instance details Defined in Language.LSP.Test.Session Methods fail :: String -> Session a #

runSession #

Arguments

:: String | The command to run the server.
-> ClientCapabilities | The capabilities that the client should declare.
-> FilePath | The filepath to the root directory for the session.
-> Session a | The session to run.
-> IO a |

Starts a new session.

    runSession "hie" fullLatestClientCaps "path/to/root/dir" $ do
      doc <- openDoc "Desktop/simple.hs" "haskell"
      diags <- waitForDiagnostics
      let pos = Position 12 5
          params = TextDocumentPositionParams doc
      hover <- request STextdocumentHover params

runSessionWithConfig #

Arguments

:: SessionConfig | Configuration options for the session.
-> String | The command to run the server.
-> ClientCapabilities | The capabilities that the client should declare.
-> FilePath | The filepath to the root directory for the session.
-> Session a | The session to run.
-> IO a |

Starts a new session with a custom configuration.

runSessionWithConfigCustomProcess #

Arguments

:: (CreateProcess -> CreateProcess) | Tweak the `CreateProcess` used to start the server.
-> SessionConfig | Configuration options for the session.
-> String | The command to run the server.
-> ClientCapabilities | The capabilities that the client should declare.
-> FilePath | The filepath to the root directory for the session.
-> Session a | The session to run.
-> IO a |

Starts a new session with a custom configuration and server `CreateProcess`.

runSessionWithHandles #

Arguments

:: Handle | The input handle
-> Handle | The output handle
-> SessionConfig |
-> ClientCapabilities | The capabilities that the client should declare.
-> FilePath | The filepath to the root directory for the session.
-> Session a | The session to run.
-> IO a |

Starts a new session, using the specified handles to communicate with the server. You can use this to host the server within the same process. An example with lsp might look like:

    (hinRead, hinWrite) <- createPipe
    (houtRead, houtWrite) <- createPipe

    forkIO $ void $ runServerWithHandles hinRead houtWrite serverDefinition
    runSessionWithHandles hinWrite houtRead defaultConfig fullLatestClientCaps "." $ do
      -- ...

runSessionWithHandles' #

Arguments

:: Maybe ProcessHandle |
-> Handle | The input handle
-> Handle | The output handle
-> SessionConfig |
-> ClientCapabilities | The capabilities that the client should declare.
-> FilePath | The filepath to the root directory for the session.
-> Session a | The session to run.
-> IO a |

setIgnoringLogNotifications :: Bool -> Session () #

setIgnoringConfigurationRequests :: Bool -> Session () #

setIgnoringRegistrationRequests :: Bool -> Session () #

## Config

data SessionConfig #

Stuff you can configure for a `Session`.

Constructors

SessionConfig |

Fields

- messageTimeout :: Int

  Maximum time to wait for a message in seconds, defaults to 60.

- logStdErr :: Bool

  Redirect the server's stderr to this stdout, defaults to False. Can be overriden with `LSP_TEST_LOG_STDERR`.

- logMessages :: Bool

  Trace the messages sent and received to stdout, defaults to False. Can be overriden with the environment variable `LSP_TEST_LOG_MESSAGES`.

- logColor :: Bool

  Add ANSI color to the logged messages, defaults to True.

- lspConfig :: Object

  The initial LSP config as JSON object, defaults to the empty object. This should include the config section for the server if it has one, i.e. if the server has a `mylang` config section, then the config should be an object with a `mylang` key whose value is the actual config for the server. You can also include other config sections if your server may request those.

- ignoreLogNotifications :: Bool

  Whether or not to ignore `window/showMessage` and `window/logMessage` notifications from the server, defaults to True.

- ignoreConfigurationRequests :: Bool

  Whether or not to ignore `workspace/configuration` requests from the server, defaults to True.

- ignoreRegistrationRequests :: Bool

  Whether or not to ignore `client/registerCapability` and `client/unregisterCapability` requests from the server, defaults to True.

- initialWorkspaceFolders :: Maybe [WorkspaceFolder]

  The initial workspace folders to send in the `initialize` request. Defaults to Nothing.

#### Instances

Instances details

Default SessionConfig # |
Instance details Defined in Language.LSP.Test.Session Methods def :: SessionConfig #

defaultConfig :: SessionConfig #

The configuration used in `runSession`.

fullLatestClientCaps :: ClientCapabilities #

## Exceptions

data SessionException #

An exception that can be thrown during a `Session`

Constructors

Timeout (Maybe FromServerMessage) |
NoContentLengthHeader |
UnexpectedMessage String FromServerMessage |
ReplayOutOfOrder FromServerMessage [FromServerMessage] |
UnexpectedDiagnostics |
IncorrectApplyEditRequest String |
Show (ErrorData m) => UnexpectedResponseError (LspId m) (TResponseError m) |
UnexpectedServerTermination |
IllegalInitSequenceMessage FromServerMessage |
MessageSendError Value IOError |

#### Instances

Instances details

Exception SessionException # |
Instance details Defined in Language.LSP.Test.Exceptions Methods toException :: SessionException -> SomeException # fromException :: SomeException -> Maybe SessionException # displayException :: SessionException -> String # backtraceDesired :: SessionException -> Bool #
Show SessionException # |
Instance details Defined in Language.LSP.Test.Exceptions Methods showsPrec :: Int -> SessionException -> ShowS # show :: SessionException -> String # showList :: [SessionException] -> ShowS #

anySessionException :: SessionException -> Bool #

A predicate that matches on any `SessionException`

withTimeout :: Int -> Session a -> Session a #

Execute a block f that will throw a `Timeout` exception after duration seconds. This will override the global timeout for waiting for messages to arrive defined in `SessionConfig`.

# Sending

request :: forall (m :: Method 'ClientToServer 'Request). SClientMethod m -> MessageParams m -> Session (TResponseMessage m) #

Sends a request to the server and waits for its response. Will skip any messages in between the request and the response `rsp <- request STextDocumentDocumentSymbol params` Note: will skip any messages in between the request and the response.

request_ :: forall (m :: Method 'ClientToServer 'Request). SClientMethod m -> MessageParams m -> Session () #

The same as `sendRequest`, but discard the response.

sendRequest #

Arguments

:: forall (m :: Method 'ClientToServer 'Request). SClientMethod m | The request method.
-> MessageParams m | The request parameters.
-> Session (LspId m) | The id of the request that was sent.

Sends a request to the server. Unlike `request`, this doesn't wait for the response.

sendNotification #

Arguments

:: forall (m :: Method 'ClientToServer 'Notification). SClientMethod m | The notification method.
-> MessageParams m | The notification parameters.
-> Session () |

Sends a notification to the server.

sendResponse :: forall {f :: MessageDirection} (m :: Method f 'Request). (ToJSON (MessageResult m), ToJSON (ErrorData m)) => TResponseMessage m -> Session () #

Sends a response to the server.

# Receiving

satisfy :: (FromServerMessage -> Bool) -> Session FromServerMessage #

Consumes and returns the next message, if it satisfies the specified predicate.

Since: 0.5.2.0

satisfyMaybe :: (FromServerMessage -> Maybe a) -> Session a #

Consumes and returns the result of the specified predicate if it returns `Just`.

Since: 0.6.1.0

message :: forall {t :: MessageKind} (m :: Method 'ServerToClient t). SServerMethod m -> Session (TMessage m) #

Matches a request or a notification coming from the server. Doesn't match Custom Messages

response :: forall (m :: Method 'ClientToServer 'Request). SMethod m -> Session (TResponseMessage m) #

Matches a response coming from the server.

responseForId :: forall (m :: Method 'ClientToServer 'Request). SMethod m -> LspId m -> Session (TResponseMessage m) #

Like `response`, but matches a response for a specific id.

customRequest :: forall (s :: Symbol). KnownSymbol s => Proxy s -> Session (TMessage ('Method_CustomMethod s :: Method 'ServerToClient 'Request)) #

customNotification :: forall (s :: Symbol). KnownSymbol s => Proxy s -> Session (TMessage ('Method_CustomMethod s :: Method 'ServerToClient 'Notification)) #

anyRequest :: Session FromServerMessage #

Matches if the message is a request.

anyResponse :: Session FromServerMessage #

Matches if the message is a response.

anyNotification :: Session FromServerMessage #

Matches if the message is a notification.

anyMessage :: Session FromServerMessage #

Matches any type of message.

loggingNotification :: Session FromServerMessage #

Matches if the message is a log message notification or a show message notification/request.

configurationRequest :: Session FromServerMessage #

Matches if the message is a configuration request from the server.

loggingOrConfiguration :: Session FromServerMessage #

publishDiagnosticsNotification :: Session (TMessage 'Method_TextDocumentPublishDiagnostics) #

Matches a `TextDocumentPublishDiagnostics` (textDocument/publishDiagnostics) notification.

# Utilities

Quick helper functions for common tasks.

## Initialization

initializeResponse :: Session (TResponseMessage 'Method_Initialize) #

Returns the initialize response that was received from the server. The initialize requests and responses are not included the session, so if you need to test it use this.

## Config

modifyConfig :: (Object -> Object) -> Session () #

Modify the client config. This will send a notification to the server that the config has changed.

setConfig :: Object -> Session () #

Set the client config. This will send a notification to the server that the config has changed.

modifyConfigSection :: String -> (Value -> Value) -> Session () #

Modify a client config section (if already present, otherwise does nothing). This will send a notification to the server that the config has changed.

setConfigSection :: String -> Value -> Session () #

Set a client config section. This will send a notification to the server that the config has changed.

## Documents

createDoc #

Arguments

:: FilePath | The path to the document to open, relative to the root directory.
-> LanguageKind | The text document's language identifier, e.g. `"haskell"`.
-> Text | The content of the text document to create.
-> Session TextDocumentIdentifier | The identifier of the document just created.

Creates a new text document. This is different from `openDoc` as it sends a workspace/didChangeWatchedFiles notification letting the server know that a file was created within the workspace, __provided that the server has registered for it__, and the file matches any patterns the server registered for. It does not actually create a file on disk, but is useful for convincing the server that one does exist.

Since: 11.0.0.0

openDoc :: FilePath -> LanguageKind -> Session TextDocumentIdentifier #

Opens a text document that exists on disk, and sends a textDocument/didOpen notification to the server.

closeDoc :: TextDocumentIdentifier -> Session () #

Closes a text document and sends a textDocument/didOpen notification to the server.

changeDoc :: TextDocumentIdentifier -> [TextDocumentContentChangeEvent] -> Session () #

Changes a text document and sends a textDocument/didOpen notification to the server.

documentContents :: TextDocumentIdentifier -> Session Text #

The current text contents of a document.

getDocumentEdit :: TextDocumentIdentifier -> Session Text #

Parses an ApplyEditRequest, checks that it is for the passed document and returns the new content

getDocUri :: FilePath -> Session Uri #

Gets the Uri for the file corrected to the session directory.

getVersionedDoc :: TextDocumentIdentifier -> Session VersionedTextDocumentIdentifier #

Adds the current version to the document, as tracked by the session.

## Symbols

getDocumentSymbols :: TextDocumentIdentifier -> Session (Either [SymbolInformation] [DocumentSymbol]) #

Returns the symbols in a document.

## Diagnostics

waitForDiagnostics :: Session [Diagnostic] #

Waits for diagnostics to be published and returns them.

waitForDiagnosticsSource :: String -> Session [Diagnostic] #

The same as `waitForDiagnostics`, but will only match a specific `_source`.

noDiagnostics :: Session () #

Expects a `PublishDiagnosticsNotification` and throws an `UnexpectedDiagnostics` exception if there are any diagnostics returned.

getCurrentDiagnostics :: TextDocumentIdentifier -> Session [Diagnostic] #

Returns the current diagnostics that have been sent to the client. Note that this does not wait for more to come in.

getIncompleteProgressSessions :: Session (Set ProgressToken) #

Returns the tokens of all progress sessions that have started but not yet ended.

## Commands

executeCommand :: Command -> Session () #

Executes a command.

## Code Actions

getCodeActions :: TextDocumentIdentifier -> Range -> Session [Command |? CodeAction] #

Returns the code actions in the specified range.

getAndResolveCodeActions :: TextDocumentIdentifier -> Range -> Session [Command |? CodeAction] #

Returns the code actions in the specified range, resolving any with a non empty _data_ field.

getAllCodeActions :: TextDocumentIdentifier -> Session [Command |? CodeAction] #

Returns all the code actions in a document by querying the code actions at each of the current diagnostics' positions.

executeCodeAction :: CodeAction -> Session () #

Executes a code action. Matching with the specification, if a code action contains both an edit and a command, the edit will be applied first.

resolveCodeAction :: CodeAction -> Session CodeAction #

Resolves the provided code action.

resolveAndExecuteCodeAction :: CodeAction -> Session () #

If a code action contains a _data_ field: resolves the code action, then executes it. Otherwise, just executes it.

## Completions

getCompletions :: TextDocumentIdentifier -> Position -> Session [CompletionItem] #

Returns the completions for the position in the document.

getAndResolveCompletions :: TextDocumentIdentifier -> Position -> Session [CompletionItem] #

Returns the completions for the position in the document, resolving any with a non empty _data_ field.

## References

getReferences #

Arguments

:: TextDocumentIdentifier | The document to lookup in.
-> Position | The position to lookup.
-> Bool | Whether to include declarations as references.
-> Session [Location] | The locations of the references.

Returns the references for the position in the document.

## Definitions

getDeclarations #

Arguments

:: TextDocumentIdentifier | The document the term is in.
-> Position | The position the term is at.
-> Session (Declaration |? ([DeclarationLink] |? Null)) |

Returns the declarations(s) for the term at the specified position.

getDefinitions #

Arguments

:: TextDocumentIdentifier | The document the term is in.
-> Position | The position the term is at.
-> Session (Definition |? ([DefinitionLink] |? Null)) |

Returns the definition(s) for the term at the specified position.

getTypeDefinitions #

Arguments

:: TextDocumentIdentifier | The document the term is in.
-> Position | The position the term is at.
-> Session (Definition |? ([DefinitionLink] |? Null)) |

Returns the type definition(s) for the term at the specified position.

getImplementations #

Arguments

:: TextDocumentIdentifier | The document the term is in.
-> Position | The position the term is at.
-> Session (Definition |? ([DefinitionLink] |? Null)) |

Returns the type definition(s) for the term at the specified position.

## Renaming

rename :: TextDocumentIdentifier -> Position -> String -> Session () #

Renames the term at the specified position.

## Hover

getHover :: TextDocumentIdentifier -> Position -> Session (Maybe Hover) #

Returns the hover information at the specified position.

## Highlights

getHighlights :: TextDocumentIdentifier -> Position -> Session [DocumentHighlight] #

Returns the highlighted occurrences of the term at the specified position

## Formatting

formatDoc :: TextDocumentIdentifier -> FormattingOptions -> Session () #

Applies formatting to the specified document.

formatRange :: TextDocumentIdentifier -> FormattingOptions -> Range -> Session () #

Applies formatting to the specified range in a document.

## Edits

applyEdit :: TextDocumentIdentifier -> TextEdit -> Session VersionedTextDocumentIdentifier #

Applys an edit to the document and returns the updated document version.

## Code lenses

getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens] #

Returns the code lenses for the specified document.

getAndResolveCodeLenses :: TextDocumentIdentifier -> Session [CodeLens] #

Returns the code lenses for the specified document, resolving any with a non empty _data_ field.

resolveCodeLens :: CodeLens -> Session CodeLens #

Resolves the provided code lens.

## Inlay Hints

getInlayHints :: TextDocumentIdentifier -> Range -> Session [InlayHint] #

Returns the inlay hints in the specified range.

getAndResolveInlayHints :: TextDocumentIdentifier -> Range -> Session [InlayHint] #

Returns the inlay hints in the specified range, resolving any with a non empty _data_ field.

resolveInlayHint :: InlayHint -> Session InlayHint #

Resolves the provided inlay hint.

## Call hierarchy

prepareCallHierarchy :: CallHierarchyPrepareParams -> Session [CallHierarchyItem] #

Pass a param and return the response from `prepareCallHierarchy`

incomingCalls :: CallHierarchyIncomingCallsParams -> Session [CallHierarchyIncomingCall] #

outgoingCalls :: CallHierarchyOutgoingCallsParams -> Session [CallHierarchyOutgoingCall] #

## SemanticTokens

getSemanticTokens :: TextDocumentIdentifier -> Session (SemanticTokens |? Null) #

Pass a param and return the response from `semanticTokensFull`

## Capabilities

getRegisteredCapabilities :: Session [SomeRegistration] #

Returns a list of capabilities that the server has requested to dynamically register during the `Session`.

Since: 0.11.0.0