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.


Instance Method Detail

def client_capabilities : LSP::ClientCapabilities #

The lsp client capabilites.


def client_capabilities? : LSP::ClientCapabilities? #

The lsp client capabilites.


def input : IO #

Input from which messages are received.


def output : IO #

Output to which the messages are sent.


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.


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.


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.


def send(message : LSP::Message, *, do_not_log = false) #

Send a message to the client.


def send(messages : Array, *, do_not_log = false) #

Send an array of messages to the client.


def server_capabilities : LSP::ServerCapabilities #

The broadcasted server capabilites.


def start(controller) #

def thread : Thread #

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