gleamunison/lsp_types

Shared LSP types and response builders. Both the protocol core (lsp.gleam) and the language features (lsp_features.gleam) need them; keeping them here breaks the import cycle between the two.

Types

pub type Message {
  Message(
    id: option.Option(dynamic.Dynamic),
    method: String,
    params: dict.Dict(String, dynamic.Dynamic),
  )
}

Constructors

Server state: the open documents. Stateless services can’t answer “what is THIS symbol in THIS file” — hover/definition/completion read the document the client opened.

pub type State {
  State(docs: dict.Dict(String, String))
}

Constructors

Values

pub fn error_response(
  id: dynamic.Dynamic,
  code: Int,
  message: String,
) -> String
pub fn id_json(id: dynamic.Dynamic) -> String
pub fn jstr(s: String) -> String
pub fn new_state() -> State
pub fn open_doc(state: State, uri: String, text: String) -> State
pub fn respond(id: dynamic.Dynamic, result: String) -> String
✨ Search Document