Loment for VS CodeLanguage support for Loment — a systems programming language: an explicit, capability-aware language whose native surface syntax is Rust-flavoured, and whose semantics can equally be written in six other surface grammars (C, C++, Java, C#, Go, Python). It compiles to native executables with its own backend, and the compiler is written in Loment itself. Source and toolchain: https://github.com/FujoJTOP/loment
Features
Every command is available from the Command Palette under The seven surface grammars (
|
| Order | Condition | What is used |
|---|---|---|
| ⓪ | the file has no fn _start and you asked to run |
refused, with an explanation — that is a library module: it links into an ELF but segfaults immediately. Build still works |
| ① | loment.toolCommand is set |
the installed Loment CLI: <cmd> <args> build FILE [-o NAME] / run FILE. No Python needed |
| ② | Windows, and scripts/lomc.ps1 is found by walking up from the workspace or from the file |
the development-tree path: seed + clang + WSL, producing .ll + .elf. No workspace folder required — opening a single .lomt is enough |
| ③ | neither | an explicit error naming the setting to fill in — never silence (a command that does nothing is the hardest kind of failure to diagnose) |
Note: the repository's Python CLI has no single-file "compile to executable" command —
loment build DIRis an incremental, whole-directory build that only emits IR. Single-file executables come from the two paths above.
Requirements
- No npm packages need to be installed — they are bundled into the VSIX. What it does need:
- Python (a
pythononPATH) — the language server and the toolchain are Python implementations; - a checkout containing
tools/loment_lsp.py— the extension walks up from the workspace to find it, or you can pointloment.serverPathat an absolute path.
The interpreter is fixed to python. If you only have py / python3, change SERVER_COMMAND at
the top of src/extension.js (this is deliberate: the executable position holds a literal only,
configuration strings never take part in constructing a command).
Neither the language server nor build/run need Python: use loment.serverCommand for the former
and loment.toolCommand for the latter.
Settings
| Setting | Default | Meaning |
|---|---|---|
loment.serverPath |
empty | absolute path to tools/loment_lsp.py; when empty, searched upward |
loment.serverCommand / serverArgs |
empty | start the language server with another command (no Python needed), e.g. wsl + ["-e", "/home/<you>/.local/share/loment/lsp"] |
loment.toolCommand / toolArgs |
empty | which Loment command Build / Run uses, e.g. wsl + ["-e", "/home/<you>/.local/share/loment/bin/loment"] |
loment.dapScript |
empty | absolute path to the debug adapter tools/loment_dap.py; when empty, searched upward |
loment.dapCommand / dapArgs |
empty | start the debug adapter with another command. Default: wsl -e python3 <dapScript> on Windows, python3 <dapScript> elsewhere |
loment.enableLsp |
true |
turn off to keep only highlighting and the commands |
loment.extraExtensions |
[] |
extra suffixes to treat as L1 source (e.g. [".foo"]). Not needed when the project has a loment.conf |
loment.buildDir |
loment/build |
output directory for .ll / .potato.json, relative to the workspace root |
Workspace Trust: the eight settings that can turn into "what gets executed"
(serverCommand / serverArgs / toolCommand / toolArgs / dapCommand / dapArgs /
serverPath / dapScript) are listed in
capabilities.untrustedWorkspaces.restrictedConfigurations — in an untrusted workspace a
.vscode/settings.json cannot change them and the extension falls back to searching. In a trusted
workspace they are overridable as usual.
Install / packaging
From the Marketplace (recommended): search for Loment in VS Code, or
code --install-extension hooyan2022.loment
https://marketplace.visualstudio.com/items?itemName=hooyan2022.loment
Working inside the repository:
# one command: repackage + side-load into the local VS Code (then Developer: Reload Window)
python tools/vscode_ext.py --install
# just produce a .vsix
python tools/vscode_ext.py --emit loment/build/loment-vscode.vsix
# health-check the installed copy (run this first when highlighting misbehaves)
python tools/vscode_ext.py --doctor
Packaging requires one npm install --omit=dev in the workspace first (it puts
vscode-languageclient into editors/vscode/node_modules, which the VSIX ships inside
extension/node_modules). The .vsix bytes are deterministic (fixed timestamps), so it can go
into a checksum manifest.
--install does not use code --install-extension: that path frequently fails in sandboxed
environments (Code.exe reports "the system cannot find the file specified" while cmd.exe is
fine — it is not a permissions problem). It unpacks into ~/.vscode/extensions/<publisher>.<name>-<version>/
following VS Code's own layout, and rewrites the registration in extensions.json to point at that
real directory.
After installing, always run
Developer: Reload Window. Language associations, grammars, commands and debuggers are registered at window start — without a reload you keep the old ones (the files are there and--doctoris green, yet nothing appears to have been installed).When side-loading, a backup of the old copy must not stay inside
extensions/: any folder there containing apackage.jsonis scanned as an extension, and VS Code may register the extension under the name that is about to be deleted — after which highlighting, commands and F5 all disappear while everything on disk "looks fine".--installmoves backups to the system temp directory, and--doctorverifies that the registration points somewhere real.
Headless verification (no GUI needed)
python tools/vscode_ext_test.py
It checks the manifest/grammar structure (compiling every regex), that server-path.js really finds
the server, a full LSP round trip against the real language server (initialize → didOpen →
completion → definition → formatting), the .vsix structure, that activate() really runs
(with every declared command, task and debugger registered), that the surface-grammar declaration
reader agrees with the reference implementation over 769 in-tree sources, that opening a document
really switches its language id, the untrusted-workspace declarations, and the stale-directory
cleanup on upgrade.