Skip to main content

atmos.lsp

The atmos.lsp function runs atmos lsp through the current Atmos executable. Its one subcommand starts the Atmos Language Server Protocol server used for editor integration.

Usage​

atmos.lsp(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)

Subcommands​

Pass the subcommand as a string before the keyword arguments. The call atmos.lsp("start") runs atmos lsp start.

SubcommandPurpose
startStart the Atmos LSP server.

See the atmos lsp start command reference for details.

Arguments​

*positionals

(Optional) Strings placed on the command line right after lsp, in order: the subcommand. Every value must be a string.

flags

(Optional) A dictionary of command-line options; see flag translation. For start, the key "transport" becomes --transport and accepts stdio, tcp, or websocket, and the key "address" becomes --address for the tcp and websocket transports.

args
(Optional) A list or tuple of strings appended after the flags.
working_directory, env, output, check

(Optional) See atmos.run for process options and defaults.

Options other than the positionals are keyword-only.

Returns​

A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.

Examples​

Start a TCP server​

atmos.lsp("start", flags = {"transport": "tcp", "address": "localhost:7777"})

This runs atmos lsp start --address=localhost:7777 --transport=tcp. The call returns when the server exits.

Start a WebSocket server on another port​

atmos.lsp("start", flags = {"transport": "websocket", "address": "localhost:9000"})
note

The language server runs until it is stopped, so the script waits at this call for the whole lifetime of the server. With the default stdio transport the server speaks to an editor over standard input and output, which a script rarely provides. Editors normally launch atmos lsp start themselves, and a script has little reason to call it unless it supervises a tcp or websocket server.