NucleScript for VS Code
Syntax highlighting and a live language server for .nsl files —
NucleScript, the declarative DNA-storage operations language for
NucleOS.
Repository & issues: github.com/VyomKulshrestha/Nucle-OS
Features
Not yet included: autocomplete, rename/refactoring, and semantic-token
highlighting (syntax highlighting already covers most of that).
Getting started
In an empty folder, create a file named sample_a.txt with any text
in it — store below archives a real file, so it needs to exist.
.nsl files resolve store/retrieve paths relative to their own
folder, so put it next to hello.nsl in the next step.
Create hello.nsl in the same folder:
pool archive: DnaPool {
codec: Ternary,
redundancy: 2x,
profile: Illumina
}
store "sample_a.txt" into archive
retrieve from archive
Click the ▷ Run File button in the top-right of the editor (or
press Ctrl+F5 / Cmd+F5). Nothing else to install: both nucle-lsp
(highlighting/diagnostics/hover) and nucle-cli (formatting and
running) download themselves the first time they're needed, cached
after that.
You'll see real output in the terminal — the encode/store/retrieve
result, strand counts, redundancy — not just a syntax check. (A "failed
to read... sample_a.txt" error means step 1 was skipped, or the file
ended up in a different folder than hello.nsl.)
More complete examples (per-store options, a full simulate → consensus
vote → encode/protect/store/verify pipeline, catching a real store
failure with Result<T, E>/? instead of aborting the run, one function
generic over three different pool profiles, branching on a caught
Result directly with match, a genuinely higher-order function with
real closure capture, a self-recursive closure, and an explicit
::<Illumina>() type argument paired with a real File-typed parameter
value) live in
docs/examples/
in the main repo — start with store.nsl, then hero.nsl, then
result_fallback_store.nsl, then generic_pool_recovery.nsl, then
match_result_fallback.nsl, then closure_retry.nsl, then
explicit_type_args_and_file_param.nsl.
Using the official packages: imports like from "nuclescript/presets"
(@nuclescript/presets, @nuclescript/profiles, @nuclescript/benchmarks,
@nuclescript/recovery — see the
package registry)
get full hover and diagnostics with no install step: those four packages
are compiled directly into both nucle-lsp and nucle-cli, not fetched
over the network. nucle-cli package install/lock/verify is only for
generating a nucle.lock for reproducible builds — the editor doesn't
need it.
Requirements
Nothing — the extension is a client for two command-line tools from the
NucleOS project, but both are fetched for you automatically the first
time they're needed:
| Tool |
Needed for |
If no prebuilt binary exists for your platform |
nucle-lsp |
diagnostics, hover, go to definition, outline |
Windows/Linux x64 and Apple Silicon Mac are covered. Otherwise, build it (cargo build -p nucle_lsp --release from a NucleOS checkout) and point nuclescript.serverPath at it. |
nucle-cli |
Format Document / format on save, and Run File |
Windows/Linux x64 and Mac (Intel or Apple Silicon, via Rosetta) are covered. Otherwise, build it (cargo build -p nucle_cli --release) and point nuclescript.cliPath at it. |
Already have nucle-lsp/nucle-cli on PATH (e.g. a local Rust build)?
That's used automatically instead of downloading anything — see
building from source.
Settings
| Setting |
Default |
Description |
nuclescript.serverPath |
nucle-lsp |
Path to the nucle-lsp binary. Set an absolute path to override the automatic lookup/download. |
nuclescript.cliPath |
nucle-cli |
Path to the nucle-cli binary, used for formatting and Run File. Set an absolute path to override the automatic lookup/download. |
Troubleshooting
- No diagnostics/hover, or an error naming
nuclescript.serverPath:
the extension couldn't find or download a nucle-lsp binary for your
platform/architecture. Build one (cargo build -p nucle_lsp --release
from a NucleOS checkout)
and point nuclescript.serverPath at it.
Format Document or Run File shows an error naming
nuclescript.cliPath: same thing for nucle-cli — build it
(cargo build -p nucle_cli --release) and point nuclescript.cliPath
at the built binary.
Run File does nothing: it only runs .nsl files — make sure the
active editor tab is a NucleScript file, and check the "NucleScript"
terminal panel for the actual error output.
Contributing
Local development setup, grammar testing, and the release process live
in CONTRIBUTING.md
in the repository — not duplicated here since this page is what installs
show, not what contributors need.
License
MIT — see LICENSE.
| |