class LSP::Server

Overview

A Language Server Protocol generic implementation.

This server is basically an I/O loop receiving, replying, sending message and handling exceptions. Actual actions are delegated to an external class.

Defined in:

server.cr

Constant Summary

DEFAULT_SERVER_CAPABILITIES = LSP::ServerCapabilities.new(text_document_sync: LSP::TextDocumentSyncKind::Incremental)

Dummy default server capabilites.

Constructors

Instance Method Summary

Constructor Detail

def self.new(input : IO = STDIN, output : IO = STDOUT, server_capabilities : LSP::ServerCapabilities = DEFAULT_SERVER_CAPABILITIES) #

Initialize a new LSP Server with the provided options.


[View source]

Instance Method Detail

def client_capabilities : LSP::ClientCapabilities #

The lsp client capabilites.


[View source]
def client_capabilities? : LSP::ClientCapabilities | Nil #

The lsp client capabilites.


[View source]
def input : IO #

Input from which messages are received.


[View source]
def output : IO #

Output to which the messages are sent.


[View source]
def reply(request : LSP::RequestMessage, *, result : T, do_not_log = false) forall T #

Reply to a request initiated by the client with the provided result.


[View source]
def reply(request : LSP::RequestMessage, *, exception, do_not_log = false) #

Reply to a request initiated by the client with an error message containing the exception details.


[View source]
def requests_sent : Hash(RequestMessage::RequestId, LSP::Message) #

A list of requests that were sent to clients to keep track of the ID and kind.


[View source]
def send(message : LSP::Message, *, do_not_log = false) #

Send a message to the client.


[View source]
def send(messages : Array, *, do_not_log = false) #

Send an array of messages to the client.


[View source]
def server_capabilities : LSP::ServerCapabilities #

The broadcasted server capabilites.


[View source]
def start(controller) #

[View source]
def thread : Thread #

This server thread, that should not get blocked by all means.


[View source]