ela
Contents

ManualEditors

What ela --lsp gives

In the terminalela --spec what-ela-lsp-gives

An editor starts ela --lsp and talks to it over stdin and stdout in the Language Server Protocol. Every editor's setup below is the same three things: the command ela --lsp, the language ela, and the files *.ela and scripts whose first line runs ela (#!/usr/bin/env ela). The server answers from the ela it runs:

The editor asks forThe server givesAs
diagnostics, as you typeeach finding of the script, an error or a warning, at the word it stands onela --lint
hover on a mistakethe message and its entry: the rule, why, wrong and right, the spec topicela --explain
hover on a keywordits section of the specela --spec
hover on a built-inits call and what it doesela --builtins
hover on a proc the script declaresits signature, with its results where it declares them: proc split_host(addr: string) -> (host: string, port: number)procs
formattingthe script as --fmt lays it out; nothing while it does not parse, which its diagnostic saysela --fmt
completionevery built-in proc, package proc and shell built-in; str.sp finds str.splitela --builtins
renamea name the script declares, a variable, a proc, a parameter, a constant, a struct, an enum, a member, a field or an import's name, and every use of it in the open documents: in code, as $name and inside a double-quoted string. A command's words, a package's procs and ela's own names stay; a document that does not parse is left out, and the one renamed in must parseela --lint
go to definitionon a proc's name, its proc line, in the script or, after an import's name, in the file imported; on an import's line, the file, a lib: one found in the library foldersela --check
semantic tokensthe colours the prompt gives a line: keywords, strings, variables, commands, numbers and commentsSHELL.md, Syntax highlighting
semantic tokens, from the parserover the prompt's colours, in LSP's standard types. type is a struct's or an enum's name, where declared and where used, a parameter's or a field's type, and Type with its members (Type.NUMBER). enumMember is FAST in Mode.FAST. function is a proc's name where declared and where called, clone in git.clone and split in str.split. namespace is str and an import's name, git. parameter is a proc's parameter where declared and as $target inside it, and a named result where declared, host in -> (host: string); a result's type is a type. A constant is a variable with the modifier readonly, where declared, ORG :: ..., and where read, $ORG, in code and in a string. The modifier declaration marks where a name is declared, defaultLibrary a built-in. The statement a mistake is in keeps the prompt's colours aloneela --check

The server reads the text as the editor last sent it, saved or not, and finds its imports from the file's folder. It counts a line's characters in UTF-8 when the editor offers that, in UTF-16 otherwise. It exits with status 0 after the editor's shutdown and exit, and with 1 when its input ends first.

Neovim colouring an ela script from ela --lsp's semantic tokens: the struct Host and the enum Mode as types, FAST and SAFE as its members, the constant REPO, roll as a proc, its parameters $host, $tag and $mode and its named result state, the import and the string package as packages, and Type.NUMBER