ExAthena.Lsp.Manager (ExAthena v0.7.1)

Copy Markdown View Source

Manages one ExAthena.Lsp.Client per {project_root, language} pair.

Clients are lazily spawned under ExAthena.Lsp.ClientSupervisor and registered in ExAthena.Lsp.Registry — the registry is the source of truth for "is this client running?", not Manager state.

Manager state holds only a %{monitor_ref => {root, language}} map for crash telemetry; pids are always looked up from the Registry.

Summary

Functions

Returns a specification to start this module under a supervisor.

Return {:ok, pid} for the LSP client that handles files with the extension of file, or {:error, :unsupported_language} if the extension is not mapped.

Return {:ok, pid} for the LSP client serving (project_root, language), spawning one if none is running yet.

Return a list of all running clients.

Terminate the client for (project_root, language) if one is running.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

client_for_file(project_root, file)

@spec client_for_file(String.t(), String.t()) ::
  {:ok, pid()} | {:error, :unsupported_language | term()}

Return {:ok, pid} for the LSP client that handles files with the extension of file, or {:error, :unsupported_language} if the extension is not mapped.

ensure_started(project_root, language)

@spec ensure_started(String.t(), atom()) :: {:ok, pid()} | {:error, term()}

Return {:ok, pid} for the LSP client serving (project_root, language), spawning one if none is running yet.

list()

@spec list() :: [%{root: String.t(), language: atom(), pid: pid()}]

Return a list of all running clients.

start_link(opts)

stop(project_root, language)

@spec stop(String.t(), atom()) :: :ok

Terminate the client for (project_root, language) if one is running.