yajlsp — Yet Another Janet LSP
Language intelligence for Janet, using the bundled Janet language server.
Installation
Install Janet and its package manager, jpm, on the machine running VS Code's extension host.
Install Spork, the required Janet package dependency:
jpm install spork
Use VS Code 1.91 or later on Linux or macOS, with cat available on PATH.
On Windows, use a WSL or SSH workspace.
Open VS Code's Extensions view, search for yajlsp in the Marketplace,
and click Install on yajlsp — Yet Another Janet LSP.
Open a .janet file to start the language server automatically.
If Janet is not on VS Code's PATH, configure its absolute path:
{
"yajlsp.executablePath": "/absolute/path/to/janet"
}
For WSL, SSH, or other remote workspaces, install Janet and Spork on the remote
host. Node and npm are not required to use the installed extension; the language
server and JavaScript client are bundled.
Previously named Janet LSP / jajlsp. Uninstall the old extension before installing yajlsp.
Rename existing janetLsp.* or jajlsp.* settings to yajlsp.*, and use kulkarniniraj.yajlsp for any
explicit editor.defaultFormatter setting.
Usage
Open a Janet file and use these features:
- Completion: type a symbol name, or press Ctrl+Space, for suggestions from
local bindings, workspace symbols, and qualified imports.
- Hover: point at a symbol to see documentation, its kind, and available function signatures.
- Go to Definition: press F12 to jump to a source declaration.
- Find References: press Shift+F12 to find usages, including closed workspace files.
- Diagnostics: parser errors appear as underlines and in the Problems panel while editing.
- Formatting: save the file to format it with Spork's
fmt, or run Format Document.
Files with parser errors are left unchanged. Disable automatic formatting with
"[janet]": { "editor.formatOnSave": false } in your settings.
- Snippets: choose
defn, defn-, def, var, let, if, when, each,
for, loop, or import from autocomplete or Insert Snippet, then press
Tab to move between placeholders.
- Native modules: cached public exports provide documentation and completion
for installed native modules, including
spork/json and native HTTP packages.
Local symbol handling covers function parameters, destructuring, let, and
standard loops. Open buffers take precedence over disk files. Workspace indexing
runs in the background and skips common dependency/build directories and symlinks.
Project code is parsed without execution. Diagnostics report the first parser
error; macro-generated exports and recursive import resolution are not supported yet.
Structural editing
Place a single caret inside a form, with no selection, then use:
| Action |
Linux |
macOS |
| Janet: Slurp Forward |
Ctrl+K, then Right |
Cmd+K, then Right |
| Janet: Barf Forward |
Ctrl+K, then Left |
Cmd+K, then Left |
These are two-step key chords. Slurp pulls the next expression into the right side
of the form: (a b) c becomes (a b c). Barf pushes the rightmost expression out:
(a b c) becomes (a b) c.
The commands support parenthesized forms, vectors, arrays, and maps; maps move a
key/value pair together. They preserve whitespace and comments, do not cross an
enclosing form's boundary, and leave unbalanced files and string/comment cursors
unchanged. Each command is one undo step. You can also run either command from
the Command Palette or rebind it in Keyboard Shortcuts.
Commands and settings
- yajlsp: Restart Server restarts using current settings.
- yajlsp: Open Server Log opens the server's file log.
- yajlsp: Show Output opens client startup and transport logs.
- yajlsp: Rebuild Native Metadata forces regeneration of installed-module docs.
yajlsp.executablePath selects the Janet runtime. yajlsp.serverPath can
point to another server's absolute main.janet path; leave it empty to use the
bundled server. Changes to either setting restart the server automatically.
Native metadata is generated in the background at startup and stored in VS Code's
extension global storage. Each installed native module initializes in a separate
subprocess with a timeout; the LSP only reads the resulting JSON. Module
initialization has your normal user permissions and is not sandboxed. Set
yajlsp.nativeMetadata.enabled to false to disable automatic generation, or
adjust yajlsp.nativeMetadata.timeoutSeconds (default 5).
Unchanged modules reuse cached metadata. Runtime/module fingerprints and schema
checks invalidate stale records; the rebuild command also handles changed shared
libraries or other dependencies that fingerprints cannot detect. Failed modules
are recorded in a scan report shown in the output channel and retried on rebuild.
If startup fails, the extension checks the runtime and reports missing Janet or
Spork with setup instructions. Use Show Output for full error details.