Somscript for VS Code / Cursor
Write Somscript, the Somali programming language, with a real editor behind you. It gives you highlighting, completion that knows your variables, errors flagged as you type, and one-key Run for .ss files.
qoraal magac = akhri("Magacaaga? ")
liis midabo = ["cas", "buluug", "cagaar"]
inta midab kujiro midabo {
daabac(magac, " wuxuu jecel yahay ", midab)
}
What it covers
This release covers the core of the language. Each feature below was checked against the Somscript interpreter.
| Feature |
Somscript |
| Print to the screen |
daabac("Salaan, ", magac) |
| Read input |
magac = akhri("Magacaaga? ") |
| Type of a value |
n_xogta(9.5) → jajab |
| Length |
dherer(qoraal), dherer(liis), dherer(qaamuus) |
| Data types |
tiro (int), jajab (float), qoraal (string), runbeen (bool: run / been), liis (list), qaamuus (dict) |
| Variables |
tiro da = 20, or just da = 20 |
| Decisions |
haddii, } haddii kale, } haddii_kale, } kale |
| Loops |
inta shuruud { }, with jooji (break) and kasoco (continue) |
| For each |
inta midab kujiro midabo { } |
| Functions (barnaamij hoosaad) |
qeex isku_dar(a, b) { soo_celi a + b } |
| Lists |
midabo[0], .kudar, .geli, .saar, .habee, .raadi, … |
| Dictionaries |
qof["magac"], .furayaasha, .qiimayaasha, .ku_jira, … |
Logic uses iyo (and), ama (or) and ma (not).
Classes, modules and imports, error handling and the Mareeg web framework are part of Somscript, but this extension doesn't support them yet. They will come in later versions, once each one is reviewed.
Editor features
- Highlighting: keywords, types, builtins, function names and parameters, strings with escapes, numbers, and comments.
- IntelliSense:
- keywords, types and builtins, plus your own functions and variables
- list methods after
liis. and dictionary methods after qaamuus., chosen by what the variable holds
- Signature help for
daabac, akhri, n_xogta, dherer, list and dictionary methods, and your own qeex functions.
- Hover docs: hovering a variable shows the type it holds.
- Live error checks, using the interpreter's own rules:
- unclosed strings and brackets
' instead of "
;
! with no = after it
kale / haddii kale / haddii_kale not on the same line as }
tiro x without = value
- a reserved word used as a variable name
- Go to Definition, Outline, folding and Format Document.
- Run File: press
Ctrl+Alt+N (Cmd+Alt+N on Mac), click the ▶ button, or right-click a .ss file. The program runs in a normal Somscript terminal:
- when it finishes, you get your shell prompt back
akhri reads what you type there
Ctrl+C stops it
- running again closes the previous run and starts fresh
- Snippets:
- decisions:
haddii, haddiikale, haddiichain
- loops:
inta, kujiro, intatiro
- functions:
qeex, qeexcelis
- typed variables:
tiro, jajab, qoraal, runbeen, liis, qaamuus
- builtins:
daabac, akhri, n_xogta, dherer
Running code
Run File needs the Somscript interpreter. By default it calls somscript on your PATH. To use something else, change these settings:
| Setting |
Default |
Purpose |
somscript.runtime |
somscript |
somscript on PATH, a full path to somscript.exe, or python |
somscript.runtimeArgs |
[] |
Arguments placed before the file, e.g. ["C:/path/to/api/shell.py"] when the runtime is python |
somscript.diagnostics.enable |
true |
Turn live error checks on or off |
File icon
.ss files get the Somscript icon. Material Icon Theme shows them as Scheme (λ) instead, so the extension offers to switch them the first time it runs. You can also do it any time with the command Somscript: Use Somscript File Icon in Material Icon Theme.
Install from a .vsix
On the Marketplace, search for Somscript in the Extensions view. To install a local build:
npm run package # writes releases/somscript-<version>.vsix
code --install-extension releases/somscript-1.1.4.vsix
cursor --install-extension releases/somscript-1.1.4.vsix
Every built version is kept in releases/, apart from the source code. That folder isn't committed to git or included in the package.
code --install-extension installs into the Default profile only. If a folder opens in another profile, add --profile "Profile Name". Afterwards, run Developer: Reload Window.
Tests
node test/run.js # grammar, manifest, diagnostics, analysis, formatter
node test/run.js ../api/samples # also scan real .ss files for false positives
License
MIT — Somscript Technologies
| |