Composer.LSP.Session (composer v0.2.0)

Copy Markdown View Source

The language server's state process, holding a Composer.LSP.Workspace.

GenLSP runs requests in tasks, so state can't live in the server. Requests read a snapshot/1; document notifications update it. Lints and reloads run in tasks the Session starts, one lint at a time, so hover, goto and completion never wait on them. When a lint or reload finishes, the Session sends the server:

  • {:composer_lsp, {:publish, [{uri, path, diagnostics}], encoding}}
  • {:composer_lsp, {:reloaded, {:ok, count} | {:error, message}}}

The Session makes no GenLSP calls.

Options

Summary

Functions

Replaces a document's text.

Returns a specification to start this module under a supervisor.

Forgets a closed document's text.

Sets the negotiated position encoding.

Records an opened document and lints it from disk.

Recompiles and rediscovers the cookbooks in a task. Returns :ok, or :running when a reload is already running.

Lints a saved document from disk.

Starts a Session linked to the caller.

Functions

change(session, uri, text)

Replaces a document's text.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(session, uri)

Forgets a closed document's text.

encoding(session, encoding)

Sets the negotiated position encoding.

open(session, uri, text)

Records an opened document and lints it from disk.

reload(session)

Recompiles and rediscovers the cookbooks in a task. Returns :ok, or :running when a reload is already running.

saved(session, uri)

Lints a saved document from disk.

snapshot(session)

What a request needs; see Composer.LSP.Workspace.snapshot/1.

start_link(opts)

Starts a Session linked to the caller.