Shplait for VS Code
Lightweight language support for Shplait,
the Rhombus-notation teaching language for programming-languages courses.
Features
- Syntax highlighting for Shplait's shrubbery notation: keywords, types,
built-in functions,
#'symbols, 'syntax quotes' with $ escapes,
#true/#false, comments (//, /* */, #//), and operators.
- Error checking while you type — the same errors DrRacket shows, powered
by
raco expand, underlined in the editor with precise locations
(debounced; also runs on open and save).
- Autocompletion for all Shplait keywords, types, and built-in functions,
with type signatures for the common ones. Type
~ for ~is, ~else,
~catch, etc.
- Scope-aware completions for your own code:
def/fun/let names,
type variants, function parameters, and variables bound by match
patterns are suggested where they're in scope, sorted ahead of built-ins
(locals first). Pressing space after match pops up the variables in
scope, and typing | inside a match offers each variant of your
datatypes as a snippet with its fields pre-filled (plus [], cons,
and ~else).
- Proximity suggestions: opening a call with
( or typing a space after
an operator (a + , x == , def y = , f(a, ) pops up the values
you're most likely to want next — bindings from the same site as the left
operand first (after fun sum(a, b, c), typing a + preselects b),
then the nearest bindings in scope.
- Hover documentation for built-ins and core forms.
- Run the current file with the ▶ button in the editor title bar, the
shift+alt+r keybinding, or Shplait: Run File from the command palette.
Runs racket -i -t file, so after the program output you get a REPL with
your file's definitions loaded (like DrRacket's interactions window).
- Snippets:
fun, type, match, matchlist, check, cond, if,
let, block, try, lang, and more.
- Indentation & editing rules for
:-blocks and | alternatives, bracket
matching, and comment toggling.
File detection
Files with extensions .shp or .shplait are always treated as Shplait.
Files with other extensions (like .rkt, as used in DrRacket) are detected by
their first line: #lang shplait. If detection doesn't kick in for a .rkt
file, click the language indicator in the status bar and pick Shplait, or add
to your settings:
"files.associations": { "*.rkt": "shplait" }
Requirements
- Racket with the
shplait package
(raco pkg install shplait).
- The extension auto-detects
racket on your PATH or in
/Applications/Racket*/bin. Override with the shplait.racketPath setting.
Settings
| Setting |
Default |
Description |
shplait.racketPath |
(auto) |
Path to the racket executable |
shplait.checkOnType |
true |
Check for errors while typing |
shplait.checkDelay |
800 |
Debounce delay in ms before checking |
CS 3520 Handin
If the course's uu-cs3520 package is installed (raco pkg install from the
course handin URL — the same package that adds the Handin button to DrRacket),
a University of Utah Handin button appears in the editor title bar for
Shplait files. Clicking it:
- fetches the list of currently open assignments from the handin server,
- asks for your username (remembered; use
user1+user2 for partners) and
password — saved to the OS keychain and autofilled for future submissions
unless you toggle off the "Save password" button on the prompt,
- submits the current file and streams the server's check progress; server
prompts appear as VS Code dialogs.
If the server rejects the submission because its checks failed, you're offered
Submit Anyway (ignore error checks), matching DrRacket's checkbox. The
submission travels over the same SSL connection, pinned certificate, and
protocol code as DrRacket's button (uu-cs3520/client).
Related commands: CS 3520: Retrieve Submitted Assignment (opens your last
submission in a new editor) and CS 3520: Forget Saved Handin Credentials.
Commands
- Shplait: Run File — run the current file in a terminal (with REPL)
- Shplait: Check File for Errors — force an immediate error check
- Shplait: Open REPL — start a standalone Shplait REPL
- CS 3520: Handin — submit the current file (also the U logo button)
- CS 3520: Retrieve Submitted Assignment — download your submission
- CS 3520: Forget Saved Handin Credentials — clear stored username/password
How error checking works
On each check the extension writes a hidden temporary copy of your buffer
(.shplait-check-<pid>-<name>) next to the file so relative imports resolve,
runs raco expand on it, deletes it, and maps any reported source location
back to your editor. Only the first error is reported (Racket stops at the
first one), matching DrRacket's behavior.
| |