PitCode
Code in plain words. PitCode is a friendly programming language that reads almost like English and turns into JavaScript. One language covers three kinds of files:
| File |
What it's for |
Like |
.pit |
programs |
JavaScript |
.pitx |
web pages with markup |
JSX / React |
.pitoss |
styles |
CSS |
pit dives = [12, 18, 31, 9]
loop depth in dives {
when depth > 30 {
say "{depth} m: a deep dive!"
} other {
say "{depth} m"
}
}
say "Deepest: {dives.max()} m, average: {dives.average()} m"
The extension is all you need: it runs PitCode by itself, with nothing else to install.
✨ What's new
🏠 PitCode Home
Click the PitCode button at the top right of the editor (or press Ctrl+Alt+H) for everything in one place:
- Home: the versions, buttons for everything the extension does, and your project at a glance (files, tests, mistakes).
- What's new: the release notes of the extension and of the language.
- Updates: checks whether the
pitcode command on your computer is up to date, and updates it in one click.
- Dictionary, Guides (the tutorial in English and French, the guide, styles, recipes, errors), Settings (like fixing mistakes on save) and Keys.
📖 A Dictionary of every word
Every word of .pit, .pitx and .pitoss, more than 1,500 in all, each with what it does and the JavaScript or CSS it matches.
- Open it with the 📖 button at the top of a file, the book in the side bar, Dictionary in the status bar, or Ctrl+Alt+D.
- Search by the word, or by what you want to do: round, repeat, bold, shadow.
- Insert puts the word in your file. Colors show their swatch.
- Hover over any word and click Open in the Dictionary.
✨ Mistakes, fixed for you
PitCode reads the code around each mistake and offers the fix. Press Ctrl+. on an underlined word:
| You wrote |
PitCode fixes it to |
if (depth > 30 && ok) { |
when depth > 30 and ok { |
let x = null |
pit x = nil |
console.log('hi') |
say "hi" |
for (let i = 0; i < 5; i++) { |
loop i in 0..5 { |
function add(a, b) { |
add(a, b) => { |
say depht |
say depth |
total = 5 (a new name) |
pit total = 5 |
a { that's never closed |
a } where the indentation shows the block ends |
list.position(x) == -1 |
list.position(x) == nil |
Fix everything at once with the ✨ in the status bar or Ctrl+Alt+F. Only fixes PitCode is sure about are made, and Ctrl+Z undoes them.
To fix a file each time you save it, add this to your settings:
"editor.codeActionsOnSave": { "source.fixAll.pitcode": "explicit" }
🧪 Tests in the Testing panel
- Each
test("...") in a file ending in _test.pit gets a ▶ Run test button.
- The Testing panel lists every test of the project, with ✓ and ✗.
- A failed test shows its message right on the line that failed.
🎨 Colors that know your code
- Functions, kinds, parameters and variables each get their own color.
- Names that are never used are dimmed.
- Calls show the parameter names:
addAir(tank: 100, more: 50).
And more
- ▶ buttons above the code: Run, Preview, Run test, and "3 uses" above each function.
- See what your code turns into: the JavaScript of a
.pit file (or the CSS of a .pitoss file), beside it, updating as you type.
- Every use highlighted when the cursor is on a name.
- Folding for blocks, comments and
// ---------- sections ----------.
- Ctrl+T finds any function, kind, test or style in the whole project.
- New project and New file, already filled in and ready to run.
- Check the whole project and Tidy every file.
- The guide comes with the extension: open it with PitCode: Open the guide. No internet needed.
- Get started: a short walkthrough (Help → Welcome) shows the main features in a few minutes.
- PitCode code blocks in Markdown files get PitCode's colors.
Everything the extension does
Writing
- Colors for
.pit, .pitx and .pitoss, with an icon for each kind of file.
- Mistakes underlined as you type, with what to do, in plain words.
- Hover help on every word.
- Autocomplete for words, modules (
math., time....) and methods.
- Snippets: type
comp, test, loopin, button, card...
Finding your way
- Go to where a name is made (F12).
- Find every use (Shift+F12).
- Rename a name everywhere, even across files (F2).
- The Outline of a file.
- What goes in a call's
( ).
Running
- ▶ Run (Ctrl+Shift+Enter) runs the file in a terminal inside VS Code; answering
ask() works there.
- A crash underlines the line where it happened.
- Preview (Ctrl+Shift+V) shows a
.pitx page live beside the code. It redraws each time you save.
Styles (.pitoss)
- Color swatches, with a color picker.
- The CSS name of each word on hover.
- A button that makes the
.css file.
- Right-click a
.css file to turn it into a .pitoss file.
Keeping code tidy
- Format Document fixes the indentation.
- Replace old words updates words from older versions of PitCode.
A taste of the three files
A web page (app.pitx):
use "./styles.pitoss"
Counter() => {
pit [count, change] = remember(0)
back <button onClick={() => change(count + 1)}>Clicked {count} times</button>
}
draw(<main>
<h1>My dives</h1>
<Counter />
</main>)
Its styles (styles.pitoss):
pit sea = #0e4d5c
style button {
padding: 8 16
corners: 8
background: sea
text-color: sea.readableText()
when hover {
background: sea.lighter(10%)
}
}
A test (tools_test.pit):
addAir(tank, more) => tank + more
test("adding air", () => {
expect(addAir(100, 50), 150)
})
Keys
| Keys |
What they do |
| Ctrl+Alt+H |
Open PitCode Home |
| Ctrl+Shift+Enter |
Run the file |
| Ctrl+Shift+V |
Preview a .pitx page |
| Ctrl+Alt+D |
Open the Dictionary (at the word under the cursor) |
| Ctrl+Alt+F |
Fix everything PitCode is sure about |
| Ctrl+. |
The fixes for the mistake under the cursor |
| F12 / Shift+F12 / F2 |
Go to where it's made / Every use / Rename |
| Ctrl+T |
Find a function, kind, test or style in the project |
On a Mac, use Cmd instead of Ctrl.
Settings
| Setting |
Default |
What it does |
pitcode.smartColors |
on |
Colors by what each name is, and dims unused names |
pitcode.hints.parameterNames |
on |
Parameter names before the values of calls |
pitcode.codeLens.run |
on |
▶ Run and ▶ Run test above the code |
pitcode.codeLens.uses |
on |
How many times each function and kind is used |
pitcode.statusBar.dictionary |
on |
The 📖 Dictionary button in the status bar |
| |